[Debian-astro-commits] [cpl-plugin-amber] 02/02: Remove accidently merged files
Ole Streicher
olebole at moszumanska.debian.org
Tue Dec 8 10:27:10 UTC 2015
This is an automated email from the git hooks/post-receive script.
olebole pushed a commit to branch pristine-tar
in repository cpl-plugin-amber.
commit 77074368306f6482ed6b3b3863f47823c879ff0e
Author: Ole Streicher <debian at liska.ath.cx>
Date: Tue Dec 8 11:26:15 2015 +0100
Remove accidently merged files
---
AUTHORS | 5 -
COPYING | 340 -
COPYING.LIB | 515 -
ChangeLog | 1201 --
INSTALL | 229 -
Makefile.am | 70 -
Makefile.in | 925 --
Makefile.purify.in | 109 -
NEWS | 0
README | 0
TODO | 0
acinclude.m4 | 187 -
aclocal.m4 | 1063 --
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 | 8406 --------------
admin/missing | 376 -
amber/Makefile.am | 125 -
amber/Makefile.in | 764 --
amber/amberSupport.c | 63 -
amber/amberSupport.h | 33 -
amber/amber_dfs.c | 131 -
amber/amber_dfs.h | 15 -
amber/amber_qc.c | 588 -
amber/amber_qc.h | 22 -
amber/amdlib.h | 1485 ---
amber/amdlibArrayGeometry.c | 367 -
amber/amdlibBadPixels.c | 370 -
amber/amdlibClosurePhases.c | 535 -
amber/amdlibDark.c | 746 --
amber/amdlibDate.c | 173 -
amber/amdlibEsoUtils.c | 618 --
amber/amdlibFlatField.c | 275 -
amber/amdlibFrameSelection.c | 482 -
amber/amdlibImagingData.c | 148 -
amber/amdlibImagingDetector.c | 158 -
amber/amdlibInsCfg.c | 348 -
amber/amdlibLog.c | 246 -
amber/amdlibMatrix.c | 1400 ---
amber/amdlibMisc.c | 92 -
amber/amdlibMultiDimArray.c | 919 --
amber/amdlibOi.c | 4090 -------
amber/amdlibOiStructures.c | 4216 -------
amber/amdlibP2vm.c | 3678 -------
amber/amdlibP2vmData.c | 184 -
amber/amdlibPiston.c | 1478 ---
amber/amdlibProtected.h | 875 --
amber/amdlibRawData.c | 2295 ----
amber/amdlibRefSpectrum.c | 623 --
amber/amdlibRegion.c | 600 -
amber/amdlibScienceData.c | 1490 ---
amber/amdlibShift.c | 475 -
amber/amdlibSpectralCalibration.c | 792 --
amber/amdlibSpectralCalibrationData.c | 216 -
amber/amdlibSpectrum.c | 742 --
amber/amdlibString.c | 123 -
amber/amdlibUtils.c | 3026 -----
amber/amdlibVersion.h | 1 -
amber/amdlibVisibilities.c | 6929 ------------
amber/amdlibWaveData.c | 518 -
amber/amdlibYorick.c | 857 --
amber/amdlibYorick.h | 106 -
amber/amdms.h | 748 --
amber/amdmsAlgo.c | 362 -
amber/amdmsBadPixels.c | 691 --
amber/amdmsCalibration.c | 1304 ---
amber/amdmsCommon.c | 274 -
amber/amdmsFit.c | 2749 -----
amber/amdmsFit.h | 202 -
amber/amdmsFits.c | 769 --
amber/amdmsFits.h | 429 -
amber/amdmsFitsCube.c | 185 -
amber/amdmsFitsData.c | 676 --
amber/amdmsFitsKeyword.c | 272 -
amber/amdmsFitsTable.c | 511 -
amber/amdmsPixelStatistics.c | 1450 ---
amber/amdmsProperties.c | 1630 ---
amber/amdrs.h | 216 -
amber/esolibCalibVis.c | 887 --
amber/esolibCalibVis.h | 33 -
amber/esolibSelector.c | 3586 ------
amber/esolibSelector.h | 16 -
amber/esolibTransferfunction.c | 1244 ---
amber/esolibTransferfunction.h | 55 -
amber/esolibamdlibOi.c | 2031 ----
amber/esolibamdlibOi.h | 26 -
amber/gipaf.c | 898 --
amber/gipaf.h | 72 -
amber/giqclog.c | 90 -
amber/giqclog.h | 52 -
calib/cal_size | 1 -
calib/dic/ESO-DFS-DIC.AMBER_QC | 4464 --------
calib/dic/ESO-VLT-DIC.AMBER_CFG | 45 -
calib/dic/ESO-VLT-DIC.AMBER_DCS | 438 -
calib/dic/ESO-VLT-DIC.AMBER_ICS | 1705 ---
calib/dic/ESO-VLT-DIC.AMBER_OS | 37 -
calib/gasgano/config/AMBER.prefs | 53 -
calib/gasgano/config/amber.oca | 181 -
config.h.in | 152 -
configure | 18799 --------------------------------
configure.ac | 104 -
doxygen/Doxyfile.in | 221 -
m4macros/cpl.m4 | 1435 ---
m4macros/eso.m4 | 1105 --
m4macros/libtool.m4 | 7360 -------------
m4macros/ltoptions.m4 | 368 -
m4macros/ltsugar.m4 | 123 -
m4macros/ltversion.m4 | 23 -
m4macros/lt~obsolete.m4 | 92 -
m4macros/purify.m4 | 27 -
recipes/Makefile.am | 114 -
recipes/Makefile.in | 733 --
recipes/amber_BeamPos.c | 1298 ---
recipes/amber_SciCal.c | 1805 ---
recipes/amber_ascii_export.c | 920 --
recipes/amber_calibrate.c | 327 -
recipes/amber_detector.c | 1681 ---
recipes/amber_oimerge.c | 1227 ---
recipes/amber_p2vm.c | 1771 ---
recipes/amber_raw_to_fitsimage.c | 387 -
recipes/amber_selector.c | 363 -
recipes/amber_spectral_calibration.c | 407 -
recipes/amber_trf.c | 339 -
regtests/Makefile.am | 30 -
regtests/Makefile.in | 614 --
regtests/tests/Makefile.am | 77 -
regtests/tests/Makefile.in | 451 -
scripts/Makefile.am | 32 -
scripts/Makefile.in | 475 -
setup | 88 -
tests/Makefile.am | 48 -
tests/Makefile.in | 532 -
136 files changed, 133326 deletions(-)
diff --git a/AUTHORS b/AUTHORS
deleted file mode 100644
index c158124..0000000
--- a/AUTHORS
+++ /dev/null
@@ -1,5 +0,0 @@
-This package is maintained by
-
- Armin Gabasch <agabasch at eso.org>
-
-on behalf of the European Southern Observatory (ESO).
diff --git a/COPYING b/COPYING
deleted file mode 100644
index d60c31a..0000000
--- a/COPYING
+++ /dev/null
@@ -1,340 +0,0 @@
- 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
deleted file mode 100644
index c4792dd..0000000
--- a/COPYING.LIB
+++ /dev/null
@@ -1,515 +0,0 @@
-
- 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
deleted file mode 100644
index 372f8f5..0000000
--- a/ChangeLog
+++ /dev/null
@@ -1,1201 +0,0 @@
-2013-12-09 13:56:35 CET agabasch
-
- unused function amdrs_error_alert() removed - see also Ticket
- PIPE-4730
-
-
-
-2013-12-09 10:48:59 CET agabasch
-
- Unused Recipe parameters amber.amber_BeamPos.str_option and
- amber.amber_BeamPos.int_binning removed from the amber_BeamPos recipe.
- See also ticket PIPE-4847
-
-
-
-2013-12-02 15:41:37 CET agabasch
-
- 4.3.0 -> 4.3.1
-
-2013-12-02 11:46:41 CET agabasch
-
-
- 4.2.3 -> 4.3.0
-
-
-2013-12-02 10:57:52 CET agabasch
-
- Changelog update
-
-2013-11-12 09:13:22 CET agabasch
-
- Recipe updated - the recipe now creates two products withe the
- pro.catg AMBER_RAW_CUBE and AMBER_RAW_SUM, the first beeing a cube
- and the second the sum of the cube. Morover, the automatic
- triggering of the recipe is/has to be removed from the oca files.
-
-2013-10-26 17:50:40 CEST mpruemm
-
- Create proper structure.
-
-2013-09-19 09:56:57 CEST agabasch
-
- CPL_LDFLAGS passed to the linker via AM_LDFLAGS variable - fixes a
- build problem on ubuntu 13.04
-
-
-2013-09-18 16:46:17 CEST agabasch
-
- deprecated variable INCLUDES replaced by AM_CPPFLAGS
-
-
-2013-09-16 17:04:04 CEST agabasch
-
- PIPE-4721: Fixed. The Makefile.am used by AMBER no longer
- overwrites a user defined CPPFLAGS variable
-
-
-2013-09-16 16:56:43 CEST agabasch
-
- PIPE-4720: Fixed. cpl_message_*() calls with a format string that
- is not a literal have been replaced
-
-
-2013-09-16 15:48:31 CEST agabasch
-
- PIPE-4719: cpl libraries added to the recipe.so and test program
-
-
-2013-03-05 10:41:19 CET agabasch
-
- 4.2.2 -> 4.2.3
-
-
-2013-02-26 16:43:45 CET agabasch
-
- AM_CONFIG_HEADER replaced by AC_CONFIG_HEADERS
-
-
-2013-02-26 16:11:09 CET agabasch
-
- check for cfitsio and fftw version aligned with cpl-6_3
-
-
-2013-02-26 11:02:34 CET agabasch
-
- macro replaced by the cpl-6_3 version
-
-
-2013-02-25 14:11:41 CET agabasch
-
- Bug in amdlib corrected: memset is not done properly in
- amdlibSumAndPackData(). Not all the result and sigma2Result array
- was properly set to zero.
-
-
-2013-01-07 14:10:13 CET agabasch
-
- author name added to AUTHORS file
-
-
-2012-11-13 16:11:24 CET agabasch
-
- 4.2.1 -> 4.2.2
-
-
-2012-11-08 08:39:36 CET agabasch
-
- 4.2.0 -> 4.2.1
-
-
-2012-11-08 08:36:56 CET agabasch
-
- Segmentation fault in amdlib (amdlibSpectralCalibration.c) fixed.
- The routine returns if the offset value is larger then 10 pixels
- freeing the noise and spectrum pointer. The latter two were
- already freed before causing the segfault
-
-
-2012-11-07 10:06:08 CET agabasch
-
- recipe description added
-
-
-2012-11-06 14:50:16 CET agabasch
-
- 4.1.3 -> 4.2.0
-
-
-2012-11-05 16:38:46 CET agabasch
-
- amber_spectral_calibration recipe added
-
-
-2012-11-05 16:29:20 CET agabasch
-
- code cleaning - more messages added
-
-
-2012-11-05 16:13:45 CET agabasch
-
- code cleaning - more messages added
-
-
-2012-11-05 15:45:11 CET agabasch
-
- New recipe prototype following ticket [DFS12326]. The recipe
- calculates the spectral calibration in the 3 telescope mode the
- same way as done by the recipe amber_p2vm
-
-
-2012-05-07 10:46:30 CEST agabasch
-
- 4.1.2 -> 4.1.3
-
-
-2012-05-04 11:42:04 CEST agabasch
-
- recipes reinstantiated with amber version 4.1.2
-
-
-2012-04-16 15:29:14 CEST agabasch
-
- minimal required version number in the library-checks added
-
-
-2012-03-16 14:09:47 CET agabasch
-
- 4.1.1 -> 4.1.2
-
-
-2012-03-15 10:10:53 CET agabasch
-
- update
-
-
-Fri Mar 09 14:06:11 CET 2012 agabasch
-
- replaced with the one from the cpl repository: cpl-6_0b2
-
- eso.m4 1.4
- cpl.m4 1.11
-
-Wed Mar 07 10:05:13 CET 2012 agabasch
-
- logging into file amdlib_SciCal.log deactivated as redirection
- standard out to the file redirected also the cpl_msg_info output
- since cpl version 6
-
- amber_SciCal.c 1.48
-
-Wed Mar 07 09:59:19 CET 2012 agabasch
-
- logging into file amdlib_p2vm.log deactivated as redirection
- standard out to the file redirected also the cpl_msg_info output
- since cpl version 6
-
- amber_p2vm.c 1.24
-
-Tue Feb 28 11:55:42 CET 2012 agabasch
-
- DFS11440 ticket fixed: lambda-min and lambda-max were inverted for
- medium resolution as the wavelength vector changes from ascending
- to descending
-
- amber_qc.c 1.18
-
-Thu Feb 09 10:57:34 CET 2012 agabasch
-
- 4.1.0 -> 4.1.1
-
- configure.ac 1.42
-
-Thu Feb 09 10:49:20 CET 2012 agabasch
-
- Update
-
- ChangeLog 1.48
-
-Wed Feb 08 14:36:59 CET 2012 agabasch
-
- DFS Ticket number DFS11333 has been implemented. A new products
- with PRO CATG = "PVM_QC" is now written by the recipe. It contains
- all the QC parameter of the p2vm file as well as 2 additional
- parameters related to the wavelength coverage: HIERARCH ESO QC
- P2VM LAMBDA MIN and HIERARCH ESO QC P2VM LAMBDA MAX The two value
- give the valid minimum and maximum of the covered wavelenth range.
-
- amber_p2vm.c 1.23
-
-Tue Jan 31 10:17:43 CET 2012 agabasch
-
- bugfix for QC of the spectrum: check ion spectrum->nbTels>1 was
- wrong - has to be pectrum->nbTels>2 to check if there is one ore 3
- baselines
-
- amber_qc.c 1.17
-
-Tue Jan 31 09:37:09 CET 2012 agabasch
-
- check added to the loop of amber_qc_average_spectrum()
-
- amber_qc.c 1.16
-
-Mon Jan 30 14:56:46 CET 2012 agabasch
-
- Ticket DFS11277 implemented. New QC parameters
- ESO.QC.SPECTRUM.CEN.TEL1/2/3 added. The qc parameter report the
- average spectrum in the central bin of the telescopes
-
- amber_SciCal.c 1.47
- esolibTransferfunction.c 1.48
- esolibSelector.c 1.25
- esolibCalibVis.c 1.23
- amber_qc.h 1.7
- amber_qc.c 1.15
-
-Mon Jan 30 12:07:37 CET 2012 agabasch
-
- M_PI added to get rid of warnings
-
- amber_qc.h 1.6
-
-Fri Jan 27 14:30:33 CET 2012 agabasch
-
- 4.0.3 -> 4.1.0
-
- configure.ac 1.41
-
-Mon Jan 23 08:25:01 CET 2012 agabasch
-
- replaced with the one from the cpl repository: head: 1.46
-
- cpl.m4 1.10
-
-Fri Jan 20 14:07:46 CET 2012 agabasch
-
- DFS11262 addressed: pipeline products are not anymore copied to
- /tmp
-
- amber_SciCal.c 1.46
- esolibSelector.c 1.24
-
-Wed Jan 18 10:07:11 CET 2012 agabasch
-
- check for cext (CPL_CHECK_CEXT) library removed
-
- configure.ac 1.40
-
-Wed Jan 18 10:03:18 CET 2012 agabasch
-
- replaced with the one from the cpl repository: head: 1.43
-
- cpl.m4 1.9
-
-Tue Jan 17 13:15:38 CET 2012 agabasch
-
- valgrind check added. Can be triggered by <make valgrind>
-
- Makefile.am 1.19
-
-Thu Jan 12 13:14:35 CET 2012 agabasch
-
- replaced with the one from the cpl repository: head: 1.3
-
- eso.m4 1.3
-
-Mon Jan 09 15:16:05 CET 2012 agabasch
-
- replaced with the one from the cpl repository: head: 1.2
-
- eso.m4 1.2
-
-Mon Jan 09 15:15:43 CET 2012 agabasch
-
- replaced with the one from the cpl repository: head: 1.41
-
- cpl.m4 1.8
-
-Mon Jan 09 15:01:22 CET 2012 agabasch
-
- update
-
- ChangeLog 1.47
-
-Mon Jan 09 13:59:14 CET 2012 agabasch
-
- configure options changed and CFITSIODIR/CC check removed
-
- setup 1.8
-
-Tue Dec 13 15:26:06 CET 2011 agabasch
-
- old scripts removed
-
- Makefile.am 1.3
-
-Mon Dec 05 13:44:57 CET 2011 agabasch
-
- bugfix in plt_spectrum_vs_wavelength. This fix takes into account
- that for a merged file the wavelenth vector could have a different
- length then the one stored in the oi_waveband extension
-
- amber_plot_OI_FITS.py 1.2
-
-Fri Dec 02 13:06:52 CET 2011 agabasch
-
- refurbished
-
- Amber_Calib_Science.xml 1.23
-
-Thu Dec 01 15:24:41 CET 2011 agabasch
-
- First prototype of a python based plotting routine for Amber
- oi-fits files.
-
- amber_plot_OI_FITS.py 1.1
-
-Tue Nov 22 13:19:46 CET 2011 agabasch
-
- 4.0.2 -> 4.0.3
-
- configure.ac 1.39
-
-Tue Nov 22 13:12:18 CET 2011 agabasch
-
- update
-
- ChangeLog 1.46
-
-Tue Nov 22 12:34:01 CET 2011 agabasch
-
- amber_JMMC_acknowledgement() changed as amdlib has problems in
- reading multiple occurences of " -- " in a COMMENT
-
- amber_dfs.c 1.9
-
-Fri Oct 28 10:44:23 CEST 2011 llundin
-
- Fix INSTR name
-
- Makefile.am 1.4
-
-Tue Oct 11 09:32:58 CEST 2011 agabasch
-
- 4.0.1 -> 4.0.2
-
- configure.ac 1.38
-
-Fri Oct 07 15:09:13 CEST 2011 agabasch
-
- update
-
- ChangeLog 1.45
-
-Fri Oct 07 13:34:10 CEST 2011 agabasch
-
- Adding the JMMC acknowledgements to the product(s)
-
- esolibTransferfunction.c 1.47
-
-Fri Oct 07 13:17:32 CEST 2011 agabasch
-
- Adding the JMMC acknowledgements to the product(s)
-
- amber_oimerge.c 1.23
-
-Fri Oct 07 13:06:56 CEST 2011 agabasch
-
- Adding the JMMC acknowledgements to the product(s)
-
- esolibCalibVis.c 1.22
-
-Fri Oct 07 12:36:40 CEST 2011 agabasch
-
- Adding the JMMC acknowledgements to the product(s)
-
- amber_SciCal.c 1.45
-
-Fri Oct 07 12:36:03 CEST 2011 agabasch
-
- Empty COMMENT in function amber_JMMC_acknowledgement() has been
- replaced by " -- " as there was a conflict with the amdlib
- functions
-
- amber_dfs.c 1.8
-
-Fri Oct 07 11:44:20 CEST 2011 agabasch
-
- Adding the JMMC acknowledgements to the product(s)
-
- esolibSelector.c 1.23
-
-Fri Oct 07 11:02:53 CEST 2011 agabasch
-
- Adding the JMMC acknowledgements to the product(s)
-
- amber_p2vm.c 1.22
-
-Fri Oct 07 10:58:33 CEST 2011 agabasch
-
- Adding the JMMC acknowledgements to the product(s)
-
- amber_BeamPos.c 1.19
-
-Fri Oct 07 09:58:06 CEST 2011 agabasch
-
- "\" letter has to be commented out when writing it in
- amber_JMMC_acknowledgement(). Fixed
-
- amber_dfs.c 1.7
-
-Thu Oct 06 15:47:47 CEST 2011 agabasch
-
- new function amber_JMMC_acknowledgement() added. The function
- writes the JMMC acknowledgement to a propertylist
-
- amber_dfs.h 1.3
- amber_dfs.c 1.6
-
-Tue Sep 27 09:03:25 CEST 2011 agabasch
-
- update to amdlib303
-
- Makefile.am 1.19
- amdlibProtected.h 1.7
- amdlibPiston.c 1.7
- amdlibPerformFrameSelection.c 1.6
- amdlibP2vmData.c 1.7
- amdlibP2vm.c 1.7
- amdlibOiStructures.c 1.7
- amdlibOi.c 1.7
- amdlibMultiDimArray.c 1.7
- amdlibMisc.c 1.6
- amdlibMergeP2vm.c 1.7
- amdlibMatrix.c 1.7
- amdlibLog.c 1.6
- amdlibInsCfg.c 1.7
- amdlibImagingDetector.c 1.7
- amdlibImagingData.c 1.7
- amdlibFrameSelection.c 1.6
- amdlibFlatField.c 1.7
- amdlibEsoUtils.c 1.4
- amdlibDate.c 1.7
- amdlibDark.c 1.4
- amdlibComputeSpectralCalibration.c 1.7
- amdlibComputeP2vm.c 1.7
- amdlibComputeOiData.c 1.6
- amdlibClosurePhases.c 1.7
- amdlibCalibrateRawData.c 1.7
- amdlibBtbl2Fits.c 1.7
- amdlibBadPixels.c 1.7
- amdlibArrayGeometry.c 1.7
- amdlibAppendOiData.c 1.6
- amdlib.h 1.7
- amdlibYorick.h 1.7
- amdlibYorick.c 1.7
- amdlibWaveData.c 1.7
- amdlibVisibilities.c 1.7
- amdlibVersion.h 1.1
- amdlibUtils.c 1.7
- amdlibString.c 1.7
- amdlibSpectrum.c 1.6
- amdlibSpectralCalibrationData.c 1.7
- amdlibSpectralCalibration.c 1.7
- amdlibShift.c 1.7
- amdlibScienceData.c 1.7
- amdlibRegion.c 1.7
- amdlibRefSpectrum.c 1.7
- amdlibRawData.c 1.7
-
-Tue Sep 27 09:00:53 CEST 2011 agabasch
-
- 4.0.0 -> 4.0.1
-
- configure.ac 1.37
-
-Mon Sep 26 15:30:45 CEST 2011 agabasch
-
- QC value "ESO QC USEDVALUE ANDselection" replaced by "ESO QC
- USEDVALUE AND" to make it DFS complient (DFS10669)
-
- esolibSelector.c 1.22
-
-Mon Sep 26 15:20:08 CEST 2011 agabasch
-
- paf file removed writing removed. paf files are written by the pkd
- mechanism
-
- amber_detector.c 1.15
- amber_BeamPos.c 1.18
- giqclog.c 1.5
- esolibTransferfunction.c 1.46
- esolibSelector.c 1.21
- esolibCalibVis.c 1.21
-
-Mon Sep 26 14:54:05 CEST 2011 agabasch
-
- re - update to amdlib30
-
- configure.ac 1.36
- Makefile.am 1.8
- setup 1.7
- amber_OI_FITS_plot_closurephase.prg 1.4
- amber_OI_FITS_plot.prg 1.6
- Amber_Calib_Science.xml 1.22
- amber_trf.c 1.11
- amber_selector.c 1.53
- amber_raw_to_fitsimage.c 1.16
- amber_p2vm.c 1.21
- amber_divider.c 1.8
- amber_detector.c 1.14
- amber_ascii_export.c 1.8
- amber_SciCal.c 1.44
- amber_BeamPos.c 1.17
- Makefile.am 1.9
- amber_OI_FITS_plot.prg 1.6
- cpl.m4 1.7
- giqclog.h 1.3
- giqclog.c 1.4
- gipaf.h 1.4
- gipaf.c 1.4
- esolibamdlibOi.c 1.5
- esolibTransferfunction.c 1.45
- esolibSelector.c 1.20
- esolibCalibVis.c 1.20
- amdlibYorick.h 1.6
- amdlibYorick.c 1.6
- amdlibWaveData.c 1.6
- amdlibVisibilities.c 1.6
- amdlibUtils.c 1.6
- amdlibString.c 1.6
- amdlibSpectrum.c 1.5
- amdlibSpectralCalibrationData.c 1.6
- amdlibSpectralCalibration.c 1.6
- amdlibShift.c 1.6
- amdlibScienceData.c 1.6
- amdlibRegion.c 1.6
- amdlibRefSpectrum.c 1.6
- amdlibRawData.c 1.6
- amdlibProtected.h 1.6
- amdlibPiston.c 1.6
- amdlibPerformFrameSelection.c 1.5
- amdlibP2vmData.c 1.6
- amdlibP2vm.c 1.6
- amdlibOiStructures.c 1.6
- amdlibOi.c 1.6
- amdlibMultiDimArray.c 1.6
- amdlibMisc.c 1.5
- amdlibMergeP2vm.c 1.6
- amdlibMatrix.c 1.6
- amdlibLog.c 1.5
- amdlibInsCfg.c 1.6
- amdlibImagingDetector.c 1.6
- amdlibImagingData.c 1.6
- amdlibFrameSelection.c 1.5
- amdlibFlatField.c 1.6
- amdlibDate.c 1.6
- amdlibComputeSpectralCalibration.c 1.6
- amdlibComputeP2vm.c 1.6
- amdlibComputeOiData.c 1.5
- amdlibClosurePhases.c 1.6
- amdlibCalibrateRawData.c 1.6
- amdlibBtbl2Fits.c 1.6
- amdlibBadPixels.c 1.6
- amdlibArrayGeometry.c 1.6
- amdlibAppendOiData.c 1.5
- amdlib.h 1.6
- Makefile.am 1.18
-
-Mon Sep 26 14:52:24 CEST 2011 agabasch
-
- update to amdlib30
-
- amdlibDark.c 1.3
- amdlibEsoUtils.c 1.3
-
-Current Release: amber-3.3.0
-=========================================
-Date Ticket Description
----------- -------- -----------
-
-2011/01/24 DFS09425 problem with amber_selector recipe when a file has
- only 1 frame: A new check for OI consistency has been
- added (function amber_check_oiconsistency). If in a
- oi-fitsfile not all extension are present the merging
- process should not take this file into account. This
- prevents that the different tables in the merged file
- are out of sync.
-
-
-16/12/2009 DFS07420 AMBER transfer function monitoring: Implemented (see
- memo in the ticked for more details)
-
-Release: amber-3.0.1
- =========================================
-Date Ticket Description
----------- -------- -----------
-2009-07-28 DFS09135 add a QC parameters, std deviation of the Vis
- spectrum: The standard deviation of the squared
- visibilities with respect to the frames (and averaged
- over the various wavelength bins) for all wavelength
- bins is calculated and added as QC parameter. The name
- of the QC parameter is the same as described in ticket
- DFS08182 and DFS07075 but with "STDEV" added to the
- string, e.g.: "QC CALV2 BIN3 BAS3 STDEV"
-
-
-Release: amber-3.0.0
-=========================================
-Date Ticket Description
----------- -------- -----------
-2009-07-26 -------- A new recipe amber_oimerge has been written. It can be
- used to merge OI-fits files of the following PRO CATG:
- SCIENCE_REDUCED
- SCIENCE_REDUCED_FILTERED
- CALIB_REDUCED
- CALIB_REDUCED_FILTERED
- AMBER_TRF_J
- AMBER_TRF_H
- AMBER_TRF_K
- SCIENCE_CALIBRATED
-
-2009-07-22 -------- Bugfix: check for overlapping wavelength intervall of
- the transfer function and science observation modified.
-
-2009-07-18 -------- two valid classification tags are added to the
- amber_SciCal recipe to identify the sky frames:
- AMBER_SKY_CALIB and AMBER_SKY_SCIENCE
-
-2009-07-18 -------- two valid classification tags are added to the
- amber_SciCal recipe to identify the dark frames:
- AMBER_DARK_CALIB and AMBER_DARK_SCIENCE
-
-2009-06-11 -------- Dummy recipe parameters removed in amber_SciCal and
- amber_p2vm
-
-Release: amber-2.9.1
-=========================================
-Date Ticket Description
----------- -------- -----------
-
-2009-06-02 -------- check for CPL_TYPE_COMPLEX added
-
-Release: amber-2.9.0
-=========================================
-Date Ticket Description
----------- -------- -----------
-
-2009-05-28 DFS08889 check in the p2vm recipe if there is pb with the data:
- a function amber_check_zeroframes() has been written
- to check the number of zeroframes in the p2vm raw
- files. The number is then written as QC parameter to
- the p2vm file: HIERARCH ESO QC ZEROFRAMES
-2009-05-25 -------- Pipeline installation directory structure has been
- changed in order to synchronize all ESO pipelines
-
-Release: amber-2.8.0
-=========================================
-Date Ticket Description
----------- -------- -----------
-
-2009-01-12 -------- amber_divider removed from the installation procedure
- as it is only a template without any functionality
-
-2009-01-11 DFS08182 new QC parameter mean SNR: new QC parameters were
- added to the products depending on the type:
-
- "ESO QC UNCALSNR BAS1"
- "ESO QC UNCALSNR BAS2"
- "ESO QC UNCALSNR BAS3"
- or
- "ESO QC CALSNR BAS1"
- "ESO QC CALSNR BAS2"
- "ESO QC CALSNR BAS3"
- or
- "ESO QC TRFSNR BAS1"
- "ESO QC TRFSNR BAS2"
- "ESO QC TRFSNR BAS3"
-
- These parameters give the mean signal to noise ratio
- of the visibilities in the different baselines
-
-
-
-Release: amber-2.7.0
-=========================================
-Date Ticket Description
----------- -------- -----------
-
-2009-12-16 DFS08100 core dumped for amber_trf when no frames on the dfo machine
- Fixed.
-
-
-
-Release: amber-2.6.0
-=========================================
-Date Ticket Description
----------- -------- -----------
-
-2009-11-30 DFS07420 AMBER transfer function monitoring:
- Implemented and currently under evaluation
-
-2009-11-30 DFS07421 super recipe for AMBER transfer function monitoring:
- Implemented and currently under evaluation
-
-
-Release: amber-2.5.2
-=========================================
-Date Ticket Description
----------- -------- -----------
-
-2009-06-10 DFS07075 Add Visibility, closure Phase QC parameters:
- The following QC parameters are added to the
- amber_SciCal and amber_selector recipe:
-
- QC LAMBDA BIN1 CHAN
- QC LAMBDA BIN1 MAX
- QC LAMBDA BIN1 MIN
-
- QC LAMBDA BIN2 CHAN
- QC LAMBDA BIN2 MAX
- QC LAMBDA BIN2 MIN
-
- QC LAMBDA BIN3 CHAN
- QC LAMBDA BIN3 MAX
- QC LAMBDA BIN3 MIN
-
- QC LAMBDA CEN CHAN
- QC LAMBDA CEN MAX
- QC LAMBDA CEN MIN
-
- QC LAMBDA CHAN
- QC LAMBDA MAX
- QC LAMBDA MIN
-
- QC UNCALV2 BIN1 BAS1
- QC UNCALV2 BIN1 BAS2
- QC UNCALV2 BIN1 BAS3
-
- QC UNCALV2 BIN2 BAS1
- QC UNCALV2 BIN2 BAS2
- QC UNCALV2 BIN2 BAS3
-
- QC UNCALV2 BIN3 BAS1
- QC UNCALV2 BIN3 BAS2
- QC UNCALV2 BIN3 BAS3
-
- QC UNCALV2 CEN BAS1
- QC UNCALV2 CEN BAS2
- QC UNCALV2 CEN BAS3
-
- QC UNCALCP BIN1
- QC UNCALCP BIN2
- QC UNCALCP BIN3
- QC UNCALCP CEN
-
- The wavelength is given in micron and the average of
- the squared visibility (V2) and closure phase (CP) is
- derived including the values at the wavelength
- boundaries.
-
-
-2009-03-30 -------- updated recipe amber_ascii_export (by Klara Shabun)
- integrated into the amber pipeline
-
-2009-03-26 -------- recipe amber_raw_to_fitsimage partially rewritten in
- order to have an ESO compliant product header.
-
-
-2009-03-20 DFS06737 Segmentation violation when running amber_SciCal with
- many frames: The pipeline recipe amber_SciCal can now
- handle up to 5000 science files in the SOF. If more
- are given, a warning will be issued and only the
- firsts 5000 files will be reduced.
-
-
-Release: amber-2.5.1
-
-2009-02-04 -------- Flatfield and Bad Pixel Mask updated:
- TPL START: 2008-09-14T20:06:51
-
-
-
-Release: amber-2.5.0
-
-
-2008-11-10 -------- Pipeline has been upgraded from the amdlib version 2.0
- to amdlib version 2.2
-
-
-Release: amber-2.4.4
-
-
-2008-10-31 -------- Qfits dependency of the amber library has been removed
-
-2008-10-31 -------- The pipeline is now linking to the installed cfitsio
- library. The cfitsio directory has been removed from
- the amberp cvs repository
-
-2008-07-14 -------- Midas/shell script
- amber_OI_FITS_plot_closurephase.prg/sh added. This
- midas program plots the closure phase of the
- amber_SciCal product. Moreover the OPD scaling in the
- amber_OI_FITS_plot.prg program has been changed form
- OPD=OPD*1e-3 to OPD=OPD*1e3
-
-
-Release: amber-2.4.4
-
-
-2008-05-29 DFS05479 amber selector: All the following methods of the
- amber_selector recipe can now be used to perform a
- frame selection:
-
- "First x Frames";
- "Fringe SNR > x";
- "Fringe SNR percentage x";
- "Flux > x";
- "Flux percentage x";
- "Exclude Frames by ASCII File";
- "Include Frames by ASCII File";
- "IO-Test: no filtering";
- "Absolute piston value < x";
- "Absolute piston value percentage x"
-
- After selecting a method one can set a selection
- criteria for every baseline by defining the variables
- X1, X2, and X3. If only one baseline is available, X2
- and X3 can be neglected. Moreover one can choose the
- combining method of the single criteria by setting the
- Boolean variable ANDselection.
-
- If ANDselection is not set (--ANDselection=FALSE), a
- frame passes the filter if at least one of the
- selection criteria (X1 || X2 || X3) is fulfilled.
-
- If ANDselection is set (--ANDselection=TRUE), a frame
- passes the filter only if ALL selection criteria (X1
- && X2 && X3) are fulfilled.
-
- Please note, that for three baselines in both cases
- the visibility triplet is written to the product file!
- See the pipeline manual for more details
-
-2008-05-19 -------- The selection method "Fringe SNR percentage x" has
- been implemented for the amber_selector recipe. For
- three baselines it first creates a vector containing
- the MAX(SNR_base1,SNR_base2,SNR_base3), then it sorts
- this vector and includes the X (in percentage) best
- frames to the product.
-
-2008-05-16 -------- The recipe amber_selector has been partially rewritten
- and updated, as the previous version never saved the
- selected frames, but always the first XXX
- frames. Moreover the recipe output was adapted to the
- naming convention of the new amdlib cmm version
- 2.29. At the moment it is enough that the signal to
- noise ratio of the fringes of only one base is above
- the threshold in order to save all bases of that
- frame.
-
-
-Release: amber-2.4.3:
-
-2008-02-12 -------- New Bad pixel map and Flatfield derived by using:
- AMBER.2008-02-07T08:54:39.578.fits
- ... AMBER.2008-02-07T10:08:43.896.fits
-
-
-Release: amber-2.4.2:
-
-2008-01-10 -------- The Midas plotting program amber_OI_FITS_plot.prg has
- been adapted to the output of the new amdlib version 2.29
-2008-01-09 -------- QC parameters for all three baselines XX added to ESO-DFS-DIC.AMBER_QC:
- QC.P2VM.J.VISXX
- QC.P2VM.J.ERRVISXX
- QC.P2VM.H.VISXX
- QC.P2VM.H.ERRVISXX
- QC.P2VM.K.VISXX
- QC.P2VM.K.ERRVISXX
-
-2007-12-11 -------- New amdlib cmm version 2.29 integrated: cmm version 2.24 -> cmm version 2.29
-
-
-2007-12-11 -------- New amber_ascii_export provided by Klara Shabun
-
-
-
-
-Version 2.4.1
-
-
-2007-10-24 -------- update of the BadPixelMap.fits, FlatFieldMap.fits as
- well as the amber.oca rule file to support the new
- detector 247
-2007-10-03 DFS04538 modify amber_detector recipe to support the new
- detector 247: amber_detector recipe adapted to the
- new detector
-2007-10-03 -------- amber_raw_to_fitsimage can now handle also detector
- calibration files
-
-
-
-
-Version 2.4.0 - 2007/09/13
-
- * Bugfix in the Makefile.am to include qfits
-
-Version 2.3.9 - 2007/08/15
-
-DFS04041: manual for amber_selector recipe:
- The methods not yet implemented are now makred as "(in
- preparation)" if "esorex --man-page amber_selector" is called.
-
-
-Version 2.3.8 - 2007/08/02
- * Various recipes updated in order to be compatible with cpl v4.0:
- -- CPL_PIXEL_MINVAL replaced by -(DBL_MAX)
- -- CPL_BPP_IEEE_DEFAULT replaced with CPL_BPP_IEEE_FLOAT
- -- cpl_propertylist_to_fits replaced by cpl_image_save
- * esorex man-page for selMethod3, selMethod4, and selMethod5 of amber_selector updated
- * Bugfix for cpl_frame_set_group in amber_p2vm
- * cpl_frame_set_group set to CPL_FRAME_GROUP_CALIB in the
- amber_selector recipe
-
-Version 2.3.7 - 2007/05/04
-
- * The PRO CATG has been modified in amber_detector.c:
- DETECTOR_FFM_REDUCED -> AMBER_FLATFIELD
- DETECTOR_BPM_REDUCED -> AMBER_BADPIX
-
-
-DFS03542: A 2D Gaussian fit (based on cpl_image_iqe()) was added to
- the beampos recipe and the peak flux of the Gaussian was put
- into the QC and logs for all 22 resulting files. Name:
- PEAKFLUX
-
-DFS03152: Pipeline version number added or/and homogenized for the
- following recipes: amber_BeamPos, amber_SciCal,
- amber_detector, amber_p2vm, and amber_selector.c
-
-
-Version 2.3.6 - 2007/03/13
- * AMBER.prefs for gasgano modified
-
-Version 2.3.5 - 2007/03/09
-
-* DFS03540: AMBER.prefs for gasgano created and added
-* ESO-DFS-DIC.AMBER_QC updated
-
-Version 2.3.4 - 2007/02/12
-* Splitted files (J, H, K) have now the right output Tag.
- According to the input file: SCIENCE_REDUCED or CALIB_REDUCED
-
-Version 2.3.3 - 2007/02/12
-
-* amber.bdd has been modified:
-- In AMBER_3P2V, AMBER_3WAVE, AMBER_2P2V, and AMBER_2WAVE DPR_CATG has
- been modified:
- DPR_CATG=="CALIB" --> (DPR_CATG=="CALIB" || DPR_CATG=="SCIENCE")
-- AMBER_COLPOS, AMBER_SEARCH, AMBER_FLUX, and AMBER_COHER have been added
-* amber.oca has been created
-* QC Parameters SHX and SHY added in the header for BeamPos files
-* QC Parameters SHX and SHY added in ESO-DFS-DIC.AMBER_QC
-* Including latest version of amber_ascii_export recipe by K. Shabun:
-- it works now both in 2 and 3 telescope mode
-- the output is located in the folder defined by the user
-- in the 3 telescope mode it divides the data into 3 files, by baselines
-- the names of the output files look like
- "/2006-12-31T03:43:18.3879_export1_J.txt/" and consist of the date
- and time of the observation, according to the raw file name, then
- comes "_export" and the baseline number, and the bandpass
-- in the 2 telescope mode only one output file is created
-- The user may choose between two different output data formats
-- the recipe can operate with several input files in the same time
-
-
-Version 2.3.2 - 16.01.07
-
-* QC log fix for interface amber_p2vm.prg
-* QC log for P2VM
-* QC dictionary for BAND, STA1, STA2 and STA3
-
-
-Version 2.3.0 - 30.11.06
-
-based on amdlib Version: 2.24 (amdlibP2VM.c and amdlibUtils.c modified) and CPL 3.0
-* amber-kit installation
-* fixed bug: amber_beampos keywords with one HIERRACH too much
-* fixed problem in amber_p2vm: core dump when only AMBER_WAVE files were given
-* fixed bug in amber_p2vm when 4 WAVEs were sent in 3 telescope mode (spectral calibration not performed)
-
-
-Version 2.2.0 - 08.11.06
-
-based on amdlib Version: 2.24 (amdlibP2VM.c and amdlibUtils.c modified) and CPL 3.0
-
-* fixed header problem while writing/reading P2VM in pipline context
-* fixed core dump in GASGANO with JNI for spectral calibration (amber_p2vm)
-
-
-Version 2.1.0 - 06.11.06
-
-based on amdlib Version: 2.20 (OIfits.c modified) and CPL 3.0
-
-* Kit-Installation-Version: amber-kit-2.1.0.tar.gz (including qfits, cpl, esorex, gasgano, amber manual)
-* amber_BeamPos: Added QC-parameter for the angle of the beam (+/- 45 degrees) and fixed a bug in centroid computation
-* amber_detector: Added QC-parameter for number of bad pixels, good pixels and the ratio in percant of all pixels.
-* Detection of amdms error returns. Various bugfixes
-* new AMBER.rul to reflect changes in the DPR keywords
-* new pipeline rules to reflect changes in the DPR keywords
-* new QC dictionnary with QC parameters for amber_BeamPos and amber_detector
-* updated MIDAS interface procedures to allow QC logging for amber_BeamPos and amber_detector
-
-
-Version 2.0.9 - 14.10.2006
-
-based on amdlib Version: Version: 2.20 (OIfits.c modified) and CPL 3.0
-
-* Bugfix for gcc 4.1.1 in amber_raw_to_fitsimage.c (warning became error)
-* Kit-Installation-Version: amber-kit-2.0.9.tar.gz (including qfits, cpl, esorex, gasgano, amber manual)
-
-Version 2.0.8 - 10.10.2006
-
-based on amdlib Version: 2.20 (OIfits.c modified) and CPL 3.0
-
-* Kit-Installation-Version: amber-kit-2.0.8.tar.gz (including qfits, cpl, esorex, gasgano, amber manual)
-* Recipe amber_BeamPosition to monitor beam alignment, algorithm for centroids, size and flux included
-* Implementation of algorithms for amber_detector based on library of MPI Bonn (as a first draft version, not supporting
- all parameters used by MPI Bonn yet)
-* New AMBER.rul for classification of DETECTOR and BEAMPOS files
-* correct version string of AMBER pipeline now in PRO.REC1.PIPE.ID
-* amber_p2vm adopted to new amdlib (spectral calibration)
-* amber_SciCal adopted to new amdlib
-* Implementation of algorithms for amber_selector (exclude/include frames by ASCII file, fringe SNR > x, first x frames )
-* correct version string of AMBER pipeline now in PRO.REC1.PIPE.ID
-* includes a specific - non general, not supported - recipe amber_ascii_export as an example for exporting OI data to ASCII files
-
-
-Version 2.0.7 - 13.09.2006
-
-based on amdlib Version: 2.10 (modified) and CPL 3.0 (it is possible to set a switch to compile for CPL 2.1.2)
-
-* New recipe amber_BeamPosition to monitor beam alignment, without real algorithm for centroids
-* fixed a missing header
-
-
-Version 2.0.6 - 11.09.2006
-
-based on amdlib Version: 2.10 (modified) and CPL 3.0 (it is possible to set a switch to compile for CPL 2.1.2)
-
-* CPL 3.0 compliant
-
-
-Version 2.0.5 - internal only
-
-based on amdlib Version: 2.10 (modified) and CPL 2.1.2
-
-* Renamed amber_display to amber_raw_to_fitsimage
-* Script for GASGANO: amber_raw_to_fitsimage: calls recipe amber_raw_to_fitsimage with ESOREX and displays result in FV
-* new recipe (interface only): amber_detector for master flatfield and bad pixel map
-* first "real" algorithm for amber_selector implemented
-* Updated online pipeline OI FITS plot to accept amdlib 2.10 output
-
-
-Version 2.0.4 - 30.05.2006
-
-based on amdlib Version: 2.10 (modified) and CPL 2.1.2
-
-* bugfix: Not always taken the right raw file header for products (OBS.NAME)
-* Spectral Calibration now compatible with latest amdlib (propagation of DET1.Px.OFFSETY values)
-* New plotting routine to reflect the changes of amdlib (amber_gasgano_plot_2_10.prg)
-* Added QC P1/P2/P3 OFFSETY to product header of amber_p2vm
-* Added QC band description to product header of amber_SciCal
-* Added QC station Index to product header of amber_SciCal
-* Bugfix for product header of amber_SciCal
-* Bugfix for product header of amber_p2vm
-* read/filter/write for amber_selector in very first version
-
-Version 2.0.3 - 16.05.2006
-
-based on amdlib Version: 2.9 and CPL 2.0
-
-* P2VM_REDUCED tag is now accepted as a legal P2VM classification for SciCal
-* (hopefully) fixed Spectral Calibration bug for some SKY files
-* recipes have successfully been tested within a Taverda workflow
-* bugfix for crashes of P2VM for 2 telescopes in Taverda/GASGANO
-* new recipe (interface only): amber_selector for selecting "good" frames by various methods
-* new recipe (interface only): amber_divider for calculation of calibrated visibilities
-
-* AMBER.rul: classification for SKY now consistent for SCIENCE and CALIB
-
-
-Version 2.0.2 beta -
-
-based on modified amdlib Version: 2.6 and CPL 2.0
-
-* P2VM pipeline product: some keywords in header were doublicated
-* classification of latest AMBER files for GASGANO and DO
-
-
-Version 2.0.1 beta - 16.02.2006
-
-based on modified amdlib Version: 2.6 and CPL 2.0
-
-* working with GASGANO now
-* integration of plots into GASGANO script directory
-
-
-Version 2.0.0 beta - 01.02.2006
-
-based on amdlib Version: 2.3 and CPL 2.0
-
-* compiled and linked amdlib along with CPL
-* changing all recipes to the new needs of amdlib 2.x
-* adjusted plots to new product format of amdlib 2.x
-* download for plotting product on the offline ws is available
-
-
-Version 1.0.3 - 08/12/2005
-
-based on amdlib Version: paranal version of 1.08
-
-* in some cases there were only 20 products registered for renaming, fixed
-* updated QC dictionnary
-* proper handling of QC parameters with QC logwriter
-* integrated QC plot changes from Paranal 08/2005
-* For the sake of DFO tools the P2VM is now called the same in both
- cases, 2- and 3-telescopes
-* Fixed memory leak for header creation
-* Fixed a runtime warning in amber_display recipe
-
-
-
-Version 1.0.2 - 22/09/2005
-
-based on amdlib Version: paranal version of 1.08
-
-* bugfix for empty DPR.CATG keword in products
-* added DFS header to P2VM product
-* added /installed/bin/amber-setup.sh to distribution (needed by VLTI-pipeline)
-
-
-
-Version 1.0.1 - 08/2005
-
-based on amdlib Version: paranal version of 1.08
-
-* adoptions to amdlib now splitting JHK bands
-* create product for each band
-* pipeline plot with better font and .ps file for each product
-
-
-
-Version 1.0.0 - 07/2005
-
-based on amdlib Version: 1.02
-
-* first official version
-
----
diff --git a/INSTALL b/INSTALL
deleted file mode 100644
index 54caf7c..0000000
--- a/INSTALL
+++ /dev/null
@@ -1,229 +0,0 @@
-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
deleted file mode 100644
index 35717d1..0000000
--- a/Makefile.am
+++ /dev/null
@@ -1,70 +0,0 @@
-## 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 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 = amber recipes scripts regtests
-
-COMPILE_LAST = tests
-
-
-HTML_SUBDIRS =
-
-SUBDIRS = $(COMPILE_FIRST) $(TOPSUBDIRS) $(COMPILE_LAST)
-
-EXTRA_DIST = 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
deleted file mode 100644
index c68d345..0000000
--- a/Makefile.in
+++ /dev/null
@@ -1,925 +0,0 @@
-# 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/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/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@
-AMBER_BINARY_AGE = @AMBER_BINARY_AGE@
-AMBER_BINARY_VERSION = @AMBER_BINARY_VERSION@
-AMBER_INCLUDES = @AMBER_INCLUDES@
-AMBER_INTERFACE_AGE = @AMBER_INTERFACE_AGE@
-AMBER_LDFLAGS = @AMBER_LDFLAGS@
-AMBER_MAJOR_VERSION = @AMBER_MAJOR_VERSION@
-AMBER_MICRO_VERSION = @AMBER_MICRO_VERSION@
-AMBER_MINOR_VERSION = @AMBER_MINOR_VERSION@
-AMBER_VERSION = @AMBER_VERSION@
-AMTAR = @AMTAR@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFITSIO_INCLUDES = @CFITSIO_INCLUDES@
-CFITSIO_LDFLAGS = @CFITSIO_LDFLAGS@
-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@
-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@
-FFTWF_INCLUDES = @FFTWF_INCLUDES@
-FFTWF_LDFLAGS = @FFTWF_LDFLAGS@
-FFTW_INCLUDES = @FFTW_INCLUDES@
-FFTW_LDFLAGS = @FFTW_LDFLAGS@
-FGREP = @FGREP@
-GREP = @GREP@
-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@
-LIBAMBER = @LIBAMBER@
-LIBCEXT = @LIBCEXT@
-LIBCFITSIO = @LIBCFITSIO@
-LIBCPLCORE = @LIBCPLCORE@
-LIBCPLDFS = @LIBCPLDFS@
-LIBCPLDRS = @LIBCPLDRS@
-LIBCPLUI = @LIBCPLUI@
-LIBFFTW = @LIBFFTW@
-LIBFFTWF = @LIBFFTWF@
-LIBOBJS = @LIBOBJS@
-LIBPTHREAD = @LIBPTHREAD@
-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@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PRODUCT_DID = @PRODUCT_DID@
-PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
-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_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@
-lt_ECHO = @lt_ECHO@
-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@
-scriptsdir = @scriptsdir@
-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@
-AUTOMAKE_OPTIONS = 1.8 foreign
-ACLOCAL_AMFLAGS = -I m4macros
-DISTCLEANFILES = *~
-COMPILE_FIRST =
-TOPSUBDIRS = amber recipes scripts regtests
-COMPILE_LAST = tests
-HTML_SUBDIRS =
-SUBDIRS = $(COMPILE_FIRST) $(TOPSUBDIRS) $(COMPILE_LAST)
-EXTRA_DIST = 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 Doxyfile; then \
- at MAINTAINER_MODE_TRUE@ echo "$(DOXYGEN)"; \
- at MAINTAINER_MODE_TRUE@ $(DOXYGEN); \
- 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
deleted file mode 100644
index 318d579..0000000
--- a/Makefile.purify.in
+++ /dev/null
@@ -1,109 +0,0 @@
-#*******************************************************************************
-# 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
deleted file mode 100644
index e69de29..0000000
diff --git a/README b/README
deleted file mode 100644
index e69de29..0000000
diff --git a/TODO b/TODO
deleted file mode 100644
index e69de29..0000000
diff --git a/acinclude.m4 b/acinclude.m4
deleted file mode 100644
index 9a689d3..0000000
--- a/acinclude.m4
+++ /dev/null
@@ -1,187 +0,0 @@
-# AMBER_SET_PREFIX(PREFIX)
-#---------------------------
-AC_DEFUN([AMBER_SET_PREFIX],
-[
- unset CDPATH
- # make $PIPE_HOME the default for the installation
- AC_PREFIX_DEFAULT($1)
-
- if test "x$prefix" = "xNONE"; then
- prefix=$ac_default_prefix
- ac_configure_args="$ac_configure_args --prefix $prefix"
- fi
-
- if test "x$exec_prefix" = "xNONE"; then
- exec_prefix=$prefix
- fi
-
-])
-
-
-# AMBER_SET_VERSION_INFO(VERSION, [CURRENT], [REVISION], [AGE])
-#----------------------------------------------------------------
-# Setup various version information, especially the libtool versioning
-AC_DEFUN([AMBER_SET_VERSION_INFO],
-[
- amber_version=`echo "$1" | sed -e 's/[[a-z,A-Z]].*$//'`
-
- amber_major_version=`echo "$amber_version" | \
- sed 's/\([[0-9]]*\).\(.*\)/\1/'`
- amber_minor_version=`echo "$amber_version" | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\)\(.*\)/\2/'`
- amber_micro_version=`echo "$amber_version" | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
-
- if test -z "$amber_major_version"; then
- amber_major_version=0
- fi
-
- if test -z "$amber_minor_version"; then
- amber_minor_version=0
- fi
-
- if test -z "$amber_micro_version"; then
- amber_micro_version=0
- fi
-
- AMBER_VERSION="$amber_version"
- AMBER_MAJOR_VERSION=$amber_major_version
- AMBER_MINOR_VERSION=$amber_minor_version
- AMBER_MICRO_VERSION=$amber_micro_version
-
- if test -z "$4"; then
- AMBER_INTERFACE_AGE=0
- else
- AMBER_INTERFACE_AGE="$4"
- fi
-
- AMBER_BINARY_AGE=`expr 100 '*' $AMBER_MINOR_VERSION + $AMBER_MICRO_VERSION`
- AMBER_BINARY_VERSION=`expr 10000 '*' $AMBER_MAJOR_VERSION + \
- $AMBER_BINARY_AGE`
-
- AC_SUBST(AMBER_VERSION)
- AC_SUBST(AMBER_MAJOR_VERSION)
- AC_SUBST(AMBER_MINOR_VERSION)
- AC_SUBST(AMBER_MICRO_VERSION)
- AC_SUBST(AMBER_INTERFACE_AGE)
- AC_SUBST(AMBER_BINARY_VERSION)
- AC_SUBST(AMBER_BINARY_AGE)
-
- AC_DEFINE_UNQUOTED(AMBER_MAJOR_VERSION, $AMBER_MAJOR_VERSION,
- [AMBER major version number])
- AC_DEFINE_UNQUOTED(AMBER_MINOR_VERSION, $AMBER_MINOR_VERSION,
- [AMBER minor version number])
- AC_DEFINE_UNQUOTED(AMBER_MICRO_VERSION, $AMBER_MICRO_VERSION,
- [AMBER micro version number])
- AC_DEFINE_UNQUOTED(AMBER_INTERFACE_AGE, $AMBER_INTERFACE_AGE,
- [AMBER interface age])
- AC_DEFINE_UNQUOTED(AMBER_BINARY_VERSION, $AMBER_BINARY_VERSION,
- [AMBER binary version number])
- AC_DEFINE_UNQUOTED(AMBER_BINARY_AGE, $AMBER_BINARY_AGE,
- [AMBER binary age])
-
- ESO_SET_LIBRARY_VERSION([$2], [$3], [$4])
-])
-
-
-# AMBER_SET_PATHS
-#------------------
-# Define auxiliary directories of the installed directory tree.
-AC_DEFUN([AMBER_SET_PATHS],
-[
-
- if test -z "$plugindir"; then
- plugindir='${libdir}/esopipes-plugins/${PACKAGE}-${VERSION}'
- fi
-
- if test -z "$privatelibdir"; then
- privatelibdir='${libdir}/${PACKAGE}-${VERSION}'
- fi
-
- htmldir='${datadir}/doc/esopipes/${PACKAGE}-${VERSION}/html'
-
- if test -z "$pipedocsdir"; then
- pipedocsdir='${datadir}/doc/esopipes/${PACKAGE}-${VERSION}/'
- fi
-
- if test -z "$configdir"; then
- configdir='${datadir}/${PACKAGE}/config'
- fi
-
- if test -z "$scriptsdir"; then
- scriptsdir='${datadir}/esopipes/${PACKAGE}-${VERSION}/scripts'
- fi
-
- AC_SUBST(plugindir)
- AC_SUBST(privatelibdir)
- AC_SUBST(htmldir)
- AC_SUBST(pipedocsdir)
- AC_SUBST(configdir)
- AC_SUBST(scriptsdir)
-
-
- # Define a preprocesor symbol for the plugin search paths
-
- AC_DEFINE_UNQUOTED(AMBER_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(AMBER_PLUGIN_PATH, "$plugin_path",
- [Absolute path to the plugin directory tree])
-
-])
-
-
-# AMBER_CREATE_SYMBOLS
-#-----------------------
-# Define include and library related makefile symbols
-AC_DEFUN([AMBER_CREATE_SYMBOLS],
-[
-
- # Symbols for package include file and library search paths
-
- AMBER_INCLUDES='-I$(top_srcdir)/amber'
- AMBER_LDFLAGS='-L$(top_builddir)/amber'
-
- all_includes='$(AMBER_INCLUDES) $(CPL_INCLUDES) $(CX_INCLUDES) $(EXTRA_INCLUDES)'
- all_ldflags='$(AMBER_LDFLAGS) $(CPL_LDFLAGS) $(CX_LDFLAGS) $(EXTRA_LDFLAGS)'
-
- # Library aliases
-
- LIBAMBER='$(top_builddir)/amber/libamber.la'
-
- # Substitute the defined symbols
-
- AC_SUBST(AMBER_INCLUDES)
- AC_SUBST(AMBER_LDFLAGS)
-
- AC_SUBST(LIBAMBER)
-
- # Check for CPL and user defined libraries
- AC_REQUIRE([CPL_CHECK_LIBS])
- AC_REQUIRE([ESO_CHECK_EXTRA_LIBS])
-
- all_includes='$(AMBER_INCLUDES) $(CPL_INCLUDES) $(CX_INCLUDES) $(EXTRA_INCLUDES)'
- all_ldflags='$(AMBER_LDFLAGS) $(CPL_LDFLAGS) $(CX_LDFLAGS) $(EXTRA_LDFLAGS)'
-
- AC_SUBST(all_includes)
- AC_SUBST(all_ldflags)
-])
-
-
-# AMBER_SET_DID(SYMBOL, NAME)
-#------------------------------
-# Adds a DID identifier string to config.h
-AC_DEFUN([AMBER_SET_DID],
-[
-
- if test -n "$1" || test -n "$2"; then
- AC_DEFINE_UNQUOTED($1, "$2",
- [Product DID identifier the library complies to])
- AC_SUBST(PRODUCT_DID)
- fi
-
-])
diff --git a/aclocal.m4 b/aclocal.m4
deleted file mode 100644
index ef2f6ed..0000000
--- a/aclocal.m4
+++ /dev/null
@@ -1,1063 +0,0 @@
-# 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.63],,
-[m4_warning([this file was generated for autoconf 2.63.
-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'.])])
-
-# 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])
-
-# 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/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/purify.m4])
-m4_include([acinclude.m4])
diff --git a/admin/compile b/admin/compile
deleted file mode 100755
index c0096a7..0000000
--- a/admin/compile
+++ /dev/null
@@ -1,143 +0,0 @@
-#! /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
deleted file mode 100755
index dc84c68..0000000
--- a/admin/config.guess
+++ /dev/null
@@ -1,1501 +0,0 @@
-#! /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
deleted file mode 100755
index 2a55a50..0000000
--- a/admin/config.sub
+++ /dev/null
@@ -1,1705 +0,0 @@
-#! /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
deleted file mode 100755
index df8eea7..0000000
--- a/admin/depcomp
+++ /dev/null
@@ -1,630 +0,0 @@
-#! /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
deleted file mode 100644
index 6038b28..0000000
--- a/admin/html.am
+++ /dev/null
@@ -1,74 +0,0 @@
-if MAINTAINER_MODE
-
-HTML_RECURSIVE_TARGETS = install-html-recursive
-
-html-am:
- @if test -f Doxyfile; then \
- echo "$(DOXYGEN)"; \
- $(DOXYGEN); \
- 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
deleted file mode 100755
index 6781b98..0000000
--- a/admin/install-sh
+++ /dev/null
@@ -1,520 +0,0 @@
-#!/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
deleted file mode 100755
index a72f2fd..0000000
--- a/admin/ltmain.sh
+++ /dev/null
@@ -1,8406 +0,0 @@
-# Generated from ltmain.m4sh.
-
-# ltmain.sh (GNU libtool) 2.2.6b
-# 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 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
-# --tag=TAG use configuration variables from tag TAG
-# -v, --verbose print informational messages (default)
-# --version print version information
-# -h, --help print short or long 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.
-# 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.2.6b
-# automake: $automake_version
-# autoconf: $autoconf_version
-#
-# Report bugs to <bug-libtool at gnu.org>.
-
-PROGRAM=ltmain.sh
-PACKAGE=libtool
-VERSION=2.2.6b
-TIMESTAMP=""
-package_revision=1.3017
-
-# 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
-
-# NLS nuisances: We save the old values to restore during execute mode.
-# Only set LANG and LC_ALL to C if already set.
-# These must not be set unconditionally because not all systems understand
-# e.g. LANG=C (notably SCO).
-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
-
-$lt_unset CDPATH
-
-
-
-
-
-: ${CP="cp -f"}
-: ${ECHO="echo"}
-: ${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_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 "X${1}" | $Xsed -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 "X${1}" | $Xsed -e "$basename"`
-}
-
-# Generated shell functions inserted here.
-
-# 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"
-
-# The name of this program:
-# In the unlikely event $progname began with a '-', it would play havoc with
-# func_echo (imagine progname=-n), so we prepend ./ in that case:
-func_dirname_and_basename "$progpath"
-progname=$func_basename_result
-case $progname in
- -*) progname=./$progname ;;
-esac
-
-# 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'
-
-# 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${mode+: }$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_error arg...
-# Echo program name prefixed message to standard error.
-func_error ()
-{
- $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
-}
-
-# func_warning arg...
-# Echo program name prefixed warning message to standard error.
-func_warning ()
-{
- $opt_warning && $ECHO "$progname${mode+: }$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 "X$my_directory_path" | $Xsed -e "$dirname"`
- done
- my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e '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 "X$my_tmpdir" | $Xsed
-}
-
-
-# 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 "X$1" | $Xsed -e "$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 "X$1" | $Xsed \
- -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_version
-# Echo version message to standard output and exit.
-func_version ()
-{
- $SED -n '/^# '$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 ()
-{
- $SED -n '/^# Usage:/,/# -h/ {
- s/^# //
- s/^# *$//
- s/\$progname/'$progname'/
- p
- }' < "$progpath"
- $ECHO
- $ECHO "run \`$progname --help | more' for full usage"
- exit $?
-}
-
-# func_help
-# Echo long help message to standard output and exit.
-func_help ()
-{
- $SED -n '/^# Usage:/,/# Report bugs to/ {
- 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
- }' < "$progpath"
- exit $?
-}
-
-# func_missing_arg argname
-# Echo program name prefixed message to standard error and set global
-# exit_cmd.
-func_missing_arg ()
-{
- func_error "missing argument for $1"
- exit_cmd=exit
-}
-
-exit_cmd=:
-
-
-
-
-
-# Check that we have a working $ECHO.
-if test "X$1" = X--no-reexec; then
- # Discard the --no-reexec flag, and continue.
- shift
-elif test "X$1" = X--fallback-echo; then
- # Avoid inline document here, it may be left over
- :
-elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
- # Yippee, $ECHO works!
- :
-else
- # Restart under the correct shell, and then maybe $ECHO will work.
- exec $SHELL "$progpath" --no-reexec ${1+"$@"}
-fi
-
-if test "X$1" = X--fallback-echo; then
- # used as fallback echo
- shift
- cat <<EOF
-$*
-EOF
- exit $EXIT_SUCCESS
-fi
-
-magic="%%%MAGIC variable%%%"
-magic_exe="%%%MAGIC EXE variable%%%"
-
-# Global variables.
-# $mode is unset
-nonopt=
-execute_dlfiles=
-preserve_args=
-lo2o="s/\\.lo\$/.${objext}/"
-o2lo="s/\\.${objext}\$/.lo/"
-extracted_archives=
-extracted_serial=0
-
-opt_dry_run=false
-opt_duplicate_deps=false
-opt_silent=false
-opt_debug=:
-
-# 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_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
-}
-
-# Parse options once, thoroughly. This comes as soon as possible in
-# the script to make things like `libtool --version' happen quickly.
-{
-
- # 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
-
- # Parse non-mode specific arguments:
- while test "$#" -gt 0; do
- opt="$1"
- shift
-
- case $opt in
- --config) func_config ;;
-
- --debug) preserve_args="$preserve_args $opt"
- func_echo "enabling shell trace mode"
- opt_debug='set -x'
- $opt_debug
- ;;
-
- -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
- execute_dlfiles="$execute_dlfiles $1"
- shift
- ;;
-
- --dry-run | -n) opt_dry_run=: ;;
- --features) func_features ;;
- --finish) mode="finish" ;;
-
- --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
- case $1 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
-
- mode="$1"
- shift
- ;;
-
- --preserve-dup-deps)
- opt_duplicate_deps=: ;;
-
- --quiet|--silent) preserve_args="$preserve_args $opt"
- opt_silent=:
- ;;
-
- --verbose| -v) preserve_args="$preserve_args $opt"
- opt_silent=false
- ;;
-
- --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
- preserve_args="$preserve_args $opt $1"
- func_enable_tag "$1" # tagname is set here
- shift
- ;;
-
- # Separate optargs to long options:
- -dlopen=*|--mode=*|--tag=*)
- func_opt_split "$opt"
- set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
- shift
- ;;
-
- -\?|-h) func_usage ;;
- --help) opt_help=: ;;
- --version) func_version ;;
-
- -*) func_fatal_help "unrecognized option \`$opt'" ;;
-
- *) nonopt="$opt"
- break
- ;;
- esac
- done
-
-
- 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_duplicate_deps
- ;;
- esac
-
- # Having warned about all mis-specified options, bail out if
- # anything was wrong.
- $exit_cmd $EXIT_FAILURE
-}
-
-# 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
-}
-
-
-## ----------- ##
-## Main. ##
-## ----------- ##
-
-$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
-
- test -z "$mode" && func_fatal_error "error: you must specify a MODE."
-
-
- # Darwin sucks
- eval std_shrext=\"$shrext_cmds\"
-
-
- # Only execute mode is allowed to have -dlopen flags.
- if test -n "$execute_dlfiles" && test "$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=$mode' for more information."
-}
-
-
-# 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_ltwrapper_scriptname_result=""
- if func_ltwrapper_executable_p "$1"; then
- func_dirname_and_basename "$1" "" "."
- func_stripname '' '.exe' "$func_basename_result"
- func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
- fi
-}
-
-# 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_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_quote_for_eval "$arg"
- CC_quoted="$CC_quoted $func_quote_for_eval_result"
- done
- 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 "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
- # 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_quote_for_eval "$arg"
- CC_quoted="$CC_quoted $func_quote_for_eval_result"
- done
- case "$@ " in
- " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
- # 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}"
- }
-}
-
-# 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)
- pie_flag="$pie_flag $arg"
- continue
- ;;
-
- -shared | -static | -prefer-pic | -prefer-non-pic)
- later="$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_quote_for_eval "$arg"
- lastarg="$lastarg $func_quote_for_eval_result"
- done
- IFS="$save_ifs"
- func_stripname ' ' '' "$lastarg"
- lastarg=$func_stripname_result
-
- # Add the arguments to base_compile.
- base_compile="$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_quote_for_eval "$lastarg"
- base_compile="$base_compile $func_quote_for_eval_result"
- 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)
- 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 "X$srcfile" | $Xsed -e 's%^.*/%%' -e '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
- removelist="$removelist $output_obj"
- $ECHO "$srcfile" > "$lockfile"
- fi
-
- $opt_dry_run || $RM $removelist
- removelist="$removelist $lockfile"
- trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
-
- if test -n "$fix_srcfile_path"; then
- eval srcfile=\"$fix_srcfile_path\"
- fi
- 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
- command="$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
- command="$command -o $obj"
- fi
-
- # Suppress compiler output if we already did a PIC compilation.
- command="$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 "$mode" = compile && func_mode_compile ${1+"$@"}
-}
-
-func_mode_help ()
-{
- # We need to display help for each of the modes.
- case $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 building PIC objects only
- -prefer-non-pic try to building 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
-
-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 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
- -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
-
-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 \`$mode'"
- ;;
- esac
-
- $ECHO
- $ECHO "Try \`$progname --help' for more information about other modes."
-
- exit $?
-}
-
- # Now that we've collected a possible --mode arg, show help if necessary
- $opt_help && func_mode_help
-
-
-# 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 $execute_dlfiles; do
- test -f "$file" \
- || func_fatal_help "\`$file' is not a file"
-
- dir=
- case $file in
- *.la)
- # 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
- dir="$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
- -*) ;;
- *)
- # 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_quote_for_eval "$file"
- args="$args $func_quote_for_eval_result"
- 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 "$mode" = execute && func_mode_execute ${1+"$@"}
-
-
-# func_mode_finish arg...
-func_mode_finish ()
-{
- $opt_debug
- libdirs="$nonopt"
- admincmds=
-
- if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
- for dir
- do
- libdirs="$libdirs $dir"
- done
-
- 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" || admincmds="$admincmds
- $cmds"
- fi
- done
- fi
-
- # Exit here if they wanted silent mode.
- $opt_silent && exit $EXIT_SUCCESS
-
- $ECHO "X----------------------------------------------------------------------" | $Xsed
- $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 "X----------------------------------------------------------------------" | $Xsed
- exit $EXIT_SUCCESS
-}
-
-test "$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.
- $ECHO "X$nonopt" | $GREP shtool >/dev/null; 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"
- install_prog="$install_prog$func_quote_for_eval_result"
-
- # We need to accept at least all the BSD install flags.
- dest=
- files=
- opts=
- prev=
- install_type=
- isdir=no
- stripme=
- for arg
- do
- if test -n "$dest"; then
- files="$files $dest"
- dest=$arg
- continue
- fi
-
- case $arg in
- -d) isdir=yes ;;
- -f)
- case " $install_prog " in
- *[\\\ /]cp\ *) ;;
- *) prev=$arg ;;
- esac
- ;;
- -g | -m | -o)
- prev=$arg
- ;;
- -s)
- stripme=" -s"
- continue
- ;;
- -*)
- ;;
- *)
- # If the previous option needed an argument, then skip it.
- if test -n "$prev"; then
- prev=
- else
- dest=$arg
- continue
- fi
- ;;
- esac
-
- # Aesthetically quote the argument.
- func_quote_for_eval "$arg"
- install_prog="$install_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 -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.
- staticlibs="$staticlibs $file"
- ;;
-
- *.la)
- # 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 "*) ;;
- *) current_libdirs="$current_libdirs $libdir" ;;
- esac
- else
- # Note the libdir as a future libdir.
- case "$future_libdirs " in
- *" $libdir "*) ;;
- *) future_libdirs="$future_libdirs $libdir" ;;
- esac
- fi
-
- func_dirname "$file" "/" ""
- dir="$func_dirname_result"
- dir="$dir$objdir"
-
- if test -n "$relink_command"; then
- # Determine the prefix the user has applied to our future dir.
- inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -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 "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
- else
- relink_command=`$ECHO "X$relink_command" | $Xsed -e "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_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" && staticlibs="$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 "X$lib" | $Xsed -e '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 "X$relink_command" | $Xsed -e '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 "X$file$stripped_ext" | $Xsed -e "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 "$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
-
-/* 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 "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
- for progfile in $progfiles; do
- func_verbose "extracting global C symbols from \`$progfile'"
- $opt_dry_run || eval "$NM $progfile | $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"
- $opt_dry_run || {
- eval '$ECHO ": $name " >> "$nlist"'
- eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
- }
- 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;
-"
- case $host in
- *cygwin* | *mingw* | *cegcc* )
- $ECHO >> "$output_objdir/$my_dlsyms" "\
-/* DATA imports from DLLs on WIN32 con't be const, because
- runtime relocations are performed -- see ld's documentation
- on pseudo-relocs. */"
- lt_dlsym_const= ;;
- *osf5*)
- echo >> "$output_objdir/$my_dlsyms" "\
-/* This system does not cope well with relocations in const data */"
- lt_dlsym_const= ;;
- *)
- lt_dlsym_const=const ;;
- esac
-
- $ECHO >> "$output_objdir/$my_dlsyms" "\
-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) ;;
- *) symtab_cflags="$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 "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
- finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
- else
- compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
- finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
- fi
- ;;
- *)
- compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
- finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "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 "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
- finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "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.
-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
- if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
- $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
- win32_nmres=`eval $NM -f posix -A $1 |
- $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_extract_an_archive dir oldlib
-func_extract_an_archive ()
-{
- $opt_debug
- f_ex_an_ar_dir="$1"; shift
- f_ex_an_ar_oldlib="$1"
- func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
- 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 | $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 | $NL2SP`
- done
-
- func_extract_archives_result="$my_oldobjs"
-}
-
-
-
-# func_emit_wrapper_part1 [arg=no]
-#
-# Emit the first part of a libtool wrapper script on stdout.
-# For more information, see the description associated with
-# func_emit_wrapper(), below.
-func_emit_wrapper_part1 ()
-{
- func_emit_wrapper_part1_arg1=no
- if test -n "$1" ; then
- func_emit_wrapper_part1_arg1=$1
- fi
-
- $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.
-Xsed='${SED} -e 1s/^X//'
-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
- ECHO=\"$qecho\"
- file=\"\$0\"
- # Make sure echo works.
- if test \"X\$1\" = X--no-reexec; then
- # Discard the --no-reexec flag, and continue.
- shift
- elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
- # Yippee, \$ECHO works!
- :
- else
- # Restart under the correct shell, and then maybe \$ECHO will work.
- exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
- fi
- fi\
-"
- $ECHO "\
-
- # Find the directory that this script lives in.
- thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e '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 \"X\$file\" | \$Xsed -e '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 \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
- file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
- done
-"
-}
-# end: func_emit_wrapper_part1
-
-# func_emit_wrapper_part2 [arg=no]
-#
-# Emit the second part of a libtool wrapper script on stdout.
-# For more information, see the description associated with
-# func_emit_wrapper(), below.
-func_emit_wrapper_part2 ()
-{
- func_emit_wrapper_part2_arg1=no
- if test -n "$1" ; then
- func_emit_wrapper_part2_arg1=$1
- fi
-
- $ECHO "\
-
- # Usually 'no', except on cygwin/mingw when embedded into
- # the cwrapper.
- WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_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 \"X\$thisdir\" | \$Xsed -e '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"
-
- # 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 \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
-
- export $shlibpath_var
-"
- fi
-
- # fixup the dll searchpath if we need to.
- if test -n "$dllsearchpath"; then
- $ECHO "\
- # Add the dll search path components to the executable PATH
- PATH=$dllsearchpath:\$PATH
-"
- fi
-
- $ECHO "\
- if test \"\$libtool_execute_magic\" != \"$magic\"; then
- # Run the actual program with our arguments.
-"
- case $host in
- # Backslashes separate directories on plain windows
- *-*-mingw | *-*-os2* | *-cegcc*)
- $ECHO "\
- exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
-"
- ;;
-
- *)
- $ECHO "\
- exec \"\$progdir/\$program\" \${1+\"\$@\"}
-"
- ;;
- esac
- $ECHO "\
- \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
- exit 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\
-"
-}
-# end: func_emit_wrapper_part2
-
-
-# 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=no
- if test -n "$1" ; then
- func_emit_wrapper_arg1=$1
- fi
-
- # split this up so that func_emit_cwrapperexe_src
- # can call each part independently.
- func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
- func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
-}
-
-
-# func_to_host_path arg
-#
-# Convert paths to host format when used with build tools.
-# Intended for use with "native" mingw (where libtool itself
-# is running under the msys shell), or in the following cross-
-# build environments:
-# $build $host
-# mingw (msys) mingw [e.g. native]
-# cygwin mingw
-# *nix + wine mingw
-# where wine is equipped with the `winepath' executable.
-# In the native mingw case, the (msys) shell automatically
-# converts paths for any non-msys applications it launches,
-# but that facility isn't available from inside the cwrapper.
-# Similar accommodations are necessary for $host mingw and
-# $build cygwin. Calling this function does no harm for other
-# $host/$build combinations not listed above.
-#
-# ARG is the path (on $build) that should be converted to
-# the proper representation for $host. The result is stored
-# in $func_to_host_path_result.
-func_to_host_path ()
-{
- func_to_host_path_result="$1"
- if test -n "$1" ; then
- case $host in
- *mingw* )
- lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
- case $build in
- *mingw* ) # actually, msys
- # awkward: cmd appends spaces to result
- lt_sed_strip_trailing_spaces="s/[ ]*\$//"
- func_to_host_path_tmp1=`( cmd //c echo "$1" |\
- $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
- func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
- $SED -e "$lt_sed_naive_backslashify"`
- ;;
- *cygwin* )
- func_to_host_path_tmp1=`cygpath -w "$1"`
- func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
- $SED -e "$lt_sed_naive_backslashify"`
- ;;
- * )
- # 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_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
- if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
- func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
- $SED -e "$lt_sed_naive_backslashify"`
- else
- # Allow warning below.
- func_to_host_path_result=""
- fi
- ;;
- esac
- if test -z "$func_to_host_path_result" ; then
- func_error "Could not determine host path corresponding to"
- func_error " '$1'"
- func_error "Continuing, but uninstalled executables may not work."
- # Fallback:
- func_to_host_path_result="$1"
- fi
- ;;
- esac
- fi
-}
-# end: func_to_host_path
-
-# func_to_host_pathlist arg
-#
-# Convert pathlists to host format when used with build tools.
-# See func_to_host_path(), above. This function supports the
-# following $build/$host combinations (but does no harm for
-# combinations not listed here):
-# $build $host
-# mingw (msys) mingw [e.g. native]
-# cygwin mingw
-# *nix + wine mingw
-#
-# 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.
-#
-# ARG is a pathlist (on $build) that should be converted to
-# the proper representation on $host. The result is stored
-# in $func_to_host_pathlist_result.
-func_to_host_pathlist ()
-{
- func_to_host_pathlist_result="$1"
- if test -n "$1" ; then
- case $host in
- *mingw* )
- lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
- # 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_to_host_pathlist_tmp2="$1"
- # Once set for this call, this variable should not be
- # reassigned. It is used in tha fallback case.
- func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
- $SED -e 's|^:*||' -e 's|:*$||'`
- case $build in
- *mingw* ) # Actually, msys.
- # Awkward: cmd appends spaces to result.
- lt_sed_strip_trailing_spaces="s/[ ]*\$//"
- func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
- $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
- func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
- $SED -e "$lt_sed_naive_backslashify"`
- ;;
- *cygwin* )
- func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
- func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
- $SED -e "$lt_sed_naive_backslashify"`
- ;;
- * )
- # unfortunately, winepath doesn't convert pathlists
- func_to_host_pathlist_result=""
- func_to_host_pathlist_oldIFS=$IFS
- IFS=:
- for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
- IFS=$func_to_host_pathlist_oldIFS
- if test -n "$func_to_host_pathlist_f" ; then
- func_to_host_path "$func_to_host_pathlist_f"
- if test -n "$func_to_host_path_result" ; then
- if test -z "$func_to_host_pathlist_result" ; then
- func_to_host_pathlist_result="$func_to_host_path_result"
- else
- func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
- fi
- fi
- fi
- IFS=:
- done
- IFS=$func_to_host_pathlist_oldIFS
- ;;
- esac
- if test -z "$func_to_host_pathlist_result" ; then
- func_error "Could not determine the host path(s) corresponding to"
- func_error " '$1'"
- func_error "Continuing, but uninstalled executables may not work."
- # Fallback. This may break if $1 contains DOS-style drive
- # specifications. The fix is not to complicate the expression
- # below, but for the user to provide a working wine installation
- # with winepath so that path translation in the cross-to-mingw
- # case works properly.
- lt_replace_pathsep_nix_to_dos="s|:|;|g"
- func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
- $SED -e "$lt_replace_pathsep_nix_to_dos"`
- fi
- # Now, add the leading and trailing path separators back
- case "$1" in
- :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
- ;;
- esac
- case "$1" in
- *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
- ;;
- esac
- ;;
- esac
- fi
-}
-# end: func_to_host_pathlist
-
-# 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.
-
- Currently, it simply execs the wrapper *script* "$SHELL $output",
- but could eventually absorb all of the scripts functionality and
- exec $objdir/$outputname directly.
-*/
-EOF
- cat <<"EOF"
-#include <stdio.h>
-#include <stdlib.h>
-#ifdef _MSC_VER
-# include <direct.h>
-# include <process.h>
-# include <io.h>
-# define setmode _setmode
-#else
-# include <unistd.h>
-# include <stdint.h>
-# ifdef __CYGWIN__
-# include <io.h>
-# define HAVE_SETENV
-# ifdef __STRICT_ANSI__
-char *realpath (const char *, char *);
-int putenv (char *);
-int setenv (const char *, const char *, int);
-# endif
-# 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>
-
-#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
-
-#ifdef _MSC_VER
-# define S_IXUSR _S_IEXEC
-# define stat _stat
-# ifndef _INTPTR_T_DEFINED
-# define intptr_t int
-# endif
-#endif
-
-#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 */
-
-#ifdef __CYGWIN__
-# define FOPEN_WB "wb"
-#endif
-
-#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)
-
-#undef LTWRAPPER_DEBUGPRINTF
-#if defined DEBUGWRAPPER
-# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
-static void
-ltwrapper_debugprintf (const char *fmt, ...)
-{
- va_list args;
- va_start (args, fmt);
- (void) vfprintf (stderr, fmt, args);
- va_end (args);
-}
-#else
-# define LTWRAPPER_DEBUGPRINTF(args)
-#endif
-
-const char *program_name = NULL;
-
-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_fatal (const char *message, ...);
-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_opt_process_env_set (const char *arg);
-void lt_opt_process_env_prepend (const char *arg);
-void lt_opt_process_env_append (const char *arg);
-int lt_split_name_value (const char *arg, char** name, char** value);
-void lt_update_exe_path (const char *name, const char *value);
-void lt_update_lib_path (const char *name, const char *value);
-
-static const char *script_text_part1 =
-EOF
-
- func_emit_wrapper_part1 yes |
- $SED -e 's/\([\\"]\)/\\\1/g' \
- -e 's/^/ "/' -e 's/$/\\n"/'
- echo ";"
- cat <<EOF
-
-static const char *script_text_part2 =
-EOF
- func_emit_wrapper_part2 yes |
- $SED -e 's/\([\\"]\)/\\\1/g' \
- -e 's/^/ "/' -e 's/$/\\n"/'
- echo ";"
-
- cat <<EOF
-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_pathlist "$temp_rpath"
- cat <<EOF
-const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result";
-EOF
- else
- cat <<"EOF"
-const char * LIB_PATH_VALUE = "";
-EOF
- fi
-
- if test -n "$dllsearchpath"; then
- func_to_host_pathlist "$dllsearchpath:"
- cat <<EOF
-const char * EXE_PATH_VARNAME = "PATH";
-const char * EXE_PATH_VALUE = "$func_to_host_pathlist_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-"
-#define LTWRAPPER_OPTION_PREFIX_LENGTH 5
-
-static const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH;
-static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
-
-static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
-
-static const size_t env_set_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
-static const char *env_set_opt = LTWRAPPER_OPTION_PREFIX "env-set";
- /* argument is putenv-style "foo=bar", value of foo is set to bar */
-
-static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
-static const char *env_prepend_opt = LTWRAPPER_OPTION_PREFIX "env-prepend";
- /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
-
-static const size_t env_append_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
-static const char *env_append_opt = LTWRAPPER_OPTION_PREFIX "env-append";
- /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
-
-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]));
- LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
- LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
-
- /* very simple arg parsing; don't want to rely on getopt */
- 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"
- printf ("%s", script_text_part1);
- printf ("%s", script_text_part2);
- return 0;
- }
- }
-
- newargz = XMALLOC (char *, argc + 1);
- tmp_pathspec = find_executable (argv[0]);
- if (tmp_pathspec == NULL)
- lt_fatal ("Couldn't find %s", argv[0]);
- LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
- tmp_pathspec));
-
- actual_cwrapper_path = chase_symlinks (tmp_pathspec);
- LTWRAPPER_DEBUGPRINTF (("(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;
-
- LTWRAPPER_DEBUGPRINTF (("(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 */
- lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
- lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
-
- newargc=0;
- for (i = 1; i < argc; i++)
- {
- if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
- {
- if (argv[i][env_set_opt_len] == '=')
- {
- const char *p = argv[i] + env_set_opt_len + 1;
- lt_opt_process_env_set (p);
- }
- else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
- {
- lt_opt_process_env_set (argv[++i]); /* don't copy */
- }
- else
- lt_fatal ("%s missing required argument", env_set_opt);
- continue;
- }
- if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
- {
- if (argv[i][env_prepend_opt_len] == '=')
- {
- const char *p = argv[i] + env_prepend_opt_len + 1;
- lt_opt_process_env_prepend (p);
- }
- else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
- {
- lt_opt_process_env_prepend (argv[++i]); /* don't copy */
- }
- else
- lt_fatal ("%s missing required argument", env_prepend_opt);
- continue;
- }
- if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
- {
- if (argv[i][env_append_opt_len] == '=')
- {
- const char *p = argv[i] + env_append_opt_len + 1;
- lt_opt_process_env_append (p);
- }
- else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
- {
- lt_opt_process_env_append (argv[++i]); /* don't copy */
- }
- else
- lt_fatal ("%s missing required argument", env_append_opt);
- continue;
- }
- if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 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 ("Unrecognized option in %s namespace: '%s'",
- ltwrapper_option_prefix, argv[i]);
- }
- /* otherwise ... */
- newargz[++newargc] = xstrdup (argv[i]);
- }
- newargz[++newargc] = NULL;
-
- LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
- for (i = 0; i < newargc; i++)
- {
- LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
- }
-
-EOF
-
- case $host_os in
- mingw*)
- cat <<"EOF"
- /* execv doesn't actually work on mingw as expected on unix */
- rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
- if (rval == -1)
- {
- /* failed to start process */
- LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, 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 ("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;
-
- LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
- path ? (*path ? path : "EMPTY!") : "NULL!"));
- 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;
-
- LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
- path ? (*path ? path : "EMPTY!") : "NULL!"));
- 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;
-
- LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n",
- wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
-
- 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 ("getcwd failed");
- 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 ("getcwd failed");
- 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)
- {
- LTWRAPPER_DEBUGPRINTF (("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
- {
- char *errstr = strerror (errno);
- lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
- }
- }
- XFREE (tmp_pathspec);
-
- if (!has_symlinks)
- {
- return xstrdup (pathspec);
- }
-
- tmp_pathspec = realpath (pathspec, buf);
- if (tmp_pathspec == 0)
- {
- lt_fatal ("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;
-}
-
-static void
-lt_error_core (int exit_status, const char *mode,
- const char *message, va_list ap)
-{
- fprintf (stderr, "%s: %s: ", program_name, mode);
- vfprintf (stderr, message, ap);
- fprintf (stderr, ".\n");
-
- if (exit_status >= 0)
- exit (exit_status);
-}
-
-void
-lt_fatal (const char *message, ...)
-{
- va_list ap;
- va_start (ap, message);
- lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
- va_end (ap);
-}
-
-void
-lt_setenv (const char *name, const char *value)
-{
- LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
- (name ? name : "<NULL>"),
- (value ? value : "<NULL>")));
- {
-#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;
-}
-
-int
-lt_split_name_value (const char *arg, char** name, char** value)
-{
- const char *p;
- int len;
- if (!arg || !*arg)
- return 1;
-
- p = strchr (arg, (int)'=');
-
- if (!p)
- return 1;
-
- *value = xstrdup (++p);
-
- len = strlen (arg) - strlen (*value);
- *name = XMALLOC (char, len);
- strncpy (*name, arg, len-1);
- (*name)[len - 1] = '\0';
-
- return 0;
-}
-
-void
-lt_opt_process_env_set (const char *arg)
-{
- char *name = NULL;
- char *value = NULL;
-
- if (lt_split_name_value (arg, &name, &value) != 0)
- {
- XFREE (name);
- XFREE (value);
- lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
- }
-
- lt_setenv (name, value);
- XFREE (name);
- XFREE (value);
-}
-
-void
-lt_opt_process_env_prepend (const char *arg)
-{
- char *name = NULL;
- char *value = NULL;
- char *new_value = NULL;
-
- if (lt_split_name_value (arg, &name, &value) != 0)
- {
- XFREE (name);
- XFREE (value);
- lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
- }
-
- new_value = lt_extend_str (getenv (name), value, 0);
- lt_setenv (name, new_value);
- XFREE (new_value);
- XFREE (name);
- XFREE (value);
-}
-
-void
-lt_opt_process_env_append (const char *arg)
-{
- char *name = NULL;
- char *value = NULL;
- char *new_value = NULL;
-
- if (lt_split_name_value (arg, &name, &value) != 0)
- {
- XFREE (name);
- XFREE (value);
- lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
- }
-
- new_value = lt_extend_str (getenv (name), value, 1);
- lt_setenv (name, new_value);
- XFREE (new_value);
- XFREE (name);
- XFREE (value);
-}
-
-void
-lt_update_exe_path (const char *name, const char *value)
-{
- LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
- (name ? name : "<NULL>"),
- (value ? value : "<NULL>")));
-
- 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)
-{
- LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
- (name ? name : "<NULL>"),
- (value ? value : "<NULL>")));
-
- if (name && *name && value && *value)
- {
- char *new_value = lt_extend_str (getenv (name), value, 0);
- lt_setenv (name, new_value);
- XFREE (new_value);
- }
-}
-
-
-EOF
-}
-# end: func_emit_cwrapperexe_src
-
-# 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
- 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
- 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
- dlfiles="$dlfiles $arg"
- else
- dlprefiles="$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 "*) ;;
- *) deplibs="$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
-# moreargs="$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
- dlfiles="$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.
- dlprefiles="$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 "*) ;;
- *) rpath="$rpath $arg" ;;
- esac
- else
- case "$xrpath " in
- *" $arg "*) ;;
- *) xrpath="$xrpath $arg" ;;
- esac
- fi
- prev=
- continue
- ;;
- shrext)
- shrext_cmds="$arg"
- prev=
- continue
- ;;
- weak)
- weak_libs="$weak_libs $arg"
- prev=
- continue
- ;;
- xcclinker)
- linker_flags="$linker_flags $qarg"
- compiler_flags="$compiler_flags $qarg"
- prev=
- func_append compile_command " $qarg"
- func_append finalize_command " $qarg"
- continue
- ;;
- xcompiler)
- compiler_flags="$compiler_flags $qarg"
- prev=
- func_append compile_command " $qarg"
- func_append finalize_command " $qarg"
- continue
- ;;
- xlinker)
- linker_flags="$linker_flags $qarg"
- compiler_flags="$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
- ;;
-
- -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"
- dir=$func_stripname_result
- if test -z "$dir"; 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
- # 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 "*) ;;
- *)
- deplibs="$deplibs -L$dir"
- lib_search_path="$lib_search_path $dir"
- ;;
- esac
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
- testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
- case :$dllsearchpath: in
- *":$dir:"*) ;;
- ::) dllsearchpath=$dir;;
- *) dllsearchpath="$dllsearchpath:$dir";;
- esac
- case :$dllsearchpath: in
- *":$testbindir:"*) ;;
- ::) dllsearchpath=$testbindir;;
- *) dllsearchpath="$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*)
- # 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
- deplibs="$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
- deplibs="$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)
- compiler_flags="$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)
- compiler_flags="$compiler_flags $arg"
- func_append compile_command " $arg"
- func_append finalize_command " $arg"
- case "$new_inherited_linker_flags " in
- *" $arg "*) ;;
- * ) new_inherited_linker_flags="$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_fatal_error "only absolute run-paths are allowed"
- ;;
- esac
- case "$xrpath " in
- *" $dir "*) ;;
- *) xrpath="$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"
- arg="$arg $wl$func_quote_for_eval_result"
- compiler_flags="$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"
- arg="$arg $wl$func_quote_for_eval_result"
- compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
- linker_flags="$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"
- ;;
-
- # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
- # -r[0-9][0-9]* specifies the processor on the SGI compiler
- # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
- # +DA*, +DD* enable 64-bit mode on the HP compiler
- # -q* pass through compiler args for the IBM compiler
- # -m*, -t[45]*, -txscale* pass through architecture-specific
- # compiler args for GCC
- # -F/path gives path to uninstalled frameworks, gcc on darwin
- # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
- # @file GCC response files
- -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
- -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
- func_quote_for_eval "$arg"
- arg="$func_quote_for_eval_result"
- func_append compile_command " $arg"
- func_append finalize_command " $arg"
- compiler_flags="$compiler_flags $arg"
- continue
- ;;
-
- # Some other compiler flag.
- -* | +*)
- func_quote_for_eval "$arg"
- arg="$func_quote_for_eval_result"
- ;;
-
- *.$objext)
- # A standard object.
- objs="$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
- dlfiles="$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.
- dlprefiles="$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.
- deplibs="$deplibs $arg"
- old_deplibs="$old_deplibs $arg"
- continue
- ;;
-
- *.la)
- # A libtool-controlled library.
-
- if test "$prev" = dlfiles; then
- # This library was specified with -dlopen.
- dlfiles="$dlfiles $arg"
- prev=
- elif test "$prev" = dlprefiles; then
- # The library was specified with -dlpreopen.
- dlprefiles="$dlprefiles $arg"
- prev=
- else
- deplibs="$deplibs $arg"
- 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 \"X\${$shlibpath_var}\" \| \$Xsed -e \'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"
- # 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_duplicate_deps ; then
- case "$libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- fi
- libs="$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 "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
- esac
- pre_post_deps="$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=
- case $lib in
- *.la) func_source "$lib" ;;
- esac
-
- # Collect preopened libtool deplibs, except any this library
- # has declared as weak libs
- for deplib in $dependency_libs; do
- deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
- case " $weak_libs " in
- *" $deplib_base "*) ;;
- *) deplibs="$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
- compiler_flags="$compiler_flags $deplib"
- if test "$linkmode" = lib ; then
- case "$new_inherited_linker_flags " in
- *" $deplib "*) ;;
- * ) new_inherited_linker_flags="$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 "*) ;;
- * ) new_inherited_linker_flags="$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"
- newlib_search_path="$newlib_search_path $func_stripname_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"
- newlib_search_path="$newlib_search_path $func_stripname_result"
- ;;
- *)
- func_warning "\`-L' is ignored for archives/objects"
- ;;
- esac # linkmode
- continue
- ;; # -L
- -R*)
- if test "$pass" = link; then
- func_stripname '-R' '' "$deplib"
- dir=$func_stripname_result
- # Make sure the xrpath contains only unique directories.
- case "$xrpath " in
- *" $dir "*) ;;
- *) xrpath="$xrpath $dir" ;;
- esac
- fi
- deplibs="$deplib $deplibs"
- continue
- ;;
- *.la) lib="$deplib" ;;
- *.$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 \"X$deplib\"" 2>/dev/null | $Xsed -e 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.
- newdlprefiles="$newdlprefiles $deplib"
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- else
- newdlfiles="$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 "X$inherited_linker_flags" | $Xsed -e '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 "*) ;;
- *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
- esac
- done
- fi
- dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e '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" && dlfiles="$dlfiles $dlopen"
- test -n "$dlpreopen" && dlprefiles="$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.
- convenience="$convenience $ladir/$objdir/$old_library"
- old_convenience="$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_duplicate_deps ; then
- case "$tmp_libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- fi
- tmp_libs="$tmp_libs $deplib"
- done
- continue
- fi # $pass = conv
-
-
- # Get the name of the library we link against.
- linklib=
- for l in $old_library $library_names; do
- linklib="$l"
- done
- 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.
- dlprefiles="$dlprefiles $lib $dependency_libs"
- else
- newdlfiles="$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 "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
- func_warning "library \`$lib' was moved."
- dir="$ladir"
- absdir="$abs_ladir"
- libdir="$abs_ladir"
- else
- dir="$libdir"
- absdir="$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
- notinst_path="$notinst_path $abs_ladir"
- else
- dir="$ladir/$objdir"
- absdir="$abs_ladir/$objdir"
- # Remove this search path later
- notinst_path="$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
- # Prefer using a static library (so that no silly _DYNAMIC symbols
- # are required to link).
- if test -n "$old_library"; then
- newdlprefiles="$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" && \
- dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
- # Otherwise, use the dlname, so that lt_dlopen finds it.
- elif test -n "$dlname"; then
- newdlprefiles="$newdlprefiles $dir/$dlname"
- else
- newdlprefiles="$newdlprefiles $dir/$linklib"
- fi
- 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
- newlib_search_path="$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"
- newlib_search_path="$newlib_search_path $func_stripname_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_duplicate_deps ; then
- case "$tmp_libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- fi
- tmp_libs="$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:"*) ;;
- *) temp_rpath="$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 "*) ;;
- *) compile_rpath="$compile_rpath $absdir"
- esac
- ;;
- esac
- case " $sys_lib_dlsearch_path " in
- *" $libdir "*) ;;
- *)
- case "$finalize_rpath " in
- *" $libdir "*) ;;
- *) finalize_rpath="$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
- notinst_deplibs="$notinst_deplibs $lib"
- need_relink=no
- ;;
- *)
- if test "$installed" = no; then
- notinst_deplibs="$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 "*) ;;
- *) compile_rpath="$compile_rpath $absdir"
- esac
- ;;
- esac
- case " $sys_lib_dlsearch_path " in
- *" $libdir "*) ;;
- *)
- case "$finalize_rpath " in
- *" $libdir "*) ;;
- *) finalize_rpath="$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 "$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
- [\\/]*)
- add_dir="$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:"*) ;;
- *) compile_shlibpath="$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:"*) ;;
- *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
- esac
- fi
- fi
- fi
-
- if test "$linkmode" = prog || test "$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:"*) ;;
- *) finalize_shlibpath="$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
- [\\/]*)
- add_dir="$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 "*) ;;
- *) xrpath="$xrpath $temp_xrpath";;
- esac;;
- *) temp_deplibs="$temp_deplibs $libdir";;
- esac
- done
- dependency_libs="$temp_deplibs"
- fi
-
- newlib_search_path="$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"
- if $opt_duplicate_deps ; then
- case "$tmp_libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- fi
- tmp_libs="$tmp_libs $deplib"
- done
-
- if test "$link_all_deplibs" != no; then
- # Add the search paths of all dependency libraries
- for deplib in $dependency_libs; do
- case $deplib in
- -L*) path="$deplib" ;;
- *.la)
- 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
- compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
- linker_flags="$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 "X $new_inherited_linker_flags" | $Xsed -e '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 "*) ;;
- *) lib_search_path="$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 "*) ;;
- *) tmp_libs="$tmp_libs $deplib" ;;
- esac
- ;;
- *) tmp_libs="$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
- tmp_libs="$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"
- objs="$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!"
- libobjs="$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|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.
- verstring="$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"
- libobjs="$libobjs $symfileobj"
- test "X$libobjs" = "X " && libobjs=
-
- if test "$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
- removelist="$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
- oldlibs="$oldlibs $output_objdir/$libname.$libext"
-
- # Transform .lo files to .o files.
- oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
- fi
-
- # Eliminate all temporary directories.
- #for path in $notinst_path; do
- # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
- # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
- # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "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
- temp_xrpath="$temp_xrpath -R$libdir"
- case "$finalize_rpath " in
- *" $libdir "*) ;;
- *) finalize_rpath="$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 "*) ;;
- *) dlfiles="$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 "*) ;;
- *) dlprefiles="$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*)
- # these systems don't actually have a c library (as such)!
- ;;
- *-*-rhapsody* | *-*-darwin1.[012])
- # Rhapsody C library is in the System framework
- deplibs="$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
- deplibs="$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 "*)
- newdeplibs="$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
- newdeplibs="$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
- ;;
- *)
- newdeplibs="$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 "*)
- newdeplibs="$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
- newdeplibs="$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
- ;;
- *)
- newdeplibs="$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 "*)
- newdeplibs="$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
- # 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 "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
- esac
- done
- if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
- $SED -e 10q |
- $EGREP "$file_magic_regex" > /dev/null; then
- newdeplibs="$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.
- newdeplibs="$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 "*)
- newdeplibs="$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 \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
- $EGREP "$match_pattern_regex" > /dev/null; then
- newdeplibs="$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.
- newdeplibs="$newdeplibs $a_deplib"
- ;;
- esac
- done # Gone through all deplibs.
- ;;
- none | unknown | *)
- newdeplibs=""
- tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
- -e 's/ -lc$//' -e '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 "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
- done
- fi
- if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' |
- $GREP . >/dev/null; then
- $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
- fi
- ;;
- 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 "X $newdeplibs" | $Xsed -e '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 "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
- new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
- deplibs=`$ECHO "X $deplibs" | $Xsed -e '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 "*)
- new_libs="$new_libs -L$path/$objdir" ;;
- esac
- ;;
- esac
- done
- for deplib in $deplibs; do
- case $deplib in
- -L*)
- case " $new_libs " in
- *" $deplib "*) ;;
- *) new_libs="$new_libs $deplib" ;;
- esac
- ;;
- *) new_libs="$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 "$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
- 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"*)
- ;;
- *)
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- ;;
- esac
- fi
- else
- eval flag=\"$hardcode_libdir_flag_spec\"
- dep_rpath="$dep_rpath $flag"
- fi
- elif test -n "$runpath_var"; then
- case "$perm_rpath " in
- *" $libdir "*) ;;
- *) perm_rpath="$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
- rpath="$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 "$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
- linknames="$linknames $link"
- done
-
- # Use standard objects if they are pic
- test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$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"
- delfiles="$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 cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- func_len " $cmd"
- len=$func_len_result
- if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
- func_show_eval "$cmd" 'exit $?'
- 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 "X$include_expsyms" | $Xsed | $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
- delfiles="$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 "*) ;;
- *)
- tmp_deplibs="$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"
- generated="$generated $gentop"
-
- func_extract_archives $gentop $convenience
- libobjs="$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\"
- linker_flags="$linker_flags $flag"
- fi
-
- # Make a backup of the uninstalled library when relinking
- if test "$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
- output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
-
- # 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
- $ECHO "$obj" >> $output
- done
- $ECHO ')' >> $output
- delfiles="$delfiles $output"
- 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
- $ECHO "$obj" >> $output
- done
- delfiles="$delfiles $output"
- output=$firstobj\"$file_list_spec$output\"
- 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.
- eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
- else
- # All subsequent reloadable object files will link in
- # the last one created.
- eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$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~
- eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
- if test -n "$last_robj"; then
- eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
- fi
- delfiles="$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 "$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 "X$include_expsyms" | $Xsed | $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
- delfiles="$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"
- generated="$generated $gentop"
-
- func_extract_archives $gentop $dlprefiles
- libobjs="$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 "$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 "$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 "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
- else
- gentop="$output_objdir/${obj}x"
- generated="$generated $gentop"
-
- func_extract_archives $gentop $convenience
- reload_conv_objs="$reload_objs $func_extract_archives_result"
- fi
- fi
-
- # Create the old-style object.
- reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$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 "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
- finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e '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])
- compile_command="$compile_command ${wl}-bind_at_load"
- finalize_command="$finalize_command ${wl}-bind_at_load"
- ;;
- esac
- fi
- # Time to change all our "foo.ltframework" stuff back to "-framework foo"
- compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
- finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e '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 "*)
- new_libs="$new_libs -L$path/$objdir" ;;
- esac
- ;;
- esac
- done
- for deplib in $compile_deplibs; do
- case $deplib in
- -L*)
- case " $new_libs " in
- *" $deplib "*) ;;
- *) new_libs="$new_libs $deplib" ;;
- esac
- ;;
- *) new_libs="$new_libs $deplib" ;;
- esac
- done
- compile_deplibs="$new_libs"
-
-
- compile_command="$compile_command $compile_deplibs"
- finalize_command="$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 "*) ;;
- *) finalize_rpath="$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"*)
- ;;
- *)
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- ;;
- esac
- fi
- else
- eval flag=\"$hardcode_libdir_flag_spec\"
- rpath="$rpath $flag"
- fi
- elif test -n "$runpath_var"; then
- case "$perm_rpath " in
- *" $libdir "*) ;;
- *) perm_rpath="$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;;
- *) dllsearchpath="$dllsearchpath:$libdir";;
- esac
- case :$dllsearchpath: in
- *":$testbindir:"*) ;;
- ::) dllsearchpath=$testbindir;;
- *) dllsearchpath="$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"*)
- ;;
- *)
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- ;;
- esac
- fi
- else
- eval flag=\"$hardcode_libdir_flag_spec\"
- rpath="$rpath $flag"
- fi
- elif test -n "$runpath_var"; then
- case "$finalize_perm_rpath " in
- *" $libdir "*) ;;
- *) finalize_perm_rpath="$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 "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
- finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$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
- *cygwin* | *mingw* )
- if test "$build_libtool_libs" != yes; then
- wrappers_required=no
- fi
- ;;
- *cegcc)
- # Disable wrappers for cegcc, we are cross compiling anyway.
- wrappers_required=no
- ;;
- *)
- 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 "X$compile_command" | $Xsed -e '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=$?'
-
- # 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
- rpath="$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
- rpath="$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 "X$link_command" | $Xsed -e '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 $?'
- 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 "X$compile_var$compile_command$compile_rpath" | $Xsed -e '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 "X$link_command" | $Xsed -e '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 $?'
-
- # 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 "X$relink_command" | $Xsed -e "$sed_quote_subst"`
- fi
-
- # Quote $ECHO for shipping.
- if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
- case $progpath in
- [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
- *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
- esac
- qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
- else
- qecho=`$ECHO "X$ECHO" | $Xsed -e "$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
- oldobjs="$oldobjs $symfileobj"
- fi
- fi
- addlibs="$old_convenience"
- fi
-
- if test -n "$addlibs"; then
- gentop="$output_objdir/${outputname}x"
- generated="$generated $gentop"
-
- func_extract_archives $gentop $addlibs
- oldobjs="$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"
- generated="$generated $gentop"
-
- func_extract_archives $gentop $dlprefiles
- oldobjs="$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"
- generated="$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"
- oldobjs="$oldobjs $gentop/$newobj"
- ;;
- *) oldobjs="$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
- 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 "X$relink_command" | $Xsed -e "$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"
- newdependency_libs="$newdependency_libs $libdir/$name"
- ;;
- *) newdependency_libs="$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"
- newdlfiles="$newdlfiles $libdir/$name"
- ;;
- *) newdlfiles="$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"
- newdlprefiles="$newdlprefiles $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
- newdlfiles="$newdlfiles $abs"
- done
- dlfiles="$newdlfiles"
- newdlprefiles=
- for lib in $dlprefiles; do
- case $lib in
- [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
- *) abs=`pwd`"/$lib" ;;
- esac
- newdlprefiles="$newdlprefiles $abs"
- done
- dlprefiles="$newdlprefiles"
- fi
- $RM $output
- # place dlname in correct position for cygwin
- tdlname=$dlname
- case $host,$output,$installed,$module,$dlname in
- *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
- 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 "$mode" = link || test "$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) RM="$RM $arg"; rmforce=yes ;;
- -*) RM="$RM $arg" ;;
- *) files="$files $arg" ;;
- esac
- done
-
- test -z "$RM" && \
- func_fatal_help "you must specify an RM program"
-
- rmdirs=
-
- origobjdir="$objdir"
- for file in $files; do
- func_dirname "$file" "" "."
- dir="$func_dirname_result"
- if test "X$dir" = X.; then
- objdir="$origobjdir"
- else
- objdir="$dir/$origobjdir"
- fi
- func_basename "$file"
- name="$func_basename_result"
- test "$mode" = uninstall && objdir="$dir"
-
- # Remember objdir for removal later, being careful to avoid duplicates
- if test "$mode" = clean; then
- case " $rmdirs " in
- *" $objdir "*) ;;
- *) rmdirs="$rmdirs $objdir" ;;
- 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
- rmfiles="$rmfiles $objdir/$n"
- done
- test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
-
- case "$mode" in
- clean)
- case " $library_names " in
- # " " in the beginning catches empty $dlname
- *" $dlname "*) ;;
- *) rmfiles="$rmfiles $objdir/$dlname" ;;
- esac
- test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${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
- rmfiles="$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
- rmfiles="$rmfiles $dir/$non_pic_object"
- fi
- fi
- ;;
-
- *)
- if test "$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
- rmfiles="$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
- rmfiles="$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
- rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
- if test "$fast_install" = yes && test -n "$relink_command"; then
- rmfiles="$rmfiles $objdir/lt-$name"
- fi
- if test "X$noexename" != "X$name" ; then
- rmfiles="$rmfiles $objdir/lt-${noexename}.c"
- fi
- fi
- fi
- ;;
- esac
- func_show_eval "$RM $rmfiles" 'exit_status=1'
- done
- objdir="$origobjdir"
-
- # 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 "$mode" = uninstall || test "$mode" = clean; } &&
- func_mode_uninstall ${1+"$@"}
-
-test -z "$mode" && {
- help="$generic_help"
- func_fatal_help "you must specify a MODE"
-}
-
-test -z "$exec_cmd" && \
- func_fatal_help "invalid operation mode \`$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
deleted file mode 100755
index 28055d2..0000000
--- a/admin/missing
+++ /dev/null
@@ -1,376 +0,0 @@
-#! /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/amber/Makefile.am b/amber/Makefile.am
deleted file mode 100644
index 46d9033..0000000
--- a/amber/Makefile.am
+++ /dev/null
@@ -1,125 +0,0 @@
-## 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 = Makefile.in
-
-endif
-
-AM_CFLAGS = -DESO_CPL_PIPELINE_VARIANT
-
-
-#SFFTW_INCLUDES = -I$(top_srcdir)/fftw/fftw
-#SFFTW_LDFLAGS = -L$(top_srcdir)/fftw/fftw
-#LIBSFFTW = $(top_builddir)/fftw/fftw/libsfftw.la
-
-#RFFTW_INCLUDES = -I$(top_srcdir)/fftw/rfftw
-#RFFTW_LDFLAGS = -L$(top_srcdir)/fftw/rfftw
-#LIBRFFTW = $(top_builddir)/fftw/rfftw/libsrfftw.la
-
-#LIBFFTW3=/home/agabasch/cpl/lib/libfftw3.la
-
-AM_CPPFLAGS = -DCX_LOG_DOMAIN=\"AmberLib\" $(CFITSIO_INCLUDES) $(FFTW_INCLUDES) $(all_includes)
-
-pkginclude_HEADERS = amberSupport.h \
- amber_dfs.h \
- amber_qc.h \
- amdlib.h \
- amdlibProtected.h \
- amdlibYorick.h \
- amdms.h \
- amdmsFit.h \
- amdmsFits.h \
- amdrs.h \
- esolibCalibVis.h \
- esolibSelector.h \
- esolibTransferfunction.h \
- esolibamdlibOi.h \
- gipaf.h \
- amdlibVersion.h \
- giqclog.h
-
-noinst_HEADERS =
-
-privatelib_LTLIBRARIES = libamber.la
-
-libamber_la_SOURCES = amberSupport.c \
- amber_dfs.c \
- amber_qc.c \
- amdlibArrayGeometry.c \
- amdlibBadPixels.c \
- amdlibClosurePhases.c \
- amdlibDark.c \
- amdlibDate.c \
- amdlibEsoUtils.c \
- amdlibFlatField.c \
- amdlibFrameSelection.c \
- amdlibImagingData.c \
- amdlibImagingDetector.c \
- amdlibInsCfg.c \
- amdlibLog.c \
- amdlibMatrix.c \
- amdlibMisc.c \
- amdlibMultiDimArray.c \
- amdlibOi.c \
- amdlibOiStructures.c \
- amdlibP2vm.c \
- amdlibP2vmData.c \
- amdlibPiston.c \
- amdlibRawData.c \
- amdlibRefSpectrum.c \
- amdlibRegion.c \
- amdlibScienceData.c \
- amdlibShift.c \
- amdlibSpectralCalibration.c \
- amdlibSpectralCalibrationData.c \
- amdlibSpectrum.c \
- amdlibString.c \
- amdlibUtils.c \
- amdlibVisibilities.c \
- amdlibWaveData.c \
- amdlibYorick.c \
- amdmsAlgo.c \
- amdmsBadPixels.c \
- amdmsCalibration.c \
- amdmsCommon.c \
- amdmsFit.c \
- amdmsFits.c \
- amdmsFitsCube.c \
- amdmsFitsData.c \
- amdmsFitsKeyword.c \
- amdmsFitsTable.c \
- amdmsPixelStatistics.c \
- amdmsProperties.c \
- esolibCalibVis.c \
- esolibSelector.c \
- esolibTransferfunction.c \
- esolibamdlibOi.c \
- gipaf.c \
- giqclog.c
-
-libamber_la_LDFLAGS = $(CPL_LDFLAGS) $(CFITSIO_LDFLAGS) $(FFTW_LDFLAGS) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
-libamber_la_LIBADD = $(LIBCPLDFS) $(LIBCPLUI) $(LIBCPLCORE) $(LIBCEXT) $(LIBCFITSIO) $(LIBFFTW)
-libamber_la_DEPENDENCIES =
diff --git a/amber/Makefile.in b/amber/Makefile.in
deleted file mode 100644
index 0213da2..0000000
--- a/amber/Makefile.in
+++ /dev/null
@@ -1,764 +0,0 @@
-# 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 = amber
-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/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/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_libamber_la_OBJECTS = amberSupport.lo amber_dfs.lo amber_qc.lo \
- amdlibArrayGeometry.lo amdlibBadPixels.lo \
- amdlibClosurePhases.lo amdlibDark.lo amdlibDate.lo \
- amdlibEsoUtils.lo amdlibFlatField.lo amdlibFrameSelection.lo \
- amdlibImagingData.lo amdlibImagingDetector.lo amdlibInsCfg.lo \
- amdlibLog.lo amdlibMatrix.lo amdlibMisc.lo \
- amdlibMultiDimArray.lo amdlibOi.lo amdlibOiStructures.lo \
- amdlibP2vm.lo amdlibP2vmData.lo amdlibPiston.lo \
- amdlibRawData.lo amdlibRefSpectrum.lo amdlibRegion.lo \
- amdlibScienceData.lo amdlibShift.lo \
- amdlibSpectralCalibration.lo amdlibSpectralCalibrationData.lo \
- amdlibSpectrum.lo amdlibString.lo amdlibUtils.lo \
- amdlibVisibilities.lo amdlibWaveData.lo amdlibYorick.lo \
- amdmsAlgo.lo amdmsBadPixels.lo amdmsCalibration.lo \
- amdmsCommon.lo amdmsFit.lo amdmsFits.lo amdmsFitsCube.lo \
- amdmsFitsData.lo amdmsFitsKeyword.lo amdmsFitsTable.lo \
- amdmsPixelStatistics.lo amdmsProperties.lo esolibCalibVis.lo \
- esolibSelector.lo esolibTransferfunction.lo esolibamdlibOi.lo \
- gipaf.lo giqclog.lo
-libamber_la_OBJECTS = $(am_libamber_la_OBJECTS)
-libamber_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(libamber_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 = $(libamber_la_SOURCES)
-DIST_SOURCES = $(libamber_la_SOURCES)
-HEADERS = $(noinst_HEADERS) $(pkginclude_HEADERS)
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMBER_BINARY_AGE = @AMBER_BINARY_AGE@
-AMBER_BINARY_VERSION = @AMBER_BINARY_VERSION@
-AMBER_INCLUDES = @AMBER_INCLUDES@
-AMBER_INTERFACE_AGE = @AMBER_INTERFACE_AGE@
-AMBER_LDFLAGS = @AMBER_LDFLAGS@
-AMBER_MAJOR_VERSION = @AMBER_MAJOR_VERSION@
-AMBER_MICRO_VERSION = @AMBER_MICRO_VERSION@
-AMBER_MINOR_VERSION = @AMBER_MINOR_VERSION@
-AMBER_VERSION = @AMBER_VERSION@
-AMTAR = @AMTAR@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFITSIO_INCLUDES = @CFITSIO_INCLUDES@
-CFITSIO_LDFLAGS = @CFITSIO_LDFLAGS@
-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@
-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@
-FFTWF_INCLUDES = @FFTWF_INCLUDES@
-FFTWF_LDFLAGS = @FFTWF_LDFLAGS@
-FFTW_INCLUDES = @FFTW_INCLUDES@
-FFTW_LDFLAGS = @FFTW_LDFLAGS@
-FGREP = @FGREP@
-GREP = @GREP@
-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@
-LIBAMBER = @LIBAMBER@
-LIBCEXT = @LIBCEXT@
-LIBCFITSIO = @LIBCFITSIO@
-LIBCPLCORE = @LIBCPLCORE@
-LIBCPLDFS = @LIBCPLDFS@
-LIBCPLDRS = @LIBCPLDRS@
-LIBCPLUI = @LIBCPLUI@
-LIBFFTW = @LIBFFTW@
-LIBFFTWF = @LIBFFTWF@
-LIBOBJS = @LIBOBJS@
-LIBPTHREAD = @LIBPTHREAD@
-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@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PRODUCT_DID = @PRODUCT_DID@
-PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
-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_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@
-lt_ECHO = @lt_ECHO@
-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@
-scriptsdir = @scriptsdir@
-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@
-AUTOMAKE_OPTIONS = 1.8 foreign
-DISTCLEANFILES = *~
- at MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = Makefile.in
-AM_CFLAGS = -DESO_CPL_PIPELINE_VARIANT
-
-#SFFTW_INCLUDES = -I$(top_srcdir)/fftw/fftw
-#SFFTW_LDFLAGS = -L$(top_srcdir)/fftw/fftw
-#LIBSFFTW = $(top_builddir)/fftw/fftw/libsfftw.la
-
-#RFFTW_INCLUDES = -I$(top_srcdir)/fftw/rfftw
-#RFFTW_LDFLAGS = -L$(top_srcdir)/fftw/rfftw
-#LIBRFFTW = $(top_builddir)/fftw/rfftw/libsrfftw.la
-
-#LIBFFTW3=/home/agabasch/cpl/lib/libfftw3.la
-AM_CPPFLAGS = -DCX_LOG_DOMAIN=\"AmberLib\" $(CFITSIO_INCLUDES) $(FFTW_INCLUDES) $(all_includes)
-pkginclude_HEADERS = amberSupport.h \
- amber_dfs.h \
- amber_qc.h \
- amdlib.h \
- amdlibProtected.h \
- amdlibYorick.h \
- amdms.h \
- amdmsFit.h \
- amdmsFits.h \
- amdrs.h \
- esolibCalibVis.h \
- esolibSelector.h \
- esolibTransferfunction.h \
- esolibamdlibOi.h \
- gipaf.h \
- amdlibVersion.h \
- giqclog.h
-
-noinst_HEADERS =
-privatelib_LTLIBRARIES = libamber.la
-libamber_la_SOURCES = amberSupport.c \
- amber_dfs.c \
- amber_qc.c \
- amdlibArrayGeometry.c \
- amdlibBadPixels.c \
- amdlibClosurePhases.c \
- amdlibDark.c \
- amdlibDate.c \
- amdlibEsoUtils.c \
- amdlibFlatField.c \
- amdlibFrameSelection.c \
- amdlibImagingData.c \
- amdlibImagingDetector.c \
- amdlibInsCfg.c \
- amdlibLog.c \
- amdlibMatrix.c \
- amdlibMisc.c \
- amdlibMultiDimArray.c \
- amdlibOi.c \
- amdlibOiStructures.c \
- amdlibP2vm.c \
- amdlibP2vmData.c \
- amdlibPiston.c \
- amdlibRawData.c \
- amdlibRefSpectrum.c \
- amdlibRegion.c \
- amdlibScienceData.c \
- amdlibShift.c \
- amdlibSpectralCalibration.c \
- amdlibSpectralCalibrationData.c \
- amdlibSpectrum.c \
- amdlibString.c \
- amdlibUtils.c \
- amdlibVisibilities.c \
- amdlibWaveData.c \
- amdlibYorick.c \
- amdmsAlgo.c \
- amdmsBadPixels.c \
- amdmsCalibration.c \
- amdmsCommon.c \
- amdmsFit.c \
- amdmsFits.c \
- amdmsFitsCube.c \
- amdmsFitsData.c \
- amdmsFitsKeyword.c \
- amdmsFitsTable.c \
- amdmsPixelStatistics.c \
- amdmsProperties.c \
- esolibCalibVis.c \
- esolibSelector.c \
- esolibTransferfunction.c \
- esolibamdlibOi.c \
- gipaf.c \
- giqclog.c
-
-libamber_la_LDFLAGS = $(CPL_LDFLAGS) $(CFITSIO_LDFLAGS) $(FFTW_LDFLAGS) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
-libamber_la_LIBADD = $(LIBCPLDFS) $(LIBCPLUI) $(LIBCPLCORE) $(LIBCEXT) $(LIBCFITSIO) $(LIBFFTW)
-libamber_la_DEPENDENCIES =
-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 amber/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign amber/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
-libamber.la: $(libamber_la_OBJECTS) $(libamber_la_DEPENDENCIES)
- $(libamber_la_LINK) -rpath $(privatelibdir) $(libamber_la_OBJECTS) $(libamber_la_LIBADD) $(LIBS)
-
-mostlyclean-compile:
- -rm -f *.$(OBJEXT)
-
-distclean-compile:
- -rm -f *.tab.c
-
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amberSupport.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amber_dfs.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amber_qc.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibArrayGeometry.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibBadPixels.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibClosurePhases.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibDark.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibDate.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibEsoUtils.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibFlatField.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibFrameSelection.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibImagingData.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibImagingDetector.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibInsCfg.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibLog.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibMatrix.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibMisc.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibMultiDimArray.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibOi.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibOiStructures.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibP2vm.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibP2vmData.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibPiston.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibRawData.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibRefSpectrum.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibRegion.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibScienceData.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibShift.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibSpectralCalibration.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibSpectralCalibrationData.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibSpectrum.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibString.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibUtils.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibVisibilities.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibWaveData.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdlibYorick.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdmsAlgo.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdmsBadPixels.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdmsCalibration.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdmsCommon.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdmsFit.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdmsFits.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdmsFitsCube.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdmsFitsData.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdmsFitsKeyword.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdmsFitsTable.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdmsPixelStatistics.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amdmsProperties.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/esolibCalibVis.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/esolibSelector.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/esolibTransferfunction.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/esolibamdlibOi.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gipaf.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/giqclog.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/amber/amberSupport.c b/amber/amberSupport.c
deleted file mode 100644
index f6e75d2..0000000
--- a/amber/amberSupport.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************/
-/* VLTI AMBER DATA REDUCTION SOFTWARE (AMDRS) */
-/* */
-/* FILE: amberSupport.c */
-/* */
-/* Contains additional support routines */
-/* */
-/* (tlicha 15-01-03) initial version */
-/* */
-/*******************************************************************/
-
-#include "amdrs.h"
-#include <math.h>
-#include <stdio.h>
-
-/* -------------------------------------------------------------- */
-/* | | */
-/* | FITS IO based functions | */
-/* | not needed anymore | */
-/* -------------------------------------------------------------- */
-int CreateRawDataDisplay( char * szInfile, char * szOutfile )
-{
- int iStatus = 1;
-
- /* ---------
- 0 = OK
- 1 = not a FITS file
- 2 = Ext 2 or 3 not present
- 3 = Wrong number of Regions in Extension 2
- 4 = No new FITS Header available
- 5 = Cannot create outfile
-
- 11 = no memory for buffer
- 12 = cannot open table with IMAGING_DATA
-
- 20 = amdlib error
- ----------- */
-
- return iStatus;
-}
-
-/*
- Copies the Raw Data Subwindows (Channels) to the new FITS Image
-*/
-int CreateFitsImage( char * szInfile, char * szOutFile, int iTelescopes, int iXSubWindow, int iYSubWindow )
-{
- int iStatus = 2;
-
- /* Not needed anymore */
-
- /* ---------
- 0 = OK
- 1 = no memory for buffer
- 2 = cannot open table
- ----------- */
- return iStatus;
-}
-
-/* -------------------------------------------------------------- */
-/* | | */
-/* | ADDITIONAL SUPPORT ROUTINES | */
-/* | | */
-/* -------------------------------------------------------------- */
diff --git a/amber/amberSupport.h b/amber/amberSupport.h
deleted file mode 100644
index 728cea6..0000000
--- a/amber/amberSupport.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************/
-/* VLTI AMBER DATA REDUCTION SOFTWARE (AMDRS) */
-/* */
-/* FILE: amberSupport.h */
-/* */
-/* Contains definitions of constant parameters, types and */
-/* prototypes for all ANSI C functions. */
-/* */
-/* (tlicha 16-01-03) Initial Version */
-/* handling routines */
-/*******************************************************************/
-
-
-
-
-
-/* --------------------------------------------------------------- */
-/* COMPILER DIRECTIVES */
-/* --------------------------------------------------------------- */
-#ifndef _AMBERSUPPORT_H
-#define _AMBERSUPPORT_H
-
-#define ESO_CPL_PIPELINE_VARIANT 1 /* forces amdlib to compile the ESO way */
-#define TRACE 1 /* switch on amdlib tracing */
-#define DEBUG 1 /* switch on amdlib debugging */
-
-/* --------------------------------------------------------------- */
-/* Support Functions for PipeLine */
-/* --------------------------------------------------------------- */
-int CreateRawDataDisplay( char * szInfile, char * szOutfile );
-int CreateFitsImage ( char * szInfile, char * szOutFile, int iTelescopes, int iXSubWindow, int iYSubWindow );
-
-#endif
diff --git a/amber/amber_dfs.c b/amber/amber_dfs.c
deleted file mode 100644
index c902295..0000000
--- a/amber/amber_dfs.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * amber_dfs.c
- *
- * Created on: Oct 13, 2009
- * Author: agabasch
- */
-#include "amber_dfs.h"
-cpl_error_code amber_dfs_set_groups(cpl_frameset * set)
-{
- cpl_errorstate prestate = cpl_errorstate_get();
- cpl_frame * frame = NULL;
- int i = 0;
-
-
- /* Loop on frames */
- for (frame = cpl_frameset_get_first(set); frame != NULL;
- frame = cpl_frameset_get_next(set), i++) {
-
- const char * tag = cpl_frame_get_tag(frame);
-
- if (tag == NULL) {
- cpl_msg_warning(cpl_func, "Frame %d has no tag", i);
- } else if (!strcmp(tag,"AMBER_2P2V" ) ||
- !strcmp(tag,"AMBER_2WAVE" ) ||
- !strcmp(tag,"AMBER_3P2V" ) ||
- !strcmp(tag,"AMBER_3WAVE" ) ||
- !strcmp(tag,"AMBER_DETECTOR_DARK" ) ||
- !strcmp(tag,"AMBER_DETECTOR_FFM" ) ||
- !strcmp(tag,"AMBER_SKY" ) ||
- !strcmp(tag,"AMBER_CALIB" ) ||
- !strcmp(tag,"AMBER_COHER" ) ||
- !strcmp(tag,"AMBER_BEAMPOS" ) ||
- !strcmp(tag,"AMBER_DARK" ) ||
- !strcmp(tag,"AMBER_COLPOS" ) ||
- !strcmp(tag,"AMBER_DARK_CALIB" ) ||
- !strcmp(tag,"AMBER_DARK_SCIENCE" ) ||
- !strcmp(tag,"AMBER_FLUX" ) ||
- !strcmp(tag,"AMBER_P2VM" ) ||
- !strcmp(tag,"AMBER_SCIENCE" ) ||
- !strcmp(tag,"AMBER_SCIENCE_CALIB" ) ||
- !strcmp(tag,"AMBER_SEARCH" ) ||
- !strcmp(tag,"AMBER_SKY_CALIB" ) ||
- !strcmp(tag,"AMBER_SKY_SCIENCE" ))
- {
- /* RAW frames */
- cpl_frame_set_group(frame, CPL_FRAME_GROUP_RAW );
- } else if (!strcmp(tag, "AMBER_BADPIX" ) ||
- !strcmp(tag, "AMBER_FLATFIELD" ) ||
- !strcmp(tag, "P2VM_REDUCED" ) ||
- !strcmp(tag, "AMBER_BEAMPOS_REDUCED" ) ||
- !strcmp(tag, "CALIB_REDUCED" ) ||
- !strcmp(tag, "CALIB_REDUCED_FILTERED" ) ||
- !strcmp(tag, "SCIENCE_REDUCED" ) ||
- !strcmp(tag, "SCIENCE_REDUCED_FILTERED") ||
- !strcmp(tag, "BADPIX_REDUCED" ) ||
- !strcmp(tag, "FLATFIELD_REDUCED" ) ||
- !strcmp(tag, "AMBER_TRF_J" ) ||
- !strcmp(tag, "AMBER_TRF_H" ) ||
- !strcmp(tag, "AMBER_TRF_K" ) ||
- !strcmp(tag, "AMBER_CALIB_DATABASE_J" ) ||
- !strcmp(tag, "AMBER_CALIB_DATABASE_H" ) ||
- !strcmp(tag, "AMBER_CALIB_DATABASE_K" ) ||
- !strcmp(tag, "CALIB_DATABASE_J" ) ||
- !strcmp(tag, "CALIB_DATABASE_H" ) ||
- !strcmp(tag, "CALIB_DATABASE_K" ) ||
- !strcmp(tag, "SCIENCE_CALIBRATED" ))
- {
- /* CALIB frames */
- cpl_frame_set_group(frame, CPL_FRAME_GROUP_CALIB);
- }
-
-
-
-
-
-
-
- }
-
- if (!cpl_errorstate_is_equal(prestate)) {
- return cpl_error_set_message(cpl_func, cpl_error_get_code(),
- "Could not identify RAW and CALIB "
- "frames");
- }
-
- return CPL_ERROR_NONE;
-}
-
-/**
- * @brief
- * Append the JMMC acknowledgement to a property list.
- *
- * @param self A property list.
- *
- * @return
- * The function returns @c CPL_ERROR_NONE on success or a CPL error
- * code otherwise.
- *
- * The property is appended to the property list @em self.
- */
-cpl_error_code amber_JMMC_acknowledgement(cpl_propertylist * plist){
-
- cpl_errorstate prestate = cpl_errorstate_get();
-
- //cpl_propertylist_append_string(plist, "COMMENT", " -- ");
- cpl_propertylist_append_string(plist, "COMMENT", "If you use the AMBER data reduction software, JMMC asks you to");
- cpl_propertylist_append_string(plist, "COMMENT", "add this sentence in the acknowledgement section of your");
- cpl_propertylist_append_string(plist, "COMMENT", "articles:");
- //cpl_propertylist_append_string(plist, "COMMENT", " -- ");
- cpl_propertylist_append_string(plist, "COMMENT", "This research has made use of the \\texttt{AMBER data");
- cpl_propertylist_append_string(plist, "COMMENT", "reduction package} of the Jean-Marie Mariotti");
- cpl_propertylist_append_string(plist, "COMMENT", "Center\\footnote{Available at http://www.jmmc.fr/amberdrs}.");
- //cpl_propertylist_append_string(plist, "COMMENT", " -- ");
- cpl_propertylist_append_string(plist, "COMMENT", "Furthermore, as user of the AMBER data reduction software, you");
- cpl_propertylist_append_string(plist, "COMMENT", "are kindly requested to cite the two following refereed papers");
- cpl_propertylist_append_string(plist, "COMMENT", "in the data reduction section of your article(s):");
- //cpl_propertylist_append_string(plist, "COMMENT", " -- ");
- cpl_propertylist_append_string(plist, "COMMENT", "Tatulli et al. (2007, available at");
- cpl_propertylist_append_string(plist, "COMMENT", "http://cdsads.u-strasbg.fr/abs/2007A&A...464...29T)");
- cpl_propertylist_append_string(plist, "COMMENT", "and Chelli et al. (2009, available at");
- cpl_propertylist_append_string(plist, "COMMENT", "http://cdsads.u-strasbg.fr/abs/2009A&A...502..705C).");
- //cpl_propertylist_append_string(plist, "COMMENT", " -- ");
-
-
- if (!cpl_errorstate_is_equal(prestate)) {
- return cpl_error_set_message(cpl_func, cpl_error_get_code(),
- "Could not write JMMS acknowledgement ");
- }
- return CPL_ERROR_NONE;
-}
-
diff --git a/amber/amber_dfs.h b/amber/amber_dfs.h
deleted file mode 100644
index b4d4ab9..0000000
--- a/amber/amber_dfs.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * amber_dfs.h
- *
- * Created on: Oct 13, 2009
- * Author: agabasch
- */
-
-#ifndef AMBER_DFS_H_
-#define AMBER_DFS_H_
-
-#include <cpl.h>
-#include <string.h>
-cpl_error_code amber_dfs_set_groups(cpl_frameset *);
-cpl_error_code amber_JMMC_acknowledgement(cpl_propertylist * plist);
-#endif /* AMBER_DFS_H_ */
diff --git a/amber/amber_qc.c b/amber/amber_qc.c
deleted file mode 100644
index 575de22..0000000
--- a/amber/amber_qc.c
+++ /dev/null
@@ -1,588 +0,0 @@
-
-#include "amber_qc.h"
-#include <string.h>
-
-/*
-static int amber_qc_calc(amdlibVIS *imdVis, amdlibVIS2 *imdVis2,
- amdlibVIS3 *imdVis3, cpl_propertylist * qclist, int channel_min,
- int channel_max, const char * base1name, const char * base2name,
- const char * base3name, const char * cpname);
- */
-static int amber_qc_calc_new(amdlibVIS *imdVis, amdlibVIS2 *imdVis2,
- amdlibVIS3 *imdVis3, cpl_propertylist * qclist, int channel_min,
- int channel_max, const char * base1name, const char * base2name,
- const char * base3name, const char * cpname);
-static int amber_qc_calc_snr(amdlibVIS *imdVis, cpl_propertylist * qclist,
- const char * base1name, const char * base2name, const char * base3name);
-static int amber_qc_average_spectrum(amdlibSPECTRUM *spectrum,
- cpl_propertylist * qclist, int channel_min, int channel_max,
- const char * base1name, const char * base2name, const char * base3name);
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Calculates QC parameters on the products
- @param imdWave pointer to the wave structure
- @param imdVis pointer to the visibility structure
- @param imdVis2 pointer to the visibility2 structure
- @param imdVis3 pointer to the closure phase structure
- @param qclist pointer to the propertylist
-
-
- @return QC parameters appended to the property list
-
- */
-/*----------------------------------------------------------------------------*/
-
-int amber_qc(amdlibWAVELENGTH *imdWave, amdlibVIS *imdVis, amdlibVIS2 *imdVis2,
- amdlibVIS3 *imdVis3, amdlibSPECTRUM *spectrum,
- cpl_propertylist * qclist, const char * calib)
-{
-
- int QC_LAMBDA_CHAN=0;
- double QC_LAMBDA_MIN=0.;
- double QC_LAMBDA_MAX=0.;
-
- double QC_LAMBDA_CEN_MIN=0.;
- double QC_LAMBDA_CEN_MAX=0.;
- int QC_LAMBDA_CEN_CHAN=0;
-
- double QC_LAMBDA_BIN1_MIN=0.;
- double QC_LAMBDA_BIN1_MAX=0.;
- int QC_LAMBDA_BIN1_CHAN=0;
-
- double QC_LAMBDA_BIN2_MIN=0.;
- double QC_LAMBDA_BIN2_MAX=0.;
- int QC_LAMBDA_BIN2_CHAN=0;
-
- double QC_LAMBDA_BIN3_MIN=0.;
- double QC_LAMBDA_BIN3_MAX=0.;
- int QC_LAMBDA_BIN3_CHAN=0;
-
- int cen_mean=0;
- int cen_min=0;
- int cen_max=0;
- int bin1_mean=0;
- int bin1_min=0;
- int bin1_max=0;
- int bin2_mean=0;
- int bin2_min=0;
- int bin2_max=0;
- int bin3_mean=0;
- int bin3_min=0;
- int bin3_max=0;
-
- /* Check if at least 1 frame is present */
- if (imdVis->nbFrames<1)
- {
- cpl_msg_warning(cpl_func,"No frame found! Skipping QC calculation");
- return 0;
- }
-
- /* Calculate */
-
- /* The three bins are centered at 1/6, 3/6 and 5/6 of the
- * full wavelength covered by the observation */
-
-
- cen_mean=(int)(imdVis2->nbWlen/2.);
- cen_min =(int)((imdVis2->nbWlen/2.)-(imdVis2->nbWlen*USE_CEN/2.));
- cen_max =(int)((imdVis2->nbWlen/2.)+(imdVis2->nbWlen*USE_CEN/2.));
- if (cen_min<0) cen_min=0;
- if (cen_max>(imdVis2->nbWlen-1)) cen_max=(imdVis2->nbWlen-1);
-
- bin1_mean= (int)(imdVis2->nbWlen*(1./6.));
- bin1_min =(int)((imdVis2->nbWlen*(1./6.))-(imdVis2->nbWlen*USE_BIN1/2.));
- bin1_max =(int)((imdVis2->nbWlen*(1./6.))+(imdVis2->nbWlen*USE_BIN1/2.));
- if (bin1_min<0) bin1_min=0;
- if (bin1_max>(imdVis2->nbWlen-1)) bin1_max=(imdVis2->nbWlen-1);
-
-
- bin2_mean= (int)(imdVis2->nbWlen*(3./6.));
- bin2_min =(int)((imdVis2->nbWlen*(3./6.))-(imdVis2->nbWlen*USE_BIN2/2.));
- bin2_max =(int)((imdVis2->nbWlen*(3./6.))+(imdVis2->nbWlen*USE_BIN2/2.));
- if (bin2_min<0) bin2_min=0;
- if (bin2_max>(imdVis2->nbWlen-1)) bin2_max=(imdVis2->nbWlen-1);
-
-
- bin3_mean= (int)(imdVis2->nbWlen*(5./6.));
- bin3_min =(int)((imdVis2->nbWlen*(5./6.))-(imdVis2->nbWlen*USE_BIN3/2.));
- bin3_max =(int)((imdVis2->nbWlen*(5./6.))+(imdVis2->nbWlen*USE_BIN3/2.));
- if (bin3_min<0) bin3_min=0;
- if (bin3_max>(imdVis2->nbWlen-1)) bin3_max=(imdVis2->nbWlen-1);
-
-
- /* Divide through 1000 to get the result in micron ... */
-
- if(imdWave->wlen[0] > imdWave->wlen[imdWave->nbWlen-1]){
-
- /* lambda in descending order */
- QC_LAMBDA_MIN=imdWave->wlen[imdWave->nbWlen-1]/1000.;
- QC_LAMBDA_MAX=imdWave->wlen[0]/1000.;
-
- QC_LAMBDA_CEN_MIN=imdWave->wlen[cen_max]/1000.;
- QC_LAMBDA_CEN_MAX=imdWave->wlen[cen_min]/1000.;
- QC_LAMBDA_BIN1_MIN=imdWave->wlen[bin1_max]/1000.;
- QC_LAMBDA_BIN1_MAX=imdWave->wlen[bin1_min]/1000.;
- QC_LAMBDA_BIN2_MIN=imdWave->wlen[bin2_max]/1000.;
- QC_LAMBDA_BIN2_MAX=imdWave->wlen[bin2_min]/1000.;
- QC_LAMBDA_BIN3_MIN=imdWave->wlen[bin3_max]/1000.;
- QC_LAMBDA_BIN3_MAX=imdWave->wlen[bin3_min]/1000.;
- }
- else {
- /* lambda in ascending order */
- QC_LAMBDA_MAX=imdWave->wlen[imdWave->nbWlen-1]/1000.;
- QC_LAMBDA_MIN=imdWave->wlen[0]/1000.;
-
- QC_LAMBDA_CEN_MAX=imdWave->wlen[cen_max]/1000.;
- QC_LAMBDA_CEN_MIN=imdWave->wlen[cen_min]/1000.;
- QC_LAMBDA_BIN1_MAX=imdWave->wlen[bin1_max]/1000.;
- QC_LAMBDA_BIN1_MIN=imdWave->wlen[bin1_min]/1000.;
- QC_LAMBDA_BIN2_MAX=imdWave->wlen[bin2_max]/1000.;
- QC_LAMBDA_BIN2_MIN=imdWave->wlen[bin2_min]/1000.;
- QC_LAMBDA_BIN3_MAX=imdWave->wlen[bin3_max]/1000.;
- QC_LAMBDA_BIN3_MIN=imdWave->wlen[bin3_min]/1000.;
- }
-
-
- QC_LAMBDA_CHAN=imdWave->nbWlen;
- QC_LAMBDA_CEN_CHAN=cen_max-cen_min+1;
- QC_LAMBDA_BIN1_CHAN=bin1_max-bin1_min+1;
- QC_LAMBDA_BIN2_CHAN=bin2_max-bin2_min+1;
- QC_LAMBDA_BIN3_CHAN=bin3_max-bin3_min+1;
-
-
- /*Delete old QC parameters*/
-
- cpl_propertylist_erase_regexp(qclist, "^ESO QC LAMBDA *", 0);
- cpl_propertylist_erase_regexp(qclist, "^ESO QC CAL*", 0);
- cpl_propertylist_erase_regexp(qclist, "^ESO QC UNCAL*", 0);
- cpl_propertylist_erase_regexp(qclist, "^ESO QC TRF*", 0);
-
- cpl_propertylist_update_int(qclist,"ESO QC LAMBDA CHAN",
- QC_LAMBDA_CHAN);
- cpl_propertylist_update_double(qclist,"ESO QC LAMBDA MIN",
- QC_LAMBDA_MIN);
- cpl_propertylist_update_double(qclist,"ESO QC LAMBDA MAX",
- QC_LAMBDA_MAX);
- cpl_propertylist_update_double(qclist,"ESO QC LAMBDA CEN MIN",
- QC_LAMBDA_CEN_MIN);
- cpl_propertylist_update_double(qclist,"ESO QC LAMBDA CEN MAX",
- QC_LAMBDA_CEN_MAX);
- cpl_propertylist_update_int(qclist,"ESO QC LAMBDA CEN CHAN",
- QC_LAMBDA_CEN_CHAN);
- cpl_propertylist_update_double(qclist,"ESO QC LAMBDA BIN1 MIN",
- QC_LAMBDA_BIN1_MIN);
- cpl_propertylist_update_double(qclist,"ESO QC LAMBDA BIN1 MAX",
- QC_LAMBDA_BIN1_MAX);
- cpl_propertylist_update_int(qclist,"ESO QC LAMBDA BIN1 CHAN",
- QC_LAMBDA_BIN1_CHAN);
- cpl_propertylist_update_double(qclist,"ESO QC LAMBDA BIN2 MIN",
- QC_LAMBDA_BIN2_MIN);
- cpl_propertylist_update_double(qclist,"ESO QC LAMBDA BIN2 MAX",
- QC_LAMBDA_BIN2_MAX);
- cpl_propertylist_update_int(qclist,"ESO QC LAMBDA BIN2 CHAN",
- QC_LAMBDA_BIN2_CHAN);
- cpl_propertylist_update_double(qclist,"ESO QC LAMBDA BIN3 MIN",
- QC_LAMBDA_BIN3_MIN);
- cpl_propertylist_update_double(qclist,"ESO QC LAMBDA BIN3 MAX",
- QC_LAMBDA_BIN3_MAX);
- cpl_propertylist_update_int(qclist,"ESO QC LAMBDA BIN3 CHAN",
- QC_LAMBDA_BIN3_CHAN);
-
- /* Averages the visibilities and closure phases. The channels
- * XXX_min and XXX_max are included in the averaging procedure! */
-
-
- if(strcmp(calib, "cal")==0){
- amber_qc_calc_new(imdVis, imdVis2, imdVis3, qclist, cen_min, cen_max,
- "ESO QC CALV2 CEN BAS1",
- "ESO QC CALV2 CEN BAS2",
- "ESO QC CALV2 CEN BAS3",
- "ESO QC CALCP CEN");
-
- amber_qc_calc_new(imdVis, imdVis2, imdVis3, qclist, bin1_min, bin1_max,
- "ESO QC CALV2 BIN1 BAS1",
- "ESO QC CALV2 BIN1 BAS2",
- "ESO QC CALV2 BIN1 BAS3",
- "ESO QC CALCP BIN1");
-
- amber_qc_calc_new(imdVis, imdVis2, imdVis3, qclist, bin2_min, bin2_max,
- "ESO QC CALV2 BIN2 BAS1",
- "ESO QC CALV2 BIN2 BAS2",
- "ESO QC CALV2 BIN2 BAS3",
- "ESO QC CALCP BIN2");
-
- amber_qc_calc_new(imdVis, imdVis2, imdVis3, qclist, bin3_min, bin3_max,
- "ESO QC CALV2 BIN3 BAS1",
- "ESO QC CALV2 BIN3 BAS2",
- "ESO QC CALV2 BIN3 BAS3",
- "ESO QC CALCP BIN3");
-
- amber_qc_calc_snr(imdVis, qclist,
- "ESO QC CALSNR BAS1",
- "ESO QC CALSNR BAS2",
- "ESO QC CALSNR BAS3");
- }
- else if(strcmp(calib, "trf")==0)
- {
- amber_qc_calc_new(imdVis, imdVis2, imdVis3, qclist, cen_min, cen_max,
- "ESO QC TRFV2 CEN BAS1",
- "ESO QC TRFV2 CEN BAS2",
- "ESO QC TRFV2 CEN BAS3",
- "ESO QC TRFCP CEN");
-
- amber_qc_calc_new(imdVis, imdVis2, imdVis3, qclist, bin1_min, bin1_max,
- "ESO QC TRFV2 BIN1 BAS1",
- "ESO QC TRFV2 BIN1 BAS2",
- "ESO QC TRFV2 BIN1 BAS3",
- "ESO QC TRFCP BIN1");
-
- amber_qc_calc_new(imdVis, imdVis2, imdVis3, qclist, bin2_min, bin2_max,
- "ESO QC TRFV2 BIN2 BAS1",
- "ESO QC TRFV2 BIN2 BAS2",
- "ESO QC TRFV2 BIN2 BAS3",
- "ESO QC TRFCP BIN2");
- amber_qc_calc_new(imdVis, imdVis2, imdVis3, qclist, bin3_min, bin3_max,
- "ESO QC TRFV2 BIN3 BAS1",
- "ESO QC TRFV2 BIN3 BAS2",
- "ESO QC TRFV2 BIN3 BAS3",
- "ESO QC TRFCP BIN3");
-
- amber_qc_calc_snr(imdVis, qclist,
- "ESO QC TRFSNR BAS1",
- "ESO QC TRFSNR BAS2",
- "ESO QC TRFSNR BAS3");
- }
- else {
- amber_qc_calc_new(imdVis, imdVis2, imdVis3, qclist, cen_min, cen_max,
- "ESO QC UNCALV2 CEN BAS1",
- "ESO QC UNCALV2 CEN BAS2",
- "ESO QC UNCALV2 CEN BAS3",
- "ESO QC UNCALCP CEN");
-
- amber_qc_calc_new(imdVis, imdVis2, imdVis3, qclist, bin1_min, bin1_max,
- "ESO QC UNCALV2 BIN1 BAS1",
- "ESO QC UNCALV2 BIN1 BAS2",
- "ESO QC UNCALV2 BIN1 BAS3",
- "ESO QC UNCALCP BIN1");
-
- amber_qc_calc_new(imdVis, imdVis2, imdVis3, qclist, bin2_min, bin2_max,
- "ESO QC UNCALV2 BIN2 BAS1",
- "ESO QC UNCALV2 BIN2 BAS2",
- "ESO QC UNCALV2 BIN2 BAS3",
- "ESO QC UNCALCP BIN2");
- amber_qc_calc_new(imdVis, imdVis2, imdVis3, qclist, bin3_min, bin3_max,
- "ESO QC UNCALV2 BIN3 BAS1",
- "ESO QC UNCALV2 BIN3 BAS2",
- "ESO QC UNCALV2 BIN3 BAS3",
- "ESO QC UNCALCP BIN3");
- amber_qc_calc_snr(imdVis, qclist,
- "ESO QC UNCALSNR BAS1",
- "ESO QC UNCALSNR BAS2",
- "ESO QC UNCALSNR BAS3");
- }
-
-
- if(spectrum !=NULL){
-
- amber_qc_average_spectrum(spectrum, qclist, cen_min, cen_max,
- "ESO QC SPECTRUM CEN TEL1",
- "ESO QC SPECTRUM CEN TEL2",
- "ESO QC SPECTRUM CEN TEL3");
- }
-
-
- return 0;
-}
-
-/*
-static int amber_qc_calc(amdlibVIS *imdVis, amdlibVIS2 *imdVis2,
- amdlibVIS3 *imdVis3, cpl_propertylist * qclist, int channel_min,
- int channel_max, const char * base1name, const char * base2name,
- const char * base3name, const char * cpname)
-{
- int iFrame= 0;
- int iWave=0;
- double base1=0.;
- double base2=0.;
- double base3=0.;
- double cp=0.;
-
- Looping and Summing up Visibility2...
- for(iFrame = 0; iFrame < imdVis->nbFrames*imdVis->nbBases; iFrame++){
- for(iWave = channel_min; iWave <= channel_max; iWave++){
- base1+=imdVis2->table[iFrame].vis2[iWave];
-
- }
- if(imdVis->nbBases>1){
- iFrame++;
- for(iWave = channel_min; iWave <= channel_max; iWave++){
- base2+=imdVis2->table[iFrame].vis2[iWave];
- }
- iFrame++;
- for(iWave = channel_min; iWave <= channel_max; iWave++){
- base3+=imdVis2->table[iFrame].vis2[iWave];
- }
- }
- }
-
- base1=base1/((channel_max-channel_min+1))/imdVis->nbFrames;
-
- if (imdVis->nbBases>1){
-
- base2=base2/((channel_max-channel_min+1))/imdVis->nbFrames;
- base3=base3/((channel_max-channel_min+1))/imdVis->nbFrames;
-
-
- Looping and Summing up Closure Phase...
- for(iFrame = 0; iFrame < imdVis->nbFrames; iFrame++){
- for(iWave = channel_min; iWave <= channel_max; iWave++){
- cp+=imdVis3->table[iFrame].vis3Phi[iWave];
- }
- }
- cp=cp/ ((channel_max-channel_min+1)*imdVis->nbFrames) * (180. / M_PI);
- }
-
- cpl_propertylist_update_double(qclist, base1name, base1);
- if (imdVis->nbBases>1){
- cpl_propertylist_update_double(qclist, base2name, base2);
- cpl_propertylist_update_double(qclist, base3name, base3);
- cpl_propertylist_update_double(qclist, cpname, cp);
- }
- return 0;
-}
- */
-
-static int amber_qc_average_spectrum(amdlibSPECTRUM *spectrum,
- cpl_propertylist * qclist, int channel_min, int channel_max,
- const char * base1name, const char * base2name, const char * base3name)
-{
- cpl_array * base1_array=NULL;
- cpl_array * base2_array=NULL;
- cpl_array * base3_array=NULL;
- cpl_size iWave=0;
-
- if (channel_max>((spectrum->nbWlen)-1)){
- channel_max=(spectrum->nbWlen)-1;
- }
-
- base1_array=cpl_array_new((cpl_size)spectrum->nbWlen,CPL_TYPE_DOUBLE);
- base2_array=cpl_array_new((cpl_size)spectrum->nbWlen,CPL_TYPE_DOUBLE);
- base3_array=cpl_array_new((cpl_size)spectrum->nbWlen,CPL_TYPE_DOUBLE);
-
- if(spectrum->nbTels>2){
- for(iWave = channel_min; iWave <= channel_max; iWave++){
- cpl_array_set_double(base1_array,iWave,spectrum->spec[0][iWave]);
- cpl_array_set_double(base2_array,iWave,spectrum->spec[1][iWave]);
- cpl_array_set_double(base3_array,iWave,spectrum->spec[2][iWave]);
- }
- }
- else{
- for(iWave = channel_min; iWave <= channel_max; iWave++){
- cpl_array_set_double(base1_array,iWave,spectrum->spec[0][iWave]);
- }
- }
- /*update the QC list*/
- cpl_propertylist_update_double(qclist, base1name,
- cpl_array_get_mean(base1_array));
- if (spectrum->nbTels>2){
- cpl_propertylist_update_double(qclist, base2name,
- cpl_array_get_mean(base2_array));
- cpl_propertylist_update_double(qclist, base3name,
- cpl_array_get_mean(base3_array));
- }
-
-
- cpl_array_delete(base1_array);
- cpl_array_delete(base2_array);
- cpl_array_delete(base3_array);
-
- return 0;
-
-
-}
-
-
-static int amber_qc_calc_new(amdlibVIS *imdVis, amdlibVIS2 *imdVis2,
- amdlibVIS3 *imdVis3, cpl_propertylist * qclist, int channel_min,
- int channel_max, const char * base1name, const char * base2name,
- const char * base3name, const char * cpname)
-{
- int iFrame= 0;
- int iFrame_single=0;
- int NumberOfChannels=0;
- int iWave=0;
- double base1=0.;
- double base2=0.;
- double base3=0.;
- double cp=0.;
- const char * base1name_stdev=NULL;
- const char * base2name_stdev=NULL;
- const char * base3name_stdev=NULL;
- const char * cpname_stdev=NULL;
- cpl_array * base1_array=NULL;
- cpl_array * base2_array=NULL;
- cpl_array * base3_array=NULL;
- cpl_array * cp_array=NULL;
-
-
- base1_array=cpl_array_new(imdVis->nbFrames,CPL_TYPE_DOUBLE);
- base2_array=cpl_array_new(imdVis->nbFrames,CPL_TYPE_DOUBLE);
- base3_array=cpl_array_new(imdVis->nbFrames,CPL_TYPE_DOUBLE);
- cp_array=cpl_array_new(imdVis->nbFrames,CPL_TYPE_DOUBLE);
-
- iFrame_single=0;
-
- /* Looping and Summing up Visibility2... */
- for(iFrame = 0; iFrame < imdVis->nbFrames*imdVis->nbBases; iFrame++){
- base1=0.;
- NumberOfChannels=0;
- for(iWave = channel_min; iWave <= channel_max; iWave++){
- if(imdVis2->table[iFrame].flag[iWave]==amdlibFALSE){
- base1+=imdVis2->table[iFrame].vis2[iWave];
- NumberOfChannels++;
- }
- }
- if(NumberOfChannels>0){
- cpl_array_set_double(base1_array,iFrame_single,base1/
- NumberOfChannels);
- }
- else {
- cpl_array_set_invalid(base1_array,iFrame_single);
- }
-
- if(imdVis->nbBases>1){
- iFrame++;
- base2=0.;
- NumberOfChannels=0;
- for(iWave = channel_min; iWave <= channel_max; iWave++){
- if(imdVis2->table[iFrame].flag[iWave]==amdlibFALSE){
- base2+=imdVis2->table[iFrame].vis2[iWave];
- NumberOfChannels++;
- }
- }
- if(NumberOfChannels>0){
- cpl_array_set_double(base2_array,iFrame_single,base2/
- NumberOfChannels);
- }
- else {
- cpl_array_set_invalid(base2_array,iFrame_single);
- }
- iFrame++;
- base3=0.;
- NumberOfChannels=0;
- for(iWave = channel_min; iWave <= channel_max; iWave++){
- if(imdVis2->table[iFrame].flag[iWave]==amdlibFALSE){
- base3+=imdVis2->table[iFrame].vis2[iWave];
- NumberOfChannels++;
- }
- }
-
- if(NumberOfChannels>0){
- cpl_array_set_double(base3_array,iFrame_single,base3/
- NumberOfChannels);
- }
- else {
- cpl_array_set_invalid(base3_array,iFrame_single);
- }
- }
- iFrame_single++;
- }
-
- if (imdVis->nbBases>1){
-
- /* Looping and Summing up Closure Phase... */
- for(iFrame = 0; iFrame < imdVis->nbFrames; iFrame++){
- cp=0.;
- NumberOfChannels=0;
- for(iWave = channel_min; iWave <= channel_max; iWave++){
- if(imdVis3->table[iFrame].flag[iWave]==amdlibFALSE){
- cp+=imdVis3->table[iFrame].vis3Phi[iWave];
- NumberOfChannels++;
- }
- }
-
- if(NumberOfChannels>0){
- cpl_array_set_double(cp_array,iFrame,cp /
- NumberOfChannels *(180. / M_PI));
- }
- else {
- cpl_array_set_invalid(cp_array,iFrame);
- }
-
- }
- }
-
- base1name_stdev=cpl_sprintf("%s STDEV",base1name);
- base2name_stdev=cpl_sprintf("%s STDEV",base2name);
- base3name_stdev=cpl_sprintf("%s STDEV",base3name);
- cpname_stdev=cpl_sprintf("%s STDEV",cpname);
-
- cpl_propertylist_update_double(qclist, base1name,
- cpl_array_get_mean(base1_array));
- cpl_propertylist_update_double(qclist, base1name_stdev,
- cpl_array_get_stdev(base1_array));
-
-
- if (imdVis->nbBases>1){
- cpl_propertylist_update_double(qclist, base2name,
- cpl_array_get_mean(base2_array));
- cpl_propertylist_update_double(qclist, base2name_stdev,
- cpl_array_get_stdev(base2_array));
-
- cpl_propertylist_update_double(qclist, base3name,
- cpl_array_get_mean(base3_array));
- cpl_propertylist_update_double(qclist, base3name_stdev,
- cpl_array_get_stdev(base3_array));
-
- cpl_propertylist_update_double(qclist, cpname,
- cpl_array_get_mean(cp_array));
- cpl_propertylist_update_double(qclist, cpname_stdev,
- cpl_array_get_stdev(cp_array));
- }
-
- cpl_array_delete(base1_array);
- cpl_array_delete(base2_array);
- cpl_array_delete(base3_array);
- cpl_array_delete(cp_array);
-
- cpl_free((void *)base1name_stdev);
- cpl_free((void *)base2name_stdev);
- cpl_free((void *)base3name_stdev);
- cpl_free((void *)cpname_stdev);
-
- return 0;
-}
-
-
-static int amber_qc_calc_snr(amdlibVIS *imdVis, cpl_propertylist * qclist,
- const char * base1name, const char * base2name, const char * base3name)
-{
- int iFrame= 0;
- double snrbase1=0.;
- double snrbase2=0.;
- double snrbase3=0.;
-
- /* Looping and Summing the SNR... */
- for(iFrame = 0; iFrame < imdVis->nbFrames*imdVis->nbBases; iFrame++){
- snrbase1+=imdVis->table[iFrame].frgContrastSnr;
- if(imdVis->nbBases>1){
- iFrame++;
- snrbase2+=imdVis->table[iFrame].frgContrastSnr;
- iFrame++;
- snrbase3+=imdVis->table[iFrame].frgContrastSnr;
- }
- }
-
- snrbase1=snrbase1/imdVis->nbFrames;
- snrbase2=snrbase2/imdVis->nbFrames;
- snrbase3=snrbase3/imdVis->nbFrames;
-
-
- cpl_propertylist_update_double(qclist, base1name, snrbase1);
- if (imdVis->nbBases>1){
- cpl_propertylist_update_double(qclist, base2name, snrbase2);
- cpl_propertylist_update_double(qclist, base3name, snrbase3);
- }
- return 0;
-}
diff --git a/amber/amber_qc.h b/amber/amber_qc.h
deleted file mode 100644
index 169f55c..0000000
--- a/amber/amber_qc.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef AMBER_QC_H
-#define AMBER_QC_H
-
-
-
-#define USE_CEN 0.80
-#define USE_BIN1 0.25
-#define USE_BIN2 0.25
-#define USE_BIN3 0.25
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846 /* pi */
-#endif /* M_PI */
-
-#include "amdlib.h"
-#include "amdlibProtected.h"
-#include <cpl.h>
-
-int amber_qc(amdlibWAVELENGTH *imdWave, amdlibVIS *imdVis, amdlibVIS2 *imdVis2,
- amdlibVIS3 *imdVis3, amdlibSPECTRUM *spectrum, cpl_propertylist * qclist, const char * calib);
-
-#endif
diff --git a/amber/amdlib.h b/amber/amdlib.h
deleted file mode 100644
index e1f6df2..0000000
--- a/amber/amdlib.h
+++ /dev/null
@@ -1,1485 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-
-#ifndef amdlibPublic_H
-#define amdlibPublic_H
-/**
- * @file
- * This file contains public functions and structures of the AMBER data
- * reduction software.
- */
-
-/* The following piece of code alternates the linkage type to C for all
- * functions declared within the braces, which is necessary to use the
- * functions in C++-code.
- */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*float types - change fftw definitions accordingly */
-#define amdlibDOUBLE double
-
-/* System files */
-#include "fitsio.h"
-
-/** Definition of boolean */
-typedef enum
-{
- amdlibFALSE = 0,
- amdlibTRUE
-} amdlibBOOLEAN;
-
-/** Error message */
-#define amdlibERROR_LENGTH 256
-typedef char amdlibERROR_MSG[amdlibERROR_LENGTH];
-
-/** Definition of the routine completion status */
-typedef enum
-{
- amdlibFAILURE = 1,
- amdlibSUCCESS
-} amdlibCOMPL_STAT;
-
-/*
- * This diagram shows the detector arrays (512x512 pixels) with a possible
- * sub-windowing configuration.
- *
- * +---------------------------------------------+
- * | |
- * | +---+ +---+ +---+ +---+ +---+ |
- * | | | | | | | | | | | |
- * | | | | | | | | | | | |
- * | | | | | | | | | | | |
- * | +---+ +---+ +---+ +---+ +---+ |
- * | |
- * | +---+ +---+ +---+ +---+ +---+ |
- * | | | | | | | | | | | |
- * | | | | | | | | | | | |
- * | | | | | | | | | | | |
- * | +---+ +---+ +---+ +---+ +---+ |
- * | |
- * | +---+ +---+ +---+ +---+ +---+ |
- * | | | | | | | | | | | |
- * | | | | | | | | | | | |
- * | | | | | | | | | | | |
- * | +---+ +---+ +---+ +---+ +---+ |
- * +---------------------------------------------+
- *
- * The following naming convention for the variables has been adopted :
- * - nbCols : specifies the number of colunms defined in the current
- * detector configuration (5 in the above example)
- * - nbRows : specifies the number of spectral windows read on the
- * detector (3 in the above example)
- * - nx : the number of pixels in column (in X direction)
- * - ny : the number of pixels in rows (in Y direction)
- *
- */
-
-/* Definition of the structure corresponding to the binary tables included in
- * the FITS files produced by the AMBER instrument (see document
- * VLT-SPE-ESO-15000-2764) */
-
-#define amdlibNB_TEL 3
-#define amdlibNBASELINE amdlibNB_TEL*(amdlibNB_TEL-1)/2
-
-/* Dimension of detector array */
-#define amdlibDET_SIZE_X 512
-#define amdlibDET_SIZE_Y 512
-
-/* Detector windowing definition */
-#define amdlibMAX_NB_ROWS 3
-#define amdlibMAX_NB_COLS 5
-#define amdlibNB_PHOTO_CHANNELS 3
-
-/* Frame definition. */
-#define amdlibFIRST_FRAME 1
-#define amdlibALL_FRAMES -1
-
-/** Values used for bad pixels in bad pixel map */
-#define amdlibBAD_PIXEL_FLAG 0
-/** Values used for good pixels in bad pixel map */
-#define amdlibGOOD_PIXEL_FLAG 1
-
-/**
- * Telescopes
- */
-typedef enum
-{
- amdlibTEL1 = 0,
- amdlibTEL2,
- amdlibTEL3
-} amdlibTELS;
-
-/**
- * Baselines
- */
-typedef enum
-{
- amdlibBASE12 = 0,
- amdlibBASE23,
- amdlibBASE31
-} amdlibBASELINE;
-
-/**
- * Frame type. DO NOT CHANGE ORDER, JUST ADD AT END!!!!!
- */
-typedef enum
-{
- amdlibDARK_FRAME = -1,
- amdlibTEL1_FRAME,
- amdlibTEL2_FRAME,
- amdlibTEL3_FRAME,
- amdlibTEL12_FRAME,
- amdlibTEL23_FRAME,
- amdlibTEL13_FRAME,
- amdlibTEL12Q_FRAME,
- amdlibTEL23Q_FRAME,
- amdlibTEL13Q_FRAME,
- amdlibTEL123_FRAME,
- amdlibSKY_FRAME,
- amdlibUNKNOWN_FRAME
-} amdlibFRAME_TYPE;
-
-#define amdlibNB_INS_CFG_KEYW 1024
-#define amdlibKEYW_LINE_LEN 80
-#define amdlibKEYW_NAME_LEN 80
-#define amdlibKEYW_VAL_LEN 80
-#define amdlibKEYW_CMT_LEN 80
-typedef char amdlibKEYW_LINE[amdlibKEYW_LINE_LEN+1];
-/**
- * Simple definition of keyword
- */
-typedef struct
-{
- char name[amdlibKEYW_NAME_LEN+1];
- char value[amdlibKEYW_VAL_LEN+1];
- char comment[amdlibKEYW_CMT_LEN+1];
-} amdlibKEYWORD;
-
-/**
- * Table containing instrument configuration table */
-typedef struct
-{
- int nbKeywords;
- amdlibKEYWORD keywords[amdlibNB_INS_CFG_KEYW];
-} amdlibINS_CFG;
-
-/**
- * Structure describing the setup and characteristics of the 2-dimensional
- * detector used to record photometric and visibility data. This information
- * comes from IMAGING_DETECTOR binary table.
- */
-typedef struct
-{
- /** Origine of the data */
- char origin[amdlibKEYW_VAL_LEN+1];
- /** Instrument name */
- char instrument[amdlibKEYW_VAL_LEN+1];
- /** Observation date (Modified Julian Date) */
- double dateObsMJD;
- /** Observation date (YYY-MM-DDThh:mm:ss UTC) */
- char dateObs[amdlibKEYW_VAL_LEN+1];
- /** HDU creation date (YYY-MM-DDThh:mm:ss UTC) */
- char date[amdlibKEYW_VAL_LEN+1];
- /** Data dictionary name */
- char detDictionaryId[amdlibKEYW_VAL_LEN+1];
- /** DCS software version string */
- char detId[amdlibKEYW_VAL_LEN+1];
- /** Number of detectors */
- int nbDetectors;
- /** Number of regions */
- int nbRegions;
- /** Maximum number of polynomial coefficients for DMC and DMP */
- int maxCoef;
- /** Number of dimensions of detector array */
- int numDim;
- /** Maximun number of telescopes for instrument */
- int maxTel;
-} amdlibIMAGING_DETECTOR;
-
-/**
- * Structure containing the detector pixel data for an exposure coming form
- * IMAGING_DATA binary table.
- */
-typedef struct
-{
- /** Origin of the data */
- char origin[amdlibKEYW_VAL_LEN+1];
- /** Instrument name */
- char instrument[amdlibKEYW_VAL_LEN+1];
- /** Observation date (Modified Julian Date) */
- double dateObsMJD;
- /** Observation date (YYY-MM-DDThh:mm:ss UTC) */
- char dateObs[amdlibKEYW_VAL_LEN+1];
- /** HDU creation date (YYY-MM-DDThh:mm:ss UTC) */
- char date[amdlibKEYW_VAL_LEN+1];
- /** Data dictionary name */
- char detDictionaryId[amdlibKEYW_VAL_LEN+1];
- /** DCS software version string */
- char detId[amdlibKEYW_VAL_LEN+1];
- /** Number of regions */
- int nbRegions;
- /** Maximun number of telescopes for instrument */
- int maxTel;
- /** Maximum number of entries in OPTICAL_TRAIN table */
- int maxIns;
- /** Maximum number of steps in an observational cycle */
- int maxStep;
-} amdlibIMAGING_DATA;
-
-#define amdlibMAX_NB_AXIS 3
-/**
- * Structure containing all informations describing regions coming from
- * either IMAGING_DETECTOR or IMAGING_DATA binary tables.
- */
-typedef struct
-{
- /* The first part gives informations on the regions. These informations are
- * stored in the IMAGING_DETECTOR binary table */
- /*** Be careful, here you can replace 2 by amdlibMAX_NB_AXIS ***/
- /** Region number that is being described */
- int regionNumber;
- /** Descriptive name of the region; e.g. I1, I2, PA, PB or QL */
- char regionName[amdlibKEYW_VAL_LEN+1];
- /** Detector that is on the region */
- int detectorNumber;
- /** Entrance ports of the interferometer that contribute to this region */
- int ports[amdlibNB_TEL];
- /** Correlation type, 0=background, 1=photometric and 2=interferometric */
- int correlation;
- /** Corner of this region on the detector as low value of x, low value of
- ** y, inclusive */
- int corner[2];
- /** Detector conversion factor from electron to ADU (e-/ADU) */
- double gain;
- /** Coordinates at the reference pixels */
- double crVal[2];
- /** Reference pixels on 'x' and 'y' axes for this region */
- double crPix[2];
- /** Type de coordinates for the 'x' and 'y' axes for this region. Standard
- ** WCS conventions are used */
- char cType[2][8];
- /** Transformation applied after DMPn/DMCn transformations. Standard
- ** WCS conventions are used */
- double cd[2][2];
- /** Distorsion correction array */
- double ***dmp;
- /** Distorsion correction array */
- double ***dmc;
- /* The second part contains the data which are stored in the IMAGING_DATA
- * binary table */
- /** Dimension of each axis */
- int dimAxis[amdlibMAX_NB_AXIS];
- /** Data */
- amdlibDOUBLE *data;
-} amdlibREGION;
-
-/**
- * Position and dimension of photometric or interferometric channel (1 column)
- */
-typedef struct
-{
- /** Start pixel (in X direction) of the column */
- int startPixel;
- /** Number of pixels */
- int nbPixels;
-} amdlibCOL_INFO;
-
-/**
- * Structure containing position and characteristic of a telescope.
- */
-typedef struct
-{
- /** Telescope name. */
- char telescopeName[amdlibKEYW_VAL_LEN+1];
- /** Station name. */
- char stationName[amdlibKEYW_VAL_LEN+1];
- /** Station number. */
- int stationIndex;
- /** Element diameter (meters). */
- amdlibDOUBLE elementDiameter;
- /** Station coordinates relative to array center (meters). */
- double stationCoordinates[3];
-} amdlibOI_ARRAY_ELEMENT;
-
-/**
- * Structure containing positions and characteristics of the telescopes used in
- * observation.
- */
-typedef struct
-{
- /* The following pointer is used to know if the data structure is
- * initialized or not. When initialized, it contains pointer to itself */
- void *thisPtr;
- /** Number of stations defined. */
- int nbStations;
- /** Array name, for cross-referencing. */
- char arrayName[amdlibKEYW_VAL_LEN+1];
- /** Coordinate frame. */
- char coordinateFrame[amdlibKEYW_VAL_LEN+1];
- /** Array center coordinates (meters). */
- double arrayCenterCoordinates[3];
- /** Array containing telescope descriptions. */
- amdlibOI_ARRAY_ELEMENT *element;
-} amdlibOI_ARRAY;
-
-#define amdlibNB_SPECTRAL_CHANNELS amdlibDET_SIZE_Y
-#define amdlibOFFSETY_NOT_CALIBRATED 999.0
-/**
- * Structure containing the effective wavelengths/bandwidths for each spectral
- * channel for the interferometric data, and the wavelength offset for each
- * photometric column. This information comes from AMBER_WAVEDATA binary table.
- */
-typedef struct
-{
- /** Origine of the data */
- char origin[amdlibKEYW_VAL_LEN+1];
- /** Instrument name */
- char instrument[amdlibKEYW_VAL_LEN+1];
- /** Observation date (Modified Julian Date) */
- double dateObsMJD;
- /** Observation date (YYY-MM-DDThh:mm:ss UTC) */
- char dateObs[amdlibKEYW_VAL_LEN+1];
- /** HDU creation date (YYY-MM-DDThh:mm:ss UTC) */
- char date[amdlibKEYW_VAL_LEN+1];
- /** Instrument dictionary name */
- char insDictionaryId[amdlibKEYW_VAL_LEN+1];
- /** INS software version string */
- char insId[amdlibKEYW_VAL_LEN+1];
- /** Number of wavelengths */
- int nbWlen;
- /** Arrays containing the wavelengths and bandwidth (microns) corresponding
- * to the interferometric data */
- amdlibDOUBLE wlen[amdlibNB_SPECTRAL_CHANNELS];
- amdlibDOUBLE bandwidth[amdlibNB_SPECTRAL_CHANNELS];
- /** Wavelength offset, in pixel, for each photometric column */
- amdlibDOUBLE photoOffset[3];
-} amdlibWAVEDATA;
-
-/** Number of spectral bands */
-#define amdlibNB_BANDS 3
-
-/**
- * Spectral bands
- */
-typedef enum
-{
- amdlibUNKNOWN_BAND = -1,
- amdlibJ_BAND,
- amdlibH_BAND,
- amdlibK_BAND,
- amdlibALL_BANDS
-} amdlibBAND;
-
-/**
- * Structure characterizing a spectral band.
- */
-typedef struct
-{
- /** Name of spectral band */
- char *name;
- /** Bounds of the spectral band considered */
- amdlibDOUBLE lowerBound;
- amdlibDOUBLE upperBound;
-} amdlibBAND_DESC;
-
-/**
- * Structure containing raw data.
- */
-typedef struct
-{
- /* The following pointer is used to know if the data structure is
- * initialized or not. When initialized, it contains pointer to itself */
- void *thisPtr;
- /** Id of the P2VM which can be used to reduce this data */
- int p2vmId;
- /** Time for this exposure (Modified Julian Date) */
- double time;
- /** Dit time in seconds */
- amdlibDOUBLE expTime;
- /** Number of spectral windows read (up to 3) */
- int nbRows;
- /** Number of columns */
- int nbCols;
- /** Number of frames */
- int nbFrames;
- /** Array of keywords corresponding to the instrument configuration at the
- * time of the data acquisition */
- amdlibINS_CFG insCfg;
- /** Wave data */
- amdlibWAVEDATA waveData;
- /** Imaging Detector informations */
- amdlibIMAGING_DETECTOR imagingDetector;
- /** Imaging data informations */
- amdlibIMAGING_DATA imagingData;
- /** Array Geometry */
- amdlibOI_ARRAY arrayGeometry;
- /** Number of regions = nbRows * nbCols */
- int nbRegions;
- /** List of regions */
- amdlibREGION *region;
- amdlibREGION *variance;
- /** Time each Frame obtained (given by DCS in IMAGING_DATA */
- double *timeTag;
- /** True if file only contains detector data; i.e. does not contains
- * ICS sub-system keywords nor wave data binary table */
- amdlibBOOLEAN detDataOnly;
- /** True if the data has been loaded */
- amdlibBOOLEAN dataLoaded;
- /** True if the data has been already calibrated */
- amdlibBOOLEAN dataCalibrated;
- /** True if the raw data has [a number of] saturated pixels */
- amdlibBOOLEAN dataIsSaturated;
- /** Frame type */
- amdlibFRAME_TYPE frameType;
-} amdlibRAW_DATA;
-
-/* CALIBRATION MAPS */
-/**
- * Structure containing flat-field map.
- */
-typedef struct
-{
- /** True if the flat field map has already been initialized */
- amdlibBOOLEAN mapIsInitialized;
- /** Flat field map */
- amdlibDOUBLE data[amdlibDET_SIZE_Y][amdlibDET_SIZE_X];
-} amdlibFLAT_FIELD_MAP;
-
-/**
- * Structure containing bad pixel map.
- */
-typedef struct
-{
- /** True if the bad pixel map has already been initialized */
- amdlibBOOLEAN mapIsInitialized;
- /** Bad pixel map */
- amdlibDOUBLE data[amdlibDET_SIZE_Y][amdlibDET_SIZE_X];
-} amdlibBAD_PIXEL_MAP;
-
-/**
- * Structure containing background (dark) data.
- */
- typedef struct
-{
- /* The following pointer is used to know if the data structure is
- * initialized or not. When initialized, it contains pointer to itself */
- void *thisPtr;
- /** Dit time in seconds. darks MUST have same dit as frame
- * to which it is applied */
- amdlibDOUBLE expTime;
- /** Number of spectral windows and columns */
- int nbRows;
- int nbCols;
- /** Imaging Detector informations */
- amdlibIMAGING_DETECTOR imagingDetector;
- /** Number of regions = nbRows * nbCols */
- int nbRegions;
- /** List of regions */
- amdlibREGION *region; /* dark (bias) value*/
- amdlibREGION *noise; /* variance of the readout noise computed
- * on dark, pixel per pixel. (=sigma2det)*/
- amdlibBOOLEAN otfBadIsPresent; /* tells whether the otfBad has been estimated */
- amdlibREGION *otfBad; /* on-the-fly bad pixel estimate */
- /** Time each Frame obtained (given by DCS in IMAGING_DATA) */
- double *timeTag;
-
-} amdlibDARK_DATA;
-
-
-/**
- * Structure containing ISS configuration information
- */
-typedef struct
-{
- /** Array containing station indexes corresponding on detectors beams */
- int stationIndex[amdlibNB_TEL];
- /** Coordinates of these stations wrt phase center */
- double stationCoordinates[3][amdlibNB_TEL];
- /** Other info necessary for U and V computation*/
- double geoLat;
- double lst;
- double ra;
- double dec;
- /** Array containing real prejected baselines position at start of
- * observation */
- double projectedBaseStart[amdlibNBASELINE];
- /** Array containing real prejected baselines position at end of
- * observation */
- double projectedBaseEnd[amdlibNBASELINE];
- /** Array containing real projected baselines angles at start of
- * observartion */
- double projectedAngleStart[amdlibNBASELINE];
- /** Array containing real projected baselines angles at end of
- * observartion */
- double projectedAngleEnd[amdlibNBASELINE];
-} amdlibISS_INFO;
-
-/**
- * Structure containing science data for one frame.
- */
-typedef struct
-{
- /** Flux Ratio */
- amdlibDOUBLE fluxRatio[amdlibNB_PHOTO_CHANNELS];
- /** Array containing the interferometric data */
- amdlibDOUBLE *intf;
- amdlibDOUBLE *sigma2Intf;
- /** Arrays containing the photometric data row and corresponding variance */
- amdlibDOUBLE *photo1;
- amdlibDOUBLE *photo2;
- amdlibDOUBLE *photo3;
- amdlibDOUBLE *sigma2Photo1;
- amdlibDOUBLE *sigma2Photo2;
- amdlibDOUBLE *sigma2Photo3;
- /** Integrated values and corresponding SNR */
- double snrPhoto1;
- double snrPhoto2;
- double snrPhoto3;
- double integratedPhoto1;
- double integratedPhoto2;
- double integratedPhoto3;
-} amdlibFRAME_SCIENCE_DATA;
-
-/**
- * Structure containing spectral dispersion.
- * Since the SPECTRAL CALIBRATION Changes with AMBER setup and Time, it is
- * necessary to TAG this table with an unique identifier, because the OI-FITS
- * format will need to refer to this identifier */
-typedef struct
-{
- /* The following pointer is used to know if the data structure is
- * initialized or not. When initialized, it contains pointer to itself */
- void *thisPtr;
- /** Number of wavelengths */
- int nbWlen;
- /** Arrays containing wavelength and bandwidth */
- amdlibDOUBLE *wlen;
- amdlibDOUBLE *bandwidth;
-} amdlibWAVELENGTH;
-
-/**
- * Structure containing spectra.
- */
-typedef struct
-{
- /* The following pointer is used to know if the data structure is
- * initialized or not. When initialized, it contains pointer to itself */
- void *thisPtr;
- /* Number of telescopes */
- int nbTels;
- /* Number of wavelengths */
- int nbWlen;
- /* Arrays containing spectra and associated errors */
- double *spec[amdlibNB_TEL]; /* [nbChannels] */
- double *specErr[amdlibNB_TEL]; /* [nbChannels] */
-} amdlibSPECTRUM;
-
-/* Whole science data */
-/* Indexes referencing photometric and interferometric channels */
-#define amdlibPHOTO1_CHANNEL 0
-#define amdlibPHOTO2_CHANNEL 1
-#define amdlibPHOTO3_CHANNEL 2
-#define amdlibINTERF_CHANNEL 3
-
-/**
- * Structure containing whole science data.
- */
-typedef struct
-{
- /* The following pointer is used to know if the data structure is
- * initialized or not. When initialized, it contains pointer to itself */
- void *thisPtr;
- /** Id of the P2VM which can be used to reduce this data */
- int p2vmId;
- /** Array of keywords corresponding to the instrument configuration at the
- * time of the data acquisition for P2VM calibration */
- amdlibINS_CFG insCfg;
- /** Integration Time per frame (supposedly globally constant) */
- amdlibDOUBLE expTime;
- /** Time each Frame obtained (given by DCS in IMAGING_DATA) */
- double *timeTag;
- /** Number of columns (3 or 4) */
- int nbCols;
- /** Dimension and position of columns (shielded area not in science data) */
- amdlibCOL_INFO col[amdlibMAX_NB_COLS-1];
- /** Number of usefull channels */
- int nbChannels;
- /** Array containing the number of each spectral channel */
- int *channelNo;
- /** Number of frames */
- int nbFrames;
- /** Structure containing information about ISS configuration */
- amdlibISS_INFO issInfo;
- /** Array containing the bad pixel flags corresponding to the
- * interferometric channel */
- unsigned char *badPixels; /* [nbChannels][nx] */
- unsigned char **badPixelsPt;
- /** Array containing the frames */
- amdlibFRAME_SCIENCE_DATA *frame;
-} amdlibSCIENCE_DATA;
-
-#define amdlibMAX_NB_FRAMES_SC 6
-/**
- * Structure containing data for spectral calibration.
- */
-typedef struct
-{
- /* The following pointer is used to know if the data structure is
- * initialized or not. When initialized, it contains pointer to itself */
- void *thisPtr;
- /** Array containing flag indicating whether corresponding raw data is
- * loaded or not. */
- amdlibBOOLEAN dataLoaded[amdlibMAX_NB_FRAMES_SC];
- /** Array containing raw data needed for spectral calibration. */
- amdlibRAW_DATA rawData[amdlibMAX_NB_FRAMES_SC];
-} amdlibSC_INPUT_DATA;
-
-/** Spectral calibration type */
-typedef enum
-{
- amdlibSC_2T = 1,
- amdlibSC_3T
-} amdlibSC_TYPE;
-
-#define amdlibMAX_NB_FRAMES_P2VM 9
-/**
- * Structure containing data for P2VM computation.
- */
-typedef struct
-{
- /* The following pointer is used to know if the data structure is
- * initialized or not. When initialized, it contains pointer to itself */
- void *thisPtr;
- /** Id of the P2VM to be computed */
- int p2vmId;
- /** Number of frames which has been used to compute P2VM */
- int nbFrames;
- /** Array containing flag indicating whether corresponding science data is
- * loaded or not. */
- amdlibBOOLEAN dataLoaded[amdlibMAX_NB_FRAMES_P2VM];
- /** Array containing science data needed for P2VM computation. */
- amdlibSCIENCE_DATA scienceData[amdlibMAX_NB_FRAMES_P2VM];
-} amdlibP2VM_INPUT_DATA;
-
-/** P2VM type */
-typedef enum
-{
- amdlibP2VM_2T = 1,
- amdlibP2VM_3T
-} amdlibP2VM_TYPE;
-
-/** P2VM accuracy */
-typedef enum
-{
- amdlibP2VM_UNKNOWN_ACC = 0,
- amdlibP2VM_STD_ACC,
- amdlibP2VM_HIGH_ACC
-} amdlibP2VM_ACCURACY;
-
-/**
- * Structure containing data for P2VM.
- */
-typedef struct
-{
- /* The following pointer is used to know if the data structure is
- * initialized or not. When initialized, it contains pointer to itself */
- void *thisPtr;
- /** Unique P2VM Id */
- int id;
- /** Array of keywords corresponding to the instrument configuration at the
- * time of the data acquisition for P2VM calibration */
- amdlibINS_CFG insCfg;
- /** P2VM type (amdlibP2VM_2T or amdlibP2VM_3T) */
- amdlibP2VM_TYPE type;
- /** P2VM accuracy (amdlibP2VM_STD_ACC or amdlibP2VM_HIGH_ACC) */
- amdlibP2VM_ACCURACY accuracy;
- /** first valid channel (in Y direction) of the row corresponding to the
- * P2VM */
- int firstChannel;
- /** Number of pixels in column */
- int nx;
- /** Number of spectral channels */
- int nbChannels;
- /** Number of frames which has been used to compute P2VM */
- int nbFrames;
- /** Array containing the wavelengths */
- amdlibDOUBLE *wlen; /* [nbChannels] */
- /** Array containing the ck and dk coefficients */
- double *matrix; /* [nbChannels][nx][2*nbBase] */
- double ***matrixPt;
- /** Arrays containing the vk coefficients */
- double *vk; /* [nbTel][nbChannels][nx] */
- double ***vkPt;
- double *sumVk; /* [nbBase][nbChannels] */
- double **sumVkPt;
- /** Array containing the bad pixel flags corresponding to the
- * interferometric channel */
- unsigned char *badPixels; /* [nbChannels][nx] */
- unsigned char **badPixelsPt;
- /** Array containing the Flat field corresponding to the
- * interferometric channel*/
- amdlibDOUBLE *flatField;
- amdlibDOUBLE **flatFieldPt;
- /** Arrays containing the photometric data */
- double *photometry; /* [2*nbBase+1][3][nbChannels] */
- double ***photometryPt;
- /** Arrays containing the validity flag */
- unsigned char *flag; /* [nbChannels]*/
- /** Array containing the phase shift */
- double *phase; /* [nbBase][nbChannels] */
- double **phasePt;
- /** Arrays containing the instrument visibilities */
- amdlibDOUBLE insVis[amdlibNBASELINE];
- amdlibDOUBLE insVisErr[amdlibNBASELINE];
- /** Arrays containing the instrument visibilities per band*/
- amdlibDOUBLE insVisInBand[amdlibNBASELINE][amdlibNB_BANDS];
- amdlibDOUBLE insVisErrInBand[amdlibNBASELINE][amdlibNB_BANDS];
-
-} amdlibP2VM_MATRIX;
-
-/* OI-FITS */
-/** Complex */
-typedef struct
-{
- double re;
- double im;
-} amdlibCOMPLEX;
-
-#define amdlib_OI_REVISION 1 /*Current revision number*/
-
-/**
- * Structure containing information about observed source.
- */
-typedef struct
-{
- /** Source number. This is an index used to reference this entry from other
- * tables. */
- int targetId;
- /** Source name. */
- char targetName[16+1];
- /** Equinox */
- amdlibDOUBLE equinox;
- /** Right ascenion at the beginning of observation. */
- double raEp0;
- /** Declinaison at the beginning of observation. */
- double decEp0;
- /** Error in apparent RA. */
- double raErr;
- /** Error in apparent DEC. */
- double decErr;
- /** Systematic radial velocity. */
- double sysVel;
- /** Velocity type. */
- char velTyp[8+1];
- /** Definition of velocity. */
- char velDef[8+1];
- /** Proper motion in RA. */
- double pmRa;
- /** Proper motion in DEC. */
- double pmDec;
- /** Error in proper motion in RA. */
- double pmRaErr;
- /** Error in proper motion in DEC. */
- double pmDecErr;
- /** Parallax value. */
- double parallax;
- /** Error in parallax value. */
- amdlibDOUBLE paraErr;
- /** Spectral type. */
- char specTyp[16+1];
-} amdlibOI_TARGET_ELEMENT;
-
-
-/**
- * Structure containing information about all observed sources.
- */
-typedef struct
-{
- void *thisPtr;
- /** Number of observed sources. */
- int nbTargets;
- /** Array containing observed sources. */
- amdlibOI_TARGET_ELEMENT *element;
-} amdlibOI_TARGET;
-
-/**
- * Structure containing photometries for one baseline.
- */
-typedef struct
-{
- /** Array[nbWlen] containing the number of electrons collected
- ** in the spectral channel */
- double *fluxSumPiPj;
- double *sigma2FluxSumPiPj;
- /** Array[nbWlen] containing the flux ratio
- ** in the spectral channel */
- double *fluxRatPiPj;
- double *sigma2FluxRatPiPj;
- /** Array[nbWlen] containing the photometric correction on the mks
- ** in the spectral channel */
- double *PiMultPj;
-
-} amdlibPHOTOMETRY_TABLE_ENTRY;
-
-/**
- * Structure containing photometries for all baselines.
- */
-typedef struct
-{
- /* The following pointer is used to know if the data structure is
- * initialized or not. When initialized, it contains pointer to itself */
- void *thisPtr;
- /** Number of frames */
- int nbFrames;
- /** Number of Baselines */
- int nbBases;
- /** Number of wavelengths */
- int nbWlen;
-
- amdlibPHOTOMETRY_TABLE_ENTRY *table;
-
-} amdlibPHOTOMETRY;
-
-/**
- * Structure containing calibrated visibilities for one baseline.
- */
-typedef struct
-{
- /** Target ID */
- int targetId;
- /** UTC time of observation */
- double time;
- /** Observation date (Modified Julian Date) */
- double dateObsMJD;
- /** Integration Time per frame (supposedly globally constant) */
- amdlibDOUBLE expTime;
- /** U coord of this visibility measurement */
- double uCoord;
- /** V coord of this visibility measurement */
- double vCoord;
- /** Stations Number contributing to the Data */
- int stationIndex[2];
- /** Array[nbWlen] containing the Visibility Expressed as Complex */
- amdlibCOMPLEX *vis;
- /** Array[nbWlen] containing the corresponding variance */
- amdlibCOMPLEX *sigma2Vis;
- /** Array[nbWlen] containing the covariance
- ** between Real and Imaginary part of the visibilities */
- double *visCovRI;
- /** Array[nbWlen] containing the differential Visibility Amplitude*/
- double *diffVisAmp;
- /** Array[nbWlen] containing the corresponding error */
- double *diffVisAmpErr;
- /** Array[nbWlen] containing the differential phase */
- double *diffVisPhi;
- /** Array[nbWlen] containing the corresponding error */
- double *diffVisPhiErr;
- /** Criterion to say whether there are fringes or not */
- double frgContrastSnrArray[amdlibNB_BANDS];
- /** Flag determining which bands are taken into account */
- amdlibBOOLEAN bandFlag[amdlibNB_BANDS];
- /** warning: obsolete field assuring compatibility with old versions*/
- double frgContrastSnr;
- /* Flag : if a value in this vector is true, the corresponding datum should
- * be ignored in all analysis */
- amdlibBOOLEAN* flag;
-
-} amdlibVIS_TABLE_ENTRY;
-
-/**
- * Structure containing calibrated visibilities for all baseline.
- */
-typedef struct
-{
- /* The following pointer is used to know if the data structure is
- * initialized or not. When initialized, it contains pointer to itself */
- void *thisPtr;
- /* Number of frames */
- int nbFrames;
- /* Number of Baselines */
- int nbBases;
- /* Number of wavelengths */
- int nbWlen;
- /** Observation date (YYY-MM-DDThh:mm:ss UTC) */
- char dateObs[amdlibKEYW_VAL_LEN+1];
- /* IAU_VIS structure with nbSamples components */
- amdlibVIS_TABLE_ENTRY *table;
-} amdlibVIS;
-
-/**
- * IAU_VIS2 structure. According to last IAU Draft,
- * that should update the ESO one about OI_VIS2
- */
-typedef struct
-{
- /** Target ID */
- int targetId;
- /** UTC time of observation */
- double time;
- /** Observation date (Modified Julian Date) */
- double dateObsMJD;
- /** Integration Time per frame (supposedly globally constant) */
- amdlibDOUBLE expTime;
- /** Array containing the Squared Visibility */
- double *vis2;
- /** Array containing the corresponding error */
- double *vis2Error;
- /** U coord of this visibility measurement */
- double uCoord;
- /** V coord of this visibility measurement */
- double vCoord;
- /** Stations Number contributing to the Data */
- int stationIndex[2];
- /* Flag : if a value in this vector is true, the corresponding datum should
- * be ignored in all analysis */
- amdlibBOOLEAN* flag;
-
-} amdlibVIS2_TABLE_ENTRY;
-
-/**
- * Structure containing calibrated square visibilities for all baseline.
- */
-typedef struct
-{
- /* The following pointer is used to know if the data structure is
- * initialized or not. When initialized, it contains pointer to itself */
- void *thisPtr;
- /* Number of frames */
- int nbFrames;
- /* Number of Baselines */
- int nbBases;
- /* Number of wavelengths */
- int nbWlen;
- /** Mean visibility with corresponding error */
- amdlibDOUBLE vis12;
- amdlibDOUBLE vis23;
- amdlibDOUBLE vis31;
- amdlibDOUBLE sigmaVis12;
- amdlibDOUBLE sigmaVis23;
- amdlibDOUBLE sigmaVis31;
- /** Observation date (YYY-MM-DDThh:mm:ss UTC) */
- char dateObs[amdlibKEYW_VAL_LEN+1];
- /* IAU_VIS2 structure with nbWlen components */
- amdlibVIS2_TABLE_ENTRY *table;
-} amdlibVIS2;
-
-/**
- * V^2 bias computation type.
- */
-typedef enum
-{
- /** Phasors algorythm, very slow and maybe inaccurate */
- amdlibSTATISTICAL_ERROR = 0,
- /** Fit of the unwrapped phase */
- amdlibTHEORETICAL_ERROR
-} amdlibERROR_TYPE;
-
-/**
- * IAU_VIS3 structure. According to last IAU Draft,
- * that should update the ESO one about OI_VIS3
- */
-typedef struct
-{
- /** Target ID */
- int targetId;
- /** UTC time of observation */
- double time;
- /** Observation date (Modified Julian Date) */
- double dateObsMJD;
- /** Integration Time per frame (supposedly globally constant) */
- amdlibDOUBLE expTime;
- /** Array[nbWlen] containing the Triple Product Amplitude */
- double *vis3Amplitude;
- /** Array[nbWlen] containing the corresponding error */
- double *vis3AmplitudeError;
- /** Array[nbWlen] containing the Triple Product Phase (degrees)*/
- double *vis3Phi;
- /** Array[nbWlen] containing the corresponding error (degrees)*/
- double *vis3PhiError;
- /** U1 coord of baseline AB of the triangle */
- double u1Coord;
- /** V1 coord of baseline AB of the triangle */
- double v1Coord;
- /** U2 coord of baseline BC of the triangle */
- double u2Coord;
- /** V2 coord of baseline BC of the triangle */
- double v2Coord;
- /** Stations Number contributing to the triple product (3 values) */
- int stationIndex[3];
- /* Flag : if a value in this vector is true, the corresponding datum should
- * be ignored in all analysis */
- amdlibBOOLEAN* flag;
-
-} amdlibVIS3_TABLE_ENTRY;
-
-/**
- * Structure containing calibrated phase closures for all baseline.
- */
-typedef struct
-{
- /* The following pointer is used to know if the data structure is
- * initialized or not. When initialized, it contains pointer to itself */
- void *thisPtr;
- /** Number of frames */
- int nbFrames;
- /** Number of phase closures */
- int nbClosures;
- /** Number of wavelengths */
- int nbWlen;
- /** Returns the closure averaged over all frames and wavelength */
- amdlibDOUBLE averageClosure;
- amdlibDOUBLE averageClosureError;
- /** Observation date (YYY-MM-DDThh:mm:ss UTC) */
- char dateObs[amdlibKEYW_VAL_LEN+1];
- /** IAU_VIS3 structure with nbWlen components */
- amdlibVIS3_TABLE_ENTRY *table;
-} amdlibVIS3;
-
-/**
- * Structure containing calibrated pistons for all baseline.
- */
-typedef struct
-{
- /* The following pointer is used to know if the data structure is
- * initialized or not. When initialized, it contains pointer to itself */
- void *thisPtr;
- /** Number of frames */
- int nbFrames;
- /** Number of Baselines */
- int nbBases;
- /** Flag determining which bands are taken into account */
- amdlibBOOLEAN bandFlag[amdlibNB_BANDS];
- /** Piston values for each baseline in same unit as lambda */
- amdlibDOUBLE *pistonOPDArray[amdlibNB_BANDS];
- /** Error on Piston same unit as above */
- amdlibDOUBLE *sigmaPistonArray[amdlibNB_BANDS];
- /** warning: obsolete fields assuring compatibility with old versions*/
- amdlibDOUBLE *pistonOPD;
- amdlibDOUBLE *sigmaPiston;
-} amdlibPISTON;
-
-/**
- * Piston algorithm.
- */
-typedef enum
-{
- /** Phasors algorythm, very slow and maybe inaccurate */
- amdlibITERATIVE_PHASOR = 0,
- /** Fit of the unwrapped phase */
- amdlibUNWRAPPED_PHASE
-} amdlibPISTON_ALGORITHM;
-
-/**
- * Frame selection criteria.
- */
-typedef enum
-{
- /** No selection */
- amdlibNO_FRAME_SEL = 0,
- /** Selection on flux ratio */
- amdlibFLUX_SEL_PCG, /* ratio = percentage */
- amdlibFLUX_SEL_THR, /* ratio = threshold */
- /** Selection on fringe contrast SNR */
- amdlibFRG_CONTRAST_SEL_PCG,
- amdlibFRG_CONTRAST_SEL_THR,
- /** Selection on piston */
- amdlibOPD_SEL_PCG,
- amdlibOPD_SEL_THR
-} amdlibFRAME_SELECTION;
-
-/**
- * Structure containing information on selected frames for 1 band.
- */
-typedef struct
-{
- /** Number of selected frames for each baseline */
- int nbSelectedFrames[amdlibNBASELINE];
- /** Index of first selected frame for each baseline */
- int firstSelectedFrame[amdlibNBASELINE];
- /** Array containing criteria to say whether a frame is selected or not
- * for each baseline */
- unsigned char **isSelectedPt;
- unsigned char *isSelected; /* [nbBases][nbFrames] */
- /** Array containing index of frames selected for all baselines and its real
- * size */
- int nbFramesOkForClosure; /* Number of phase closures */
- int *frameOkForClosure; /* [nbFrames] */
-} amdlibSELECTION_BAND;
-
-typedef struct
-{
- /** Total number of frames */
- int nbFrames;
- /** Number of baselines */
- int nbBases;
- /** Selected frames per band */
- amdlibSELECTION_BAND band[amdlibNB_BANDS];
-} amdlibSELECTION;
-
-#define amdlibDEFAULT_CPT_VIS_OPTIONS {999999, amdlibSTATISTICAL_ERROR, \
- amdlibUNWRAPPED_PHASE, amdlibFALSE, \
- amdlibNO_FRAME_SEL, 1.0}
-
-/**
- * Structure containing information necessary for visibilities computation.
- */
-typedef struct
-{
- /** Number of frames used to measure a visibility in output */
- int binSize;
- /** Noise computation type */
- amdlibERROR_TYPE errorType;
- /** Piston computation type */
- amdlibPISTON_ALGORITHM pistonType;
- /** Forces to use the given p2vm even if its id is not OK */
- amdlibBOOLEAN noCheckP2vmId;
- /** Frame selection */
- amdlibFRAME_SELECTION frameSelectionType;
- /** Percentage of frames to be selected */
- double frameSelectionRatio;
-} amdlibCPT_VIS_OPTIONS;
-
-/* Function prototypes */
-/* Version */
-void amdlibGetVersion(char version[32]);
-void amdlibPrintVersion(void);
-
-/* Raw data */
-amdlibCOMPL_STAT amdlibLoadRawData(const char *filename,
- amdlibRAW_DATA *rawData,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibLoadRawDataHdr(const char *filename,
- amdlibRAW_DATA *rawData,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibLoadRawFrames(const char *filename,
- amdlibRAW_DATA *rawData,
- int firstFrame,
- int nbFrames,
- amdlibERROR_MSG errMsg);
-void amdlibReleaseRawData(amdlibRAW_DATA *rawData);
-
-amdlibCOMPL_STAT amdlibGluedImage2RawData(amdlibDOUBLE *gluedImage,
- int nbRows,
- int nbCols,
- int colWidth[amdlibMAX_NB_COLS],
- int rowHeight[amdlibMAX_NB_ROWS],
- amdlibRAW_DATA *rawData,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibExtractColPos(amdlibRAW_DATA *rawData,
- amdlibDOUBLE colPos[amdlibMAX_NB_COLS],
- amdlibDOUBLE maxVal[amdlibMAX_NB_COLS]);
-amdlibCOMPL_STAT amdlibExtractSpectPos(amdlibRAW_DATA *rawData,
- amdlibDOUBLE spectPos[amdlibMAX_NB_COLS]
- [amdlibMAX_NB_ROWS]);
-
-amdlibBOOLEAN amdlibIsSameDetCfg(amdlibRAW_DATA *rawData1,
- amdlibRAW_DATA *rawData2);
-
-/* Calibration maps */
-amdlibCOMPL_STAT amdlibLoadBadPixelMap(const char *filename,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibSetBadPixelMap(amdlibBOOLEAN goodPixel);
-
-amdlibCOMPL_STAT amdlibLoadFlatFieldMap(const char *filename,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibSetFlatFieldMap(double value);
-
-/* Dark data */
-void amdlibReleaseDarkData(amdlibDARK_DATA *dark);
-amdlibCOMPL_STAT amdlibGenerateDarkData(amdlibRAW_DATA *rawData,
- amdlibDARK_DATA *dark,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibSetDarkData (amdlibRAW_DATA *rawData,
- amdlibDARK_DATA *dark,
- amdlibDOUBLE value,
- amdlibDOUBLE ron,
- amdlibERROR_MSG errMsg);
-/* Calibrated data */
-amdlibCOMPL_STAT amdlibRemoveGlobalBias(amdlibRAW_DATA *rawData,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibCalibrateRawData(amdlibDARK_DATA *dark,
- amdlibRAW_DATA *rawData,
- amdlibERROR_MSG errMsg);
-
-/* Spectral calibration */
-amdlibCOMPL_STAT amdlibPerformSpectralCalibration
- (amdlibSC_INPUT_DATA *scData,
- amdlibSC_TYPE scType,
- amdlibWAVEDATA *calWaveData,
- amdlibERROR_MSG errMsg);
-
-/* Science data */
-amdlibCOMPL_STAT amdlibRawData2ScienceData(amdlibRAW_DATA *rawData,
- amdlibWAVEDATA *waveData,
- amdlibSCIENCE_DATA *scienceData,
- amdlibBOOLEAN sumData,
- amdlibERROR_MSG errMsg);
-void amdlibReleaseScienceData(amdlibSCIENCE_DATA *scienceData);
-
-/* Spectral calibration data */
-amdlibCOMPL_STAT amdlibAddToSpectralCalibrationData
- (amdlibRAW_DATA *rawData,
- amdlibSC_INPUT_DATA *spectralCalibrationData,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibAddP2VDataToSpectralCalibrationData
- (amdlibRAW_DATA *rawData,
- amdlibSC_INPUT_DATA *spectralCalibrationData,
- amdlibERROR_MSG errMsg);
-void amdlibReleaseSpectralCalibrationData
- (amdlibSC_INPUT_DATA *spectralCalibrationData);
-
-amdlibBAND amdlibGetBand(amdlibDOUBLE wavelength);
-amdlibBAND_DESC *amdlibGetBandDescription(amdlibBAND band);
-char amdlibBandNumToStr (amdlibBAND band);
-
-amdlibCOMPL_STAT amdlibGetWaveDataFromRawData(amdlibRAW_DATA *rawData,
- amdlibWAVEDATA *waveData,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibGetWaveDataFromP2vm(amdlibP2VM_MATRIX *p2vm,
- amdlibWAVEDATA *waveData,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibGetChannelsInBand(amdlibP2VM_MATRIX *p2vm,
- amdlibSCIENCE_DATA *data,
- amdlibWAVEDATA *waveData,
- amdlibBAND band,
- int *nbChannelsInBand,
- int *channelNoInBand);
-
-/* Spectra */
-amdlibCOMPL_STAT amdlibAllocateSpectrum(amdlibSPECTRUM *spc,
- const int nbTels,
- const int nbWlen);
-void amdlibReleaseSpectrum(amdlibSPECTRUM *spc);
-
-amdlibCOMPL_STAT amdlibGetSpectrumFromP2VM(amdlibP2VM_MATRIX *p2vm,
- amdlibWAVELENGTH *wave,
- amdlibSPECTRUM *spectrum,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibGetSpectrumFromScienceData (amdlibSCIENCE_DATA *data,
- amdlibWAVEDATA *waveData,
- amdlibWAVELENGTH *wave,
- amdlibSPECTRUM *spectrum,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibGetAndNormalizeSpectrumFromScienceData (amdlibSCIENCE_DATA *data,
- amdlibP2VM_MATRIX *p2vm,
- amdlibWAVEDATA *waveData,
- amdlibWAVELENGTH *wave,
- amdlibSPECTRUM *spectrum,
- amdlibERROR_MSG errMsg);
-
-/* P2VM data */
-amdlibCOMPL_STAT amdlibAddToP2vmData (amdlibRAW_DATA *rawData,
- amdlibWAVEDATA *waveData,
- amdlibP2VM_INPUT_DATA *p2vmData,
- amdlibERROR_MSG errMsg);
-void amdlibReleaseP2vmData(amdlibP2VM_INPUT_DATA *p2vmData);
-
-/* P2VM */
-amdlibCOMPL_STAT amdlibComputeP2VM(amdlibP2VM_INPUT_DATA *p2vmData,
- amdlibP2VM_TYPE p2vmType,
- amdlibWAVEDATA *waveData,
- amdlibP2VM_MATRIX *p2vm,
- amdlibERROR_MSG errMsg);
-void amdlibReleaseP2VM(amdlibP2VM_MATRIX *p2vm);
-amdlibBOOLEAN amdlibIsValidChannel(amdlibP2VM_MATRIX *p2vm,
- int channelNo,
- int *iChannel);
-amdlibBOOLEAN amdlibIsP2VMUsable(amdlibSCIENCE_DATA *scienceData,
- amdlibP2VM_MATRIX *p2vm,
- amdlibDOUBLE *percentage);
-amdlibCOMPL_STAT amdlibSaveP2VM(const char *filename,
- amdlibP2VM_MATRIX *p2vm,
- amdlibP2VM_ACCURACY accuracy,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibLoadP2VM(const char *filename,
- amdlibP2VM_MATRIX *p2vm,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibDuplicateP2VM (amdlibP2VM_MATRIX *srcP2vm,
- amdlibP2VM_MATRIX *dstP2vm,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibMergeP2VM(amdlibP2VM_MATRIX *firstP2vm,
- amdlibP2VM_MATRIX *secondP2vm,
- amdlibP2VM_MATRIX *mergedP2vm,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibCopyP2VM(amdlibP2VM_MATRIX *srcP2vm,
- amdlibP2VM_MATRIX *dstP2vm,
- amdlibERROR_MSG errMsg);
-
-/* Frame selection */
-amdlibCOMPL_STAT amdlibReadSelectionFile(const char *fileName,
- amdlibINS_CFG *selKeywList,
- amdlibSELECTION *selectionBand,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibWriteSelectionFile(const char *fileName,
- amdlibSELECTION *selection,
- amdlibERROR_MSG errMsg);
-void amdlibReleaseSelection(amdlibSELECTION *selection);
-
-/* Visibilities */
-int amdlibComputeVisibilities(/* Input */
- amdlibSCIENCE_DATA *data,
- amdlibP2VM_MATRIX *p2vm,
- amdlibWAVEDATA *waveData,
- amdlibBAND band,
- amdlibCPT_VIS_OPTIONS *visOptions,
- /* Output */
- amdlibPHOTOMETRY *photometry,
- amdlibVIS *vis,
- amdlibVIS2 *vis2,
- amdlibVIS3 *vis3,
- amdlibWAVELENGTH *wave,
- amdlibPISTON *opd,
- amdlibERROR_MSG errMsg);
-int amdlibExtractVisibilities(/* Input */
- amdlibSCIENCE_DATA *data,
- amdlibP2VM_MATRIX *p2vm,
- amdlibWAVEDATA *waveData,
- amdlibBAND band,
- int nbBinning,
- amdlibERROR_TYPE errorType,
- amdlibPISTON_ALGORITHM pistonType,
- amdlibBOOLEAN noCheckP2vmId,
- /* Output */
- amdlibPHOTOMETRY *photometry,
- amdlibVIS *vis,
- amdlibVIS2 *vis2,
- amdlibVIS3 *vis3,
- amdlibWAVELENGTH *wave,
- amdlibPISTON *opd,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT
-amdlibComputeVisibilitiesFor(/* Input */
- amdlibSCIENCE_DATA *data,
- amdlibP2VM_MATRIX *p2vm,
- amdlibWAVEDATA *waveData,
- int *channelNo,
- int nbChannels,
- int nbBinning,
- amdlibERROR_TYPE errorType,
- amdlibPISTON_ALGORITHM pistonType,
- amdlibBOOLEAN noCheckP2vmId,
- /* Output */
- amdlibPHOTOMETRY *photometry,
- amdlibVIS *vis,
- amdlibVIS2 *vis2,
- amdlibVIS3 *vis3,
- amdlibWAVELENGTH *wave,
- amdlibPISTON *opd,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibAverageVisibilities(amdlibPHOTOMETRY *phot,
- amdlibVIS *vis,
- amdlibVIS2 *vis2,
- amdlibVIS3 *vis3,
- amdlibPISTON *opd,
- amdlibBAND band,
- amdlibWAVELENGTH *wave,
- amdlibSELECTION *selectedFrames,
- amdlibERROR_MSG errMsg);
-
-
-/* Allocation functions, used for link with yorick */
-
-amdlibCOMPL_STAT amdlibAllocatePhotometry(amdlibPHOTOMETRY *photometry,
- const int nbFrames,
- const int nbBases,
- const int nbWlen);
-void amdlibReleasePhotometry(amdlibPHOTOMETRY *photometry);
-
-/* Visibilities */
-amdlibCOMPL_STAT amdlibAllocateVis(amdlibVIS *vis,
- const int nbFrames,
- const int nbBases,
- const int nbWlen);
-void amdlibReleaseVis(amdlibVIS *vis);
-
-/* squared Visibilities */
-amdlibCOMPL_STAT amdlibAllocateVis2(amdlibVIS2 *vis2,
- const int nbFrames,
- const int nbBases,
- const int nbWlen);
-void amdlibReleaseVis2(amdlibVIS2 *vis2);
-
-/* Bispectrum, closure phase */
-amdlibCOMPL_STAT amdlibAllocateVis3(amdlibVIS3 *vis3,
- const int nbFrames,
- const int nbClosures,
- const int nbWlen);
-void amdlibReleaseVis3(amdlibVIS3 *vis3);
-
-/* Wavelength table */
-amdlibCOMPL_STAT amdlibAllocateWavelength(amdlibWAVELENGTH *wave,
- const int nbWlen,
- amdlibERROR_MSG errMsg);
-
-void amdlibReleaseWavelength(amdlibWAVELENGTH *wave);
-
-/* Piston table */
-amdlibCOMPL_STAT amdlibAllocatePiston(amdlibPISTON *piston,
- const int nbFrames,
- const int nbBases);
-void amdlibReleasePiston(amdlibPISTON *opd);
-
-/* OI target table */
-amdlibCOMPL_STAT amdlibAllocateOiTarget(amdlibOI_TARGET *target,
- const int nbElements);
-void amdlibReleaseOiArray(amdlibOI_ARRAY *array);
-
-/* OI array table */
-amdlibCOMPL_STAT amdlibAllocateOiArray(amdlibOI_ARRAY *array,
- const int nbElements,
- amdlibERROR_MSG errMsg);
-void amdlibReleaseOiTarget(amdlibOI_TARGET *target);
-
-/* OI-FITS */
-amdlibCOMPL_STAT amdlibSaveOiFile(const char *filename,
- amdlibINS_CFG *insCfg,
- amdlibOI_ARRAY *array,
- amdlibOI_TARGET *target,
- amdlibPHOTOMETRY *photometry,
- amdlibVIS *vis,
- amdlibVIS2 *vis2,
- amdlibVIS3 *vis3,
- amdlibWAVELENGTH *wave,
- amdlibPISTON *pst,
- amdlibSPECTRUM *spectrum,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibLoadOiFile(const char *filename,
- amdlibINS_CFG *insCfg,
- amdlibOI_ARRAY *array,
- amdlibOI_TARGET *target,
- amdlibPHOTOMETRY *photometry,
- amdlibVIS *vis,
- amdlibVIS2 *vis2,
- amdlibVIS3 *vis3,
- amdlibWAVELENGTH *wave,
- amdlibPISTON *pst,
- amdlibSPECTRUM *spectrum,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibGetOiArrayFromRawData(amdlibRAW_DATA *rawData,
- amdlibOI_ARRAY *array,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibGetOiTargetFromRawData(amdlibRAW_DATA *data,
- amdlibOI_TARGET *target);
-
-
-
-void amdlibSetUserPref(int code, amdlibDOUBLE value);
-
-/* Backward compatibility */
-#define amdlibExtractVisibilitiesFor amdlibComputeVisibilitiesFor
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /*!amdlibPublic_H*/
diff --git a/amber/amdlibArrayGeometry.c b/amber/amdlibArrayGeometry.c
deleted file mode 100644
index 106c4e4..0000000
--- a/amber/amdlibArrayGeometry.c
+++ /dev/null
@@ -1,367 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Function to handle the array geometry binary table.
- *
- * The ARRAY_GEOMETRY binary table gives the positions and characteristics of
- * the telescopes used in the observation.
- */
-
-#define _POSIX_SOURCE 1
-
-/*
- * System Headers
- */
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "fitsio.h"
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/*
- * Local function definition
- */
-static void amdlibFreeOiArray(amdlibOI_ARRAY *array);
-
-/**
- * Read information from ARRAY_GEOMETRY binary table and store it into the
- * amdlibOI_ARRAY structure.
- *
- * This function reads, from ARRAY_GEOMETRY binary table, positions and
- * characteristics of the telescopes used in observation. This mainly concerns
- * information related to :
- * \li the array center coordinates
- * \li the number of stations used
- * \li the telescope names
- * \li the telescope diameters
- * \li the station names
- * \li the station positions
- *
- * @param filePtr name of the FITS file containing IMAGING_DATA binary table.
- * @param arrayGeometry structure where array geometry information is stored.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibReadArrayGeometry (fitsfile *filePtr,
- amdlibOI_ARRAY *arrayGeometry,
- amdlibERROR_MSG errMsg)
-
-{
- int status = 0;
- char fitsioMsg[256];
- long nbRows;
- int station;
- int colnum;
- int anynull = 0;
-
- amdlibLogTrace("amdlibReadArrayGeometry()");
-
- /* Reset error message */
- memset(errMsg, '\0', sizeof(amdlibERROR_MSG));
-
- /* Clear 'ARRAY_GEOMETRY' data structure */
- amdlibReleaseOiArray(arrayGeometry);
-
- /* Go to the ARRAY_GEOMETRY binary table */
- if (fits_movnam_hdu(filePtr, BINARY_TBL, "ARRAY_GEOMETRY", 0, &status))
- {
- /* If ARRAY_GEOMETRY is not found, return. This means that VLTI was
- * ignored during this exposition. */
- /* amdlibLogWarning("No ARRAY_GEOMETRY table !"); */
- return amdlibSUCCESS;
- }
-
- /* Get number of rows */
- if (fits_get_num_rows(filePtr, &nbRows, &status))
- {
- amdlibReturnFitsError("nbStations");
- }
-
- /* Allocate structure array */
- if (amdlibAllocateOiArray(arrayGeometry, (int)nbRows, errMsg) !=
- amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- /* Get the array name */
- if(fits_read_key (filePtr, TSTRING, "ARRNAME", arrayGeometry->arrayName,
- NULL, &status))
- {
- amdlibReturnFitsError("ARRNAME");
- }
-
- if(fits_read_key (filePtr, TSTRING, "FRAME", arrayGeometry->coordinateFrame,
- NULL, &status))
- {
- amdlibReturnFitsError("FRAME");
- }
-
- /* Get the array position */
- if(fits_read_key (filePtr, TDOUBLE, "ARRAYX",
- &arrayGeometry->arrayCenterCoordinates[0],
- NULL, &status))
- {
- amdlibReturnFitsError("ARRAYX");
- }
-
- if(fits_read_key (filePtr, TDOUBLE, "ARRAYY",
- &arrayGeometry->arrayCenterCoordinates[1], NULL, &status))
- {
- amdlibReturnFitsError("ARRAYY");
- }
- /* correct ISS error if present (was present on Mars 2007) */
- if (arrayGeometry->arrayCenterCoordinates[1] >
- arrayGeometry->arrayCenterCoordinates[0])
- {
- arrayGeometry->arrayCenterCoordinates[2] =
- arrayGeometry->arrayCenterCoordinates[1];
- arrayGeometry->arrayCenterCoordinates[1] =
- arrayGeometry->arrayCenterCoordinates[0];
- arrayGeometry->arrayCenterCoordinates[0] =
- arrayGeometry->arrayCenterCoordinates[2];
- arrayGeometry->arrayCenterCoordinates[2] = 0.0;
- }
-
- if(fits_read_key (filePtr, TDOUBLE, "ARRAYZ",
- &arrayGeometry->arrayCenterCoordinates[2], NULL, &status))
- {
- amdlibReturnFitsError("ARRAYZ");
- }
-
- /* For each station */
- for (station=1; station<=arrayGeometry->nbStations; station++)
- {
- char *p;
-
- /* Get the telescope name */
- if(fits_get_colnum (filePtr, CASEINSEN, "TEL_NAME", &colnum,
- &status))
- {
- amdlibReturnFitsError("TEL_NAME");
- }
-
- p = arrayGeometry->element[station-1].telescopeName;
-
- if(fits_read_col (filePtr, TSTRING, colnum, station, 1, 1,
- NULL, &p, &anynull, &status))
- {
- amdlibReturnFitsError("TEL_NAME");
- }
-
- /* Get the station name */
- if(fits_get_colnum (filePtr, CASEINSEN, "STA_NAME", &colnum,
- &status))
- {
- amdlibReturnFitsError("STA_NAME");
- }
-
- p = arrayGeometry->element[station-1].stationName;
-
- if(fits_read_col (filePtr, TSTRING, colnum, station, 1, 1,
- NULL, &p, &anynull, &status))
- {
- amdlibReturnFitsError("STA_NAME");
- }
-
- /* Get the station index */
- if(fits_get_colnum (filePtr, CASEINSEN, "STA_INDEX", &colnum,
- &status))
- {
- amdlibReturnFitsError("STA_INDEX");
- }
-
- if(fits_read_col (filePtr, TINT, colnum, station, 1, 1, NULL,
- &arrayGeometry->element[station-1].stationIndex,
- &anynull, &status))
- {
- amdlibReturnFitsError("STA_INDEX");
- }
-
- /* Get the telescope diameter */
- if(fits_get_colnum (filePtr, CASEINSEN, "DIAMETER", &colnum,
- &status))
- {
- amdlibReturnFitsError("DIAMETER");
- }
-
- if(fits_read_col (filePtr, TDOUBLE, colnum, station, 1, 1, NULL,
- &arrayGeometry->element[station-1].elementDiameter,
- &anynull, &status))
- {
- amdlibReturnFitsError("DIAMETER");
- }
-
- /* Get the station position */
- if(fits_get_colnum (filePtr, CASEINSEN, "STAXYZ", &colnum,
- &status))
- {
- amdlibReturnFitsError("STAXYZ");
- }
-
- if(fits_read_col (filePtr, TDOUBLE, colnum, station, 1, 3, NULL,
- &arrayGeometry->element[station-1].stationCoordinates,
- &anynull, &status))
- {
- amdlibReturnFitsError("STAXYZ");
- }
-
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Retrieve OI array structure from the specified raw data
- *
- * @param rawData input raw data
- * @param array pointer to OI array
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibGetOiArrayFromRawData(amdlibRAW_DATA *rawData,
- amdlibOI_ARRAY *array,
- amdlibERROR_MSG errMsg)
-{
- int station;
-
- amdlibLogTrace("amdlibGetOiArrayFromRawData()");
-
- /* Allocate structure array */
- if (amdlibAllocateOiArray
- (array, rawData->arrayGeometry.nbStations, errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- /* Copy 'amdlibOI_ARRAY' data structure */
- strcpy(array->arrayName, rawData->arrayGeometry.arrayName);
- strcpy(array->coordinateFrame, rawData->arrayGeometry.coordinateFrame);
- array->arrayCenterCoordinates[0] =
- rawData->arrayGeometry.arrayCenterCoordinates[0];
- array->arrayCenterCoordinates[1] =
- rawData->arrayGeometry.arrayCenterCoordinates[1];
- array->arrayCenterCoordinates[2] =
- rawData->arrayGeometry.arrayCenterCoordinates[2];
-
- for (station = 0; station < array->nbStations; station++)
- {
- strcpy(array->element[station].telescopeName,
- rawData->arrayGeometry.element[station].telescopeName);
- strcpy(array->element[station].stationName,
- rawData->arrayGeometry.element[station].stationName);
- array->element[station].stationIndex =
- rawData->arrayGeometry.element[station].stationIndex;
- array->element[station].elementDiameter =
- rawData->arrayGeometry.element[station].elementDiameter;
- array->element[station].stationCoordinates[0] =
- rawData->arrayGeometry.element[station].stationCoordinates[0];
- array->element[station].stationCoordinates[1] =
- rawData->arrayGeometry.element[station].stationCoordinates[1];
- array->element[station].stationCoordinates[2] =
- rawData->arrayGeometry.element[station].stationCoordinates[2];
- }
-
- return amdlibSUCCESS;
-}
-
-/*
- * Protected functions
- */
-/**
- * Allocate memory for storing information of OI array.
- *
- * This function allocates memory for storing information of N stations.
- *
- * @param array pointer to amdlibOI_ARRAY structure.
- * @param nbElements number of stations
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAllocateOiArray(amdlibOI_ARRAY *array,
- const int nbElements,
- amdlibERROR_MSG errMsg)
-{
- amdlibLogTrace("amdlibAllocateOiArray()");
-
- /* First free previous allocated memory */
- if (array->thisPtr == array)
- {
- amdlibFreeOiArray(array);
- }
-
- /* Init data structure */
- array->thisPtr = memset(array, '\0', sizeof(*array));
- /* Set array size */
- array->nbStations = nbElements;
-
- /* Allocate table pointer list */
- array->element = calloc(nbElements, sizeof(*(array->element)));
- if (array->element == NULL)
- {
- amdlibFreeOiArray(array);
- amdlibSetErrMsg("%s OI array : %ld required", amdlibERR_ALLOC_MEM,
- (long)(nbElements * sizeof(*(array->element))));
- return amdlibFAILURE;
- }
- /* Return */
- return amdlibSUCCESS;
-}
-
-/**
- * Release memory allocated to store OI array, and reset the structure members
- * to zero.
- *
- * @param array pointer to amdlibOI_ARRAY structure.
- */
-void amdlibReleaseOiArray(amdlibOI_ARRAY *array)
-{
- amdlibLogTrace("amdlibReleaseOiArray()");
-
- amdlibFreeOiArray(array);
- memset (array, '\0', sizeof(amdlibOI_ARRAY));
-}
-
-/*
- * Local functions
- */
-/**
- * Free memory allocated for OI array.
- *
- * This function frees memory allocated to store array information.
- *
- * @param array pointer to amdlibOI_ARRAY structure.
- */
-void amdlibFreeOiArray(amdlibOI_ARRAY *array)
-{
- amdlibLogTrace("amdlibFreeOiArray()");
-
- /* Check thisPtr and do nothing if unitialized*/
- if (array->thisPtr != array)
- {
- return;
- }
- if (array->element != NULL)
- {
- free(array->element);
- }
- memset (array, '\0', sizeof(*array));
-
-}
-
-/*___oOo___*/
diff --git a/amber/amdlibBadPixels.c b/amber/amdlibBadPixels.c
deleted file mode 100644
index e208b5e..0000000
--- a/amber/amdlibBadPixels.c
+++ /dev/null
@@ -1,370 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Functions to handle bad pixel map.
- *
- * The bad pixel map contains for each pixel a flag (1 = good pixel, 0 = bad
- * pixel). All pixel marked as bad has to be ignored but the values for that
- * pixels can be interpolated from the values of the surrounding pixels.
- */
-
-#define _POSIX_SOURCE 1
-
-/*
- * System Headers
- */
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "fitsio.h"
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/*
- * Global variables
- */
-static amdlibBAD_PIXEL_MAP amdlibBadPixelMap = {amdlibFALSE};
-
-/*
- * Public functions
- */
-/**
- * Set bad pixel map to the given value.
- *
- * This function set all flags of the bad pixel map to the given value; if set
- * to true (amdlibTRUE) all pixels are marked as good, otherwise they are marked
- * as bad.
- *
- * @param flag indicates whether all pixels are good or bad.
- *
- * @return
- * Always return amdlibSUCCESS
- */
-amdlibCOMPL_STAT amdlibSetBadPixelMap(amdlibBOOLEAN flag)
-{
- int x, y;
- int pixelFlag;
-
- amdlibLogTrace("amdlibSetBadPixelMap()");
-
- if (flag == amdlibTRUE)
- {
- pixelFlag = amdlibGOOD_PIXEL_FLAG;
- }
- else
- {
- pixelFlag = amdlibBAD_PIXEL_FLAG;
- }
-
- /* Set all pixel flags to the given value */
- for (y = 0; y < amdlibDET_SIZE_Y; y++)
- {
- for (x = 0; x < amdlibDET_SIZE_X; x++)
- {
- amdlibBadPixelMap.data[y][x] = pixelFlag;
- }
- }
- amdlibBadPixelMap.mapIsInitialized = amdlibTRUE;
-
- return amdlibSUCCESS;
-}
-
-/**
- * Load bad pixel map from file.
- *
- * This function load the bad pixel map from file.
- *
- * @param filename name of the FITS file containing bad pixel map.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibLoadBadPixelMap(const char *filename,
- amdlibERROR_MSG errMsg)
-{
- struct stat statBuf;
- char fitsioMsg[256];
- fitsfile *filePtr;
- int status = 0, nbFound;
- long nAxes[2];
- int anynull = 0;
- amdlibDOUBLE nullval;
-
- amdlibLogTrace("amdlibLoadBadPixelMap()");
-
- /* Check the file exists */
- if (stat(filename, &statBuf) != 0)
- {
- amdlibSetErrMsg("File '%.80s' does not exist", filename);
- return amdlibFAILURE;
- }
-
- /* Open FITS file */
- if (fits_open_file(&filePtr, filename, READONLY, &status) != 0)
- {
- amdlibReturnFitsError(filename);
- }
-
- /* Check file type (if given in header) */
- char dprType[256];
- char comment[amdlibKEYW_CMT_LEN+1];
- if (fits_read_key(filePtr, TSTRING, "HIERARCH ESO DPR TYPE", dprType,
- comment, &status))
- {
- status = 0;
- strcpy(dprType , "BADPIX");
- }
- if (strncmp(dprType, "BADPIX", strlen("BADPIX")) != 0)
- {
- amdlibSetErrMsg("Invalid file type '%s' : must be BADPIX", dprType);
- return amdlibFAILURE;
- }
-
- /* Read the NAXIS1 and NAXIS2 keyword to get image size */
- if (fits_read_keys_lng(filePtr, "NAXIS", 1, 2,
- nAxes, &nbFound, &status) != 0)
- {
- amdlibGetFitsError("NAXIS");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- /* Check bad pixel map size */
- if (nAxes[0] != amdlibDET_SIZE_X)
- {
- fits_close_file(filePtr, &status);
- amdlibSetErrMsg("Invalid number of pixels in X direction %ld : "
- "should be %d", nAxes[0], amdlibDET_SIZE_X);
- return amdlibFAILURE;
- }
- if (nAxes[1] != amdlibDET_SIZE_Y)
- {
- fits_close_file(filePtr, &status);
- amdlibSetErrMsg("Invalid number of pixels in Y direction %ld : "
- "should be %d", nAxes[1], amdlibDET_SIZE_Y);
- return amdlibFAILURE;
- }
-
- /* Read 'imaging detector header' */
- nullval = 0; /* Don't check for null values in the image */
- if (fits_read_img(filePtr, TDOUBLE, 1, nAxes[0]*nAxes[1], &nullval,
- amdlibBadPixelMap.data, &anynull, &status) != 0)
- {
- amdlibGetFitsError("Reading map");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- /* Close the FITS file */
- if (fits_close_file(filePtr, &status) != 0)
- {
- amdlibReturnFitsError(filename);
- }
-
- amdlibBadPixelMap.mapIsInitialized = amdlibTRUE;
- return amdlibSUCCESS;
-}
-
-/*
- * Protected functions
- */
-/**
- * Get the current bad pixel map.
- *
- * This function returns the bad pixel map. If there is no bad pixel map loaded
- * or set, a perfect (all pixel set to good) bad pixel map is loaded.
- *
- * @return pointer to the current bad pixel or NULL if no "real" bad pixel map
- * is available
- */
-amdlibBAD_PIXEL_MAP *amdlibGetBadPixelMap(void)
-{
- amdlibLogTrace("amdlibGetBadPixelMap()");
-
- /* If map is not loaded, assume that all pixels are good */
- if (amdlibBadPixelMap.mapIsInitialized == amdlibFALSE)
- {
- if (amdlibSetBadPixelMap(amdlibGOOD_PIXEL_FLAG) != amdlibSUCCESS)
- {
- return NULL;
- }
- else
- {
- amdlibBadPixelMap.mapIsInitialized = amdlibTRUE;
- }
- }
-
- return &amdlibBadPixelMap;
-}
-
-/**
- * Get bad pixel flags for a given region.
- *
- * This function returns from the bad pixel map, the flags for the given region.
- * If there is no bad pixel map loaded or set, a perfect (all pixel set to good)
- * bad pixel map is loaded.
- *
- * @param startPixelX[0..511] origin of the region along X axis
- * @param startPixelY[0..511] origin of the region along Y axis
- * @param nbPixelX width of the region
- * @param nbPixelY height of the region
- * @param errMsg error description message returned if function fails.
- *
- * @return bad pixel flags for the given region.
- */
-amdlibDOUBLE **amdlibGetBadPixelMapRegion(int startPixelX,
- int startPixelY,
- int nbPixelX,
- int nbPixelY,
- amdlibERROR_MSG errMsg)
-{
- static amdlibDOUBLE **badPixelRegion = NULL;
- int x;
- int y;
-
- amdlibLogTrace("amdlibGetBadPixelMapRegion()");
-
- /* Check origin [0..511] */
- if ((startPixelX < 0) || (startPixelX >= amdlibDET_SIZE_X) ||
- (startPixelY < 0) || (startPixelY >= amdlibDET_SIZE_Y))
- {
- amdlibSetErrMsg("Origin (%d, %d) is out of range",
- startPixelX, startPixelY);
- return NULL;
- }
-
- /* Check region dimension */
- if ((nbPixelX < 0) || (startPixelX + nbPixelX) > amdlibDET_SIZE_X)
- {
- amdlibSetErrMsg("Invalid region width %d : should be in [0..%d]",
- nbPixelX, (amdlibDET_SIZE_X - startPixelX));
- return NULL;
- }
- if ((nbPixelY < 0) || (startPixelY + nbPixelY) > amdlibDET_SIZE_Y)
- {
- amdlibSetErrMsg("Invalid region height %d : should be in [0..%d]",
- nbPixelY, (amdlibDET_SIZE_Y - startPixelY));
- return NULL;
- }
-
- /* If map is not loaded, assume that all pixels are good */
- if (amdlibBadPixelMap.mapIsInitialized == amdlibFALSE)
- {
- if (amdlibSetBadPixelMap(amdlibGOOD_PIXEL_FLAG) != amdlibSUCCESS)
- {
- return NULL;
- }
- else
- {
- amdlibBadPixelMap.mapIsInitialized = amdlibTRUE;
- }
- }
-
- /* Allocate memory to store bad pixel flags corresponding to the given
- * region */
- badPixelRegion = amdlibAlloc2DArrayDouble(nbPixelX, nbPixelY, errMsg);
- if (badPixelRegion != NULL)
- {
- /* Get flags for the pixels belonging to the region */
- for (y = 0; y < nbPixelY; y++)
- {
- for (x = 0; x < nbPixelX; x++)
- {
- badPixelRegion[y][x] =
- amdlibBadPixelMap.data[startPixelY + y][startPixelX + x];
- }
- }
- }
- return badPixelRegion;
-}
-
-/**
- * Update bad pixel flags for a given region.
- *
- * This function modifies in the current bad pixel map the flags for
- * the given region. If there is no bad pixel map loaded or set, a
- * perfect (all pixel set to good) bad pixel map is created, and the
- * region is updated.
- *
- * @param startPixelX origin of the region along X axis
- * @param startPixelY origin of the region along Y axis
- * @param nbPixelX width of the region
- * @param nbPixelY height of the region
- * @param mask a 2d array of double values 0(bad) and 1(good) for the region
- * @param errMsg error description message returned if function fails.
- *
- * @return Completion Status.
- */
- amdlibCOMPL_STAT amdlibUpdateBadPixelMap(int startPixelX,
- int startPixelY,
- int nbPixelX,
- int nbPixelY,
- amdlibDOUBLE **mask,
- amdlibERROR_MSG errMsg)
-{
- int x;
- int y;
-
- amdlibLogTrace("amdlibUpdateBadPixelMap()");
-
- /* Check origin [0..511] */
- if ((startPixelX < 0) || (startPixelX >= amdlibDET_SIZE_X) ||
- (startPixelY < 0) || (startPixelY >= amdlibDET_SIZE_Y))
- {
- amdlibSetErrMsg("Origin (%d, %d) is out of range",
- startPixelX, startPixelY);
- return amdlibFAILURE;
- }
-
- /* Check region dimension */
- if ((nbPixelX < 0) || (startPixelX + nbPixelX) > amdlibDET_SIZE_X)
- {
- amdlibSetErrMsg("Invalid region width %d : should be in [0..%d]",
- nbPixelX, (amdlibDET_SIZE_X - startPixelX));
- return amdlibFAILURE;
- }
- if ((nbPixelY < 0) || (startPixelY + nbPixelY) > amdlibDET_SIZE_Y)
- {
- amdlibSetErrMsg("Invalid region height %d : should be in [0..%d]",
- nbPixelY, (amdlibDET_SIZE_Y - startPixelY));
- return amdlibFAILURE;
- }
-
- /* If map is not loaded, create one with all pixels good */
- if (amdlibBadPixelMap.mapIsInitialized == amdlibFALSE)
- {
- if (amdlibSetBadPixelMap(amdlibGOOD_PIXEL_FLAG) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- else
- {
- amdlibBadPixelMap.mapIsInitialized = amdlibTRUE;
- }
- }
-
- /* Update bad pixel flags in the given region */
- for (y = 0; y < nbPixelY; y++)
- {
- for (x = 0; x < nbPixelX; x++)
- {
- if (mask[y][x]==0.0)
- {
- /* if(amdlibBadPixelMap.data[startPixelY + y][startPixelX + x]==0.0) amdlibLogInfo("bad pixel confirmed at %d %d",startPixelX + x+1,startPixelY + y +1); */
- amdlibBadPixelMap.data[startPixelY + y][startPixelX + x]=0.0;
- }
- }
- }
- return amdlibSUCCESS;
-}
-
-/*___oOo___*/
diff --git a/amber/amdlibClosurePhases.c b/amber/amdlibClosurePhases.c
deleted file mode 100644
index 75f93e8..0000000
--- a/amber/amdlibClosurePhases.c
+++ /dev/null
@@ -1,535 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Useful functions related to closure phases.
- */
-
-#define _POSIX_SOURCE 1
-
-/*
- * System Headers
- */
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include "fitsio.h"
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-
-/** Useful macro to free all dynamically allocated structures */
-#define amdlibComputeClosurePhases_FREEALL() \
- amdlibFree2DArrayWrapping((void **)tablePtr); \
- amdlibFree2DArrayWrapping((void **)table3Ptr);
-/**
- * Compute closure phases.
- *
- * This function computes the closure phases, averaged over a bin,
- * from a bin of instantaneous correlated fluxes.
- *
- * @param instantCorrFlux instantaneous bin of correlated flux.
- * @param selectedFrames structure containing information relative to frame
- * selection. By default, all frames are selected.
- * @param vis3 data structure (binned) where results are stored.
- * @param iBin index of the result in the output vis3 structure.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-
-amdlibCOMPL_STAT amdlibComputeClosurePhases(/* Input */
- amdlibVIS *instantCorrFlux,
- int iBin,
- amdlibBAND band,
- amdlibSELECTION *selectedFrames,
- amdlibERROR_TYPE errorType,
- /* Output */
- amdlibVIS3 *vis3,
- amdlibERROR_MSG errMsg)
-{
- double Re_bispectrum = 0.0;
- double Im_bispectrum = 0.0;
- double Sigma2_bispectrum_re = 0.0;
- double Sigma2_bispectrum_im = 0.0;
- double Re2_bispectrum = 0.0;
- double Im2_bispectrum = 0.0;
- double Re4Im4_bispectrum = 0.0;
- double R, I, s2R, s2I, R12, R23, R13, I12, I23, I13;
- double s2R12, s2R23, s2R13, s2I12, s2I23, s2I13;
- double val;
-
- int iClos;
- int lVis;
- int nbClos = vis3->nbClosures;
- int nbWlen = vis3->nbWlen;
- int nbBases = instantCorrFlux->nbBases;
- int nbOkFrames = selectedFrames->band[band].nbFramesOkForClosure;
-
- int iFrame, nbGoodFrames, i;
- amdlibVIS_TABLE_ENTRY **tablePtr = NULL;
- amdlibVIS3_TABLE_ENTRY **table3Ptr = NULL;
-
- amdlibLogTrace("amdlibComputeClosurePhases()");
-
- /* Wrap instantCorrFlux->table structure to easy the reading of the code*/
- tablePtr =
- (amdlibVIS_TABLE_ENTRY **)amdlibWrap2DArray(instantCorrFlux->table,
- nbBases,
- instantCorrFlux->nbFrames,
- sizeof(amdlibVIS_TABLE_ENTRY),
- errMsg);
- if (tablePtr == NULL)
- {
- amdlibComputeClosurePhases_FREEALL();
- return amdlibFAILURE;
- }
-
- table3Ptr =
- (amdlibVIS3_TABLE_ENTRY **)amdlibWrap2DArray(vis3->table,
- nbClos, vis3->nbFrames,
- sizeof(amdlibVIS3_TABLE_ENTRY),
- errMsg);
- if (table3Ptr == NULL)
- {
- amdlibComputeClosurePhases_FREEALL();
- return amdlibFAILURE;
- }
-
- for (iClos = 0; iClos < nbClos; iClos++)
- {
- for (lVis = 0; lVis < nbWlen; lVis++)
- { /* begin loop for lVis */
-
- Re_bispectrum = 0.0;
- Im_bispectrum = 0.0;
- Re2_bispectrum = 0.0;
- Im2_bispectrum = 0.0;
- Re4Im4_bispectrum = 0.0;
- Sigma2_bispectrum_re = 0.0;
- Sigma2_bispectrum_im = 0.0;
-
- nbGoodFrames=0;
- for (i = 0; i < nbOkFrames; i++)
- {
- /* Whatever whether one, two or three good frames were selected,
- * we need to test the goodness of each individual visibility using its flag,
- * all the 3 visibilities needing to be unflagged. */
- iFrame = selectedFrames->band[band].frameOkForClosure[i];
-
- if (tablePtr[iFrame][0].flag[lVis] == amdlibFALSE &&
- tablePtr[iFrame][1].flag[lVis] == amdlibFALSE &&
- tablePtr[iFrame][2].flag[lVis] == amdlibFALSE)
- {
- nbGoodFrames++;
- R12 = tablePtr[iFrame][0].vis[lVis].re;
- R23 = tablePtr[iFrame][1].vis[lVis].re;
- R13 = tablePtr[iFrame][2].vis[lVis].re;
- I12 = tablePtr[iFrame][0].vis[lVis].im;
- I23 = tablePtr[iFrame][1].vis[lVis].im;
- I13 = tablePtr[iFrame][2].vis[lVis].im;
- s2R12 = tablePtr[iFrame][0].sigma2Vis[lVis].re;
- s2R23 = tablePtr[iFrame][1].sigma2Vis[lVis].re;
- s2R13 = tablePtr[iFrame][2].sigma2Vis[lVis].re;
- s2I12 = tablePtr[iFrame][0].sigma2Vis[lVis].im;
- s2I23 = tablePtr[iFrame][1].sigma2Vis[lVis].im;
- s2I13 = tablePtr[iFrame][2].sigma2Vis[lVis].im;
-
- val = R12*R23*R13 - I12*I23*R13 + I12*R23*I13 + R12*I23*I13;
-
- Re_bispectrum += val;
- Re2_bispectrum += amdlibPow2(val);
- Re4Im4_bispectrum += amdlibPow2(val*val);
- val = I12*I23*I13 - R12*R23*I13 + R12*I23*R13 + I12*R23*R13;
- Im_bispectrum += val;
- Im2_bispectrum += amdlibPow2(val);
- Re4Im4_bispectrum += amdlibPow2(val*val);
-
- if ((errorType == amdlibTHEORETICAL_ERROR)||
- (errorType == amdlibSTATISTICAL_ERROR))
- /* FIXME -- PLEASE MODIFY BELOW TO ADD PROPER
- * STATISTICAL ERROR TRETAMENT (action FM)
- */
- {
- /* Please have a look to the F. Millour thesis
- (http://tel.archives-ouvertes.fr/tel-00134268),
- pp.84-85 (eq. 4.34 and 4.35) */
- Sigma2_bispectrum_re +=
- s2R12 * (amdlibPow2(R23*R13) + amdlibPow2(I23*I13)) +
- s2R23 * (amdlibPow2(R12*R13) + amdlibPow2(I12*I13)) +
- s2R13 * (amdlibPow2(R12*R23) + amdlibPow2(I12*I23)) +
- s2I12 * (amdlibPow2(I23*R13) + amdlibPow2(R23*I13)) +
- s2I23 * (amdlibPow2(I12*R13) + amdlibPow2(R12*I13)) +
- s2I13 * (amdlibPow2(I23*R12) + amdlibPow2(R23*I12));
-
- Sigma2_bispectrum_im +=
- s2I12 * (amdlibPow2(R23*R13) + amdlibPow2(I23*I13)) +
- s2I23 * (amdlibPow2(R12*R13) + amdlibPow2(I12*I13)) +
- s2I13 * (amdlibPow2(I12*I23) + amdlibPow2(R12*R23)) +
- s2R12 * (amdlibPow2(R23*I13) + amdlibPow2(I23*R13)) +
- s2R23 * (amdlibPow2(R12*I13) + amdlibPow2(I12*R13)) +
- s2R13 * (amdlibPow2(I12*R23) + amdlibPow2(R12*I23));
- }
- else if(errorType == amdlibSTATISTICAL_ERROR)
- {
- Sigma2_bispectrum_re += 0;
- Sigma2_bispectrum_im += 0;
- }
- }
- }
-
- if (nbGoodFrames != 0)
- {
- Re_bispectrum /= nbGoodFrames;
- Im_bispectrum /= nbGoodFrames;
- Re2_bispectrum /= nbGoodFrames;
- Im2_bispectrum /= nbGoodFrames;
- Re4Im4_bispectrum /= nbGoodFrames;
- Sigma2_bispectrum_re /= nbGoodFrames;
- Sigma2_bispectrum_im /= nbGoodFrames;
-
- R = Re_bispectrum;
- I = Im_bispectrum;
- s2R = Sigma2_bispectrum_re;
- s2I = Sigma2_bispectrum_im;
-
- table3Ptr[iBin][iClos].vis3Amplitude[lVis] =
- sqrt(R*R + I*I);
- table3Ptr[iBin][iClos].vis3Phi[lVis] =
- atan2(I,R);
-
- table3Ptr[iBin][iClos].vis3AmplitudeError[lVis] =
- 1 / (R*R + I*I) *R*R*s2R +
- 1 / (R*R+I*I) *I*I*s2I;
-
- /* Please have a look to the F. Millour thesis
- (http://tel.archives-ouvertes.fr/tel-00134268),
- pp.55-57 (eq 3.28) and pp.84-85 (eq 4.36 where a typo error
- removed the M factor) */
- table3Ptr[iBin][iClos].vis3PhiError[lVis] =
- sqrt( (s2R * Im2_bispectrum + s2I * Re2_bispectrum) /
- Re4Im4_bispectrum );
- table3Ptr[iBin][iClos].flag[lVis] = amdlibFALSE;
- }
- else
- {
- table3Ptr[iBin][iClos].vis3Amplitude[lVis] = amdlibBLANKING_VALUE;
- table3Ptr[iBin][iClos].vis3Phi[lVis] = amdlibBLANKING_VALUE;
-
- table3Ptr[iBin][iClos].flag[lVis] = amdlibTRUE;
- }
- }
- }
-
- amdlibComputeClosurePhases_FREEALL();
- return amdlibSUCCESS;
-}
-#undef amdlibComputeClosurePhases_FREEALL
-
-
-/** Useful macro to free all dynamically allocated structures */
-#define amdlibBinClosurePhases_FREEALL() \
- amdlibFree2DArrayWrapping((void **)tablePtr); \
- amdlibFree2DArrayWrapping((void **)table3Ptr);
-/**
- * Bin closure phases.
- *
- * This function computes the closure phases, averaged over a bin,
- * from a bin of instantaneous correlated fluxes.
- *
- * @param instantCorrFlux instantaneous bin of correlated flux.
- * @param selectedFrames structure containing information relative to frame
- * selection. By default, all frames are selected.
- * @param vis3 data structure (binned) where results are stored.
- * @param iBin index of the result in the output vis3 structure.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-
-amdlibCOMPL_STAT amdlibBinClosurePhases(/* Input */
- amdlibVIS *instantCorrFlux,
- int firstFrame,
- int nbFrames,
- int iBin,
- amdlibBAND band,
- amdlibERROR_TYPE errorType,
- /* Output */
- amdlibVIS3 *vis3,
- amdlibERROR_MSG errMsg)
-{
- double Re_bispectrum = 0.0;
- double Im_bispectrum = 0.0;
- double Sigma2_bispectrum_re = 0.0;
- double Sigma2_bispectrum_im = 0.0;
- double Re2_bispectrum = 0.0;
- double Im2_bispectrum = 0.0;
- double Re4Im4_bispectrum = 0.0;
- double R, I, s2R, s2I, R12, R23, R13, I12, I23, I13;
- double s2R12, s2R23, s2R13, s2I12, s2I23, s2I13;
- double val;
-
- int iClos;
- int lVis;
- int nbClos = vis3->nbClosures;
- int nbWlen = vis3->nbWlen;
- int nbBases = instantCorrFlux->nbBases;
-
- int iFrame, runningFrame,nbGoodFrames;
- amdlibVIS_TABLE_ENTRY **tablePtr = NULL;
- amdlibVIS3_TABLE_ENTRY **table3Ptr = NULL;
-
- amdlibLogTrace("amdlibBinClosurePhases()");
-
- /* Wrap instantCorrFlux->table structure to easy the reading of the code*/
- tablePtr =
- (amdlibVIS_TABLE_ENTRY **)amdlibWrap2DArray(instantCorrFlux->table,
- nbBases,
- instantCorrFlux->nbFrames,
- sizeof(amdlibVIS_TABLE_ENTRY),
- errMsg);
- if (tablePtr == NULL)
- {
- amdlibBinClosurePhases_FREEALL();
- return amdlibFAILURE;
- }
-
- table3Ptr =
- (amdlibVIS3_TABLE_ENTRY **)amdlibWrap2DArray(vis3->table,
- nbClos, vis3->nbFrames,
- sizeof(amdlibVIS3_TABLE_ENTRY),
- errMsg);
- if (table3Ptr == NULL)
- {
- amdlibBinClosurePhases_FREEALL();
- return amdlibFAILURE;
- }
-
- for (iClos = 0; iClos < nbClos; iClos++)
- {
- for (lVis = 0; lVis < nbWlen; lVis++)
- { /* begin loop for lVis */
-
- Re_bispectrum = 0.0;
- Im_bispectrum = 0.0;
- Re2_bispectrum = 0.0;
- Im2_bispectrum = 0.0;
- Re4Im4_bispectrum = 0.0;
- Sigma2_bispectrum_re = 0.0;
- Sigma2_bispectrum_im = 0.0;
-
- nbGoodFrames=0;
- for (iFrame = 0, runningFrame=firstFrame; iFrame < nbFrames;
- iFrame++, runningFrame++)
- {
- if (tablePtr[runningFrame][0].flag[lVis] == amdlibFALSE &&
- tablePtr[runningFrame][1].flag[lVis] == amdlibFALSE &&
- tablePtr[runningFrame][2].flag[lVis] == amdlibFALSE)
- {
- nbGoodFrames++;
- R12 = tablePtr[runningFrame][0].vis[lVis].re;
- R23 = tablePtr[runningFrame][1].vis[lVis].re;
- R13 = tablePtr[runningFrame][2].vis[lVis].re;
- I12 = tablePtr[runningFrame][0].vis[lVis].im;
- I23 = tablePtr[runningFrame][1].vis[lVis].im;
- I13 = tablePtr[runningFrame][2].vis[lVis].im;
- s2R12 = tablePtr[runningFrame][0].sigma2Vis[lVis].re;
- s2R23 = tablePtr[runningFrame][1].sigma2Vis[lVis].re;
- s2R13 = tablePtr[runningFrame][2].sigma2Vis[lVis].re;
- s2I12 = tablePtr[runningFrame][0].sigma2Vis[lVis].im;
- s2I23 = tablePtr[runningFrame][1].sigma2Vis[lVis].im;
- s2I13 = tablePtr[runningFrame][2].sigma2Vis[lVis].im;
-
- val = R12*R23*R13 - I12*I23*R13 + I12*R23*I13 + R12*I23*I13;
- Re_bispectrum += val;
- Re2_bispectrum += amdlibPow2(val);
- Re4Im4_bispectrum += amdlibPow2(val*val);
-
- val = I12*I23*I13 - R12*R23*I13 + R12*I23*R13 + I12*R23*R13;
- Im_bispectrum += val;
- Im2_bispectrum += amdlibPow2(val);
- Re4Im4_bispectrum += amdlibPow2(val*val);
-
- if ((errorType == amdlibTHEORETICAL_ERROR)||
- (errorType == amdlibSTATISTICAL_ERROR))
- /* FIXME -- PLEASE MODIFY BELOW TO ADD PROPER
- * STATISTICAL ERROR TRETAMENT (action FM)
- */
- {
- /* Please have a look to the F. Millour thesis
- (http://tel.archives-ouvertes.fr/tel-00134268),
- pp.84-85 (eq. 4.34 and 4.35) */
- Sigma2_bispectrum_re +=
- s2R12 * (amdlibPow2(R23*R13) + amdlibPow2(I23*I13)) +
- s2R23 * (amdlibPow2(R12*R13) + amdlibPow2(I12*I13)) +
- s2R13 * (amdlibPow2(R12*R23) + amdlibPow2(I12*I23)) +
- s2I12 * (amdlibPow2(I23*R13) + amdlibPow2(R23*I13)) +
- s2I23 * (amdlibPow2(I12*R13) + amdlibPow2(R12*I13)) +
- s2I13 * (amdlibPow2(I23*R12) + amdlibPow2(R23*I12));
-
- Sigma2_bispectrum_im +=
- s2I12 * (amdlibPow2(R23*R13) + amdlibPow2(I23*I13)) +
- s2I23 * (amdlibPow2(R12*R13) + amdlibPow2(I12*I13)) +
- s2I13 * (amdlibPow2(I12*I23) + amdlibPow2(R12*R23)) +
- s2R12 * (amdlibPow2(R23*I13) + amdlibPow2(I23*R13)) +
- s2R23 * (amdlibPow2(R12*I13) + amdlibPow2(I12*R13)) +
- s2R13 * (amdlibPow2(I12*R23) + amdlibPow2(R12*I23));
- }
- else if(errorType == amdlibSTATISTICAL_ERROR)
- {
- Sigma2_bispectrum_re += 0;
- Sigma2_bispectrum_im += 0;
- }
- }
- }
- if (nbGoodFrames>0)
- {
- Re_bispectrum /= nbGoodFrames;
- Im_bispectrum /= nbGoodFrames;
- Re2_bispectrum /= nbGoodFrames;
- Im2_bispectrum /= nbGoodFrames;
- Re4Im4_bispectrum /= nbGoodFrames;
- Sigma2_bispectrum_re /= nbGoodFrames;
- Sigma2_bispectrum_im /= nbGoodFrames;
-
- R = Re_bispectrum;
- I = Im_bispectrum;
- s2R = Sigma2_bispectrum_re;
- s2I = Sigma2_bispectrum_im;
-
- table3Ptr[iBin][iClos].vis3Amplitude[lVis] =
- sqrt(R*R + I*I);
- table3Ptr[iBin][iClos].vis3Phi[lVis] =
- atan2(I,R);
-
- table3Ptr[iBin][iClos].vis3AmplitudeError[lVis] =
- 1 / (R*R + I*I) *R*R*s2R +
- 1 / (R*R+I*I) *I*I*s2I;
-
- /* Please have a look to the F. Millour thesis
- (http://tel.archives-ouvertes.fr/tel-00134268),
- pp.55-57 (eq 3.28) and pp.84-85 (eq 4.36 where a typo error
- removed the M factor) */
- table3Ptr[iBin][iClos].vis3PhiError[lVis] =
- sqrt( (s2R * Im2_bispectrum + s2I * Re2_bispectrum) /
- Re4Im4_bispectrum );
- table3Ptr[iBin][iClos].flag[lVis] = amdlibFALSE;
- }
- else
- {
- table3Ptr[iBin][iClos].vis3Amplitude[lVis] = amdlibBLANKING_VALUE;
- table3Ptr[iBin][iClos].vis3Phi[lVis] = amdlibBLANKING_VALUE;
-
- table3Ptr[iBin][iClos].flag[lVis] = amdlibTRUE;
- }
- }
- }
-
- amdlibBinClosurePhases_FREEALL();
- return amdlibSUCCESS;
-}
-#undef amdlibBinClosurePhases_FREEALL
-
-
-/**
- * Computes a crude weighted average of all closures phase in a closure
- * phase structure.
- *
- * @param vis3 input/output: closure structure, where averaged values are
- * writen in member "averageClosure".
- */
-void amdlibAverageClosurePhases(amdlibVIS3 *vis3)
-{
- double spectralClosurePhase[amdlibNB_SPECTRAL_CHANNELS];
- double spectralClosurePhaseErr[amdlibNB_SPECTRAL_CHANNELS];
- double averageClosurePhase;
- double averageClosurePhaseErr;
- double c,e;
-
- int iClos;
- int lVis;
- int iFrame;
- const int nbClos = 1; /* Number of Closures FIXED */
- int nbWlen = vis3->nbWlen;
- int nbFrames = vis3->nbFrames;
- int nbGoodClos = 0;
- int nc = 0;
-
- amdlibLogTrace("amdlibAverageClosurePhases()");
-
- amdlibVIS3_TABLE_ENTRY **table3Ptr = NULL;
- static amdlibERROR_MSG errMsg;
-
- table3Ptr =
- (amdlibVIS3_TABLE_ENTRY **)amdlibWrap2DArray(vis3->table,
- nbClos, nbFrames,
- sizeof(amdlibVIS3_TABLE_ENTRY),
- errMsg);
- if (table3Ptr == NULL)
- {
- amdlibFree2DArrayWrapping((void **)table3Ptr);
- }
-
- averageClosurePhase = 0;
- averageClosurePhaseErr = 0;
- for (iClos = 0; iClos < nbClos; iClos++)
- {
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- nc = 0;
- spectralClosurePhase[lVis] = 0;
- spectralClosurePhaseErr[lVis] = 0;
- for (iFrame = 0; iFrame < nbFrames; iFrame++)
- {
- if (table3Ptr[iFrame][iClos].flag[lVis]==amdlibFALSE)
- {
- c = table3Ptr[iFrame][iClos].vis3Phi[lVis];
- e = table3Ptr[iFrame][iClos].vis3PhiError[lVis];
- spectralClosurePhase[lVis] +=
- table3Ptr[iFrame][iClos].vis3Phi[lVis];
- spectralClosurePhaseErr[lVis] +=
- table3Ptr[iFrame][iClos].vis3PhiError[lVis];
- nc++;
- }
- }
- if (nc>0)
- {
- spectralClosurePhase[lVis] /= nc;
- spectralClosurePhaseErr[lVis] /= nc;
- averageClosurePhase += spectralClosurePhase[lVis];
- averageClosurePhaseErr += spectralClosurePhaseErr[lVis];
- nbGoodClos++;
- }
- else
- {
- spectralClosurePhase[lVis] = amdlibBLANKING_VALUE;
- spectralClosurePhaseErr[lVis] = amdlibBLANKING_VALUE;
- }
- }
- if (nbGoodClos>0)
- {
- vis3->averageClosure = averageClosurePhase / nbGoodClos;
- vis3->averageClosureError = averageClosurePhaseErr /
- nbGoodClos;
- }
- else
- {
- vis3->averageClosure = amdlibBLANKING_VALUE;
- vis3->averageClosureError = amdlibBLANKING_VALUE;
- }
- }
- amdlibFree2DArrayWrapping((void **)table3Ptr);
-}
-
-
-/*___oOo___*/
diff --git a/amber/amdlibDark.c b/amber/amdlibDark.c
deleted file mode 100644
index 0f99d4b..0000000
--- a/amber/amdlibDark.c
+++ /dev/null
@@ -1,746 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Functions to handle dark current values.
- *
- * The dark maps are needed in order to compensate for detector effects.
- * These maps are made by calculating an average image out of a sequence of raw
- * uncalibrated data. A dark map is only validate for a specific subwindow
- * setup and exposure time. Normally a sequence of SKY images are used to
- * generate a dark map, but AMBER DARK files (not on sky, but on lab
- * temperature shutters) may be used as well.
- */
-
-#define _POSIX_SOURCE 1
-
-/*
- * System Headers
- */
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "fitsio.h"
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/*
- * Local function declaration
- */
-static void amdlibInitDarkData(amdlibDARK_DATA *dark);
-static amdlibCOMPL_STAT amdlibAllocateDarkData
- (amdlibRAW_DATA *rawData,
- amdlibDARK_DATA *dark);
-static void amdlibFreeDarkData(amdlibDARK_DATA *dark);
-
-/*
- * Public functions
- */
-/**
- * Release memory allocated to store dark
- *
- * @param dark structure where dark (or sky) is stored
- */
-void amdlibReleaseDarkData(amdlibDARK_DATA *dark)
-{
- amdlibLogTrace("amdlibReleaseDarkData()");
-
- amdlibFreeDarkData(dark);
- memset (dark, '\0', sizeof(amdlibDARK_DATA));
-}
-
-/**
- * Save dark structure on disk to save time in case it is needed more than once
- *
- */
-amdlibCOMPL_STAT amdlibSaveDarkDataOnFile(amdlibDARK_DATA *dark,
- FILE *fp)
-{
- int iRegion;
- char version[32];
-
- amdlibLogTrace("amdlibSaveDarkDataOnFile()");
-
- if (dark->thisPtr != dark)
- {
- return amdlibFAILURE;
- }
- /*tag with version*/
- amdlibGetVersion(version);
- if ( fwrite(version,sizeof(char), 32,fp) != 32 )
- {
- return amdlibFAILURE;
- }
- /* write otfBadIsPresent */
- if ( fwrite(&dark->otfBadIsPresent,sizeof(amdlibBOOLEAN), 1,fp) != 1 )
- {
- return amdlibFAILURE;
- }
- for (iRegion = 0; iRegion < dark->nbRegions; iRegion++)
- {
- int nbOfElements;
- nbOfElements = dark->region[iRegion].dimAxis[0] *
- dark->region[iRegion].dimAxis[1];
-
- /* write data */
- if ( fwrite(dark->region[iRegion].data,sizeof(amdlibDOUBLE), nbOfElements,fp) != nbOfElements )
- {
- return amdlibFAILURE;
- }
- if ( fwrite(dark->noise[iRegion].data,sizeof(amdlibDOUBLE), nbOfElements,fp) != nbOfElements )
- {
- return amdlibFAILURE;
- }
- if (dark->otfBadIsPresent==amdlibTRUE)
- {
- if ( fwrite(dark->otfBad[iRegion].data,sizeof(amdlibDOUBLE), nbOfElements,fp) != nbOfElements )
- {
- return amdlibFAILURE;
- }
- }
- }
- return amdlibSUCCESS;
-}
-
-amdlibCOMPL_STAT amdlibRetrieveSavedDarkDataOnFile(amdlibDARK_DATA *dark,
- FILE *fp)
-{
- int iRegion;
- char version[32],fileVersion[32];
-
- amdlibLogTrace("amdlibRetrieveSavedDarkDataOnFile()");
-
- if (dark->thisPtr != dark)
- {
- return amdlibFAILURE;
- }
- /*check tag with version*/
- amdlibGetVersion(version);
- if ( fread(fileVersion,sizeof(char), 32,fp) != 32 )
- {
- return amdlibFAILURE;
- }
- if(strcmp(version,fileVersion)!=0)
- {
- amdlibLogWarning("saved bad pixel file version %s differs from amdlib version %s, will recompute.",fileVersion,version);
- return amdlibFAILURE;
- }
-
- /* read otfBadIsPresent */
- if ( fread(&dark->otfBadIsPresent,sizeof(amdlibBOOLEAN), 1,fp) != 1 )
- {
- return amdlibFAILURE;
- }
- for (iRegion = 0; iRegion < dark->nbRegions; iRegion++)
- {
- int nbOfElements;
- nbOfElements = dark->region[iRegion].dimAxis[0] *
- dark->region[iRegion].dimAxis[1];
-
- /* read data */
- if ( fread(dark->region[iRegion].data,sizeof(amdlibDOUBLE), nbOfElements,fp)!= nbOfElements )
- {
- return amdlibFAILURE;
- }
- if ( fread(dark->noise[iRegion].data,sizeof(amdlibDOUBLE), nbOfElements,fp)!= nbOfElements )
- {
- return amdlibFAILURE;
- }
- if (dark->otfBadIsPresent==amdlibTRUE)
- {
- if ( fread(dark->otfBad[iRegion].data,sizeof(amdlibDOUBLE), nbOfElements,fp)!= nbOfElements )
- {
- return amdlibFAILURE;
- }
- }
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Set dark map to the given value.
- *
- * This function allocates a dark structure corresponding to the raw data
- * structure (i.e. having same regions), and generate the dark map by
- * computing the mean pixel value on all frames.
- *
- * @param input rawData structure (that measured the dark)
- * @param output dark structure
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-#define amdlibMAX_REGIONS 15
-#define amdlibMIN_FRAMES_FOR_BADPIXEL_STATISTICS 400
-amdlibCOMPL_STAT amdlibGenerateDarkData(amdlibRAW_DATA *rawData,
- amdlibDARK_DATA *dark,
- amdlibERROR_MSG errMsg)
-{
- int iRegion;
- int iRow, iCol;
- int iPixel;
- int iFrame, iFirstFrame;
- int nbFrames=rawData->region[0].dimAxis[2];
- int nbGoodFrames;
- double sum, sigma2det;
- int startPixelX,x,nx,startPixelY,y,ny;
- int iFFskip=0;
- double **otfBadPtr;
- int do_removeGlobalBias=0;
- int compute=0;
- double *lineMean;
- int i;
- int regionSize;
-#define MGNLEN 512
- char magicName[MGNLEN],tmp[MGNLEN];
- double obsDate=-1.0;
- FILE *fp = NULL;
- char *darkMemoryDir=NULL;
- int useDarkRepository=0;
-
- amdlibLogTrace("amdlibGenerateDarkData()");
-
- /* Check raw data structure contains data */
- if (rawData->dataLoaded == amdlibFALSE)
- {
- amdlibSetErrMsg("The raw data structure does "
- "not contain data. Check call to amdlibLoadRawData()");
- return amdlibFAILURE;
- }
-
- /* Check frame type */
- if (rawData->frameType != amdlibDARK_FRAME &&
- rawData->frameType != amdlibSKY_FRAME)
- {
- amdlibLogWarning("Use of a non-dark frame type: proceed at your own "
- "risks");
- }
-
- if (amdlibAllocateDarkData(rawData, dark) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for the dark map");
- return amdlibFAILURE;
- }
-
- /* Get DATE keyword to retrieve eventual save of this dark */
- for (i=0; i < rawData->insCfg.nbKeywords; i++)
- {
- if ( strncmp(rawData->insCfg.keywords[i].name, "MJD-OBS", 7) == 0)
- {
- sscanf(rawData->insCfg.keywords[i].value, "%lf", &obsDate);
- /* Convert MJD to minutes from 01/01/2000 */
- /* Note that MJD is given from 17/11/1858, and 51544 is the number
- * of days between 01/01/2000 and this date.*/
- obsDate = (obsDate-51544.0)*1440;
- sprintf(magicName,"amdlibDarkSave.%d",(int)obsDate);
- break;
- }
- }
-
- if (amdlibGetUserPref(amdlibDROP).set==amdlibTRUE)
- iFFskip=amdlibGetUserPref(amdlibDROP).value;
- sprintf(tmp,".%d",iFFskip);
- strncat(magicName,tmp,MGNLEN);
-
- do_removeGlobalBias=0;
- if (!(amdlibGetUserPref(amdlibNO_BIAS).set==amdlibTRUE))
- {
- do_removeGlobalBias=1;
- }
- sprintf(tmp,".%1d",do_removeGlobalBias);
- strncat(magicName,tmp,MGNLEN);
-
-
- /* If an env is set to define the dir where dark memory files are
- * stored, then use this facility. */
- if ((darkMemoryDir=getenv("AMDLIB_DARK_REPOSITORY"))!=NULL)
- {
- strncpy(tmp,magicName,MGNLEN);
- sprintf(magicName,"%s/",darkMemoryDir);
- strncat(magicName,tmp,MGNLEN);
- useDarkRepository=1;
- }
-
- /* is there a memory file present ?*/
- if (useDarkRepository==1)
- {
- fp = fopen(magicName, "r");
- if (fp==NULL)
- {
- compute=1;
- }
- else
- {
- compute=0;
- /* if obsDate was absent, force compute (unnecessary precaution?) */
- if (obsDate==-1.0)
- {
- fclose(fp);
- compute=1;
- }
- else
- {
- if ( amdlibRetrieveSavedDarkDataOnFile(dark,fp) != amdlibSUCCESS)
- {
- compute=1; /*will overwrite bad file */
- }
- else
- {
- amdlibLogInfo("Successfully Retrieved saved dark file %s",magicName);
- }
- fclose(fp);
- }
- }
- }
- else
- {
- compute=1;
- }
- /* depending whether the saved dark has otfBad or not, we are able to use it if amdlibAUTO_BADPIXEL is set*/
- if (compute==0)
- {
- if (amdlibGetUserPref(amdlibAUTO_BADPIXEL).set==amdlibTRUE)
- {
- if (dark->otfBadIsPresent==amdlibTRUE) /* ok we can, the saved dark for some reason has them */
- {
- amdlibLogInfo("Saved Dark has already the requested otf bad pixel values");
- /* Then Update Bad Pixel Map with the otfBad values */
- for (iRow = 0; iRow < dark->nbRows; iRow++)
- {
- for (iCol = 1; iCol < dark->nbCols; iCol++)
- {
- iRegion = iRow * dark->nbCols + iCol;
- nx = dark->region[iRegion].dimAxis[0];
- ny = dark->region[iRegion].dimAxis[1];
- startPixelX = dark->region[iRegion].corner[0] - 1;
- startPixelY = dark->region[iRegion].corner[1] - 1;
- otfBadPtr = amdlibWrap2DArrayDouble(dark->otfBad[iRegion].data,nx, ny, errMsg);
- if (amdlibUpdateBadPixelMap(startPixelX, startPixelY, nx, ny, otfBadPtr, errMsg) != amdlibSUCCESS)
- {
- amdlibFree2DArrayDoubleWrapping(otfBadPtr);
- return amdlibFAILURE;
- }
- amdlibFree2DArrayDoubleWrapping(otfBadPtr);
- }
- }
- return amdlibSUCCESS;
- }
- else /* saved dark has no bad. But this may be normal in view of the number of frames */
- {
- if (nbFrames>=amdlibMIN_FRAMES_FOR_BADPIXEL_STATISTICS)
- {
- amdlibLogInfo("Saved Dark exists, but has no otf bad pixel estimate. Will recompute dark");
- compute=1; /* will compute otf */
- }
- }
- }
- }
-
- if (compute)
- {
- dark->otfBadIsPresent=amdlibFALSE;
- if (amdlibGetUserPref(amdlibAUTO_BADPIXEL).set==amdlibTRUE)
- {
- if (nbFrames>=amdlibMIN_FRAMES_FOR_BADPIXEL_STATISTICS)
- {
- dark->otfBadIsPresent=amdlibTRUE;
- }
- else
- {
- amdlibLogWarning("Number of frames (%d) for dark is too low to enable on-the-fly bad pixel estimate.",nbFrames);
- }
- }
-
- /* /\* This is a dark, not a Bias. Remove the Bias from the Dark first. *\/ */
- /* /\* pixel bias does not exist yet. Here is where it should be removed: *\/ */
- /* /\* Subtract Pixel Bias Map directly on raw data *\/ */
- /* if (amdlibSubtractPixelBias(pixelBias, rawData, errMsg) != amdlibSUCCESS) */
- /* { */
- /* return amdlibFAILURE; */
- /* } */
-
- /* For the moment we use another way: estimate bias from the masked pixels */
- /* Calculate and Remove Global Bias (until we have cold shutter bias maps) */
-
- if (do_removeGlobalBias)
- {
- if (amdlibRemoveGlobalBias(rawData, errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- }
- /* Calculate the dark: mean of all valid frames (i.e., non-null,
- * dropping iFFskip first frames) */
- for (iRow = 0; iRow < rawData->nbRows; iRow++)
- {
- for (iCol = 0; iCol < rawData->nbCols; iCol++)
- {
- iRegion = iRow * rawData->nbCols + iCol;
- nx = rawData->region[iRegion].dimAxis[0];
- ny = rawData->region[iRegion].dimAxis[1];
- startPixelX = rawData->region[iRegion].corner[0] - 1;
- startPixelY = rawData->region[iRegion].corner[1] - 1;
- regionSize = nx * ny;
- nbFrames = rawData->region[iRegion].dimAxis[2];
- iFirstFrame=iFFskip;
- for (iPixel = 0; iPixel < regionSize; iPixel++)
- {
- sum = 0.0;
- nbGoodFrames=0;
- for (iFrame = iFirstFrame; iFrame < nbFrames; iFrame++)
- {
- if ( rawData->timeTag[iFrame] != 0.0 )
- {
- nbGoodFrames++;
- sum += rawData->region[iRegion].data[iFrame*regionSize
- + iPixel];
- }
- }
- sum /= (amdlibDOUBLE)nbGoodFrames;
- dark->region[iRegion].data[iPixel] = sum;
- /* compute the noise of this pixel */
- sigma2det = 0.0;
- nbGoodFrames=0;
- for (iFrame = iFirstFrame; iFrame < nbFrames; iFrame++)
- {
- if ( rawData->timeTag[iFrame] != 0.0 )
- {
- nbGoodFrames++;
- sigma2det += amdlibPow2(rawData->region[iRegion].data[iFrame*regionSize
- + iPixel]-sum);
- }
- }
- sigma2det /= (amdlibDOUBLE)nbGoodFrames;
- dark->noise[iRegion].data[iPixel] = sigma2det;
- }
-
- /* Global Averages */
- sum = 0.0;
- sigma2det = 0.0;
- for (iPixel = 0; iPixel < regionSize; iPixel++)
- {
- sum += dark->region[iRegion].data[iPixel];
- sigma2det += dark->noise[iRegion].data[iPixel];
- }
- sum /= (amdlibDOUBLE) regionSize ;
- sigma2det /= (amdlibDOUBLE) regionSize;
- amdlibLogTest("Dark region %d: average value=%f (adu), average ron=%f (adu)",iRegion,sum,sqrt(sigma2det));
- if (dark->otfBadIsPresent && iCol!=0)
- {
- /*Compute a list of bad pixels in this region:
- * 1) all the pixels whose rms is > amdlibCLIP_RON,
- * 2) all the pixels whose mean value is markedly different
- * from the others. */
- otfBadPtr = amdlibWrap2DArrayDouble(dark->otfBad[iRegion].data,nx, ny, errMsg);
- lineMean = calloc(ny, sizeof(*lineMean));
- for (iPixel = 0, y = 0; y < ny; y++)
- {
- lineMean[y]=amdlibQuickSelectDble(&(dark->region[iRegion].data[iPixel]),nx);
- iPixel+=nx;
- }
- /*use otfBadPtr as workspace */
- for (iPixel = 0, y = 0; y < ny; y++)
- {
- for (x = 0; x < nx; x++)
- {
- otfBadPtr[y][x]=dark->region[iRegion].data[iPixel];
- otfBadPtr[y][x]-=lineMean[y];
- iPixel++;
- }
- }
-#define amdlibBIASCLIPFACTOR 8.0 /*8 sigma */
-#define amdlibRONCLIPFACTOR 3.0 /*3 sigma */
- /*flag 1 or 0 according to the 2 requirements */
- for (iPixel = 0, y = 0; y < ny; y++)
- {
- for (x = 0; x < nx; x++)
- {
- /* cut everything above some normal variation due to noise, represented by typical ron */
- if(fabs(otfBadPtr[y][x])>amdlibBIASCLIPFACTOR*sqrt(sigma2det/nbFrames))
- {
- otfBadPtr[y][x]=0.0;
- }
- /* variance limited to amdlibRONCLIPFACTOR the typical variance*/
- else if (dark->noise[iRegion].data[iPixel] > (amdlibRONCLIPFACTOR*amdlibRONCLIPFACTOR)*sigma2det)
- {
- otfBadPtr[y][x]=0.0;
- }
- else
- {
- otfBadPtr[y][x]=1.0;
- }
- iPixel++;
- }
- }
- if (amdlibUpdateBadPixelMap(startPixelX, startPixelY, nx, ny, otfBadPtr, errMsg) != amdlibSUCCESS)
- {
- amdlibFree2DArrayDoubleWrapping(otfBadPtr);
- free(lineMean);
- return amdlibFAILURE;
- }
- amdlibFree2DArrayDoubleWrapping(otfBadPtr);
- free(lineMean);
- }
- }
- }
- if (useDarkRepository==1)
- {
- fp = fopen(magicName, "w");
- if (fp!=NULL)
- {
- if (amdlibSaveDarkDataOnFile(dark,fp) != amdlibSUCCESS)
- {
- amdlibLogTrace("Problem saving dark values snaphsot on disk.");
- }
- fclose(fp);
- }
- }
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Set dark to a given value (in ADU).
- *
- * This function allocates a dark structure corresponding to the raw data
- * structure (i.e. having same regions), and set all value of the dark
- * to the given value.
- *
- * @param input rawData structure (used as template for regions)
- * @param output dark structure
- * @param value dark value to store GIVEN IN ELECTRONS (for compatibility!).
- * @param ron readout noise value to store GIVEN IN ELECTRONS (for compatibility!).
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibSetDarkData (amdlibRAW_DATA *rawData,
- amdlibDARK_DATA *dark,
- amdlibDOUBLE value,
- amdlibDOUBLE ron,
- amdlibERROR_MSG errMsg)
-{
- int iRegion;
- int iRow, iCol;
- int iPixel;
- int regionSize;
- double sum,sigma2det;
- amdlibDOUBLE gain;
- amdlibLogTrace("amdlibSetDarkData()");
-
- /* Check raw data structure contains data */
- if (rawData->dataLoaded == amdlibFALSE)
- {
- amdlibSetErrMsg("The raw data structure does "
- "not contain data. Check call to amdlibLoadRawData()");
- return amdlibFAILURE;
- }
-
- /* Allocate memory for data */
- if (amdlibAllocateDarkData(rawData, dark) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for the dark");
- return amdlibFAILURE;
- }
-
- /* Set the dark */
- for (iRow = 0; iRow < rawData->nbRows; iRow++)
- {
- for (iCol = 0; iCol < rawData->nbCols; iCol++)
- {
- iRegion = iRow * rawData->nbCols + iCol;
- gain = rawData->region[iRegion].gain;
- regionSize = rawData->region[iRegion].dimAxis[0] *
- rawData->region[iRegion].dimAxis[1];
- for (iPixel = 0; iPixel < regionSize; iPixel++)
- {
- dark->region[iRegion].data[iPixel] = value/gain;
- dark->noise[iRegion].data[iPixel] = (ron*ron)/(gain*gain);
- }
- }
- }
-
- for (iRow = 0; iRow < rawData->nbRows; iRow++)
- {
- for (iCol = 0; iCol < rawData->nbCols; iCol++)
- {
- iRegion = iRow * rawData->nbCols + iCol;
- regionSize = rawData->region[iRegion].dimAxis[0] *
- rawData->region[iRegion].dimAxis[1];
- sum = 0.0;
- sigma2det = 0.0;
- for (iPixel = 0; iPixel < regionSize; iPixel++)
- {
- sum += dark->region[iRegion].data[iPixel];
- sigma2det += dark->noise[iRegion].data[iPixel];
- }
- sum /= (amdlibDOUBLE) regionSize ;
- sigma2det /= (amdlibDOUBLE) regionSize;
- amdlibLogTrace("Dark region %d: fixed value=%f (adu), fixed ron=%f (adu)",iRegion,sum,sqrt(sigma2det));
- }
- }
-
- return amdlibSUCCESS;
-}
-
-/*
- * Local functions
- */
-/**
- * Initialize dark structure.
- *
- * @param dark pointer to dark structure
- */
-void amdlibInitDarkData(amdlibDARK_DATA *dark)
-{
- amdlibLogTrace("amdlibInitDarkData()");
-
- /* Initialize data structure */
- memset (dark, '\0', sizeof(amdlibDARK_DATA));
- dark->thisPtr = dark;
-}
-
-/**
- * Allocate memory for dark structure.
- *
- * This function allocates memory for dark which will result from
- * computation of the given raw data.
- *
- * @param rawData structure (used as template for region size, etc)
- * @param output dark structure to be initialized
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAllocateDarkData(amdlibRAW_DATA *rawData,
- amdlibDARK_DATA *dark)
-{
- int iRegion;
-
- amdlibLogTrace("amdlibAllocateDarkData()");
-
- if (rawData->thisPtr != rawData)
- {
- return amdlibFAILURE;
- }
-
- /* If dark data structure is not initialized, do it */
- if (dark->thisPtr != dark)
- {
- amdlibInitDarkData(dark);
- }
-
- amdlibFreeDarkData(dark);
- dark->expTime = rawData->expTime;
- dark->nbRows = rawData->nbRows;
- dark->nbCols = rawData->nbCols;
- dark->imagingDetector = rawData->imagingDetector;
- dark->nbRegions = rawData->nbRegions;
- dark->otfBadIsPresent= amdlibFALSE;
- /* Allocate memory for storing information of dark regions */
- if (amdlibAllocateRegions(&dark->region,
- dark->nbRegions) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- /* Allocate memory for storing information of noise regions */
- if (amdlibAllocateRegions(&dark->noise,
- dark->nbRegions) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- /* Allocate memory for storing information of noise regions */
- if (amdlibAllocateRegions(&dark->otfBad,
- dark->nbRegions) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- /* Allocate memory for storing dark region data */
- for (iRegion = 0; iRegion < dark->nbRegions; iRegion++)
- {
- int nbOfElements;
-
- memcpy(&dark->region[iRegion],
- &rawData->region[iRegion],sizeof(amdlibREGION));
- dark->region[iRegion].dimAxis[2] = 1;
- dark->region[iRegion].dmp = NULL;
- dark->region[iRegion].dmc = NULL;
- nbOfElements = rawData->region[iRegion].dimAxis[0] *
- rawData->region[iRegion].dimAxis[1];
-
- /* Allocate memory for data */
- dark->region[iRegion].data = calloc(sizeof(amdlibDOUBLE), nbOfElements);
- if (dark->region[iRegion].data == NULL)
- {
- return amdlibFAILURE;
- }
- /* the same for noise */
- memcpy(&dark->noise[iRegion],
- &rawData->region[iRegion],sizeof(amdlibREGION));
- dark->noise[iRegion].dimAxis[2] = 1;
- dark->noise[iRegion].dmp = NULL;
- dark->noise[iRegion].dmc = NULL;
- nbOfElements = rawData->region[iRegion].dimAxis[0] *
- rawData->region[iRegion].dimAxis[1];
-
- /* Allocate memory for data */
- dark->noise[iRegion].data = calloc(sizeof(amdlibDOUBLE), nbOfElements);
- if (dark->noise[iRegion].data == NULL)
- {
- return amdlibFAILURE;
- }
-
- /* the same for otfBad */
- memcpy(&dark->otfBad[iRegion],
- &rawData->region[iRegion],sizeof(amdlibREGION));
- dark->otfBad[iRegion].dimAxis[2] = 1;
- dark->otfBad[iRegion].dmp = NULL;
- dark->otfBad[iRegion].dmc = NULL;
- nbOfElements = rawData->region[iRegion].dimAxis[0] *
- rawData->region[iRegion].dimAxis[1];
-
- /* Allocate memory for data */
- dark->otfBad[iRegion].data = calloc(sizeof(amdlibDOUBLE), nbOfElements);
- if (dark->otfBad[iRegion].data == NULL)
- {
- return amdlibFAILURE;
- }
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Free memory allocated memory of dark structure.
- *
- * This function frees previously allocated memory (if any) where dark has
- * been stored.
- *
- * @param dark structure to be freed
- */
-void amdlibFreeDarkData(amdlibDARK_DATA *dark)
-{
- amdlibLogTrace("amdlibFreeDarkData()");
-
- if (dark->thisPtr != dark)
- {
- amdlibInitDarkData(dark);
- return;
- }
-
- amdlibFreeRegions(&dark->region, dark->nbRegions);
- amdlibFreeRegions(&dark->noise, dark->nbRegions);
- amdlibFreeRegions(&dark->otfBad, dark->nbRegions);
-}
-
-/*___oOo___*/
diff --git a/amber/amdlibDate.c b/amber/amdlibDate.c
deleted file mode 100644
index a16db6e..0000000
--- a/amber/amdlibDate.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Useful functions related to date.
- *
- * Routines to convert to and from ISO 8601 date to Modified Julian Day
- * Based on formulae by Tom Van Flandern in the UseNet newsgroup sci.astro.
- * cast into C by Raymond Gardner.
- */
-
-#define _POSIX_SOURCE 1
-
-/*
- * System Headers
- */
-#include <stdlib.h>
-#include <string.h>
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/*
- * Local function
- */
-static void amdlibJDNL2YMD(int jdn, int *yy, int *mm, int *dd);
-
-/*
- * Protected functions
- */
-
-/**
- * Return the radians equivalent of a input double in sexagesimal coding
- * (like -hhmmss.sss or dddmmss.ss). The 24 (hours) or 180 (degrees) flavor
- * is given by the code parameter.
- * *
- * @param value the sexagesimal value as a double
- * @param code an int code either 24 or 180 telling if these are hours
- * or degrees.
- *
- * @return an angle in radians in double precision.
- */
-double amdlibSexagToRad(double value, int code)
-{
- int hour=0, min=0, sign;
- double dh, dm, val, tmp;
- double second=0.0;
- val=value;
- sign=1;
-
- if (val<0.0)
- {
- sign=-1;
- val=-1*val;
- }
- hour=val;
- dh=hour;
- dh/=10000.0;
- hour=dh;
- val=val-hour*10000.0;
- min=val;
- dm=min;
- dm/=100.0;
- min=dm;
- second=val-min*100;
- tmp=sign*(hour+min/60.0+second/3600.0);
- if(code==24)
- {
- tmp=tmp*15;
- }
- tmp=tmp*M_PI/180.0;
- return(tmp);
-}
-
-/**
- * Convert Modified Julian Day date to Standard ISO date
- *
- * This function convert the given Modified Julian day date to ISO Standard date
- * and format this date as string in the following format
- * "YYYY-MM-DDThh:mm:ss.ssss".
- *
- * @param mjd Modified Julian Day date.
- *
- * @return
- * Standard ISO date as string
- */
-char *amdlibMJD2ISODate(double mjd)
-{
- int day=0, year=0, month=0;
- int hour=0, min=0;
- double second=0.0;
-
- /* Julian date */
- int jdn;
- double fd;
- static char isoDate[32];
-
- amdlibLogTrace("MJD2ISODate()");
-
- memset (isoDate, '\0', sizeof(*isoDate));
-
- /* Get the integral value; integral number of days */
- jdn =(int)mjd;
-
- /* Get the decimal value */
- fd = mjd-jdn;
-
- /* And convert it in hours, minutes and seconds */
- fd *= 24.0;
- hour = (int)fd;
- fd -= hour;
- fd *= 60.0;
- min = (int)fd;
- fd -= min;
- second = fd * 60.0;
-
- /* Convert MJD to JD */
- jdn += 2400001;
-
- /* Get year, month and day form JD */
- amdlibJDNL2YMD(jdn, &year, &month, &day);
-
- /* aramirez-20060720 */
- /* Changed seconds format 6.4f -> 07.4f */
- sprintf(isoDate,"%4.4d-%2.2d-%2.2dT%2.2d:%2.2d:%07.4f",
- year, month, day ,hour,min,second);
-
- return (isoDate);
-}
-
-/**
- * Convert Julian Day date to year, month and day
- *
- * @param jdn Julian Day date.
- * @param yy year.
- * @param mm month.
- * @param dd day.
- */
-void amdlibJDNL2YMD(int jdn, int *yy, int *mm, int *dd)
-{
- int x, z, m, d, y;
- int daysPer400Years = 146097L;
- int fudgedDaysPer4000Years = 1460970L + 31;
-
- amdlibLogTrace("amdlibJDNL2YMD()");
-
- x = jdn + 68569L;
- z = 4 * x / daysPer400Years;
- x = x - (daysPer400Years * z + 3) / 4;
- y = 4000 * (x + 1) / fudgedDaysPer4000Years;
- x = x - 1461 * y / 4 + 31;
- m = 80 * x / 2447;
- d = x - 2447 * m / 80;
- x = m / 11;
- m = m + 2 - 12 * x;
- y = 100 * (z - 49) + y + x;
-
- *yy = (int)y;
- *mm = (int)m;
- *dd = (int)d;
-
- if (*yy <= 0)
- {
- (*yy)--; /* Adjust Before Christ(BC) years */
- }
-}
-
-
-/*___oOo___*/
diff --git a/amber/amdlibEsoUtils.c b/amber/amdlibEsoUtils.c
deleted file mode 100644
index 20c0f37..0000000
--- a/amber/amdlibEsoUtils.c
+++ /dev/null
@@ -1,618 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Special functions used by AMBER observation software.
- */
-#define _POSIX_SOURCE 1
-#define amdlibREMANENCE 0.00
-
-/*
- * System Headers
- */
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include "fitsio.h"
-#include <time.h>
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-
-
-/** Max number of peaks along Y axis */
-#define amdlibMAX_NB_SPEC 15
-/** Max number of peaks along X axis */
-#define amdlibMAX_NB_PEAKS 10
-
-static int amdlibFindPeakPosition(double *data, int nbData, double threshold,
- int nbMaxPeaks, double *peakPos,
- double *peakWeight, double *peakMax);
-
-
-/**
- * Determine the positions of the columns
- *
- * This function finds the position of the columns. This consists to find
- * the position, along the X axis, of the peak for each column. If several peaks
- * are found, this function computes the mean weighted position of the peaks. If
- * raw data has more than one row, the mean position of the peaks in the rows
- * for each column is returned. If no peak is found the column position is set
- * to 0.
- * This function returns, in addition to the column positions, the max value
- * found for each column.
- *
- * @param rawData structure where raw data is stored
- * @param colPos position of the peak found for each column.
- * @param maxVal max value found for each column.
- *
- * @return
- * Always return amdlibSUCCESS
- */
-amdlibCOMPL_STAT amdlibExtractColPos(amdlibRAW_DATA *rawData,
- amdlibDOUBLE colPos[amdlibMAX_NB_COLS],
- amdlibDOUBLE maxVal[amdlibMAX_NB_COLS])
-{
- int col;
- int row;
- int iRegion;
-
- int x, y, frame;
- int nbX,nbY,nbFrames;
-
- double meanX[512];
- double pixelOffset[512];
- double mean;
- double variance;
- double threshold;
-
- amdlibLogTrace("amdlibExtractColPos()");
-
- /* Check raw data structure contains data */
- if (rawData->dataLoaded == amdlibFALSE)
- {
- return amdlibFAILURE;
- }
-
- /* Position of column 0 (i.e. dark) is not computed. Always set to 0 */
- colPos[0] = 0.0;
-
- /* For each column (excepted column 0 which is dark) */
- for(col=1; col<rawData->nbCols; col++)
- {
- double position[amdlibMAX_NB_ROWS][amdlibMAX_NB_PEAKS];
- double weight[amdlibMAX_NB_ROWS][amdlibMAX_NB_PEAKS];
- double max[amdlibMAX_NB_ROWS][amdlibMAX_NB_PEAKS];
- double meanPos;
- int nbPos;
-
- /* For each row */
- for(row=0; row<rawData->nbRows; row++)
- {
- /* Get the region index and size */
- iRegion = row*rawData->nbCols + col;
- nbX = rawData->region[iRegion].dimAxis[0];
- nbY = rawData->region[iRegion].dimAxis[1];
- nbFrames = rawData->region[iRegion].dimAxis[2];
-
- /* Compute mean value along X axis */
- for (x=0; x<nbX; x++)
- {
- double sum;
-
- sum = 0.;
- pixelOffset[x] = rawData->region[iRegion].corner[0];
- for (y=0; y<nbY; y++)
- {
- for (frame=0; frame<nbFrames; frame++)
- {
- sum += rawData->region[iRegion].data[frame*nbX*nbY+y*nbX+x];
- }
- }
- meanX[x] = sum / (double)(nbY*nbFrames);
- }
-
- /* Compute the threshold used to find peaks according to the mean
- * value and variance of all pixels in region */
- mean =0.0;
- variance =0.0;
- threshold =0.0;
- for(x=0; x<nbX; x++)
- {
- mean += meanX[x];
- variance += meanX[x]*meanX[x];
- }
- mean /= (double)(nbX);
- variance -= (double)(nbX) * mean * mean ;
- variance = variance /(double)(nbX-1);
- variance = sqrt(variance );
-
- /* If the image is flat */
- if (variance < 10.0)
- {
- /* Do not search for peak */
- position[row][0] = 0.0;
- }
- else
- {
-
- threshold = mean + variance ; /* 4 sigma */
- nbPos=amdlibFindPeakPosition (meanX, nbX, threshold,
- amdlibMAX_NB_PEAKS,
- position[row], weight[row],
- max[row]);
- if (nbPos != 0)
- {
- double w = 0.;
- double wSum = 0.;
- double m = 0.;
- int pos;
-
- for (pos=0; pos<nbPos; pos++)
- {
- w += weight[row][pos];
- wSum += weight[row][pos] * position[row][pos];
- if (m < max[row][pos])
- {
- m = max[row][pos];
- }
- }
- position[row][0] = wSum/w;
- max[row][0] = m;
- }
- else
- {
- position[row][0] = 0.0;
- max[row][0] = 0.0;
- }
- }
- }
-
- /* Compute the mean position and max value of the column */
- meanPos = 0.0;
- maxVal[col] = 0.0;
- nbPos = 0;
- for (row=0; row<rawData->nbRows; row++)
- {
- if (position[row][0] != 0.0)
- {
- meanPos += position[row][0];
- nbPos++;
- maxVal[col] += max[row][0];
- }
- }
- if (nbPos != 0)
- {
- meanPos /= nbPos;
- colPos[col] = pixelOffset[lround(meanPos)]+meanPos;
- }
- else
- {
- colPos[col] = 0.0;
- }
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Determine the positions of the columns
- * Determine the position of the peak along Y axis
- *
- * This function finds, for each region, the central spectral position. This
- * consists to find the position, along the Y axis, of the peak for each region.
- * If no peak is found the spectral position is set to 0.
- *
- * @param rawData structure where raw data is stored
- * @param spectPos position of the peak found for each region.
- *
- * @return
- * Always return amdlibSUCCESS
- */
-amdlibCOMPL_STAT amdlibExtractSpectPos(amdlibRAW_DATA *rawData,
- amdlibDOUBLE spectPos[amdlibMAX_NB_COLS][amdlibMAX_NB_ROWS])
-{
- int col;
- int row;
- int iRegion;
-
- int x, y, frame;
- int nbX,nbY,nbFrames;
-
- double meanY[512];
- double startPixel[512];
- double mean;
- double variance;
- double threshold;
-
- amdlibLogTrace("amdlibExtractSpectPos()");
-
- /* Check raw data structure contains data */
- if (rawData->dataLoaded == amdlibFALSE)
- {
- return amdlibFAILURE;
- }
-
- /* Position of column 0 (i.e. dark) is not computed. Always set to 0 */
- for(row=0; row<rawData->nbRows; row++)
- {
- spectPos[0][row] = 0;
- }
-
- /* For each column (excepted column 0 which is dark) */
- for(col=1; col<rawData->nbCols; col++)
- {
- int nbPosition[amdlibMAX_NB_ROWS];
- double position[amdlibMAX_NB_ROWS][amdlibMAX_NB_SPEC];
- double weight[amdlibMAX_NB_ROWS][amdlibMAX_NB_SPEC];
- double max[amdlibMAX_NB_ROWS][amdlibMAX_NB_PEAKS]; /* Not used */
-
- /* For each row */
- memset(position, '\0', sizeof(position));
- for(row=0; row<rawData->nbRows; row++)
- {
- /* Get the region index and size */
- iRegion = row*rawData->nbCols + col;
- nbX = rawData->region[iRegion].dimAxis[0];
- nbY = rawData->region[iRegion].dimAxis[1];
- nbFrames = rawData->region[iRegion].dimAxis[2];
-
- /* Compute mean value along X axis */
- for (y=0; y<nbY; y++)
- {
- double sum;
-
- sum = 0.;
- startPixel[y] = rawData->region[iRegion].corner[1];
- for (x=0; x<nbX; x++)
- {
- for (frame=0; frame<nbFrames; frame++)
- {
- sum +=
- rawData->region[iRegion].data[frame*nbX*nbY+y*nbX+x];
- }
- }
- meanY[y] = sum / (double)(nbX*nbFrames);
- }
- /* Compute the threshold used to find peaks according to the mean
- * value and variance of all pixels in region */
- mean =0.0;
- variance =0.0;
- threshold =0.0;
- for(y=0; y<nbY; y++)
- {
- mean += meanY[y];
- variance += meanY[y]*meanY[y];
- }
- mean /= (double)(nbY);
- variance -= (double)(nbY)*mean *mean ;
- variance = variance /(double)(nbY-1);
- variance = sqrt(variance );
-
- /* If the image is flat */
- if (variance < 10.0)
- {
- /* Do not search for peak */
- nbPosition[row] = 0;
- }
- else
- {
- threshold = mean + (2. * variance); /* 4 sigma */
- nbPosition[row] = amdlibFindPeakPosition
- (meanY, nbY, threshold, amdlibMAX_NB_SPEC, position[row],
- weight[row], max[row]);
- }
- }
-
- /* Get the max peak positions on detector */
- for (row=0; row<rawData->nbRows; row++)
- {
- int i, iMax;
- double max;
-
- if (nbPosition[row] != 0)
- {
- /* Find max peak */
- iMax = 0;
- max = meanY[lround(position[row][iMax])];
- for (i=0;i<nbPosition[row];i++)
- {
- if (meanY[lround(position[row][i])] >
- meanY[lround(position[row][iMax])])
- {
- iMax = i;
- max = meanY[lround(position[row][iMax])];
- }
- }
-
- spectPos[col][row] = startPixel[lround(position[row][iMax])] +
- position[row][iMax];
- }
- else
- {
- spectPos[col][row] = 0.0;
- }
- }
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Find peaks in the given value array.
- *
- * This function finds peaks (i.e. greater than the given threshold value),
- * and compute the weight of each peak.
- *
- * @param data table of values.
- * @param nbData number of values in table.
- * @param threshold value used to detect peaks
- * @param nbMaxPeaks number of peaks which can be found; i.e. size of the two
- * following arrays.
- * @param peakPos position of the found peaks
- * @param peakWeight weight of the found peaks
- * @param peakMax maximum value of the found peaks
- *
- * @return
- * The number of the found peaks
- */
-int amdlibFindPeakPosition(double *data, int nbData, double threshold,
- int nbMaxPeaks, double *peakPos, double *peakWeight,
- double *peakMax)
-{
- int i, nbPeaks = 0;
- double delta;
- double weight = 0.;
- double weightedSum = 0.;
- double max = 0.;
-
- amdlibBOOLEAN peakFound = amdlibFALSE;
-
- amdlibLogTrace("amdlibFindPeakPosition()");
-
-#if 0
- /* Print out command lines to visualize data using yorick program */
- amdlibLogTrace("data=[");
- for (i = 0; i < nbData; i++)
- {
- amdlibLogTrace("%.1f", data[i]);
- if(i!=(nbData-1))
- amdlibLogTrace(",");
- }
- amdlibLogTrace("]");
- amdlibLogTrace("thr=array(amdlibDOUBLE(%.1f), dimsof(data)(2))", threshold);
- amdlibLogTrace("plg,data");
- amdlibLogTrace("plg,thr,color=\"red\"");
-#endif
-
- /* For each value in table */
- for (i = 0; i < nbData; i++)
- {
- delta = data[i] - threshold;
-
- /* If value is greater than threshold */
- if (delta > 0.0)
- {
- /* Update weighted sum and weight */
- weight += delta;
- weightedSum += i * delta;
- peakFound = amdlibTRUE;
- /* Update max value */
- if (max < data[i])
- {
- max = data[i];
- }
- }
- /* End if */
-
- /* If value is lower than threshold (or it is the last value) and peak
- * has been found, corresponding to the end of peak */
- if (((delta <= 0.) || (i == (nbData-1))) && (peakFound == amdlibTRUE))
- {
- /* Compute position of peak (barycenter) */
- peakPos[nbPeaks] = weightedSum / weight;
- peakWeight[nbPeaks] = weight;
- peakMax[nbPeaks] = max;
-
- nbPeaks++;
- /* If max number of peaks is reached */
- if(nbPeaks >= nbMaxPeaks)
- {
- /* Stop */
- return nbPeaks;
- }
- /* End if */
-
- weightedSum = 0.0;
- weight = 0.0;
- max = 0.0;
- peakFound = amdlibFALSE;
- }
- /* End if */
- }
- /* End for */
- return nbPeaks;
-}
-
-/**
- * Split glued image into data regions
- *
- * This function split the glued image into regions. It is assumed that regions
- * is organised in rows and column, as shown below:
- * \code
- * +----+-------+-------+------+
- * | | | | |
- * | | | | |
- * | | | | |
- * +----+-------+-------+------+
- * | | | | |
- * | | | | |
- * +----+-------+-------+------+
- * \endcode
- *
- * The detector configuration is given by the nbRows and nbCols parameters,
- * which respectively defines the number of rows and columns, and therefore the
- * number of regions. The dimensions of each regions are given by the colWidth
- * and rowHeight parameters.
-
- * @param gluedImage pointer to the glued image
- * @param nbRows number of rows
- * @param nbCols number of column
- * @param colWidth width of the regions for each column
- * @param rowHeight height of the regions for each row
- * @param rawData structure where raw data will be stored
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibGluedImage2RawData(amdlibDOUBLE *gluedImage,
- int nbRows, int nbCols,
- int colWidth[amdlibMAX_NB_COLS],
- int rowHeight[amdlibMAX_NB_ROWS],
- amdlibRAW_DATA *rawData,
- amdlibERROR_MSG errMsg)
-{
- amdlibBOOLEAN detCfgChanged;
- int iRow, iCol, iY;
- int iRegion;
- int nbOfElements;
- int startPos;
-
- amdlibLogTrace("amdlibGluedImage2RawData()");
-
- /* If raw data structure is not initailized, do it */
- if (rawData->thisPtr != rawData)
- {
- amdlibInitRawData(rawData);
- }
-
- /* Check the detector configuration against region configuration */
- detCfgChanged = amdlibFALSE;
- if ((nbRows * nbCols) != rawData->nbRegions)
- {
- detCfgChanged = amdlibTRUE;
- }
- else
- {
- for (iRow=0; iRow < nbRows ; iRow++)
- {
- for (iCol = 0; iCol < nbCols; iCol++)
- {
- iRegion = iRow * nbCols + iCol;
- if ((rawData->region[iRegion].dimAxis[0] != colWidth[iCol]) ||
- (rawData->region[iRegion].dimAxis[1] != rowHeight[iRow]))
- {
- detCfgChanged = amdlibTRUE;
- }
- }
- }
- }
-
- /* If detector configuration has changed, free and allocate new data
- * structure */
- if (detCfgChanged)
- {
- /* Free memory */
- amdlibReleaseRawData(rawData);
-
- /* Allocate memory for region array */
- rawData->nbCols=nbCols;
- rawData->nbRows=nbRows;
- rawData->nbRegions=nbRows * nbCols;
- rawData->nbFrames = 1;
- /* Allocate memory for time Tag (1 value) */
- rawData->timeTag = calloc(rawData->nbFrames,sizeof(*(rawData->timeTag)));
- if (amdlibAllocateRegions
- (&rawData->region, rawData->nbRegions) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for regions");
- return amdlibFAILURE;
- }
-
- /* Allocate memory for regions */
- for (iRow = 0; iRow < nbRows ; iRow++)
- {
- for (iCol = 0; iCol < nbCols; iCol++)
- {
- iRegion = iRow * nbCols + iCol;
- nbOfElements = colWidth[iCol] * rowHeight[iRow];
- rawData->region[iRegion].data =
- calloc( nbOfElements, sizeof(amdlibDOUBLE));
- if (rawData->region[iRegion].data == NULL)
- {
- amdlibSetErrMsg("Could not allocate memory for data of "
- "region %d (size %dx%d)", iRegion,
- colWidth[iCol], rowHeight[iRow]);
- return amdlibFAILURE;
- }
- rawData->region[iRegion].dimAxis[0]=colWidth[iCol];
- rawData->region[iRegion].dimAxis[1]=rowHeight[iRow];
- rawData->region[iRegion].dimAxis[2]=rawData->nbFrames;
- }
- }
- /* Allocate rms structure */
- if (amdlibAllocateRegions
- (&rawData->variance, rawData->nbRegions) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for rms regions");
- return amdlibFAILURE;
- }
-
- /* Allocate memory for variance */
- for (iRow = 0; iRow < nbRows ; iRow++)
- {
- for (iCol = 0; iCol < nbCols; iCol++)
- {
- iRegion = iRow * nbCols + iCol;
- nbOfElements = colWidth[iCol] * rowHeight[iRow];
- rawData->variance[iRegion].data =
- calloc( nbOfElements, sizeof(amdlibDOUBLE));
- if (rawData->variance[iRegion].data == NULL)
- {
- amdlibSetErrMsg("Could not allocate memory for data of "
- "variance region %d (size %dx%d)", iRegion,
- colWidth[iCol], rowHeight[iRow]);
- return amdlibFAILURE;
- }
- rawData->variance[iRegion].dimAxis[0]=colWidth[iCol];
- rawData->variance[iRegion].dimAxis[1]=rowHeight[iRow];
- rawData->variance[iRegion].dimAxis[2]=1;
- }
- }
- }
-
- /* Split glued image into region data */
- startPos = 0;
- for (iRow = 0; iRow < nbRows ; iRow++)
- {
- for (iY = 0; iY < rowHeight[iRow]; iY++)
- {
- for (iCol = 0; iCol < nbCols; iCol++)
- {
- iRegion = iRow * nbCols + iCol;
-
- memcpy(&rawData->region[iRegion].data[iY*colWidth[iCol]],
- &gluedImage[startPos], colWidth[iCol] * sizeof(amdlibDOUBLE));
- startPos += colWidth[iCol];
- }
- }
- }
- /*Fill in a Time Tag*/
- rawData->timeTag[0] = time(NULL) / 86400.0; /*One frame*/
-
- /* Inform the data is loaded in structure, but there is not calibrated */
- rawData->dataLoaded = amdlibTRUE;
- rawData->dataCalibrated = amdlibFALSE;
-
- /* No reference to P2VM */
- rawData->p2vmId = 0;
-
- return amdlibSUCCESS;
-}
diff --git a/amber/amdlibFlatField.c b/amber/amdlibFlatField.c
deleted file mode 100644
index 6bb156a..0000000
--- a/amber/amdlibFlatField.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Functions to handle flat-field map.
- *
- * The flat field map contains for each pixel a factor which gives the gain of
- * that pixel according to the average gain.
- */
-
-#define _POSIX_SOURCE 1
-
-/*
- * System Headers
- */
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "fitsio.h"
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/*
- * Global variables
- */
-static amdlibFLAT_FIELD_MAP amdlibFlatFieldMap = {amdlibFALSE};
-
-/*
- * Public functions
- */
-/**
- * Set flat-field map to the given value.
- *
- * This function set all gains of the flat-field map to the given value.
- *
- * @param value gain value.
- *
- * @return
- * Always return amdlibSUCCESS
- */
-amdlibCOMPL_STAT amdlibSetFlatFieldMap(double value)
-{
- int x, y;
-
- amdlibLogTrace("amdlibSetFlatFieldMap()");
-
- /* Set all gains to the given value */
- for (y = 0; y < amdlibDET_SIZE_Y; y++)
- {
- for (x = 0; x < amdlibDET_SIZE_X; x++)
- {
- amdlibFlatFieldMap.data[y][x] = value;
- }
- }
-
- amdlibFlatFieldMap.mapIsInitialized = amdlibTRUE;
-
- return amdlibSUCCESS;
-}
-
-/**
- * Load flat-field map from file.
- *
- * This function load the flat-field map from file.
- *
- * @param filename name of the FITS file containing flat-field map.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibLoadFlatFieldMap(const char *filename,
- amdlibERROR_MSG errMsg)
-{
- struct stat statBuf;
- char fitsioMsg[256];
- fitsfile *filePtr;
- int status = 0, nbFound;
- long nAxes[2];
- int anynull = 0;
- amdlibDOUBLE nullval;
-
- amdlibLogTrace("amdlibLoadFlatFieldMap()");
-
- /* Check the file exists */
- if (stat(filename, &statBuf) != 0)
- {
- amdlibSetErrMsg("File '%.80s' does not exist", filename);
- return amdlibFAILURE;
- }
-
- /* Open FITS file */
- if (fits_open_file(&filePtr, filename, READONLY, &status) != 0)
- {
- amdlibReturnFitsError(filename);
- }
-
- /* Check file type (if given in header) */
- char dprType[256];
- char comment[amdlibKEYW_CMT_LEN+1];
- if (fits_read_key(filePtr, TSTRING, "HIERARCH ESO DPR TYPE", dprType,
- comment, &status))
- {
- status = 0;
- strcpy(dprType , "FLATFIELD");
- }
- if (strncmp(dprType, "FLATFIELD", strlen("FLATFIELD")) != 0)
- {
- amdlibSetErrMsg("Invalid file type '%s' : must be FLATFIELD", dprType);
- return amdlibFAILURE;
- }
-
- /* Read the NAXIS1 and NAXIS2 keyword to get image size */
- if (fits_read_keys_lng(filePtr, "NAXIS", 1, 2,
- nAxes, &nbFound, &status) != 0)
- {
- amdlibGetFitsError("NAXIS");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- /* Check size of the flat field map */
- if (nAxes[0] != amdlibDET_SIZE_X)
- {
- fits_close_file(filePtr, &status);
- amdlibSetErrMsg("Invalid number of pixels in X direction %ld : "
- "should be %d", nAxes[0], amdlibDET_SIZE_X);
- return amdlibFAILURE;
- }
- if (nAxes[1] != amdlibDET_SIZE_Y)
- {
- fits_close_file(filePtr, &status);
- amdlibSetErrMsg("Invalid number of pixels in Y direction %ld : "
- "Should be %d", nAxes[1], amdlibDET_SIZE_Y);
- return amdlibFAILURE;
- }
-
- /* Read 'imaging detector header' */
- nullval = 0; /* Don't check for null values in the image */
- if (fits_read_img(filePtr, TDOUBLE, 1, nAxes[0]*nAxes[1], &nullval,
- amdlibFlatFieldMap.data, &anynull, &status) != 0)
- {
- amdlibGetFitsError("Reading map");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- /* Close the FITS file */
- if (fits_close_file(filePtr, &status) != 0)
- {
- amdlibReturnFitsError(filename);
- }
-
- amdlibFlatFieldMap.mapIsInitialized = amdlibTRUE;
- return amdlibSUCCESS;
-}
-
-/**
- * Get the current flat-field map.
- *
- * This function returns the flat-field map. If there is no flat-field map
- * loaded or set, a perfect (all gains to 1.0) flat-field map is loaded.
- *
- * @return pointer to the current flat field map or NULL if no "real" flatfield
- * map is available
- */
-amdlibFLAT_FIELD_MAP *amdlibGetFlatFieldMap(void)
-{
- amdlibLogTrace("amdlibGetFlatFieldMap()");
-
- /* If map is not loaded, assume that all pixels are good */
- if (amdlibFlatFieldMap.mapIsInitialized == amdlibFALSE)
- {
- if (amdlibSetFlatFieldMap(1.0) != amdlibSUCCESS)
- {
- return NULL;
- }
- else
- {
- amdlibFlatFieldMap.mapIsInitialized = amdlibTRUE;
- }
- }
-
- return &amdlibFlatFieldMap;
-}
-
-/**
- * Get flat-field for a given region.
- *
- * This function returns from the flat-field map, the gains for the given
- * region. If there is no flat-field map loaded or set, a perfect (all gains to
- * 1.0) flat-field map is loaded.
- *
- * @param startPixelX origin of the region along X axis
- * @param startPixelY origin of the region along Y axis
- * @param nbPixelX width of the region
- * @param nbPixelY height of the region
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibDOUBLE **amdlibGetFlatFieldMapRegion(int startPixelX,
- int startPixelY,
- int nbPixelX,
- int nbPixelY,
- amdlibERROR_MSG errMsg)
-{
- static amdlibDOUBLE **flatFieldRegion = NULL;
- int x;
- int y;
-
- amdlibLogTrace("amdlibGetFlatFieldMapRegion()");
-
- /* Check origin */
- if ((startPixelX < 0) || (startPixelX >= amdlibDET_SIZE_X) ||
- (startPixelY < 0) || (startPixelY >= amdlibDET_SIZE_Y))
- {
- amdlibSetErrMsg("Origin (%d, %d) is out of range",
- startPixelX, startPixelY);
- return NULL;
- }
-
- /* Check region dimension */
- if ((nbPixelX < 0) || (startPixelX + nbPixelX) > amdlibDET_SIZE_X)
- {
- amdlibSetErrMsg("Invalid region width %d : should be in [0..%d]",
- nbPixelX, (amdlibDET_SIZE_X - startPixelX));
- return NULL;
- }
- if ((nbPixelY < 0) || (startPixelY + nbPixelY) > amdlibDET_SIZE_Y)
- {
- amdlibSetErrMsg("Invalid region height %d : should be in [0..%d]",
- nbPixelY, (amdlibDET_SIZE_Y - startPixelY));
- return NULL;
- }
-
- /* If map is not loaded, assume that all gains are 1.0 */
- if (amdlibFlatFieldMap.mapIsInitialized == amdlibFALSE)
- {
- if (amdlibSetFlatFieldMap(1.0) != amdlibSUCCESS)
- {
- return NULL;
- }
- else
- {
- amdlibFlatFieldMap.mapIsInitialized = amdlibTRUE;
- }
- }
-
- /* Allocate memory to store gains corresponding to the given region */
- flatFieldRegion = amdlibAlloc2DArrayDouble(nbPixelX, nbPixelY, errMsg);
- if (flatFieldRegion != NULL)
- {
- /* Get gains for the pixels belonging to the region */
- for (y = 0; y < nbPixelY; y++)
- {
- for (x = 0; x < nbPixelX; x++)
- {
- flatFieldRegion[y][x] =
- amdlibFlatFieldMap.data[startPixelY + y][startPixelX + x];
- }
- }
- }
- return flatFieldRegion;
-}
-
-/*___oOo___*/
diff --git a/amber/amdlibFrameSelection.c b/amber/amdlibFrameSelection.c
deleted file mode 100644
index 0bd6145..0000000
--- a/amber/amdlibFrameSelection.c
+++ /dev/null
@@ -1,482 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Functions to handle frame selection structure/file.
- */
-
-/*
- * System Headers
- */
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <time.h>
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/**
- * Allocate memory for structure containing necessary information for frame
- * selection.
- *
- * @param selection structure to be allocated.
- * @param nbFrames total number of frames in current observation.
- * @param nbBases number of baselines in current observation.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAllocateSelection(amdlibSELECTION *selection,
- int nbFrames,
- int nbBases,
- amdlibERROR_MSG errMsg)
-{
- int i;
- int band, base;
-
- amdlibLogTrace("amdlibAllocateSelection()");
-
- selection->nbFrames = nbFrames;
- selection->nbBases = nbBases;
-
- /* For each band */
- for (band = 0; band < amdlibNB_BANDS; band++)
- {
- /* Flag related to selected frames */
- selection->band[band].isSelected = calloc(nbBases*nbFrames, sizeof(char));
- if (selection->band[band].isSelected == NULL)
- {
- amdlibSetErrMsg("%s selected frame flag array",
- amdlibERR_ALLOC_MEM);
- return amdlibFAILURE;
- }
-
- /* Wrap this array */
- selection->band[band].isSelectedPt =
- amdlibWrap2DArrayUnsignedChar(selection->band[band].isSelected,
- nbFrames, nbBases, errMsg);
- if (selection->band[band].isSelectedPt == NULL)
- {
- return amdlibFAILURE;
- }
-
- /* Tag all frames as selected */
- for (base=0; base < selection->nbBases; base++)
- {
- selection->band[band].nbSelectedFrames[base] = nbFrames;
- }
- memset(selection->band[band].isSelected, 1,
- nbBases * nbFrames * sizeof(char));
-
- /* Flag related to phase closures */
- selection->band[band].frameOkForClosure = calloc(nbFrames, sizeof(int));
- if (selection->band[band].frameOkForClosure == NULL)
- {
- amdlibSetErrMsg("%s phase closure flag array", amdlibERR_ALLOC_MEM);
- return amdlibFAILURE;
- }
- for (i = 0; i < nbFrames; i++)
- {
- selection->band[band].frameOkForClosure[i] = i;
- }
- selection->band[band].nbFramesOkForClosure = nbFrames;
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Select/Unselect all frames for the given band.
- *
- * @param selection structure to be allocated.
- * @param band spectral band
- * @param nbBases number of baselines in current observation.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibSetSelection(amdlibSELECTION *selection,
- amdlibBAND band,
- amdlibBOOLEAN isSelected)
-{
- int base, frame;
-
- amdlibLogTrace("amdlibSetSelection()");
-
- /* Flag related to frame selection */
- for (base = 0; base < selection->nbBases; base++)
- {
- for (frame = 0; frame < selection->nbFrames; frame++)
- {
- selection->band[band].isSelectedPt[base][frame] = isSelected;
- }
- }
-
- /* Update flags related to phase closures */
- amdlibUpdateSelection(selection);
-
- return amdlibSUCCESS;
-}
-
-/**
- * Update informations related to phase closures
- *
- * @param selection structure containing information on selection.
- *
- * @return
- * amdlibSUCCESS
- */
-amdlibCOMPL_STAT amdlibUpdateSelection(amdlibSELECTION *selection)
-{
- int band, frame, base;
-
- amdlibLogTrace("amdlibUpdateSelection()");
-
- /* For each band */
- for (band = 0; band < amdlibNB_BANDS; band++)
- {
- int nbFramesOkForClosure = 0;
-
- for (base = 0; base < selection->nbBases; base++)
- {
- selection->band[band].nbSelectedFrames[base] = 0;
- selection->band[band].firstSelectedFrame[base] = -1;
- for (frame = 0; frame < selection->nbFrames; frame++)
- {
- if (selection->band[band].isSelectedPt[base][frame] ==
- amdlibTRUE)
- {
- selection->band[band].nbSelectedFrames[base] += 1;
- if (selection->band[band].firstSelectedFrame[base] == -1)
- {
- selection->band[band].firstSelectedFrame[base] = frame;
- }
- }
- }
- }
- /* 3T case. We deem OK for closure if 1 frame has passed the selection test */
- if (selection->nbBases == 3)
- {
- int frame;
- for (frame = 0; frame < selection->nbFrames; frame++)
- {
- if ((selection->band[band].isSelectedPt[0][frame] == amdlibTRUE) ||
- (selection->band[band].isSelectedPt[1][frame] == amdlibTRUE) ||
- (selection->band[band].isSelectedPt[2][frame] == amdlibTRUE) )
- {
- selection->band[band].frameOkForClosure[nbFramesOkForClosure] = frame;
- nbFramesOkForClosure++;
- }
- }
- }
- selection->band[band].nbFramesOkForClosure = nbFramesOkForClosure;
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Releases memory allocated to store information relative to frame selection.
- *
- * @param selection structure where selection information is stored.
- */
-void amdlibReleaseSelection(amdlibSELECTION *selection)
-{
- int band;
-
- amdlibLogTrace("amdlibReleaseSelection()");
-
- /* For each band */
- for (band = 0; band < amdlibNB_BANDS; band++)
- {
- if (selection->band[band].isSelected != NULL)
- {
- free(selection->band[band].isSelected);
- }
-
- if (selection->band[band].frameOkForClosure != NULL)
- {
- free(selection->band[band].frameOkForClosure);
- }
- amdlibFree2DArrayUnsignedCharWrapping(selection->band[band].isSelectedPt);
- }
- memset(selection, '\0', sizeof(amdlibSELECTION));
-}
-
-/**
- * This function reads given fits file and extracts selection information.
- *
- * @param fileName name of the file to read.
- * @param selKeywList list of keywords related to frame selection
- * @param selectionBandJ selection structure for spectral band 'J'.
- * @param selectionBandH selection structure for spectral band 'H'.
- * @param selectionBandK selection structure for spectral band 'K'.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibReadSelectionFile(const char *fileName,
- amdlibINS_CFG *selKeywList,
- amdlibSELECTION *selection,
- amdlibERROR_MSG errMsg)
-{
- fitsfile *filePtr;
- int status = 0;
- char fitsioMsg[256];
- int band, i;
- int nbFrames;
- long nbBases;
- char keyName[36];
- char keyVal[36];
- char comment[amdlibKEYW_CMT_LEN+1];
- char nullLogical = amdlibFALSE;
- int anynull;
- int keysExist = 0;
- int moreKeys = 0;
- amdlibKEYW_LINE record;
-
- amdlibLogTrace("amdlibReadSelectionFile ()");
-
- /* Check a file name has been specified */
- if (strlen(fileName) == 0)
- {
- amdlibSetErrMsg("No input file name specified");
- return amdlibFAILURE;
- }
-
- /* Open FITS file */
- if (fits_open_file(&filePtr, fileName, READONLY, &status))
- {
- amdlibReturnFitsError(fileName);
- }
-
- /* Get primary header's keywords */
- keysExist = 0;
- moreKeys = 0;
- if (fits_get_hdrspace(filePtr, &keysExist, &moreKeys, &status) != 0)
- {
- status = 0;
- }
- for (i = 1; i <= keysExist; i++)
- {
- /* Read keyword line #i */
- if (fits_read_record(filePtr, i, record, &status) != 0)
- {
- status = 0;
- }
- else
- {
- /* Only retrieve HIERARCH ESO keywords, excepted PRO CATG
- * keyword */
- if ((strstr(record, "HIERARCH ESO ") != NULL) &&
- (strstr(record, "HIERARCH ESO PRO CATG") == NULL))
- {
- /* Store keyword */
- if (amdlibAddInsCfgKeyword(selKeywList,
- record, errMsg) == amdlibFAILURE)
- {
- return amdlibFAILURE;
- }
- }
- }
- }
-
- /* Get all rows data */
- if (fits_movnam_hdu(filePtr, BINARY_TBL, "FRAME_SELECTION", 0, &status))
- {
- amdlibGetFitsError("FRAME_SELECTION table");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- /* Get number of bases */
- if (fits_get_num_rows(filePtr, &nbBases, &status))
- {
- amdlibGetFitsError("FRAME_SELECTION number of rows");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- /* Get number of frames */
- int naxis;
- long naxes[2];
- if (fits_read_tdim(filePtr, 1, 2, &naxis, naxes, &status))
- {
- amdlibGetFitsError("FRAME_SELECTION dimensions");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- nbFrames = naxes[0];
-
- /* Allocate frame selection structure */
- if (amdlibAllocateSelection(selection, nbFrames,
- nbBases, errMsg) == amdlibFAILURE)
- {
- return amdlibFAILURE;
- }
-
- for (band=amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- sprintf(keyName, "TFORM%d", band+1);
- if (fits_read_key(filePtr, TSTRING, keyName, keyVal,
- comment, &status))
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- sscanf(keyVal, "%dL", &nbFrames);
-
- if (fits_read_col(filePtr, TLOGICAL, band+1, 1, 1,
- nbFrames * nbBases,
- &nullLogical, selection->band[band].isSelected,
- &anynull, &status))
- {
- amdlibGetFitsError("FRAME_SELECTION read column");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
-
- /* Close file */
- if (fits_close_file(filePtr, &status))
- {
- amdlibReturnFitsError(fileName);
- }
-
- /* Update selection; i.e. compute number of selected frames, find the first
- * ones, ...*/
- amdlibUpdateSelection(selection);
-
- return amdlibSUCCESS;
-}
-
-/**
- * This function stores given selection structures into a binary table.
- *
- * @param fileName name of the file to be written.
- * @param selectionBandJ selection structure for spectral band 'J'.
- * @param selectionBandH selection structure for spectral band 'H'.
- * @param selectionBandK selection structure for spectral band 'K'.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibWriteSelectionFile(const char *fileName,
- amdlibSELECTION *selection,
- amdlibERROR_MSG errMsg)
-{
- struct stat statBuf;
- fitsfile *filePtr;
- int status = 0;
- char fitsioMsg[256];
- int tfields = 3;
- char *ttype[] = {"J", "H", "K"};
- char *tform[3];
- char *tunit[] = {"", "", ""};
- int band;
- time_t timeSecs;
- struct tm *timeNow;
- char strTime[amdlibKEYW_VAL_LEN+1];
-
- /* Check a file name has been specified */
- if (strlen(fileName) == 0)
- {
- amdlibSetErrMsg("No input file name specified");
- return amdlibFAILURE;
- }
-
- /* First remove previous IO file (if any) */
- if (stat(fileName, &statBuf) == 0)
- {
- if (remove(fileName) != 0)
- {
- amdlibSetErrMsg("Could not overwrite file %s", fileName);
- return amdlibFAILURE;
- }
- }
-
- /* Create file */
- if (fits_create_file(&filePtr, fileName, &status) != 0)
- {
- amdlibReturnFitsError(fileName);
- }
-
- for (band=amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- tform[band] = calloc(36, sizeof(char));
- sprintf(tform[band], "%dL", selection->nbFrames);
- }
-
- /* Create binary table */
- if (fits_create_tbl(filePtr, BINARY_TBL, 1, tfields, ttype, tform, tunit,
- "FRAME_SELECTION", &status) != 0)
- {
- amdlibGetFitsError("FRAME_SELECTION");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- for (band=amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- free(tform[band]);
- }
-
- /* Write columns */
- for (band=amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- if (fits_write_col(filePtr, TLOGICAL, band+1, 1, 1,
- selection->nbBases * selection->nbFrames,
- selection->band[band].isSelected,
- &status) != 0)
- {
- amdlibGetFitsError("FRAME_SELECTION - write column");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
-
- /* Write keywords in primary header */
- if (fits_movabs_hdu(filePtr, 1,0, &status) != 0)
- {
- amdlibGetFitsError("Main header");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- timeSecs = time(NULL);
- timeNow = gmtime(&timeSecs);
- strftime(strTime, sizeof(strTime), "%Y-%m-%dT%H:%M:%S", timeNow);
- if (fits_write_key(filePtr, TSTRING, "DATE", strTime,
- "Date this file was written", &status) != 0)
- {
- amdlibGetFitsError("DATE");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- if (fits_write_key(filePtr, TSTRING, "HIERARCH ESO PRO CATG",
- "FRAME_SELECTION",
- "Category of product frames", &status) != 0)
- {
- amdlibGetFitsError("HIERARCH ESO PRO CATG");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- /* Close file */
- if (fits_close_file(filePtr, &status))
- {
- amdlibReturnFitsError(fileName);
- }
-
- return amdlibSUCCESS;
-}
diff --git a/amber/amdlibImagingData.c b/amber/amdlibImagingData.c
deleted file mode 100644
index 75b1f47..0000000
--- a/amber/amdlibImagingData.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Function to handle the header of imaging data binary table.
- *
- * The IMAGING_DATA binary table gives the detector pixel data for an exposure.
- */
-
-#define _POSIX_SOURCE 1
-
-/*
- * System Headers
- */
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "fitsio.h"
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/*
- * Protected function
- */
-/**
- * Read information from header of the IMAGING_DATA binary table and store
- * it into the amdlibIMAGING_DATA structure.
- *
- * This function reads information from header of the IMAGING_DATA binary table
- * and store it in the given data structure. This concerns information related
- * to :
- * \li the origin of the data
- * \li the instrument name
- * \li the observation date
- * \li the HDU creation date
- * \li the Data dictionary name
- * \li the DCS software version string
- * \li the number of regions
- * \li the maximun number of telescopes for instrument
- * \li the maximum number of entries in OPTICAL_TRAIN table
- * \li the maximum number of steps in an observational cycle
- *
- * Excepted for the number of regions, if information is not found in header,
- * the error is ignored.
- *
- * @param filePtr name of the FITS file containing IMAGING_DATA binary table.
- * @param imagingData structure where loaded information is stored.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibReadImagingDataHdr
- (fitsfile *filePtr,
- amdlibIMAGING_DATA *imagingData,
- amdlibERROR_MSG errMsg)
-
-{
- int status = 0;
- char fitsioMsg[256];
-
- amdlibLogTrace("amdlibReadImagingDataHdr()");
-
- /* Reset error message */
- memset(errMsg, '\0', sizeof(amdlibERROR_MSG));
-
- /* Clear 'IMAGING_DATA' data structure */
- memset(imagingData, '\0', sizeof(amdlibIMAGING_DATA));
-
- /* Go to the IMAGING_DATA binary table */
- if (fits_movnam_hdu(filePtr, BINARY_TBL, "IMAGING_DATA", 0, &status) != 0)
- {
- amdlibReturnFitsError("IMAGING_DATA");
- }
-
- /*** Read header informations */
- /* Read origine of the data and instrument name. If not found, the error
- * is ignored */
- if (fits_read_key(filePtr, TSTRING, "ORIGIN", &imagingData->origin,
- NULL, &status) != 0)
- {
- status = 0;
- }
- if (fits_read_key(filePtr, TSTRING, "INSTRUME",
- &imagingData->instrument, NULL, &status) != 0)
- {
- status = 0;
- }
- /* Read dates */
- if (fits_read_key(filePtr, TDOUBLE, "MJD-OBS", &imagingData->dateObsMJD,
- NULL, &status) != 0)
- {
- status = 0;
- }
- if (fits_read_key(filePtr, TSTRING, "DATE-OBS", &imagingData->dateObs,
- NULL, &status) != 0)
- {
- status = 0;
- }
- if (fits_read_key(filePtr, TSTRING, "DATE", &imagingData->date,
- NULL, &status) != 0)
- {
- status = 0;
- }
- /* Read dictionary names */
- if (fits_read_key(filePtr, TSTRING, "ESO DET DID",
- &imagingData->detDictionaryId, NULL, &status) != 0)
- {
- status = 0;
- }
- if (fits_read_key(filePtr, TSTRING, "ESO DET ID", &imagingData->detId,
- NULL, &status) != 0)
- {
- status = 0;
- }
- /* Read the number of regions */
- if (fits_read_key(filePtr, TINT, "NREGION", &imagingData->nbRegions,
- NULL, &status) != 0)
- {
- amdlibReturnFitsError("NREGION");
- }
- /* Read other parameters. If not found, the error is ignored */
- if (fits_read_key(filePtr, TINT, "MAXTEL", &imagingData->maxTel,
- NULL, &status) != 0)
- {
- status = 0;
- }
- if (fits_read_key(filePtr, TINT, "MAXINS", &imagingData->maxIns,
- NULL, &status) != 0)
- {
- status = 0;
- }
- if (fits_read_key(filePtr, TINT, "MAXSTEP", &imagingData->maxStep,
- NULL, &status) != 0)
- {
- status = 0;
- }
- return amdlibSUCCESS;
-}
-
-/*___oOo___*/
diff --git a/amber/amdlibImagingDetector.c b/amber/amdlibImagingDetector.c
deleted file mode 100644
index 9f4a66e..0000000
--- a/amber/amdlibImagingDetector.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Function to read data from IMAGING_DETECTOR binary table.
- *
- * The IMAGING_DETECTOR binary table describe the setup and characteristics of
- * the 2-dimensional detector used to record photometric and visibility data.
- */
-
-#define _POSIX_SOURCE 1
-
-/*
- * System Headers
- */
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "fitsio.h"
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/*
- * Protected function
- */
-
-/**
- * Read data from header of the IMAGING_DETECTOR binary table and store
- * it into the amdlibIMAGING_DETECTOR structure.
- *
- * This function reads information from header of the IMAGING_DETECTOR binary
- * table and store it in the given data structure. This concerns information
- * related to :
- * \li the origin of the data
- * \li the instrument name
- * \li the observation date
- * \li the HDU creation date
- * \li the Data dictionary name
- * \li the DCS software version string
- * \li the number of detectors
- * \li the number of regions
- * \li the maximum number of polynomial coefficients for DMC and DMP
- * \li the number of dimensions of detector array
- * \li the maximun number of telescopes for instrument
- *
- * Excepted for the 5 last fields (from the number of detectors to the maximun
- * number of telescopes), if the informations is not found in header, the error
- * is ignored.
-
- * @param filePtr name of the FITS file containing IMAGING_DATA binary table.
- * @param imagingDetector structure where loaded information is stored.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibReadImagingDetectorHdr
- (fitsfile *filePtr,
- amdlibIMAGING_DETECTOR *imagingDetector,
- amdlibERROR_MSG errMsg)
-
-{
- int status = 0;
- char fitsioMsg[256];
-
- amdlibLogTrace("amdlibReadImagingDetectorHdr()");
-
- /* Reset error message */
- memset(errMsg, '\0', sizeof(amdlibERROR_MSG));
-
- /* Clear 'IMAGING_DETECTOR' data structure */
- memset(imagingDetector, '\0', sizeof(amdlibIMAGING_DETECTOR));
-
- /* Go to the IMAGING_DETECTOR binary table */
- if (fits_movnam_hdu(filePtr, BINARY_TBL,
- "IMAGING_DETECTOR", 0, &status) != 0)
- {
- amdlibReturnFitsError("IMAGING_DETECTOR");
- }
-
- /*** Read header informations */
- /* Read origine of the data and instrument name. If not found, the error
- * is ignored */
- if (fits_read_key(filePtr, TSTRING, "ORIGIN", &imagingDetector->origin,
- NULL, &status) != 0)
- {
- status = 0;
- }
- if (fits_read_key(filePtr, TSTRING, "INSTRUME",
- &imagingDetector->instrument, NULL, &status) != 0)
- {
- status = 0;
- }
- /* Read dates */
- if (fits_read_key(filePtr, TDOUBLE, "MJD-OBS", &imagingDetector->dateObsMJD,
- NULL, &status) != 0)
- {
- status = 0;
- }
- if (fits_read_key(filePtr, TSTRING, "DATE-OBS", &imagingDetector->dateObs,
- NULL, &status) != 0)
- {
- status = 0;
- }
- if (fits_read_key(filePtr, TSTRING, "DATE", &imagingDetector->date,
- NULL, &status) != 0)
- {
- status = 0;
- }
- /* Read dictionary names */
- if (fits_read_key(filePtr, TSTRING, "ESO DET DID",
- &imagingDetector->detDictionaryId, NULL, &status) != 0)
- {
- status = 0;
- }
- if (fits_read_key(filePtr, TSTRING, "ESO DET ID", &imagingDetector->detId,
- NULL, &status) != 0)
- {
- status = 0;
- }
- /* Read informations on data */
- if (fits_read_key(filePtr, TINT, "NDETECT", &imagingDetector->nbDetectors,
- NULL, &status) != 0)
- {
- amdlibReturnFitsError("NDETECT");
- }
- if (fits_read_key(filePtr, TINT, "NREGION", &imagingDetector->nbRegions,
- NULL, &status) != 0)
- {
- amdlibReturnFitsError("NREGION");
- }
- if (fits_read_key(filePtr, TINT, "NUM_DIM", &imagingDetector->numDim,
- NULL, &status) != 0)
- {
- amdlibReturnFitsError("NUM_DIM");
- }
- if (fits_read_key(filePtr, TINT, "MAX_COEF", &imagingDetector->maxCoef,
- NULL, &status) != 0)
- {
- amdlibReturnFitsError("MAX_COEF");
- }
- if (fits_read_key(filePtr, TINT, "MAXTEL", &imagingDetector->maxTel,
- NULL, &status) != 0)
- {
- amdlibReturnFitsError("MAXTEL");
- }
-
- return amdlibSUCCESS;
-}
-
-/*___oOo___*/
diff --git a/amber/amdlibInsCfg.c b/amber/amdlibInsCfg.c
deleted file mode 100644
index 02691cd..0000000
--- a/amber/amdlibInsCfg.c
+++ /dev/null
@@ -1,348 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Functions to handle instrumental configuration.
- *
- */
-
-/*
- * System Headers
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/*
- * Local function declaration
- */
-static amdlibCOMPL_STAT amdlibSplitHeaderKeyword(amdlibKEYW_LINE keywLine,
- amdlibKEYWORD *keyword);
-
-/*
- * Protected function definition
- */
-/**
- * Add / Modify a keyword to an instrumental configuration array.
- *
- * This function inserts a new keyword in the specified instrumental
- * configuration array if it is not already stored in the array. This keyword is
- * given as a line read on headers (ie from type "@e name = @e value [ /
- * @e comment ]" ).
- *
- * @param insCfg instrumental configuration array.
- * @param keywLine the data to insert.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAddInsCfgKeyword(amdlibINS_CFG *insCfg,
- amdlibKEYW_LINE keywLine,
- amdlibERROR_MSG errMsg)
-{
- int i;
- amdlibKEYWORD keyword;
- char name[amdlibKEYW_NAME_LEN+1];
- char currentName[amdlibKEYW_NAME_LEN+1];
-
- /* Split the keyword line in its components */
- if (amdlibSplitHeaderKeyword(keywLine, &keyword) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Impossible to split the input line");
- return amdlibFAILURE;
- }
-
- strcpy(name, keyword.name);
- amdlibStripBlanks(name);
- /* Look for keyword in table */
- for (i = 0; i < insCfg->nbKeywords; i++)
- {
- strcpy(currentName, insCfg->keywords[i].name);
- amdlibStripBlanks(currentName);
- if (strcmp(currentName, name) == 0)
- {
- /* If found, returns error */
- amdlibSetErrMsg("%s keyword to add is already present in insCfg "
- "array", keyword.name);
- return amdlibFAILURE;
- }
- }
-
- /* Insert it if array is not full */
- if (i < amdlibNB_INS_CFG_KEYW)
- {
- strcpy(insCfg->keywords[i].name, keyword.name);
- strcpy(insCfg->keywords[i].value, keyword.value);
- strcpy(insCfg->keywords[i].comment, keyword.comment);
- insCfg->nbKeywords++;
- return amdlibSUCCESS;
- }
-
- amdlibSetErrMsg("insCfg array is full - impossible to insert it");
- return amdlibFAILURE;
-}
-
-/**
- * Remove keyword(s) containing string in an instrumental configuration array.
- * The keywords removed contain at least one instance of the string.
- *
- * @param insCfg instrumental configuration array.
- * @param keyword the string to which compare the keyword to remove.
- *
- */
-void amdlibRemoveInsCfgKeyword(amdlibINS_CFG *insCfg,
- char *keyword)
-{
- int i,j;
- char name[amdlibKEYW_NAME_LEN+1];
- char currentName[amdlibKEYW_NAME_LEN+1];
-
- strcpy(name, keyword);
- /* Look for keyword in table */
- i=0;
-
- while (i < insCfg->nbKeywords)
- {
- strcpy(currentName, insCfg->keywords[i].name);
- if (strstr(currentName, name) != NULL)
- {
- /* found, at location I */
- for (j=i+1;j<insCfg->nbKeywords;j++)
- {
- strcpy(insCfg->keywords[j-1].name, insCfg->keywords[j].name);
- strcpy(insCfg->keywords[j-1].value, insCfg->keywords[j].value);
- strcpy(insCfg->keywords[j-1].comment, insCfg->keywords[j].comment);
- }
- insCfg->nbKeywords--;
- }
- else
- {
- i++;
- }
- }
-
- return;
-}
-
-/**
- * Get the value of a given keyword from an instrumental configuration array.
- *
- * This function finds the value corresponding to the given keyword name in the
- * given instrumental configuration array.
- *
- * @param insCfg instrumental configuration array.
- * @param keywName name of the keyword to find.
- * @param keywValue value of the found keyword.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibGetInsCfgKeyword(amdlibINS_CFG *insCfg,
- char *keywName,
- char keywValue[amdlibKEYW_VAL_LEN+1],
- amdlibERROR_MSG errMsg)
-{
- int i;
- char name[amdlibKEYW_NAME_LEN+1];
- char currentName[amdlibKEYW_NAME_LEN+1];
-
- strcpy(name, keywName);
- amdlibStripBlanks(name);
- /* Look for keyword in table */
- for (i = 0; i < insCfg->nbKeywords; i++)
- {
- strcpy(currentName, insCfg->keywords[i].name);
- amdlibStripBlanks(currentName);
- if (strcmp(currentName, name) == 0)
- {
- /* If found, store it */
- strcpy((char *)keywValue, insCfg->keywords[i].value);
- return amdlibSUCCESS;
- }
- }
- amdlibSetErrMsg("Keyword %s has not been found in input list of keywords",
- keywName);
- return amdlibFAILURE;
-}
-
-/**
- * Insert a keyword in the given instrumental configuration array.
- *
- * This function inserts a keyword in the given array. If a keyword with same
- * name already stays in the array, its value and comment are changed, otherwise
- * a amdlibKEYWORD object is created and inserted.
- *
- * @param insCfg instrumental configuration array.
- * @param keywName name of the keyword to set.
- * @param keywVal value of the keyword to set.
- * @param keywCmt comment of the keyword to set.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibSetInsCfgKeyword(amdlibINS_CFG *insCfg,
- char *keywName,
- char *keywVal,
- char *keywCmt,
- amdlibERROR_MSG errMsg)
-{
- int i;
- char name[amdlibKEYW_NAME_LEN+1];
- char currentName[amdlibKEYW_NAME_LEN+1];
-
- strcpy(name, keywName);
- amdlibStripBlanks(name);
-
- /* Look for keyword in table */
- for (i = 0; i < insCfg->nbKeywords; i++)
- {
- strcpy(currentName, insCfg->keywords[i].name);
- amdlibStripBlanks(currentName);
- /* If found, set it */
- if (strcmp(name, currentName) == 0)
- {
- memset(insCfg->keywords[i].value, '\0',
- sizeof(char[amdlibKEYW_VAL_LEN+1]));
- memset(insCfg->keywords[i].comment, '\0',
- sizeof(char[amdlibKEYW_CMT_LEN+1]));
- strcpy(insCfg->keywords[i].value, keywVal);
- strcpy(insCfg->keywords[i].comment, keywCmt);
- return amdlibSUCCESS;
- }
- }
- /* If not found, insert it */
- if (i < amdlibNB_INS_CFG_KEYW)
- {
- strcpy(insCfg->keywords[i].name, keywName);
- strcpy(insCfg->keywords[i].value, keywVal);
- if (keywCmt != NULL || strlen(keywCmt) != 0)
- {
- strcpy(insCfg->keywords[i].comment, keywCmt);
- }
- insCfg->nbKeywords++;
- return amdlibSUCCESS;
- }
-
- amdlibSetErrMsg("insCfg array is full - impossible to insert %s", keywName);
- return amdlibFAILURE;
-}
-
-/**
- * Clear the given instrumental configuration array.
- *
- * This function clears the given array, ie sets all keywords to 0.
- *
- * @param insCfg instrumental configuration array to clear.
- *
- * @return Always returns amdlibSUCCESS.
- */
-amdlibCOMPL_STAT amdlibClearInsCfg(amdlibINS_CFG *insCfg)
-{
- amdlibLogTrace("amdlibClearInsCfg()");
-
- memset(insCfg->keywords,'\0',amdlibNB_INS_CFG_KEYW * sizeof(amdlibKEYWORD));
- insCfg->nbKeywords = 0;
-
- return amdlibSUCCESS;
-}
-
-
-
-/*
- * Local function definition
- */
-/**
- * Split a keyword line into name, value and comment.
- *
- * This function splits a keyword line of type "@e name = @e value [ /
- * @e comment ]" into an amdlibKEYWORD data structure storing name, keyword
- * and comment separately.
- *
- * @param keywLine line to split.
- * @param keyword structure where data is stored.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibSplitHeaderKeyword(amdlibKEYW_LINE keywLine,
- amdlibKEYWORD *keyword)
-{
- int index = 0, index2 = 0;
- int keywLineLen;
-
- /* Init keyword */
- memset((char *)keyword, 0, sizeof(amdlibKEYWORD));
- keywLineLen = strlen(keywLine);
- if (keywLineLen > amdlibKEYW_LINE_LEN)
- {
- keywLineLen = amdlibKEYW_LINE_LEN;
- }
-
- /* Check if it is a comment line ("COMMENT / <comment>\0") */
- if (strstr(keywLine, "COMMENT ") != NULL)
- {
- index = strlen("COMMENT ");
- strncpy((char *)keyword->comment, keywLine + index,
- amdlibKEYW_CMT_LEN);
- return amdlibSUCCESS;
- }
-
- /* Copy out keyword name */
- while ((index < keywLineLen) && (*(keywLine + index) != '='))
- {
- *(keyword->name + index) = *(keywLine + index);
- index++;
- }
- *(keyword->name + index) = '\0';
-
- /* Skip the equal sign for the possible value */
- while ((index < keywLineLen) && ((*(keywLine + index) == '=')))
- {
- index++;
- }
- if (index >= keywLineLen)
- {
- /* There is no value */
- return amdlibSUCCESS;
- }
-
- /* Copy out keyword value */
- index2 = 0;
- while ((index < keywLineLen) && (*(keywLine + index) != '/') )
- {
- *(keyword->value + index2) = *(keywLine + index);
- index++;
- index2++;
- }
- *(keyword->value + index2) = '\0';
-
- /* Skip '/' for the possible comment */
- while ((index < keywLineLen) && ((*(keywLine + index) == '/')))
- {
- index++;
- }
- if (index >= keywLineLen)
- {
- /* There is no comment */
- return amdlibSUCCESS;
- }
- /* Copy out a possible comment */
- if (index < (keywLineLen - 1))
- {
- strncpy(keyword->comment, (keywLine + index),
- (size_t)(keywLineLen - index + 1));
- }
- return amdlibSUCCESS;
-}
-
-/*___oOo___*/
diff --git a/amber/amdlibLog.c b/amber/amdlibLog.c
deleted file mode 100644
index a4348f2..0000000
--- a/amber/amdlibLog.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Function related to logging service. It provides functions to print out log
- * message on stdout verbosity level.
- */
-
-/**
- at page amdlibLog ICARE logging facility
-
- at section Description
-Every program needs to display diagnostics: error messages, debugging output,
-and so on. Traditionally, this is done using a number of printf() calls in
-application in order to help trace execution paths or display helpful runtime
-information. ICARE logging facility provides user with ways to do these things
-while at the same time giving us great control over how much of the information
-is printed and where it is directed (for the time being messages in only printed
-out on stdout, but in future it will be possble to redirect them into a log
-file).
-
-It is important to have a convenient way to create debug statements. In this
-modern age of graphical source-level debuggers, it might seem strange to pepper
-your application with the equivalent of a bunch of print statements. However,
-diagnostic statements are useful both during development and long after an
-application is considered to be bug free.
-
- at li messages can be logged while the program is running and a debugger
-isn't available or practical, such as with a server.
- at li messages can recorded during testing for regression analysis.
-
-The ICARE mechanisms allow, at runtime, to enable and disable these statements,
-and to control verbosity level. Thus, you don't have to pay for the overhead in
-either CPU cycles or disk space under normal conditions. But if a problem
-arises, you can easily cause copious amounts of debugging information to be
-recorded to assist you in finding and fixing it. It is an unfortunate fact that
-many bugs will never appear until the program is in the hands of the end user.
-
-The messages are printed out on stdout according to the message level (see
-amdlibLOG_LEVEL) and the current logging level, formatted as follows:
- at code
-[<date>] - [<file>:<line>] - <message>
- at endcode
-
-The <dfn>\<date\></dfn> and <dfn>\<file\>:\<line\></dfn> informations is optional, and can be controlled using amdlibLogSet() function, which also control log level.
-
-amdlibLogError(), amdlibLogWarning(), amdlibLogInfo(), amdlibLogTest() and amdlibLogTrace()
-convenient macros are provided to display diagnostic output from your code.
-
-The amdlibLogTrace is reserved to trace execution paths and should be added at the
-beginning og all functions ot methods, as shown in the following example, where
-<dfn>mymod</dfn> is the name of the module where this function is defined :
- at code
-amdlibCOMPL_STAT mymodFunction(...)
-{
- amdlibLogTrace("mymodFunction()");
- ...
-}
- at endcode
-
-*/
-
-/*
- * System Headers
- */
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include <time.h>
-#include <sys/time.h>
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/**
- * Configuration for logging
- */
-static amdlibLOG_CONFIG amdlibLogConfig =
-{
- amdlibTRUE, /** Log disabled */
- amdlibLOG_INFO,
- amdlibFALSE, /** Print date/time */
- amdlibFALSE /** Print file/line */
-};
-
-/**
- * Configure logging service.
- *
- * It enables/disables message logging, set verbose level and switches on/off
- * the display of date and file/line informations in logged messages.
- *
- * @param enabled flag to enable or disable message logging.
- * @param level lowest level of messages to be printed out.
- * @param printDateFileLine flag to whether print or not date and file/line
- * informations.
- */
-void amdlibLogSet(amdlibBOOLEAN enabled, amdlibLOG_LEVEL level,
- amdlibBOOLEAN printDateFileLine)
-{
- amdlibLogConfig.enabled = enabled;
- amdlibLogConfig.level = level;
- amdlibLogConfig.printFileLine = printDateFileLine;
- amdlibLogConfig.printDate = printDateFileLine;
-}
-
-/**
- * Return whether the logging service is enabled or not.
- *
- * @return amdlibTRUE if logging service is enabled, and amdlibFALSE
- * otherwise.
- */
-amdlibBOOLEAN amdlibLogIsEnabled(void)
-{
- return (amdlibLogConfig.enabled);
-}
-
-/**
- * Return the current log level.
- *
- * @return current log level.
- */
-amdlibLOG_LEVEL amdlibLogGetLevel(void)
-{
- return (amdlibLogConfig.level);
-}
-
-/**
- * Prints out message on stdout.
- *
- * It prints out log message, according to the current logging setting (see
- * amdlibLogSet).
- *
- * @param level level of the given message
- * @param fileLine file name and line number from where function has been called
- * @param format printf-like string format to be expanded.
- *
- * @note
- * This function should never be called directly. amdlibLogError(),
- * amdlibLogWarning(), amdlibLogInfo(), amdlibLogTest() and amdlibLogTrace()
- * should be used instead of.
- */
-void amdlibLogPrint(amdlibLOG_LEVEL level, amdlibBOOLEAN isDetail, const char *fileLine,
- const char *format, ...)
-{
- va_list argPtr;
-
- /* If log is enabled */
- if ((amdlibLogConfig.enabled == amdlibTRUE) &&
- (level <= amdlibLogConfig.level))
- {
-
- /* Print out date */
- if (amdlibLogConfig.printDate == amdlibTRUE)
- {
- char infoTime[32];
- /* Get UNIX-style time and display as number and string. */
- amdlibGetTimeStamp(infoTime, 6);
-
- /* Print it */
- printf("%s - ", infoTime);
- }
-
- /* Print out file/line */
- if ((fileLine != NULL ) &&
- (amdlibLogConfig.printFileLine == amdlibTRUE))
- {
- /* Print it */
- fprintf(stdout, "%s - ", fileLine);
- }
-
- /* It is not additional infos */
- if (isDetail == amdlibFALSE)
- {
- /* Added prefix */
- switch (level)
- {
- case amdlibLOG_ERROR:
- fprintf(stdout, " ERROR : ");
- break;
- case amdlibLOG_WARNING:
- fprintf(stdout, " WARNING : ");
- break;
- default:
- fprintf(stdout, " ");
- break;
- }
- }
- else
- {
- /* Indent */
- fprintf(stdout, " ");
- }
-
- /* Print message */
- va_start(argPtr, format);
- vfprintf(stdout, format, argPtr);
- fprintf(stdout, "\n");
- fflush(stdout);
- va_end(argPtr);
- }
-}
-
-/**
- * Returns the current date and time.
- *
- * It returns the current date and time, to be used as time stamp in logs or
- * errors. It generates the string corresponding to the current date,
- * expressed in Coordinated Universal Time (UTC), using the following format
- * YYYY-MM-DDThh:mm:ss[.ssssss], as shown in the following example :
- *
- * @code
- * 2004-06-16T16:16:48.02941
- * @endcode
- *
- * @param timeStamp buffer where date will be written
- * @param precision number of digits for milli-seconds.
- */
-void amdlibGetTimeStamp(char timeStamp[32], unsigned int precision)
-{
- struct timeval time;
- struct tm *timeNow;
- char tmpBuf[32];
-
- /* Get local time */
- gettimeofday(&time, NULL);
-
- /* Format the date */
- timeNow = gmtime(&time.tv_sec);
- strftime(timeStamp, 32, "%Y-%m-%dT%H:%M:%S", timeNow);
-
- /* Add milli-second and micro-second */
- if (precision != 0)
- {
- char format[8];
- sprintf(format, "%%.%df", precision);
-
- sprintf(tmpBuf, format, time.tv_usec/1e6);
- strcat(timeStamp, (tmpBuf + 1)); /* Remove first character; i.e 0 */
- }
-}
-
-/*___oOo___*/
diff --git a/amber/amdlibMatrix.c b/amber/amdlibMatrix.c
deleted file mode 100644
index cf43813..0000000
--- a/amber/amdlibMatrix.c
+++ /dev/null
@@ -1,1400 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Various (usefull) utilities for matrix manipulations
- */
-
-#define _POSIX_SOURCE 1
-
-/*
- * System Headers
- */
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "fitsio.h"
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/*
- * Protected functions
- */
-/*
- * This Quickselect routine is based on the algorithm described in
- * "Numerical recipies in C", Second Edition,
- * Cambridge University Press, 1992, Section 8.5, ISBN 0-521-43108-5
- */
-
-#define PIX_SWAP(a,b) { double temp=(a);(a)=(b);(b)=temp; }
-
-amdlibCOMPL_STAT amdlibQsortDouble(double *pix_arr, int npix)
-{
- int i,
- ir,
- j,
- k,
- l;
- int * i_stack ;
- int j_stack ;
- double a ;
-
- ir = npix ;
- l = 1 ;
- j_stack = 0 ;
- i_stack = malloc(npix * sizeof(double)) ;
- for (;;) {
- if (ir-l < 7) {
- for (j=l+1 ; j<=ir ; j++) {
- a = pix_arr[j-1];
- for (i=j-1 ; i>=1 ; i--) {
- if (pix_arr[i-1] <= a) break;
- pix_arr[i] = pix_arr[i-1];
- }
- pix_arr[i] = a;
- }
- if (j_stack == 0) break;
- ir = i_stack[j_stack-- -1];
- l = i_stack[j_stack-- -1];
- } else {
- k = (l+ir) >> 1;
- PIX_SWAP(pix_arr[k-1], pix_arr[l])
- if (pix_arr[l] > pix_arr[ir-1]) {
- PIX_SWAP(pix_arr[l], pix_arr[ir-1])
- }
- if (pix_arr[l-1] > pix_arr[ir-1]) {
- PIX_SWAP(pix_arr[l-1], pix_arr[ir-1])
- }
- if (pix_arr[l] > pix_arr[l-1]) {
- PIX_SWAP(pix_arr[l], pix_arr[l-1])
- }
- i = l+1;
- j = ir;
- a = pix_arr[l-1];
- for (;;) {
- do i++; while (pix_arr[i-1] < a);
- do j--; while (pix_arr[j-1] > a);
- if (j < i) break;
- PIX_SWAP(pix_arr[i-1], pix_arr[j-1]);
- }
- pix_arr[l-1] = pix_arr[j-1];
- pix_arr[j-1] = a;
- j_stack += 2;
- if (j_stack > npix) {
- amdlibLogError("stack too small in amdlibQsortDouble");
- return amdlibFAILURE ;
- }
- if (ir-i+1 >= j-l) {
- i_stack[j_stack-1] = ir;
- i_stack[j_stack-2] = i;
- ir = j-1;
- } else {
- i_stack[j_stack-1] = j-1;
- i_stack[j_stack-2] = l;
- l = i;
- }
- }
- }
- free(i_stack) ;
- return amdlibSUCCESS ;
-}
-
-#undef PIX_SWAP
-
-#define PIX_SWAP(a,b) { double temp=(a);(a)=(b);(b)=temp; }
-#define IDX_SWAP(a,b) { int temp=(a);(a)=(b);(b)=temp; }
-
-amdlibCOMPL_STAT amdlibQsortDoubleIndexed(double *pix_arr, int *index, int npix)
-{
- int i,
- ir,
- j,
- k,
- l;
- int * i_stack ;
- int j_stack ;
- double a ;
- int ia;
-
- /* intialise index */
- for (i=0;i<npix;i++) index[i]=i;
-
- ir = npix ;
- l = 1 ;
- j_stack = 0 ;
- i_stack = malloc(npix * sizeof(double)) ;
- for (;;) {
- if (ir-l < 7) {
- for (j=l+1 ; j<=ir ; j++) {
- a = pix_arr[j-1];
- ia = j-1;
- for (i=j-1 ; i>=1 ; i--) {
- if (pix_arr[i-1] <= a) break;
- pix_arr[i] = pix_arr[i-1];
- index[i] = index[i-1];
- }
- pix_arr[i] = a;
- index[i] = ia;
- }
- if (j_stack == 0) break;
- ir = i_stack[j_stack-- -1];
- l = i_stack[j_stack-- -1];
- } else {
- k = (l+ir) >> 1;
- PIX_SWAP(pix_arr[k-1], pix_arr[l])
- IDX_SWAP(index[k-1], index[l])
- if (pix_arr[l] > pix_arr[ir-1]) {
- PIX_SWAP(pix_arr[l], pix_arr[ir-1])
- IDX_SWAP(index[l], index[ir-1])
- }
- if (pix_arr[l-1] > pix_arr[ir-1]) {
- PIX_SWAP(pix_arr[l-1], pix_arr[ir-1])
- IDX_SWAP(index[l-1], index[ir-1])
- }
- if (pix_arr[l] > pix_arr[l-1]) {
- PIX_SWAP(pix_arr[l], pix_arr[l-1])
- IDX_SWAP(index[l], index[l-1])
- }
- i = l+1;
- j = ir;
- a = pix_arr[l-1];
- ia = index[l-1];
- for (;;) {
- do i++; while (pix_arr[i-1] < a);
- do j--; while (pix_arr[j-1] > a);
- if (j < i) break;
- PIX_SWAP(pix_arr[i-1], pix_arr[j-1]);
- IDX_SWAP(index[i-1], index[j-1]);
- }
- pix_arr[l-1] = pix_arr[j-1];
- index[l-1] = index[j-1];
- pix_arr[j-1] = a;
- index[j-1] = ia;
- j_stack += 2;
- if (j_stack > npix) {
- amdlibLogError("stack too small in amdlibQsortDouble");
- return amdlibFAILURE ;
- }
- if (ir-i+1 >= j-l) {
- i_stack[j_stack-1] = ir;
- i_stack[j_stack-2] = i;
- ir = j-1;
- } else {
- i_stack[j_stack-1] = j-1;
- i_stack[j_stack-2] = l;
- l = i;
- }
- }
- }
- free(i_stack) ;
- return amdlibSUCCESS ;
-}
-
-#undef PIX_SWAP
-#undef IDX_SWAP
-
-#define amdlibELEM_SWAP_SNGL(a,b) { register float t=(a);(a)=(b);(b)=t; }
-
-float amdlibQuickSelectSngl(float* arr, int n)
-{
- int low, high ;
- int median;
- int middle, ll, hh;
-
- low = 0 ; high = n-1 ; median = (low + high) / 2;
- for (;;) {
- if (high <= low) /* One element only */
- return arr[median] ;
-
- if (high == low + 1) { /* Two elements only */
- if (arr[low] > arr[high])
- amdlibELEM_SWAP_SNGL(arr[low], arr[high]) ;
- return arr[median] ;
- }
-
- /* Find median of low, middle and high items; swap into position low */
- middle = (low + high) / 2;
- if (arr[middle] > arr[high]) amdlibELEM_SWAP_SNGL(arr[middle], arr[high]) ;
- if (arr[low] > arr[high]) amdlibELEM_SWAP_SNGL(arr[low], arr[high]) ;
- if (arr[middle] > arr[low]) amdlibELEM_SWAP_SNGL(arr[middle], arr[low]) ;
-
- /* Swap low item (now in position middle) into position (low+1) */
- amdlibELEM_SWAP_SNGL(arr[middle], arr[low+1]) ;
-
- /* Nibble from each end towards middle, swapping items when stuck */
- ll = low + 1;
- hh = high;
- for (;;) {
- do ll++; while (arr[low] > arr[ll]) ;
- do hh--; while (arr[hh] > arr[low]) ;
-
- if (hh < ll)
- break;
-
- amdlibELEM_SWAP_SNGL(arr[ll], arr[hh]) ;
- }
-
- /* Swap middle item (in position low) back into correct position */
- amdlibELEM_SWAP_SNGL(arr[low], arr[hh]) ;
-
- /* Re-set active partition */
- if (hh <= median)
- low = ll;
- if (hh >= median)
- high = hh - 1;
- }
-}
-
-#undef amdlibELEM_SWAP_SNGL
-/*
- * This Quickselect routine is based on the algorithm described in
- * "Numerical recipies in C", Second Edition,
- * Cambridge University Press, 1992, Section 8.5, ISBN 0-521-43108-5
- */
-
-
-#define amdlibELEM_SWAP_DBLE(a,b) { register double t=(a);(a)=(b);(b)=t; }
-
-double amdlibQuickSelectDble(double* OutArr, int n)
-{
- int low, high ;
- int median;
- int middle, ll, hh;
- double *arr, value;
-
- /* this version protects its input array now */
- arr=malloc(n*sizeof(double));
- memcpy(arr,OutArr,n*sizeof(double));
-
- low = 0 ; high = n-1 ; median = (low + high) / 2;
- for (;;) {
- if (high <= low)
- { /* One element only */
- value = arr[median] ;
- free(arr);
- return(value);
- }
- if (high == low + 1) { /* Two elements only */
- if (arr[low] > arr[high])
- amdlibELEM_SWAP_DBLE(arr[low], arr[high]) ;
- value = arr[median];
- free(arr);
- return(value);
- }
-
- /* Find median of low, middle and high items; swap into position low */
- middle = (low + high) / 2;
- if (arr[middle] > arr[high]) amdlibELEM_SWAP_DBLE(arr[middle], arr[high]) ;
- if (arr[low] > arr[high]) amdlibELEM_SWAP_DBLE(arr[low], arr[high]) ;
- if (arr[middle] > arr[low]) amdlibELEM_SWAP_DBLE(arr[middle], arr[low]) ;
-
- /* Swap low item (now in position middle) into position (low+1) */
- amdlibELEM_SWAP_DBLE(arr[middle], arr[low+1]) ;
-
- /* Nibble from each end towards middle, swapping items when stuck */
- ll = low + 1;
- hh = high;
- for (;;) {
- do ll++; while (arr[low] > arr[ll]) ;
- do hh--; while (arr[hh] > arr[low]) ;
-
- if (hh < ll)
- break;
-
- amdlibELEM_SWAP_DBLE(arr[ll], arr[hh]) ;
- }
-
- /* Swap middle item (in position low) back into correct position */
- amdlibELEM_SWAP_DBLE(arr[low], arr[hh]) ;
-
- /* Re-set active partition */
- if (hh <= median)
- low = ll;
- if (hh >= median)
- high = hh - 1;
- }
-}
-
-#undef amdlibELEM_SWAP_DBLE
-
-/**
- * Macro to sort two pixel values.
- */
-#define amdlibPIX_SWAP(a,b) { amdlibDOUBLE tmp=(a);(a)=(b);(b)=tmp; }
-#define amdlibPIX_SORT(a,b) { if ((a)>(b)) amdlibPIX_SWAP((a),(b)); }
-/**
- * Compute the median.
- *
- * This function computes the median values of the entries in the given table.
- * It is superfast (since completely hardcoded median filter for 9 values).
- *
- * @note
- * Formula from: XILINX XCELL magazine, vol. 23 by John L. Smith
- *
- * @param p table containing the 9 values.
- *
- * @return
- * The median value.
- */
-amdlibDOUBLE amdlibMedian9(amdlibDOUBLE *p)
-{
- amdlibPIX_SORT(p[1], p[2]); amdlibPIX_SORT(p[4], p[5]);
- amdlibPIX_SORT(p[7], p[8]); amdlibPIX_SORT(p[0], p[1]);
- amdlibPIX_SORT(p[3], p[4]); amdlibPIX_SORT(p[6], p[7]);
- amdlibPIX_SORT(p[1], p[2]); amdlibPIX_SORT(p[4], p[5]);
- amdlibPIX_SORT(p[7], p[8]); amdlibPIX_SORT(p[0], p[3]);
- amdlibPIX_SORT(p[5], p[8]); amdlibPIX_SORT(p[4], p[7]);
- amdlibPIX_SORT(p[3], p[6]); amdlibPIX_SORT(p[1], p[4]);
- amdlibPIX_SORT(p[2], p[5]); amdlibPIX_SORT(p[4], p[7]);
- amdlibPIX_SORT(p[4], p[2]); amdlibPIX_SORT(p[6], p[4]);
- amdlibPIX_SORT(p[4], p[2]);
- return(p[4]) ;
-}
-#undef amdlibPIX_SORT
-
-
-
-/**
- * Invert squared matrix by LU decomposition.
- *
- * This function inverts a squared (dim,dim) matrix and writes the result in
- * place.
- *
- * @param matrix matrix to invert
- * @param dim dimension of the matrix
- *
- * @return
- * Always return amdlibSUCCESS
- */
-amdlibCOMPL_STAT amdlibInvertMatrix(double *matrix, int dim)
-{
- int i;
- int j;
- int k;
- double sum = 0.0;
- double x = 1.0;
-
- amdlibLogTrace("amdlibInvertMatrix()");
-
- if (dim <= 0)
- {
- return amdlibFAILURE; /* sanity check */
- }
- if (dim == 1)
- {
- return amdlibFAILURE; /* must be of dimension >= 2 */
- }
-
- for (i = 1; i < dim; i++)
- {
- matrix[i] /= matrix[0]; /* normalize row 0 */
- }
-
- for (i = 1; i < dim; i++)
- {
- for (j = i; j < dim; j++) /* do a column of L */
- {
- sum = 0.0;
- for (k = 0; k < i; k++)
- {
- sum += matrix[j*dim + k] * matrix[k*dim + i];
- }
- matrix[j*dim + i] -= sum;
- }
- if (i == dim - 1)
- {
- continue;
- }
- for (j = i + 1; j < dim; j++) /* do a row of U */
- {
- sum = 0.0;
- for (k = 0; k < i; k++)
- {
- sum += matrix[i*dim +k ] * matrix[k*dim + j];
- }
- matrix[i*dim + j] = (matrix[i*dim + j] - sum) / matrix[i*dim + i];
- }
- }
- for (i = 0; i < dim; i++) /* invert L */
- {
- for (j = i; j < dim; j++)
- {
- x = 1.0;
- if (i != j)
- {
- x = 0.0;
- for (k = i; k < j; k++)
- x -= matrix[j*dim + k] * matrix[k*dim + i];
- }
- matrix[j*dim + i] = x / matrix[j*dim + j];
- }
- }
- for (i = 0; i < dim; i++) /* invert U */
- {
- for (j = i; j < dim; j++)
- {
- if (i == j)
- {
- continue;
- }
- sum = 0.0;
- for (k = i; k < j; k++)
- {
- sum += matrix[k*dim + j] * ((i == k) ? 1.0 : matrix[i*dim +k]);
- }
- matrix[i*dim + j] = -sum;
- }
- }
-
- for (i = 0; i < dim; i++) /* final inversion */
- {
- for (j = 0; j < dim; j++)
- {
- sum = 0.0;
- for (k = ((i > j) ? i : j); k < dim; k++)
- {
- sum += ((j == k) ? 1.0 : matrix[j*dim + k]) * matrix[k*dim +i];
- }
- matrix[j*dim + i] = sum;
- }
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Tranpose matrix.
- *
- * This function transposes (dim1,dim2) matrix into (dim1,dim2) matrix
- *
- * @param matrix matrix to transpose
- * @param tmatrix transposed matrix
- * @param dim1 dimension along X-axis of the matrix
- * @param dim2 dimension along Y-axis of the matrix
- *
- * @return
- * Always return amdlibSUCCESS
- */
-void amdlibTransposeMatrix(double *matrix, double *tmatrix, int dim1, int dim2)
-{
- int i;
- int j;
-
- amdlibLogTrace("amdlibTransposeMatrix()");
-
- for (i = 0; i < dim2; i++)
- {
- for (j = 0; j < dim1; j++)
- {
- tmatrix[i*dim1 + j] = matrix[j*dim2 + i];
- }
- }
-}
-
-/**
- * Computes the product matrix
- *
- * This function computes the product of a (dim1,dim2) matrix with a (dim2,dim3)
- * matrix.
- *
- * @param matrix1 matrix 1 used in product
- * @param matrix2 matrix 2 used in product
- * @param matprod matrix resulting of matrix product
- * @param dim1 dimension along X-axis of the matrix 1
- * @param dim2 dimension along Y-axis of the matrix 1 and along X-axis of the
- * matrix 2
- * @param dim3 dimension along Y-axis of the matrix 2
- *
- * @return
- * Always return amdlibSUCCESS
- */
-amdlibCOMPL_STAT amdlibProductMatrix(double *matrix1, double *matrix2,
- double *matprod, int dim1, int dim2,
- int dim3)
-{
- int i,j,k;
-
- amdlibLogTrace("amdlibProductMatrix()");
-
- for (i = 0; i < dim1; i++)
- {
- for (j = 0; j < dim3; j++)
- {
- matprod[i*dim3 + j] = 0.;
- for (k = 0; k < dim2; k++)
- {
- matprod[i*dim3 + j] += matrix1[i*dim2 + k] *
- matrix2[k*dim3 + j];
- }
- }
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Compute the covariance of 2 observables x and y
- *
- * This function computes the covariance of 2 observables x and y
- * matrixes. These observables are should be stored in multi-dimensional array
- * having the following dimensions [nbFrames][nbWlen][nbBases].
- * The resulting covariance is stored in a vector [nbWlen][nbBases].
- *
- * @param x first observable
- * @param y second observable
- * @param lambda wavelength index at which covariance is computed
- * @param nbWlen number of wavelengths
- * @param nbFrames number of frames
- * @param nbBases number of bases
- * @param cov_xy vector where result is stored
- */
-void amdlibComputeMatrixCov(double *x, double *y, int lambda, int nbWlen,
- int nbFrames, int nbBases, double *cov_xy)
-{
- int kbase;
- int ifram;
- double prod = 0.;
- double av_x = 0.;
- double av_y = 0.;
-
- amdlibLogTrace("amdlibComputeMatrixCov()");
-
- for (kbase = 0; kbase < nbBases; kbase++)
- {
- prod = 0.;
- av_x = 0.;
- av_y = 0.;
- for (ifram = 0; ifram < nbFrames; ifram++)
- {
- /* sum(xy) */
- prod += x[nbBases*nbWlen*ifram + nbBases*lambda + kbase] *
- y[nbBases*nbWlen*ifram + nbBases*lambda + kbase];
- /* sum(x) */
- av_x += x[nbBases*nbWlen*ifram + nbBases*lambda + kbase];
- /* sum(y) */
- av_y += y[nbBases*nbWlen*ifram + nbBases*lambda + kbase];
- }
- /* averages */
- prod /= nbFrames;
- av_x /= nbFrames;
- av_y /= nbFrames;
- /* cov(x,y) = average(xy)-average(x)*average(y) */
- cov_xy[nbBases*lambda + kbase] = prod - (av_x * av_y);
- }
-}
-
-/**
- * Compute the covariance of 2 vectors x and y
- *
- * This function computes the covariance of 2 vectors x and y.
- * having the dimension [nbFrames].
- * The resulting covariance is stored in a double.
- *
- * @param x first observable
- * @param y second observable
- * @param nbFrames number of frames
- */
-double amdlibComputeCov(double *x, double *y, int nbFrames)
-{
- int ifram;
- double prod = 0.;
- double av_x = 0.;
- double av_y = 0.;
- double cov_xy = 0.;
-
- prod = 0.;
- av_x = 0.;
- av_y = 0.;
- for (ifram = 0; ifram < nbFrames; ifram++)
- {
- /* sum(xy) */
- prod += x[ifram] * y[ifram];
- /* sum(x) */
- av_x += x[ifram];
- /* sum(y) */
- av_y += y[ifram];
- }
- /* averages */
- prod /= nbFrames;
- av_x /= nbFrames;
- av_y /= nbFrames;
- /* cov(x,y) = average(xy)-average(x)*average(y) */
- cov_xy = prod - (av_x * av_y);
- return (cov_xy);
-}
-
-double amdlibComputeWeightedCov(int n, double *x, double *wx,
- double *y, double *wy)
-{
- int i, nv=0;
- double prod = 0.;
- double av_x = 0.;
- double av_y = 0.;
- double cov_xy = 0.;
-
- prod = 0.;
- av_x = 0.;
- av_y = 0.;
- for (i = 0; i < n; i++)
- {
- if ((x[i] == x[i]) && (wx[i] > 0) && (y[i] == y[i]) && (wx[i] > 0))
- {
- nv++;
- /* sum(xy) */
- prod += x[i] * y[i];
- /* sum(x) */
- av_x += x[i];
- /* sum(y) */
- av_y += y[i];
- }
- }
- if (nv > 0)
- {
- /* averages */
- prod /= nv;
- av_x /= nv;
- av_y /= nv;
- /* cov(x,y) = average(xy)-average(x)*average(y) */
- cov_xy = prod - (av_x * av_y);
- return (cov_xy);
- }
- return(0.0);
-}
-
-
-void amdlibLinearFit(int n, double *x, double *wx, double *y,
- double *wy, double *a, double *b)
-{
- double sx,sy,sxy,mx,my;
-
- sx=amdlibPow2(amdlibRmsTable(n,x,wx));
- sy=amdlibPow2(amdlibRmsTable(n,y,wy));
- mx=amdlibAvgTable(n,x,wx);
- my=amdlibAvgTable(n,y,wy);
- sxy=amdlibComputeWeightedCov(n,x,wx,y,wy);
- *b=sxy/sx;
- *a=my-(*b)*mx;
-}
-
-void amdlibBoxCarSmooth(int n, double *y, int w)
-{
- double *x;
- int i,j;
-
- x=calloc(n,sizeof(double));
- for (i=0;i<n;i++)
- {
- x[i]=y[i];
- }
-
- for (i=((w-1)/2)-1;i<n-(w+1)/2;i++)
- {
- x[i]=0.0;
- for (j=0;j<w;j++)
- {
- x[i]+=y[i+j-w/2];
- }
- }
- for (i=((w-1)/2)-1;i<n-(w+1)/2;i++)
- {
- y[i]=x[i]/w;
- }
- free(x);
-}
-
-void amdlibHalfComplexGaussianShape(int n, double *y, double fwhm)
-{
- int i;
- double c,x, val;
- double fact1=2.354820044;
-
- c=2.0/fwhm;
- c=c/fact1;
- y[0]=1;
- /* This is a multiplying factor on the complex, i.e., the real and
- * imaginary parts which are stored in a halfComplex as follows:
- * r0, r1, r2, ..., rn/2, i(n+1)/2-1, ..., i2, i1 */
- y[0] = 1;
- for (i = 1; i < (n + 1) / 2; i++)
- {
- x=2.0*(double)i/(double)n;
- val=exp(-1*x*x/2/c/c) ;
- y[i] = val;
- y[n- i] = val;
- }
- if (n % 2 == 0)
- {
- x=2.0;
- val=exp(-1*x*x/2/c/c) ;
- y[n/ 2] = val;
- }
-
-}
-
-void amdlibGaussSmooth(int n, double *y, double w)
-{
-#include <complex.h>
-#include <fftw3.h>
- double *x,*fft,*g;
- double lin;
- double debut = y[0];
- double fin = y[n - 1];
- int i;
-
- fftw_plan p;
-
- x=calloc(n,sizeof(double));
- fft=calloc(n,sizeof(double));
- g=calloc(n,sizeof(double));
-
- /* compute gauss fft shape */
- amdlibHalfComplexGaussianShape(n, g, w);
-
- /*remove the linear function between start and end */
- for (i=0;i<n;i++)
- {
- lin = ((fin-debut) / (n - 1)) * i + debut;
- x[i]=y[i]-lin;
- }
-
- /* we use fftw's HalfComplex format in amdlib */
- p = fftw_plan_r2r_1d(n, x, fft, FFTW_R2HC, FFTW_ESTIMATE);
- fftw_execute(p);
- fftw_destroy_plan(p);
- /* multiply */
-
- for (i = 0; i < n ; i++)
- {
- fft[i] *= g[i];
- }
-
- p = fftw_plan_r2r_1d(n, fft, x, FFTW_HC2R, FFTW_ESTIMATE);
- fftw_execute(p);
- fftw_destroy_plan(p);
-
- /* give back with normalization N (fftw) and initial slope */
- for (i=0;i<n;i++)
- {
- lin = ((fin-debut) / (n - 1)) * i + debut;
- y[i]=x[i]/n+lin;
- }
- free(g);
- free(fft);
- free(x);
-}
-
-void amdlibLinearize(int n, double *y, double *wy)
-{
- double *x,*wx;
- double a=0,b=0;
- int i;
- x=calloc(n,sizeof(double));
- wx=calloc(n,sizeof(double));
- for (i=0;i<n;i++)
- {
- x[i]=i;
- wx[i]=1.0;
- }
- amdlibLinearFit(n,x,wx,y,wy,&a,&b);
- for (i=0;i<n;i++)
- {
- y[i]=a+b*x[i];
- }
-
- free(x);
- free(wx);
-}
-
-/**
- * Calculate ponderated mean.
- *
- * @param nbPix size of table.
- * @param table input data.
- * @param sigma2 ponderation values.
- *
- * @return the average value.
- */
-double amdlibAvgTable(int nbPix,
- double *table,
- double *sigma2)
-{
- double ponderation = 0;
- double avg = 0;
- int iPix;
-
- for (iPix = 0; iPix < nbPix; iPix++)
- {
- if ((table[iPix] == table[iPix]) && (sigma2[iPix] > 0))
- {
- avg += table[iPix] / sigma2[iPix];
- ponderation += 1.0 / sigma2[iPix];
- }
- }
- if (ponderation > 0)
- {
- avg /= ponderation;
- }
-
- return avg;
-}
-
-/**
- * Calculate the residual rms.
- *
- * @param nbPix size of table.
- * @param table input data.
- * @param sigma2 ponderation values.
- *
- * @return the value of rms.
- */
-double amdlibRmsTable(int nbPix,
- double *table,
- double *sigma2)
-{
- double ponderation = 0;
- double avg = 0;
- double rms = 0;
- int iPix;
-
- avg = amdlibAvgTable(nbPix, table, sigma2);
-
- for (iPix = 0; iPix < nbPix; iPix++)
- {
- if ((table[iPix] == table[iPix]) && (sigma2[iPix] > 0))
- {
- rms += amdlibPow2(table[iPix] - avg) / sigma2[iPix];
- ponderation += 1.0 / sigma2[iPix];
- }
- }
-
- if (ponderation > 0)
- {
- rms /= ponderation;
- rms = sqrt(rms);
- }
- return rms;
-}
-
-
-/**
- * Calculate mean.
- *
- * @param nbPix size of table.
- * @param table input data.
- * @return the average value.
- */
-double amdlibAvgValues(int nbPix, double *table)
-{
- double ponderation = 0;
- double avg = 0;
- int iPix;
-
- for (iPix = 0 ; iPix < nbPix; iPix++)
- {
- if (table[iPix] == table[iPix]) /*nan-protected*/
- {
- avg += table[iPix] ;
- ponderation += 1.0 ;
- }
- }
- if (ponderation > 0)
- {
- avg /= ponderation;
- }
-
- return avg;
-}
-
-/**
- * Calculate the residual rms.
- *
- * @param nbPix size of table.
- * @param table input data.
- * @return the value of rms.
- */
-double amdlibRmsValues(int nbPix, double *table)
-{
- double ponderation = 0;
- double avg = 0;
- double rms = 0;
- int iPix;
-
- avg = amdlibAvgValues(nbPix, table);
-
- for (iPix = 0; iPix < nbPix; iPix++)
- {
- if (table[iPix] == table[iPix]) /*nan-protected*/
- {
- rms += amdlibPow2(table[iPix] - avg);
- ponderation += 1.0;
- }
- }
-
- if (ponderation > 0)
- {
- rms /= ponderation;
- rms = sqrt(rms);
- }
- return rms;
-}
-
-
-/**
- * Compute signed square root
- *
- * @param a input value.
- *
- * @return the value computed.
- */
-double amdlibSignedSqrt(double a)
-{
- double val = a;
- if (a != 0.0)
- {
- val = (a / fabs(a)) * sqrt(fabs(a));
- }
- return val;
-}
-
-#define amdlibCorrect3DVisTableFromAchromaticPiston_FREEALL() \
- amdlibFree3DArrayComplex(tmpCpxVis);
-
-/**
- * Removes a constant phase (achromatic piston) on a complexVisibility vector.
- */
-amdlibCOMPL_STAT amdlibCorrect3DVisTableFromAchromaticPiston(
- amdlibCOMPLEX ***cpxVisTable,
- amdlibCOMPLEX ***cNopTable,
- int nbFrames,
- int nbBases,
- int nbLVis,
- amdlibDOUBLE *wlen,
- amdlibDOUBLE **pst,
- amdlibERROR_MSG errMsg)
-{
-
- int iFrame;
- int iBase;
- int lVis, nbGoodVis;
- double x;
- amdlibCOMPLEX phasor, cpxVis, cpxVisAvg;
- amdlibCOMPLEX *** tmpCpxVis = NULL;
-
- tmpCpxVis = amdlibAlloc3DArrayComplex(nbLVis, nbBases, nbFrames, errMsg);
- if (tmpCpxVis == NULL)
- {
- amdlibCorrect3DVisTableFromAchromaticPiston_FREEALL();
- return amdlibFAILURE;
- }
- for (iFrame = 0; iFrame < nbFrames; iFrame++)
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- if( !(amdlibCompareDouble(pst[iFrame][iBase],amdlibBLANKING_VALUE)))
- {
- for (lVis = 0; lVis < nbLVis; lVis++) /*Flagged Vis not important here*/
- {
- /* Note older versions artificially removed -1*pst
- * since the pst sign in amdlib was kept wrong because
- * the OPD correction at ESO was in the wrong direction.
- * To use this new version in the OS at Paranal, one must
- * change the sign of the displacements of, e.g., the Delay
- * lines that are used in templates.
- * x = (2 * M_PI/wlen[lVis]) * -1*pst[iFrame][iBase]; */
- x = (2 * M_PI/wlen[lVis]) * pst[iFrame][iBase];
- phasor.re = cos(x);
- phasor.im = -sin(x);
- cpxVis.re = cpxVisTable[iFrame][iBase][lVis].re;
- cpxVis.im = cpxVisTable[iFrame][iBase][lVis].im;
-
- /* Store complex Product of the phasor with the coherent flux
- in cNopTable*/
- amdlibCpxMul(cpxVis, phasor, cNopTable[iFrame][iBase][lVis]);
- }
- /*Flag cNopTable where cpxVis was Flagged */
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- if (amdlibCompareDouble(cpxVisTable[iFrame][iBase][lVis].re,amdlibBLANKING_VALUE))
- {
- cNopTable[iFrame][iBase][lVis].re=amdlibBLANKING_VALUE;
- cNopTable[iFrame][iBase][lVis].im=amdlibBLANKING_VALUE;
- }
- }
- /* Recenter this by removing the mean, taking account of bad Vis */
- /* Compute the mean over lambda */
- cpxVisAvg.re = 0.0;
- cpxVisAvg.im = 0.0;
- for (nbGoodVis=0, lVis = 0; lVis < nbLVis; lVis++)
- {
- if (!amdlibCompareDouble(cNopTable[iFrame][iBase][lVis].re,amdlibBLANKING_VALUE))
- {
- cpxVisAvg.re += cNopTable[iFrame][iBase][lVis].re;
- cpxVisAvg.im += cNopTable[iFrame][iBase][lVis].im;
- nbGoodVis++;
- }
- }
- cpxVisAvg.re /= nbGoodVis;
- cpxVisAvg.im /= nbGoodVis;
- /* Store conjugate complex values in tmpCpxVis as (constant)
- * vector */
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- tmpCpxVis[iFrame][iBase][lVis].re = cpxVisAvg.re;
- tmpCpxVis[iFrame][iBase][lVis].im = -cpxVisAvg.im;
- }
- /*Remove constant by multiplying the two */
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- phasor.re = tmpCpxVis[iFrame][iBase][lVis].re;
- phasor.im = tmpCpxVis[iFrame][iBase][lVis].im;
- cpxVis.re = cNopTable[iFrame][iBase][lVis].re;
- cpxVis.im = cNopTable[iFrame][iBase][lVis].im;
- /* Store Complex Product of the phasor with the coherent flux
- in cNopTable*/
- amdlibCpxMul(cpxVis, phasor, cNopTable[iFrame][iBase][lVis]);
- }
- /*re-Flag cNopTable where cpxVis was Flagged */
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- if (amdlibCompareDouble(cpxVisTable[iFrame][iBase][lVis].re,amdlibBLANKING_VALUE))
- {
- cNopTable[iFrame][iBase][lVis].re=amdlibBLANKING_VALUE;
- cNopTable[iFrame][iBase][lVis].im=amdlibBLANKING_VALUE;
- }
- }
- }
- else
- {
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- cNopTable[iFrame][iBase][lVis].re=amdlibBLANKING_VALUE;
- cNopTable[iFrame][iBase][lVis].im=amdlibBLANKING_VALUE;
- }
- }
- }
- }
- amdlibCorrect3DVisTableFromAchromaticPiston_FREEALL();
-
- return amdlibSUCCESS;
-}
-
-int amdlibFindIndexOfMinimum(double *data, int N)
-{
- double min = data[0];
- int theIndex = 0;
- int i;
- for (i = 1; i < N; i++)
- {
- if (data[i] < min)
- {
- min = data[i];
- theIndex = i;
- }
- }
- return (theIndex);
-}
-
-double amdlibArrayDoubleMinimum(double *data, int N)
-{
- double min = data[0];
- int i;
- for (i = 1; i < N; i++)
- {
- if (data[i] < min)
- {
- min = data[i];
- }
- }
- return (min);
-}
-
-int amdlibFindIndexOfMaximum(double *data, int N)
-{
- double max = data[0];
- int theIndex = 0;
- int i;
- for (i = 1; i < N; i++)
- {
- if (data[i] > max)
- {
- max = data[i];
- theIndex = i;
- }
- }
- return (theIndex);
-}
-
-double amdlibArrayDoubleMaximum(double *data, int N)
-{
- double max = data[0];
- int i;
- for (i = 1; i < N; i++)
- {
- if (data[i] > max)
- {
- max = data[i];
- }
- }
- return (max);
-}
-
-double amdlibArrayDoubleSum(double *data, int N)
-{
- double sum = 0;
- int i;
- for (i = 1; i < N; i++)
- {
- sum += data[i];
- }
- return (sum);
-}
-
-int amdlibCompareDouble(double x, double y)
- {
- if ( fabs(x-y) < (double)amdlibPRECISION )
- {
- return 1;
- }
- else
- {
- return 0;
- }
- }
-
-amdlibCOMPL_STAT amdlibComputeUVCoords(amdlibSCIENCE_DATA *data,
- int nbBases,
- amdlibDOUBLE **uCoord, /* uCoord[iFrame][iBase]*/
- amdlibDOUBLE **vCoord) /* vCoord[iFrame][iBase]*/
-{
- double ha,x,y,z;
- double xx,yy,zz;
- double cl,sl,ch,sh,cd,sd;
- int iBase, iFrame, nbFrames=data->nbFrames;
- double deltaT;
-
- /* play it for lst and lst+duration*/
- cl=cos(data->issInfo.geoLat);
- cd=cos(data->issInfo.dec);
- sl=sin(data->issInfo.geoLat);
- sd=sin(data->issInfo.dec);
- /* get baseline vectors in equatorial local coords */
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- int tel1;
- int tel2;
- if (nbBases == 1)
- {
- tel1 = 0;
- tel2 = 1;
- }
- else
- {
- tel1 = amdlibMin((iBase % nbBases) , ((iBase+1) % nbBases) );
- tel2 = amdlibMax((iBase % nbBases) , ((iBase+1) % nbBases) );
- }
-
- /*axes x and y seem reverted wrt the aspro convention. I use aspro sign:*/
- x=(-1*data->issInfo.stationCoordinates[0][tel2])-(-1*data->issInfo.stationCoordinates[0][tel1]);
- y=(-1*data->issInfo.stationCoordinates[1][tel2])-(-1*data->issInfo.stationCoordinates[1][tel1]);
- z=data->issInfo.stationCoordinates[2][tel2]-data->issInfo.stationCoordinates[2][tel1];
-
- /* convert to equatorial local */
- xx=0*x-sl*y+cl*z;
- yy=x+0*y+0*z;
- zz=0*x+cl*y+sl*z;
-
- for (iFrame=0; iFrame < nbFrames; iFrame++)
- {
- deltaT = (data->timeTag[iFrame]-data->timeTag[0]); /*seconds*/
- /* hour angle start */
- ha=fmod(data->issInfo.lst-data->issInfo.ra+(deltaT*M_PI/3600.0/12.0),2*M_PI);
- ch=cos(ha);
- sh=sin(ha);
- /* project onto star direction */
- uCoord[iFrame][iBase]=sh*xx+ch*yy;
- vCoord[iFrame][iBase]=-sd*ch*xx+sd*sh*yy+cd*zz;
- }
- }
- return amdlibSUCCESS;
-}
-
-amdlibCOMPL_STAT amdlibComputeBaselines(amdlibISS_INFO *iss, int nbBases,
- double duration)
-{
- double ha,x,y,z,u,v,w;
- double xx[amdlibNBASELINE],yy[amdlibNBASELINE],zz[amdlibNBASELINE];
- double cl,sl,ch,sh,cd,sd;
- int i;
-
- /* play it for lst and lst+duration*/
- cl=cos(iss->geoLat);
- cd=cos(iss->dec);
- sl=sin(iss->geoLat);
- sd=sin(iss->dec);
- /* get baseline vectors in equatorial local coords */
- for (i = 0; i < nbBases; i++)
- {
- int tel1;
- int tel2;
- if (nbBases == 1)
- {
- tel1 = 0;
- tel2 = 1;
- }
- else
- {
- tel1 = amdlibMin((i % nbBases) , ((i+1) % nbBases) );
- tel2 = amdlibMax((i % nbBases) , ((i+1) % nbBases) );
- }
-
- /*axes x and y seem reverted wrt the aspro convention. I use aspro sign:*/
- x=(-1*iss->stationCoordinates[0][tel2])-(-1*iss->stationCoordinates[0][tel1]);
- y=(-1*iss->stationCoordinates[1][tel2])-(-1*iss->stationCoordinates[1][tel1]);
- z=iss->stationCoordinates[2][tel2]-iss->stationCoordinates[2][tel1];
-
- /* convert to equatorial local */
- xx[i]=0*x-sl*y+cl*z;
- yy[i]=x+0*y+0*z;
- zz[i]=0*x+cl*y+sl*z;
- }
-
- for (i = 0; i < nbBases; i++)
- {
- /* hour angle start */
- ha=fmod(iss->lst-iss->ra,2*M_PI);
- ch=cos(ha);
- sh=sin(ha);
- /* project onto star direction */
- u=sh*xx[i]+ch*yy[i];
- v=-sd*ch*xx[i]+sd*sh*yy[i]+cd*zz[i];
- w=cd*ch*xx[i]-cd*sh*yy[i]+sd*zz[i];
- /* Update PBL and PBLA at Start and End to enable further interpolation of
- * u and v in amdlibVisibilities. */
- iss->projectedBaseStart[i]=sqrt(u*u+v*v);
- /* PBLA is a PA East of North */
- iss->projectedAngleStart[i]=fmod(90.0-(atan2(v,u)*180.0/M_PI),360.0);
- /* hour angle end. duration is in seconds of time, convert to radians */
- ha=fmod(iss->lst-iss->ra+(duration*M_PI/3600.0/12.0),2*M_PI);
- ch=cos(ha);
- sh=sin(ha);
- /* project onto star direction */
- u=sh*xx[i]+ch*yy[i];
- v=-sd*ch*xx[i]+sd*sh*yy[i]+cd*zz[i];
- w=cd*ch*xx[i]-cd*sh*yy[i]+sd*zz[i];
- /* Update PBL and PBLA at Start and End to enable further interpolation of
- * u and v in amdlibVisibilities. */
- iss->projectedBaseEnd[i]=sqrt(u*u+v*v);
- iss->projectedAngleEnd[i]=fmod(90.0-(atan2(v,u)*180.0/M_PI),360.0);
- }
- return amdlibSUCCESS;
-}
-
-
-double amdlibAbacusErrPhi(double x)
-/**
- * Estimate true phase rms from the cross-spectrum variance.
- * see Petrov, Roddier and Aime, JOSAA vol 3, N�5, may 1986 p 634.
- * and Petrov's Thesis, p. 50 ff.
- * I replace the piecewise interpolation usually used by a polynomial
- * approximation of the function:
- * if z=log10(y),
- * then z=(C[1]*X^7+C[2]*X^6+C[3]*X^5+C[4]*X^4+C[5]*X^3+C[6]*X^2+C[7]*X+C[8])
- * and y=10^z.
- * where
- * C[01]= 2.71918080109099
- * C[02]=-17.1901043936273
- * C[03]= 45.0654103760899
- * C[04]=-63.4441678243197
- * C[05]= 52.3098941426378
- * C[06]=-25.8090699917488
- * C[07]= 7.84352873962491
- * C[08]=-1.57308595820081
- * This interpolation is valid in the range x=[0.1,1.74413].
- * Error is 1% everywhere except above x=1.73 where it is 10%
- * Below x=0.1: y=x
- * Above x=M_PI/sqrt(3.0), y = blanking (impossible value)
- * Above x=1.74413, we take: y=0.691/(pi/sqrt(3.0)-x)
- */
-{
- const double Asymptot=M_PI/sqrt(3.0);
- double c[8]={2.7191808010909,
- -17.1901043936273,
- 45.0654103760899,
- -63.4441678243197,
- 52.3098941426378,
- -25.8090699917488,
- 7.84352873962491,
- -1.57308595820081};
-
- double x2,x3,x4,x5,x6,x7,z;
- if(x>Asymptot)
- {
- return((double)amdlibBLANKING_VALUE);
- }
- if(x>1.74413)
- {
- return(0.691/(Asymptot-x));
- }
- if(x<0.1)
- {
- return(x);
- }
- x2=x*x;
- x3=x2*x;
- x4=x2*x2;
- x5=x3*x2;
- x6=x3*x3;
- x7=x6*x;
- z=c[0]*x7+c[1]*x6+c[2]*x5+c[3]*x4+c[4]*x3+c[5]*x2+c[6]*x+c[7];
- return pow(10,z);
-}
-
-double amdlibRefractiveAirIndex(double lambda,
- double temp,
- double pressure,
- double partialWaterVaporPressure)
-/*
-* Compute the refractive air index by Edlen's formula.
-* It can be found in 'Owens, 1967', p-56 Eq.32
-*
-* Inputs:
-* - lambda: (double) wavelength in nm (AMBER).
-* - temp, double: temperature in [K]
-* - pressure, double: pressure in [Pascal]
-* - partialWaterVaporPressure, double: partial pressure of water vapor in [Pascal]
-*
-* Outputs:
-* - amdlibRefractiveAirIndex, double:
-* refractive index of air at lambda.
-* nb: the air index n is defined as
-* n = 1 + amdlibRefractiveAirIndex*1e-8
-*
-* This function is validated. It can be improved by the work of Vannier M.
-* which try to take into account a better description of the water vapor
-* dispersion.
-* credits: JB Le Bouquin
-* SEE ALSO: Owens, 1967, p-56 Eq.32
-*/
-{
- double t,p,f,s2,l,r;
- /* initial conversion */
- t = temp - 273.15; /* t in [deg Centigrade] */
- p = pressure / 1.333224e+02; /* p in [torricelli] */
- f = partialWaterVaporPressure / 1.333224e+02; /* f in [torricelli] */
- l=1.0E3*lambda; /* constants below are for lambda in [micron] */
- s2 = 1.0/(l*l);
-
- /* air refraction , Owens, 1967, p-56 Eq 32 */
- r = (8342.13 + 2406030./(130.-s2) + 15997/(38.9-s2)) *
- (p/720.775) *
- (1 + p*(0.817 - 0.0133*t)*1e-6) / (1. + 0.0036610*t) +
- f*(5.722 - 0.0457*s2);
-
- return r;
-}
-
-/*___oOo___*/
diff --git a/amber/amdlibMisc.c b/amber/amdlibMisc.c
deleted file mode 100644
index 3996eec..0000000
--- a/amber/amdlibMisc.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Miscellaneous useful functions.
- *
- * This file contains functions:
- * - to handle program (main)
- */
-
-/*
- * System Headers
- */
-#include <stdio.h>
-#include <string.h>
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-
-/*
- * Protected functions definition
- */
-
-static amdlibUSERPREF_VALUES amdlibUserPrefValues[24]=
-{
- {amdlibFALSE,0.0},{amdlibFALSE,0.0},{amdlibFALSE,0.0},
- {amdlibFALSE,0.0},{amdlibFALSE,0.0},{amdlibFALSE,0.0},
- {amdlibFALSE,0.0},{amdlibFALSE,0.0},{amdlibFALSE,0.0},
- {amdlibFALSE,0.0},{amdlibFALSE,0.0},{amdlibFALSE,0.0},
- {amdlibFALSE,0.0},{amdlibFALSE,0.0},{amdlibFALSE,0.0},
- {amdlibFALSE,0.0},{amdlibFALSE,0.0},{amdlibFALSE,0.0},
- {amdlibFALSE,0.0},{amdlibFALSE,0.0},{amdlibFALSE,0.0},
- {amdlibFALSE,0.0},{amdlibFALSE,0.0},{amdlibFALSE,0.0}
-};
-
-/**
- * Get the program name.
- *
- * Get the program name without its path, if argv0 was containing it.
- *
- * @param argv0 name of the program
- *
- * @return pointer on the program name.
- */
-const char * amdlibGetProgramName(char * argv0)
-{
- const char *endPath;
- const char *programName;
-
- /* Find if a path exists in front of program name */
- endPath = strrchr(argv0, '/');
- if (endPath != (char *)NULL)
- {
- /* A path exists: only retrieve program name which is
- * after the last slash caracter
- */
- programName = endPath + 1;
- }
- else
- {
- /* No path in front of program name */
- programName = argv0;
- }
-
- return programName;
-}
-
-amdlibUSERPREF_VALUES amdlibGetUserPref(int code)
-{
- return(amdlibUserPrefValues[code]);
-}
-
-void amdlibSetUserPref(int code, amdlibDOUBLE value)
-{
- amdlibUserPrefValues[code].set=amdlibTRUE;
- amdlibUserPrefValues[code].value=value;
-}
-
-void amdlibUnsetUserPref(int code)
-{
- amdlibUserPrefValues[code].set=amdlibFALSE;
- amdlibUserPrefValues[code].value=0.0;
-}
-
-
-
-/*___oOo___*/
diff --git a/amber/amdlibMultiDimArray.c b/amber/amdlibMultiDimArray.c
deleted file mode 100644
index 7591657..0000000
--- a/amber/amdlibMultiDimArray.c
+++ /dev/null
@@ -1,919 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Functions to handle dynamical multi-dimensional arrays
- *
- * Tables of pointers are used in order to make easier the access to arrays
- * elements by a classical indexation method : tab[i][j] or tab[i][j][k].
- * If required, the memory allocated for elements is contiguous, the type of
- * stored elements is specified in the function name. Elements are initialized
- * to 0. If not, tables of pointers just wrap already assigned arrays.
- */
-
-/*
- * System Headers
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/*
- * Protected functions definition
- */
-/**
- * Allocate memory for 2-dimensional array of unsigned char.
- *
- * This function allocates a 2-dimensional array of unsigned char. Elements are
- * initialized to 0.
- *
- * @param firstDim first dimension of allocated array.
- * @param secondDim second dimension of allocated array.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-unsigned char **amdlibAlloc2DArrayUnsignedChar(const int firstDim,
- const int secondDim,
- amdlibERROR_MSG errMsg)
-{
- /* Check if each dimension is != 0 */
- if (firstDim == 0 || secondDim == 0)
- {
- amdlibSetErrMsg("Nil dimension");
- return NULL;
- }
-
- int i = 0;
- /* Create the table of pointers */
- unsigned char **tabOfPtr =
- (unsigned char **)calloc(secondDim, sizeof(unsigned char *));
- tabOfPtr[0] =
- (unsigned char *)calloc(firstDim * secondDim, sizeof(unsigned char));
- for (i=1; i < secondDim; ++i)
- {
- tabOfPtr[i] = tabOfPtr[0] + i*firstDim;
- }
- /* Initialize the data structure with 0 */
- memset(tabOfPtr[0], '\0', firstDim * secondDim * sizeof(unsigned char));
- return tabOfPtr;
-}
-
-/**
- * Allocate memory for 2-dimensional array of double.
- *
- * This function allocates a 2-dimensional array of double. Elements are
- * initialized to 0.0.
- *
- * @param firstDim first dimension of allocated array.
- * @param secondDim second dimension of allocated array.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-double **amdlibAlloc2DArrayDouble(const int firstDim,
- const int secondDim,
- amdlibERROR_MSG errMsg)
-{
- /* Check if each dimension is != 0 */
- if (firstDim == 0 || secondDim == 0)
- {
- amdlibSetErrMsg("Nil dimension");
- return NULL;
- }
-
- int i = 0;
- /* Create the table of pointers */
- double ** tabOfPtr = (double **)calloc(secondDim, sizeof(double *));
- tabOfPtr[0] = (double *)calloc(firstDim * secondDim, sizeof(double));
- for (i=1; i < secondDim; ++i)
- {
- tabOfPtr[i] = tabOfPtr[0] + i*firstDim;
- }
- /* Initialize the data structure with 0 */
- memset(tabOfPtr[0], '\0', firstDim * secondDim * sizeof(double));
- return tabOfPtr;
-}
-
-/**
- * Allocate memory for 3-dimensional array of double.
- *
- * This function allocates a 3-dimensional array of double. Elements are
- * initialized to 0.0.
- *
- * @param firstDim first dimension of allocated array.
- * @param secondDim second dimension of allocated array.
- * @param thirdDim third dimension of allocated array.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-double ***amdlibAlloc3DArrayDouble(const int firstDim,
- const int secondDim,
- const int thirdDim,
- amdlibERROR_MSG errMsg)
-{
- /* Check if each dimension is != 0 */
- if (firstDim == 0 || secondDim == 0 || thirdDim == 0)
- {
- amdlibSetErrMsg("Nil dimension");
- return NULL;
- }
-
- int i = 0;
- int j = 0;
- /* Create the table of pointers */
- double ***tabOfPtr = (double ***)calloc(thirdDim, sizeof(double **));
- tabOfPtr[0] = (double **)calloc(secondDim * thirdDim, sizeof(double *));
- tabOfPtr[0][0] =
- (double *)calloc(firstDim * secondDim * thirdDim, sizeof(double));
- for(i=0; i<thirdDim; i++)
- {
- tabOfPtr[i] = tabOfPtr[0] + i*secondDim;
- for(j=0; j<secondDim; j++)
- {
- tabOfPtr[i][j] = tabOfPtr[0][0] + i*firstDim*secondDim + j*firstDim;
- }
- }
- /* Initialize the data structure with 0 */
- memset(tabOfPtr[0][0], '\0',
- firstDim * secondDim * thirdDim * sizeof(double));
- return tabOfPtr;
-}
-
-/**
- * Allocate memory for 2-dimensional array of float.
- *
- * This function allocates a 2-dimensional array of float. Elements are
- * initialized to 0.0.
- *
- * @param firstDim first dimension of allocated array.
- * @param secondDim second dimension of allocated array.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-float **amdlibAlloc2DArrayFloat(const int firstDim,
- const int secondDim,
- amdlibERROR_MSG errMsg)
-{
- /* Check if each dimension is != 0 */
- if (firstDim == 0 || secondDim == 0)
- {
- amdlibSetErrMsg("Nil dimension");
- return NULL;
- }
-
- int i = 0;
- /* Create the table of pointers */
- float **tabOfPtr = (float **)calloc(secondDim, sizeof(float *));
- tabOfPtr[0] = (float *)calloc(firstDim * secondDim, sizeof(float));
- for (i=1; i < secondDim; ++i)
- {
- tabOfPtr[i] = tabOfPtr[0] + i*firstDim;
- }
- /* Initialize the data structure with 0 */
- memset(tabOfPtr[0], '\0', firstDim * secondDim * sizeof(float));
- return tabOfPtr;
-}
-
-/**
- * Allocate memory for 3-dimensional array of float.
- *
- * This function allocates a 3-dimensional array of float. Elements are
- * initialized to 0.0.
- *
- * @param firstDim first dimension of allocated array.
- * @param secondDim second dimension of allocated array.
- * @param thirdDim third dimension of allocated array.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-float ***amdlibAlloc3DArrayFloat(const int firstDim,
- const int secondDim,
- const int thirdDim,
- amdlibERROR_MSG errMsg)
-{
- /* Check if each dimension is != 0 */
- if (firstDim == 0 || secondDim == 0 || thirdDim == 0)
- {
- amdlibSetErrMsg("Nil dimension");
- return NULL;
- }
-
- int i = 0;
- int j = 0;
-
- /* Create the table of pointers */
- float ***tabOfPtr = (float ***)calloc(thirdDim, sizeof(float **));
- tabOfPtr[0] = (float **)calloc(secondDim * thirdDim, sizeof(float *));
- tabOfPtr[0][0] =
- (float *)calloc(firstDim * secondDim * thirdDim, sizeof(float));
- for(i=0; i<thirdDim; i++)
- {
- tabOfPtr[i] = tabOfPtr[0] + i*secondDim;
- for(j=0; j<secondDim; j++)
- {
- tabOfPtr[i][j] = tabOfPtr[0][0] + i*firstDim*secondDim + j*firstDim;
- }
- }
- /* Initialize the data structure with 0 */
- memset(tabOfPtr[0][0], '\0',
- firstDim * secondDim * thirdDim * sizeof(float));
- return tabOfPtr;
-}
-
-/**
- * Allocate memory for 2-dimensional array of amdlibCOMPLEX.
- *
- * This function allocates a 2-dimensional array of amdlibCOMPLEX. Elements are
- * initialized to 0.0.
- *
- * @param firstDim first dimension of allocated array.
- * @param secondDim second dimension of allocated array.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPLEX **amdlibAlloc2DArrayComplex(const int firstDim,
- const int secondDim,
- amdlibERROR_MSG errMsg)
-{
- /* Check if each dimension is != 0 */
- if (firstDim == 0 || secondDim == 0)
- {
- amdlibSetErrMsg("Nil dimension");
- return NULL;
- }
-
- int i = 0;
- /* Create the table of pointers */
- amdlibCOMPLEX **tabOfPtr = (amdlibCOMPLEX **)calloc(secondDim,
- sizeof(amdlibCOMPLEX*));
- tabOfPtr[0] = (amdlibCOMPLEX *)calloc(firstDim * secondDim,
- sizeof(amdlibCOMPLEX));
- for (i=1; i < secondDim; ++i)
- {
- tabOfPtr[i] = tabOfPtr[0] + i * firstDim;
- }
- /* Initialize the data structure with 0 */
- memset(tabOfPtr[0], '\0', firstDim * secondDim * sizeof(amdlibCOMPLEX));
- return tabOfPtr;
-}
-
-/**
- * Allocate memory for 3-dimensional array of amdlibCOMPLEX.
- *
- * This function allocates a 3-dimensional array of amdlibCOMPLEX. Elements are
- * initialized to 0.0.
- *
- * @param firstDim first dimension of allocated array.
- * @param secondDim second dimension of allocated array.
- * @param thirdDim third dimension of allocated array.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * pointer on amdlibCOMPLEX 3-dimensional array on successful completion.
- * Otherwise NULL is returned.
- */
-amdlibCOMPLEX ***amdlibAlloc3DArrayComplex(const int firstDim,
- const int secondDim,
- const int thirdDim,
- amdlibERROR_MSG errMsg)
-{
- /* Check if each dimension is != 0 */
- if (firstDim == 0 || secondDim == 0 || thirdDim == 0)
- {
- amdlibSetErrMsg("One of the amdlibCOMPLEX 3D-array dimension is null");
- return NULL;
- }
-
- int i = 0;
- int j = 0;
-
- /* Create the table of pointers */
- amdlibCOMPLEX ***tabOfPtr = (amdlibCOMPLEX ***)calloc(thirdDim,
- sizeof(amdlibCOMPLEX**));
- tabOfPtr[0] = (amdlibCOMPLEX **)calloc(secondDim * thirdDim,
- sizeof(amdlibCOMPLEX*));
- tabOfPtr[0][0] = (amdlibCOMPLEX *)calloc(firstDim * secondDim *thirdDim,
- sizeof(amdlibCOMPLEX));
- for(i=0; i<thirdDim; i++)
- {
- tabOfPtr[i] = tabOfPtr[0] + i*secondDim;
- for(j=0; j<secondDim; j++)
- {
- tabOfPtr[i][j] = tabOfPtr[0][0] + i*firstDim*secondDim + j*firstDim;
- }
- }
- /* Initialize the data structure with 0 */
- memset(tabOfPtr[0][0], '\0',
- firstDim * secondDim * thirdDim * sizeof(amdlibCOMPLEX));
-
- return tabOfPtr;
-}
-
-/**
- * Wrap a 2D-array.
- *
- * This function enables the wrapping of a 2D array of element by a table of
- * pointers, which allows to use classical indexation in order to access its
- * elements.
- *
- * @warning dimensions are supposed to be correct.
- *
- * @param array array to wrap.
- * @param firstDim first dimension of array.
- * @param secondDim second dimension of array.
- * @param elemSize size of element in array.
- * @param errMsg error description message returned if function fails.
- *
- * @return the wrapping.
- */
-void **amdlibWrap2DArray(void * array,
- const int firstDim,
- const int secondDim,
- const int elemSize,
- amdlibERROR_MSG errMsg)
-{
- /* Check if each dimension is != 0 */
- if (firstDim == 0 || secondDim == 0)
- {
- amdlibSetErrMsg("Nil dimension");
- return NULL;
- }
-
- /* Check array to wrap is not NULL */
- if (array == NULL)
- {
- amdlibSetErrMsg("Array to wrap NULL");
- return NULL;
- }
-
- int i = 0;
- /* Create the table of pointers */
- void **tabOfPtr = (void **)calloc(secondDim, sizeof(void *));
- /* No allocation of memory for data, it points on the input array */
- tabOfPtr[0] = array;
- for (i=1; i < secondDim; ++i)
- {
- tabOfPtr[i] = tabOfPtr[0] + i*firstDim*elemSize;
- }
- return tabOfPtr;
-}
-
-/**
- * Wrap a 3D-array.
- *
- * This function enables the wrapping of a 3D array of elements by a table of
- * pointers, which allows to use classical indexation in order to access its
- * elements.
- *
- * @warning dimensions are supposed to be correct.
- *
- * @param array array to wrap.
- * @param firstDim first dimension of array.
- * @param secondDim second dimension of array.
- * @param thirdDim third dimension of array.
- * @param elemSize size of element in array.
- * @param errMsg error description message returned if function fails.
- *
- * @return the wrapping.
- */
-void ***amdlibWrap3DArray(void * array,
- const int firstDim,
- const int secondDim,
- const int thirdDim,
- const int elemSize,
- amdlibERROR_MSG errMsg)
-{
- /* Check if each dimension is != 0 */
- if (firstDim == 0 || secondDim == 0 || thirdDim == 0)
- {
- amdlibSetErrMsg("Nil dimension");
- return NULL;
- }
-
- /* Check array to wrap is not NULL */
- if (array == NULL)
- {
- amdlibSetErrMsg("Array to wrap NULL");
- return NULL;
- }
-
- int i = 0;
- int j = 0;
- /* Create the table of pointers */
- void ***tabOfPtr = (void ***)calloc(thirdDim, sizeof(void **));
- tabOfPtr[0] = (void **)calloc(secondDim * thirdDim, sizeof(void *));
- /* No allocation of memory for data, it points on the input array */
- tabOfPtr[0][0] = array;
- for(i=0; i<thirdDim; i++)
- {
- tabOfPtr[i] = tabOfPtr[0] + i*secondDim;
- for(j=0; j<secondDim; j++)
- {
- tabOfPtr[i][j] = tabOfPtr[0][0] +
- (i*firstDim*secondDim + j*firstDim)*elemSize;
- }
- }
- return tabOfPtr;
-}
-
-/**
- * Wrap a 4D-array.
- *
- * This function enables the wrapping of a 3D array of elements by a table of
- * pointers, which allows to use classical indexation in order to access its
- * elements.
- *
- * @warning dimensions are supposed to be correct.
- *
- * @param array array to wrap.
- * @param firstDim first dimension of array.
- * @param secondDim second dimension of array.
- * @param thirdDim third dimension of array.
- * @param fourthDim third dimension of array.
- * @param elemSize size of element in array.
- * @param errMsg error description message returned if function fails.
- *
- * @return the wrapping.
- */
-void ****amdlibWrap4DArray(void * array,
- const int firstDim,
- const int secondDim,
- const int thirdDim,
- const int fourthDim,
- const int elemSize,
- amdlibERROR_MSG errMsg)
-{
- /* Check if each dimension is != 0 */
- if (firstDim == 0 || secondDim == 0 || thirdDim == 0 || fourthDim == 0)
- {
- amdlibSetErrMsg("Nil dimension");
- return NULL;
- }
-
- /* Check array to wrap is not NULL */
- if (array == NULL)
- {
- amdlibSetErrMsg("Array to wrap NULL");
- return NULL;
- }
-
- int i = 0;
- int j = 0;
- int k =0;
- /* Create the table of pointers */
- void ****tabOfPtr = (void ****)calloc(fourthDim, sizeof(void ***));
- tabOfPtr[0] = (void ***)calloc(thirdDim * fourthDim, sizeof(void **));
- tabOfPtr[0][0] = (void **)calloc(secondDim * thirdDim * fourthDim, sizeof(void *));
- /* No allocation of memory for data, it points on the input array */
- tabOfPtr[0][0][0] = array;
-
- for(i=0; i<fourthDim; i++)
- {
- tabOfPtr[i] = tabOfPtr[0] + i*thirdDim;
- for(j=0; j<thirdDim; j++)
- {
- tabOfPtr[i][j] = tabOfPtr[0][0] + i*thirdDim*secondDim + j*secondDim;
- for(k=0; k<secondDim; k++)
- {
- tabOfPtr[i][j][k] = tabOfPtr[0][0][0] +
- (i*firstDim*secondDim*thirdDim + j*firstDim*secondDim + k*firstDim)*elemSize;
- }
- }
- }
- return tabOfPtr;
-}
-
-
-/**
- * Wrap a 2D-array of float.
- *
- * This function enables the wrapping of a 2D array of float by a table of
- * pointers, which allows to use classical indexation in order to access its
- * elements.
- *
- * @warning dimensions are supposed to be correct.
- *
- * @param array array to wrap.
- * @param firstDim first dimension of array.
- * @param secondDim second dimension of array.
- * @param errMsg error description message returned if function fails.
- *
- * @return the wrapping.
- */
-float **amdlibWrap2DArrayFloat(float * array,
- const int firstDim,
- const int secondDim,
- amdlibERROR_MSG errMsg)
-{
- return (float **)amdlibWrap2DArray(array, firstDim, secondDim,
- sizeof(float), errMsg);
-}
-
-/**
- * Wrap a 3D-array of float.
- *
- * This function enables the wrapping of a 3D array of float by a table of
- * pointers, which allows to use classical indexation in order to access its
- * elements.
- *
- * @warning dimensions are supposed to be correct.
- *
- * @param array array to wrap.
- * @param firstDim first dimension of array.
- * @param secondDim second dimension of array.
- * @param thirdDim third dimension of array.
- * @param errMsg error description message returned if function fails.
- *
- * @return the wrapping.
- */
-float ***amdlibWrap3DArrayFloat(float * array,
- const int firstDim,
- const int secondDim,
- const int thirdDim,
- amdlibERROR_MSG errMsg)
-{
- return (float ***)amdlibWrap3DArray(array, firstDim, secondDim, thirdDim,
- sizeof(float), errMsg);
-}
-
-/**
- * Wrap a 2D-array of double.
- *
- * This function enables the wrapping of a 2D array of double by a table of
- * pointers, which allows to use classical indexation in order to access its
- * elements.
- *
- * @warning dimensions are supposed to be correct.
- *
- * @param array array to wrap.
- * @param firstDim first dimension of array.
- * @param secondDim second dimension of array.
- * @param errMsg error description message returned if function fails.
- *
- * @return the wrapping.
- */
-double **amdlibWrap2DArrayDouble(double * array,
- const int firstDim,
- const int secondDim,
- amdlibERROR_MSG errMsg)
-{
- return (double **)amdlibWrap2DArray(array, firstDim, secondDim,
- sizeof(double), errMsg);
-}
-
-/**
- * Wrap a 3D-array of double.
- *
- * This function enables the wrapping of a 3D array of double by a table of
- * pointers, which allows to use classical indexation in order to access its
- * elements.
- *
- * @warning dimensions are supposed to be correct.
- *
- * @param array array to wrap.
- * @param firstDim first dimension of array.
- * @param secondDim second dimension of array.
- * @param thirdDim third dimension of array.
- * @param errMsg error description message returned if function fails.
- *
- * @return the wrapping.
- */
-double ***amdlibWrap3DArrayDouble(double * array,
- const int firstDim,
- const int secondDim,
- const int thirdDim,
- amdlibERROR_MSG errMsg)
-{
- double ***tabOfPtr =
- (double ***)amdlibWrap3DArray(array, firstDim, secondDim, thirdDim,
- sizeof(double), errMsg);
- return tabOfPtr;
-}
-
-double ****amdlibWrap4DArrayDouble(double * array,
- const int firstDim,
- const int secondDim,
- const int thirdDim,
- const int fourthDim,
- amdlibERROR_MSG errMsg)
-{
- double ****tabOfPtr =
- (double ****)amdlibWrap4DArray(array, firstDim, secondDim,
- thirdDim, fourthDim,
- sizeof(double), errMsg);
- return tabOfPtr;
-}
-
-/**
- * Wrap a 2D-array of unsigned char.
- *
- * This function enables the wrapping of a 2D array of unsigned char by a
- * table of pointers, which allows to use classical indexation in order
- * to access its elements.
- *
- * @warning dimensions are supposed to be correct.
- *
- * @param array array to wrap.
- * @param firstDim first dimension of array.
- * @param secondDim second dimension of array.
- * @param errMsg error description message returned if function fails.
- *
- * @return the wrapping.
- */
-unsigned char **amdlibWrap2DArrayUnsignedChar(unsigned char * array,
- const int firstDim,
- const int secondDim,
- amdlibERROR_MSG errMsg)
-{
- unsigned char **tabOfPtr =
- (unsigned char **)amdlibWrap2DArray(array, firstDim, secondDim,
- sizeof(unsigned char), errMsg);
- return tabOfPtr;
-}
-
-/**
- * Free a dynamically allocated 2-dimensional array of unsigned char.
- *
- * This function frees a dynamically allocated 2-dimensional array of unsigned
- * char.
- *
- * @param arrayToFree array to free.
- */
-void amdlibFree2DArrayUnsignedChar(unsigned char **arrayToFree)
-{
- if (arrayToFree != NULL)
- {
- free((unsigned char *)arrayToFree[0]);
- free((unsigned char **)arrayToFree);
- arrayToFree = NULL;
- }
-}
-
-/**
- * Free a dynamically allocated 2-dimensional array of double.
- *
- * This function frees a dynamically allocated 2-dimensional array of double.
- *
- * @param arrayToFree array to free.
- */
-void amdlibFree2DArrayDouble(double **arrayToFree)
-{
- if (arrayToFree != NULL)
- {
- free((double *)arrayToFree[0]);
- free((double **)arrayToFree);
- arrayToFree = NULL;
- }
-}
-
-/**
- * Free a dynamically allocated 3-dimensional array of double.
- *
- * This function frees a dynamically allocated 3-dimensional array of double.
- *
- * @param arrayToFree array to free.
- */
-void amdlibFree3DArrayDouble(double ***arrayToFree)
-{
- if (arrayToFree != NULL)
- {
- free((double *)arrayToFree[0][0]);
- free((double **)arrayToFree[0]);
- free((double ***)arrayToFree);
- arrayToFree = NULL;
- }
-}
-void amdlibFree4DArrayDouble(double ****arrayToFree)
-{
- if (arrayToFree != NULL)
- {
- free((double *)arrayToFree[0][0][0]);
- free((double **)arrayToFree[0][0]);
- free((double ***)arrayToFree[0]);
- free((double ****)arrayToFree);
- arrayToFree = NULL;
- }
-}
-/**
- * Free a dynamically allocated 3-dimensional array of complex.
- *
- * This function frees a dynamically allocated 3-dimensional array of complex.
- *
- * @param arrayToFree array to free.
- */
-void amdlibFree3DArrayComplex(amdlibCOMPLEX ***arrayToFree)
-{
- if (arrayToFree != NULL)
- {
- free((amdlibCOMPLEX *)arrayToFree[0][0]);
- free((amdlibCOMPLEX **)arrayToFree[0]);
- free((amdlibCOMPLEX ***)arrayToFree);
- arrayToFree = NULL;
- }
-}
-
-/**
- * Free a dynamically allocated 2-dimensional array of float.
- *
- * This function frees a dynamically allocated 2-dimensional array of float.
- *
- * @param arrayToFree array to free.
- */
-void amdlibFree2DArrayFloat(float **arrayToFree)
-{
- if (arrayToFree != NULL)
- {
- free((float *)arrayToFree[0]);
- free((float **)arrayToFree);
- arrayToFree = NULL;
- }
-}
-
-/**
- * Free a dynamically allocated 3-dimensional array of float.
- *
- * This function frees a dynamically allocated 3-dimensional array of float.
- *
- * @param arrayToFree array to free.
- */
-void amdlibFree3DArrayFloat(float ***arrayToFree)
-{
- if (arrayToFree != NULL)
- {
- free((float *)arrayToFree[0][0]);
- free((float **)arrayToFree[0]);
- free((float ***)arrayToFree);
- arrayToFree = NULL;
- }
-}
-
-/**
- * Free a dynamically allocated 2-dimensional array of amdlibCOMPLEX.
- *
- * This function frees a dynamically allocated 2-dimensional array of
- * amdlibCOMPLEX.
- *
- * @param arrayToFree array to free.
- */
-void amdlibFree2DArrayComplex(amdlibCOMPLEX **arrayToFree)
-{
- if (arrayToFree != NULL)
- {
- free((amdlibCOMPLEX *)arrayToFree[0]);
- free((amdlibCOMPLEX **)arrayToFree);
- arrayToFree = NULL;
- }
-}
-
-/**
- * Free a wrapping on a 2-dimensional array.
- *
- * This function frees a wrapping on 2-dimensional array, without
- * deleting data themselves.
- *
- * @param wrappingToFree table of pointers to free.
- */
-void amdlibFree2DArrayWrapping(void **wrappingToFree)
-{
- if (wrappingToFree != NULL)
- {
- free((void **)wrappingToFree);
- wrappingToFree = NULL;
- }
-}
-
-/**
- * Free a wrapping on a 3-dimensional array.
- *
- * This function frees a wrapping on 3-dimensional array, without
- * deleting data themselves.
- *
- * @param wrappingToFree table of pointers to free.
- */
-void amdlibFree3DArrayWrapping(void ***wrappingToFree)
-{
- if (wrappingToFree != NULL)
- {
- free((void **)wrappingToFree[0]);
- free((void ***)wrappingToFree);
- wrappingToFree = NULL;
- }
-}
-
-/**
- * Free a wrapping on a 2-dimensional array of float.
- *
- * This function frees a wrapping on 2-dimensional array of float, without
- * deleting data themselves.
- *
- * @param wrappingToFree table of pointers to free.
- */
-void amdlibFree2DArrayFloatWrapping(float **wrappingToFree)
-{
- if (wrappingToFree != NULL)
- {
- free((float **)wrappingToFree);
- wrappingToFree = NULL;
- }
-}
-
-/**
- * Free a wrapping on a 3-dimensional array of float.
- *
- * This function frees a wrapping on 3-dimensional array of float, without
- * deleting data themselves.
- *
- * @param wrappingToFree table of pointers to free.
- */
-void amdlibFree3DArrayFloatWrapping(float ***wrappingToFree)
-{
- if (wrappingToFree != NULL)
- {
- free((float **)wrappingToFree[0]);
- free((float ***)wrappingToFree);
- wrappingToFree = NULL;
- }
-}
-
-/**
- * Free a wrapping on a 2-dimensional array of double.
- *
- * This function frees a wrapping on 2-dimensional array of double, without
- * deleting data themselves.
- *
- * @param wrappingToFree table of pointers to free.
- */
-void amdlibFree2DArrayDoubleWrapping(double **wrappingToFree)
-{
- if (wrappingToFree != NULL)
- {
- free((double **)wrappingToFree);
- wrappingToFree = NULL;
- }
-}
-
-/**
- * Free a wrapping on a 3-dimensional array of double.
- *
- * This function frees a wrapping on 3-dimensional array of double, without
- * deleting data themselves.
- *
- * @param wrappingToFree table of pointers to free.
- */
-void amdlibFree3DArrayDoubleWrapping(double ***wrappingToFree)
-{
- if (wrappingToFree != NULL)
- {
- free((double **)wrappingToFree[0]);
- free((double ***)wrappingToFree);
- wrappingToFree = NULL;
- }
-}
-void amdlibFree4DArrayDoubleWrapping(double ****wrappingToFree)
-{
- if (wrappingToFree != NULL)
- {
- free((double **)wrappingToFree[0][0]);
- free((double ***)wrappingToFree[0]);
- free((double ****)wrappingToFree);
- wrappingToFree = NULL;
- }
-}
-
-/**
- * Free a wrapping on a 2-dimensional array of unsigned char.
- *
- * This function frees a wrapping on 2-dimensional array of unsigned char,
- * without deleting data themselves.
- *
- * @param wrappingToFree table of pointers to free.
- */
-void amdlibFree2DArrayUnsignedCharWrapping(unsigned char **wrappingToFree)
-{
- if (wrappingToFree != NULL)
- {
- free((unsigned char **)wrappingToFree);
- wrappingToFree = NULL;
- }
-}
-
-
-/*___oOo___*/
diff --git a/amber/amdlibOi.c b/amber/amdlibOi.c
deleted file mode 100644
index 5cb43c2..0000000
--- a/amber/amdlibOi.c
+++ /dev/null
@@ -1,4090 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Functions to read/write IO-FITS file
- */
-#define _POSIX_SOURCE 1
-
-/*
- * System Headers
- */
-
-#include "fitsio.h"
-#include <string.h>
-#include <math.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-/*
- Local Headers
-*/
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/* Local function declaration */
-static amdlibCOMPL_STAT amdlibWriteOiArray(fitsfile *filePtr,
- amdlibOI_ARRAY *array,
- amdlibERROR_MSG errMsg);
-static amdlibCOMPL_STAT amdlibReadOiArray(fitsfile *filePtr,
- amdlibOI_ARRAY *array,
- amdlibERROR_MSG errMsg );
-
-static amdlibCOMPL_STAT amdlibWriteOiTarget(fitsfile *filePtr,
- amdlibOI_TARGET *target,
- amdlibERROR_MSG errMsg);
-static amdlibCOMPL_STAT amdlibReadOiTarget(fitsfile *filePtr,
- amdlibOI_TARGET *target,
- amdlibERROR_MSG errMsg);
-
-static amdlibCOMPL_STAT amdlibWriteOiWavelength(fitsfile *filePtr,
- char *insName,
- amdlibWAVELENGTH *wave,
- amdlibERROR_MSG errMsg);
-static amdlibCOMPL_STAT amdlibReadOiWavelength(fitsfile *filePtr,
- amdlibWAVELENGTH *wave,
- amdlibERROR_MSG errMsg);
-
-static amdlibCOMPL_STAT amdlibWriteOiVis(fitsfile *filePtr,
- char *insName,
- char *arrName,
- amdlibVIS *vis,
- amdlibERROR_MSG errMsg);
-static amdlibCOMPL_STAT amdlibReadOiVis(fitsfile *filePtr,
- amdlibVIS *vis,
- int nbBases,
- amdlibERROR_MSG errMsg);
-
-static amdlibCOMPL_STAT amdlibWriteOiVis2(fitsfile *filePtr,
- char *insName,
- char *arrName,
- amdlibVIS2 *vis2,
- amdlibERROR_MSG errMsg);
-static amdlibCOMPL_STAT amdlibReadOiVis2(fitsfile *filePtr,
- amdlibVIS2 *vis2,
- int nbBases,
- amdlibERROR_MSG errMsg);
-
-static amdlibCOMPL_STAT amdlibWriteOiVis3(fitsfile *filePtr,
- char *insName,
- char *arrName,
- amdlibVIS3 *vis3,
- amdlibERROR_MSG errMsg);
-static amdlibCOMPL_STAT amdlibReadOiVis3(fitsfile *filePtr,
- amdlibVIS3 *vis3,
- amdlibERROR_MSG errMsg);
-
-static amdlibCOMPL_STAT amdlibWriteAmberData(fitsfile *filePtr,
- char *insName,
- amdlibPHOTOMETRY *photometry,
- amdlibVIS *vis,
- amdlibPISTON *pst,
- amdlibWAVELENGTH *wave,
- amdlibERROR_MSG errMsg);
-static amdlibCOMPL_STAT amdlibReadAmberData(fitsfile *filePtr,
- amdlibPHOTOMETRY *photometry,
- amdlibVIS *vis,
- amdlibPISTON *pst,
- int nbBases,
- amdlibERROR_MSG errMsg);
-
-
-/*
- * Public functions
- */
-/**
- * Write OI-FITS file.
- *
- * This function create OI-FITS file containing the OI_ARRAY, OI_TARGET, OI_VIS,
- * OI_VIS2, OI_T3 and OI_WAVELENGTH binary tables defined in the IAU standard,
- * and the AMBER_DATA binary table which is specific to AMBER. The AMBER_DATA
- * binary table contains photometry and piston data.
- *
- * @note
- * If the file exists, it is overwritten.
- *
- * @param filename name of the OI-FITS file to create
- * @param insCfg array containing keywords of the primary header.
- * @param array structure containing information of OI_ARRAY binary table
- * @param target structure containing information of OI_TARGET binary table
- * @param photometry structure containing photometry which is stored in
- * AMBER_DATA binary table.
- * @param vis structure containing information of OI_VIS binary table
- * @param vis2 structure containing information of OI_VIS2 binary table
- * @param vis3 structure containing information of OI_T3 binary table
- * @param wave structure containing information of OI_WAVELENGTH binary table
- * @param pst structure containing piston which is stored in AMBER_DATA binary
- * table.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibSaveOiFile(const char *filename,
- amdlibINS_CFG *insCfg,
- amdlibOI_ARRAY *array,
- amdlibOI_TARGET *target,
- amdlibPHOTOMETRY *photometry,
- amdlibVIS *vis,
- amdlibVIS2 *vis2,
- amdlibVIS3 *vis3,
- amdlibWAVELENGTH *wave,
- amdlibPISTON *pst,
- amdlibSPECTRUM *spectrum,
- amdlibERROR_MSG errMsg)
-{
- int status = 0;
- fitsfile *filePtr;
- int i;
-#ifndef ESO_CPL_PIPELINE_VARIANT
- struct stat statBuf;
- time_t timeSecs;
- struct tm *timeNow;
- char strTime[amdlibKEYW_VAL_LEN+1];
-#endif
- char fitsioMsg[256];
- char insName[amdlibKEYW_VAL_LEN+1];
- char arrName[amdlibKEYW_VAL_LEN+1];
- char version[32];
-
- amdlibLogTrace("amdlibSaveOiFile()");
-
-#ifndef ESO_CPL_PIPELINE_VARIANT
- /*
- * amdlib will create the file on its own
- */
- /* First remove previous IO file (if any) */
- if (stat(filename, &statBuf) == 0)
- {
- if (remove(filename) != 0)
- {
- amdlibSetErrMsg("Could not overwrite file %s", filename);
- return amdlibFAILURE;
- }
- }
-
- /* Create new FITS file */
- if (fits_create_file(&filePtr, filename, &status))
- {
- amdlibReturnFitsError("opening file");
- }
-#else
- /*
- * The ESO pipeline will create that file and prepare the header
- * with DMD compliant keywords. Hence amdlib shall just append to it
- */
-
- /* Append to FITS file */
- if (fits_open_file(&filePtr, filename, READWRITE, &status))
- {
- printf("%s->fits_open_file cannot open in append mode\n", filename );
- amdlibReturnFitsError("opening file");
- }
- else
- {
- printf("%s->fits_open_file append OK\n", filename);
- }
-#endif
-
- /* Build a uniq INSNAME using P2VM id (if possible), else use default */
- sprintf(insName, "AMBER");
-
- /* Retrieve ARRNAME if possible, else use default.*/
- if (array != NULL)
- {
- strncpy(arrName, array->arrayName, amdlibKEYW_VAL_LEN+1);
- }
- else
- {
- sprintf(arrName, "UNKNOWN");
- }
-
- /* Write OI_ARRAY binary table */
- if (array != NULL)
- {
- if (amdlibWriteOiArray(filePtr, array, errMsg) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
-
- /* Write OI_TARGET binary table */
- if (target != NULL)
- {
- if (amdlibWriteOiTarget(filePtr, target, errMsg) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
-
- /* Write OI_WAVELENGTH binary table */
- if (wave != NULL)
- {
- if (amdlibWriteOiWavelength(filePtr, insName,
- wave, errMsg) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
-
- /* Write OI_VIS binary table */
- if (vis != NULL)
- {
- if (amdlibWriteOiVis(filePtr, insName, arrName,
- vis, errMsg) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
-
- /* Write OI_VIS2 binary table */
- if (vis2 != NULL)
- {
- if (amdlibWriteOiVis2(filePtr, insName, arrName,
- vis2, errMsg) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
- /* Write OI_T3 binary table */
- if (vis3 != NULL)
- {
- if (amdlibWriteOiVis3(filePtr, insName, arrName,
- vis3, errMsg) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
-
- /* Write AMBER_DATA binary table */
- if ((photometry != NULL) && (vis != NULL) && (pst != NULL))
- {
- if (vis->nbFrames != 1)
- {
- if (amdlibWriteAmberData(filePtr, insName,
- photometry, vis, pst, wave,
- errMsg) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
- }
-
- /* Write AMBER_SPECTRUM binary table */
- if (spectrum != NULL)
- {
- if (amdlibWriteAmberSpectrum(filePtr, wave, spectrum,
- errMsg) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
-
- /* Move to main header */
- amdlibLogTrace("Move to main header");
- if (fits_movabs_hdu(filePtr, 1, 0, &status) != 0)
- {
- amdlibGetFitsError("main header");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
-#ifndef ESO_CPL_PIPELINE_VARIANT
- /* Complete main header */
- if (insCfg != NULL)
- {
- /* Add DATE */
- amdlibLogTrace("Add DATE");
- timeSecs = time(NULL);
- timeNow = gmtime(&timeSecs);
- strftime(strTime, sizeof(strTime), "%Y-%m-%dT%H:%M:%S", timeNow);
- if (fits_write_key(filePtr, TSTRING, "DATE", strTime,
- "Date this file was written", &status) != 0)
- {
- amdlibGetFitsError("completing main header");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- /* Add other keywords */
- amdlibLogTrace("Add other keywords");
- for (i = 0; i < insCfg->nbKeywords; i++)
- {
- char keywLine[200];
-
- if ((strstr(insCfg->keywords[i].name, "SIMPLE") == NULL) &&
- (strstr(insCfg->keywords[i].name, "BITPIX") == NULL) &&
- (strstr(insCfg->keywords[i].name, "NAXIS ") == NULL) &&
- (strstr(insCfg->keywords[i].name, "EXTEND") == NULL) &&
- (strstr(insCfg->keywords[i].name, "DATE ") == NULL))
- {
- sprintf((char*)keywLine, "%s=%s/%s", insCfg->keywords[i].name,
- insCfg->keywords[i].value,
- insCfg->keywords[i].comment);
-
- if (fits_write_record(filePtr, keywLine, &status) != 0)
- {
- amdlibGetFitsError("completing main header");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
- }
- }
-#else
- /* Complete main header */
- if (insCfg != NULL)
- {
- /* Add QC keywords - spectral shifts */
- amdlibLogTrace("Add QC keywords - spectral shifts");
- for (i = 0; i < insCfg->nbKeywords; i++)
- {
- char keywLine[200];
- if ((strstr(insCfg->keywords[i].name,
- "HIERARCH ESO QC P1 ") != NULL) ||
- (strstr(insCfg->keywords[i].name,
- "HIERARCH ESO QC P2 ") != NULL) ||
- (strstr(insCfg->keywords[i].name,
- "HIERARCH ESO QC P3 ") != NULL))
- {
- sprintf((char*)keywLine, "%s=%s/%s", insCfg->keywords[i].name,
- insCfg->keywords[i].value,
- insCfg->keywords[i].comment);
- if (fits_write_record(filePtr, keywLine, &status) != 0)
- {
- amdlibGetFitsError("completing main header");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
- }
- }
-#endif
-
- /* Add amdlib version */
- amdlibLogTrace("Add amdlib version");
- amdlibGetVersion(version);
- if (fits_update_key(filePtr, TSTRING, "HIERARCH ESO OCS DRS VERSION",
- version,
- "Data Reduction SW version", &status) != 0)
- {
- amdlibGetFitsError("HIERARCH ESO OCS DRS VERSION");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- /* Close FITS file */
- amdlibLogTrace("Close FITS file");
- if (fits_close_file(filePtr, &status))
- {
- amdlibReturnFitsError("closing file");
- }
-
- amdlibLogTrace("amdlibSaveOiFile done");
- return amdlibSUCCESS;
-}
-
-/**
- * Read OI-FITS file.
- *
- * This function reads OI-FITS file containing the OI_ARRAY, OI_TARGET, OI_VIS,
- * OI_VIS2, OI_T3 and OI_WAVELENGTH binary tables defined in the IAU standard,
- * and the AMBER_DATA binary table which is specific to AMBER. The AMBER_DATA
- * binary table contains photometry and piston data.
- *
- * @note
- * If the file exists, it is overwritten.
- *
- * @param filename name of the OI-FITS file to read
- * @param insCfg array which will contain keywords of the primary header.
- * @param array structure which will contain information of OI_ARRAY binary
- * table
- * @param target structure which will contain information of OI_TARGET binary
- * table
- * @param photometry structure which will contain photometry which is stored in
- * AMBER_DATA binary table.
- * @param vis structure which will contain information of OI_VIS binary table
- * @param vis2 structure which will contain information of OI_VIS2 binary table
- * @param vis3 structure which will contain information of OI_T3 binary table
- * @param wave structure which will contain information of OI_WAVELENGTH binary
- * table
- * @param pst structure which will contain piston which is stored in AMBER_DATA
- * binary table.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibLoadOiFile(const char *filename,
- amdlibINS_CFG *insCfg,
- amdlibOI_ARRAY *array,
- amdlibOI_TARGET *target,
- amdlibPHOTOMETRY *photometry,
- amdlibVIS *vis,
- amdlibVIS2 *vis2,
- amdlibVIS3 *vis3,
- amdlibWAVELENGTH *wave,
- amdlibPISTON *pst,
- amdlibSPECTRUM *spectrum,
- amdlibERROR_MSG errMsg)
-{
- int status = 0;
- fitsfile *filePtr;
- char fitsioMsg[256];
- int nbBases, i;
- int nbTels;
- int keysExist = 0;
- int moreKeys = 0;
- amdlibKEYW_LINE record;
-
- amdlibLogTrace("amdlibLoadOiFile()");
-
- /* Open FITS file */
- if (fits_open_file(&filePtr, filename, READONLY, &status))
- {
- amdlibGetFitsError("Opening file");
- return amdlibFAILURE;
- }
- /* Get the number of keywords in HDU */
- if (insCfg != NULL)
- {
- keysExist=0;
- moreKeys=0;
- if (fits_get_hdrspace(filePtr, &keysExist, &moreKeys, &status) != 0)
- {
- status = 0;
- }
- /* For each keyword */
- for (i = 1; i <= keysExist; i++)
- {
- /* Read keyword line #i */
- if (fits_read_record(filePtr, i, record, &status) != 0)
- {
- status = 0;
- }
- else
- {
- /* If it is not a simple comment */
- if (strstr(record, "COMMENT ") == NULL)
- {
- /* Store keyword */
- if (amdlibAddInsCfgKeyword(insCfg,
- record, errMsg) == amdlibFAILURE)
- {
- return amdlibFAILURE;
- }
- }
- }
- }
-
- /* Get instrument mode */
- char insMode[amdlibKEYW_NAME_LEN+1];
- if (amdlibGetInsCfgKeyword(insCfg, "HIERARCH ESO INS MODE",
- insMode, errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- if (strstr(insMode, "Low") != NULL)
- {
- amdlibLogWarning("Differential phases and visibilities are not yet "
- "validated in low resolution mode.");
- amdlibLogWarningDetail("Must be used carrefully");
-
- }
- }
- /* Read OI_ARRAY binary table */
- if (array != NULL)
- {
- if (amdlibReadOiArray(filePtr, array, errMsg) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- amdlibLogWarning("No OI_ARRAY table");
- }
- }
-
- /* Read OI_TARGET binary table */
- if (target != NULL)
- {
- if (amdlibReadOiTarget(filePtr, target, errMsg) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- amdlibLogError("No OI_TARGET table: non conformant OIFITS");
- return amdlibFAILURE;
- }
- }
-
- /* Read OI_WAVELENGTH binary table */
- if (wave != NULL)
- {
- if (amdlibReadOiWavelength(filePtr, wave, errMsg) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- amdlibLogError("No OI_WAVELENGTH table: non conformant OIFITS");
- return amdlibFAILURE;
- }
- }
-
- /* Read OI_T3 binary table */
- if (vis3 != NULL)
- {
- if (amdlibReadOiVis3(filePtr, vis3, errMsg) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- amdlibLogTest("No OI_T3 table");
- }
- }
-
- /* If there is no structure for phase closure, assuming there is only one
- * baseline */
- if (vis3->thisPtr != vis3)
- {
- nbBases = 1;
- nbTels = 2;
- }
- else
- {
- nbBases = 3;
- nbTels = 3;
- }
-
- /* Read OI_VIS binary table */
- if (vis != NULL)
- {
- if (amdlibReadOiVis(filePtr, vis, nbBases, errMsg) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- amdlibLogWarning("No OI_VIS table");
- }
- }
-
- /* Read OI_VIS2 binary table */
- if (vis2 != NULL)
- {
- if (amdlibReadOiVis2(filePtr, vis2, nbBases, errMsg) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- amdlibLogWarning("No OI_VIS2 table");
- }
- }
-
- /* Read AMBER_DATA binary table */
- if (photometry != NULL)
- {
- if (amdlibReadAmberData(filePtr, photometry, vis,
- pst, nbBases, errMsg) != amdlibSUCCESS)
- {
- amdlibLogTest("No AMBER_DATA table");
- }
- }
-
- /* Read AMBER_SPECTRUM binary table */
- if (spectrum != NULL)
- {
- if (amdlibReadAmberSpectrum(filePtr, nbTels,
- spectrum, errMsg) != amdlibSUCCESS)
- {
- amdlibLogTest("No AMBER_SPECTRUM table");
- }
- }
-
- /* Close FITS file */
- if (fits_close_file(filePtr, &status))
- {
- amdlibReturnFitsError("closing file");
- }
-
- return amdlibSUCCESS;
-}
-
-/*
- * Protected functions
- */
-
-/*
- * Local functions
- */
-/**
- * Write OI_ARRAY table in OI-FITS file
- *
- * This function writes the OI_ARRAY binary table defined in the IAU standard
- * in the OI-FITS file given as parameter.
- *
- * @param filePtr pointer on the file to be created
- * @param array OI_ARRAY produced
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibWriteOiArray(fitsfile *filePtr,
- amdlibOI_ARRAY *array,
- amdlibERROR_MSG errMsg)
-{
- const int tfields = 5;
- char *ttype[] = {"TEL_NAME", "STA_NAME", "STA_INDEX", "DIAMETER",
- "STAXYZ"};
- char *tform[] = {"8A", "8A", "I", "E", "3D"};
- char *tunit[] = {"\0", "\0", "\0", "m", "m"};
- char extname[] = "OI_ARRAY";
- int status = 0;
- int iRow;
- char fitsioMsg[256];
- int revision = amdlib_OI_REVISION;
- char *str;
-
- amdlibLogTrace("amdlibWriteOiArray()");
-
- /* Algorithm */
-
- /* Create binary table */
- if (fits_create_tbl(filePtr, BINARY_TBL, 1, tfields, ttype, tform, tunit,
- extname, &status))
- {
- amdlibReturnFitsError("Creating Binary Table");
- }
-
- /* Write revision number */
- if (fits_write_key(filePtr, TINT, "OI_REVN", &revision,
- "Revision number of the table definition", &status))
- {
- amdlibReturnFitsError("OI_REVN");
- }
-
- /* Write array name */
- if (fits_write_key(filePtr, TSTRING, "ARRNAME", array->arrayName,
- "Array name", &status))
- {
- amdlibReturnFitsError("ARRNAME");
- }
-
- /* Write coordinate frame */
- if (fits_write_key(filePtr, TSTRING, "FRAME", array->coordinateFrame,
- "Coordinate frame", &status))
- {
- amdlibReturnFitsError("FRAME");
- }
-
- /* Write array center x coordinate */
- if (fits_write_key(filePtr, TDOUBLE, "ARRAYX",
- &array->arrayCenterCoordinates[0],
- "Array centre x coordinate", &status))
- {
- amdlibReturnFitsError("ARRAYX");
- }
-
- if (fits_write_key_unit(filePtr, "ARRAYX", "m", &status))
- {
- amdlibReturnFitsError("ARRAYX");
- }
-
- /* Write array center y coordinate */
- if (fits_write_key(filePtr, TDOUBLE, "ARRAYY",
- &array->arrayCenterCoordinates[1],
- "Array centre y coordinate", &status))
- {
- amdlibReturnFitsError("ARRAYY");
- }
-
- if (fits_write_key_unit(filePtr, "ARRAYY", "m", &status))
- {
- amdlibReturnFitsError("ARRAYY");
- }
-
- /* Write array center z coordinate */
- if (fits_write_key(filePtr, TDOUBLE, "ARRAYZ",
- &array->arrayCenterCoordinates[2],
- "Array centre z coordinate", &status))
- {
- amdlibReturnFitsError("ARRAYZ");
- }
-
- if (fits_write_key_unit(filePtr, "ARRAYZ", "m", &status))
- {
- amdlibReturnFitsError("ARRAYZ");
- }
-
- /* Write information on instrument */
- for (iRow = 1; iRow <= array->nbStations; iRow++)
- {
- str = array->element[iRow-1].telescopeName;
- if (fits_write_col(filePtr, TSTRING, 1, iRow, 1, 1, &str, &status))
- {
- amdlibReturnFitsError("telescopeName");
- }
- str = array->element[iRow-1].stationName;
- if (fits_write_col(filePtr, TSTRING, 2, iRow, 1, 1, &str, &status))
- {
- amdlibReturnFitsError("stationName");
- }
- if (fits_write_col(filePtr, TINT, 3, iRow, 1, 1,
- &array->element[iRow-1].stationIndex, &status))
- {
- amdlibReturnFitsError("stationIndex");
- }
- if (fits_write_col(filePtr, TDOUBLE, 4, iRow, 1, 1,
- &array->element[iRow-1].elementDiameter, &status))
- {
- amdlibReturnFitsError("diameter");
- }
- if (fits_write_col(filePtr, TDOUBLE, 5, iRow, 1, 3,
- array->element[iRow-1].stationCoordinates, &status))
- {
- amdlibReturnFitsError("staXYZ");
- }
- }
- return amdlibSUCCESS;
-}
-
-
-/**
- * Write OI_TARGET table in OI-FITS file.
- *
- * This function writes the OI_TARGET binary table defined in the IAU standard
- * in the OI-FITS file given as parameter.
- *
- * @param filePtr pointer on the file to be created.
- * @param target OI_TARGET produced.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibWriteOiTarget(fitsfile *filePtr,
- amdlibOI_TARGET *target,
- amdlibERROR_MSG errMsg)
-{
- const int tfields = 17;
- char *ttype[] = {"TARGET_ID", "TARGET", "RAEP0", "DECEP0", "EQUINOX",
- "RA_ERR", "DEC_ERR", "SYSVEL", "VELTYP", "VELDEF", "PMRA", "PMDEC",
- "PMRA_ERR", "PMDEC_ERR", "PARALLAX", "PARA_ERR", "SPECTYP"};
- char *tform[] = {"I", "16A", "D", "D", "E", "D", "D", "D", "8A",
- "8A", "D", "D", "D", "D", "E", "E", "16A"};
- char *tunit[] = {"\0", "\0", "deg", "deg", "year", "deg", "deg",
- "m/s", "\0", "\0", "deg/year", "deg/year", "deg/year", "deg/year",
- "deg", "deg", "\0"};
- char extname[] = "OI_TARGET";
- char fitsioMsg[256];
- int status = 0;
- int revision = amdlib_OI_REVISION;
- int iRow;
- char *str;
-
- amdlibLogTrace("amdlibWriteOiTarget()");
-
- /* Create binary table */
- if (fits_create_tbl(filePtr, BINARY_TBL, 1, tfields, ttype, tform, tunit,
- extname, &status))
- {
- amdlibReturnFitsError("Creating Binary Table");
- }
-
- /* Write revision number of the table definition */
- if (fits_write_key(filePtr, TINT, "OI_REVN", &revision,
- "Revision number of the table definition", &status))
- {
- amdlibReturnFitsError("OI_REVN");
- }
-
- for (iRow = 1; iRow <= target->nbTargets; iRow++)
- {
- /* Write target identity */
- if (fits_write_col(filePtr, TINT, 1, iRow, 1, 1,
- &target->element[iRow-1].targetId, &status))
- {
- amdlibReturnFitsError("targetId");
- }
-
- str = target->element[iRow-1].targetName;
-
- /* Write target name */
- if (fits_write_col(filePtr, TSTRING, 2, iRow, 1, 1, &str, &status))
- {
- amdlibReturnFitsError("targetName");
- }
-
- /* Write right ascension at mean equinox */
- if (fits_write_col(filePtr, TDOUBLE, 3, iRow, 1, 1,
- &target->element[iRow-1].raEp0, &status))
- {
- amdlibReturnFitsError("raEp0");
- }
- /* Write declinaison at mean equinox */
- if (fits_write_col(filePtr, TDOUBLE, 4, iRow, 1, 1,
- &target->element[iRow-1].decEp0, &status))
- {
- amdlibReturnFitsError("decEp0");
- }
- /* Write equinox of raEp0 and decEp0 */
- if (fits_write_col(filePtr, TDOUBLE, 5, iRow, 1, 1,
- &target->element[iRow-1].equinox, &status))
- {
- amdlibReturnFitsError("equinox");
- }
- /* Write error in apparent RA */
- if (fits_write_col(filePtr, TDOUBLE, 6, iRow, 1, 1,
- &target->element[iRow-1].raErr, &status))
- {
- amdlibReturnFitsError("raErr");
- }
- /* Write error in apparent DEC */
- if (fits_write_col(filePtr, TDOUBLE, 7, iRow, 1, 1,
- &target->element[iRow-1].decErr, &status))
- {
- amdlibReturnFitsError("decErr");
- }
- /* Write systemic radial velocity */
- if (fits_write_col(filePtr, TDOUBLE, 8, iRow, 1, 1,
- &target->element[iRow-1].sysVel, &status))
- {
- amdlibReturnFitsError("sysVel");
- }
-
- str = target->element[iRow-1].velTyp;
- /* Write velocity type of sysVel */
- if (fits_write_col(filePtr, TSTRING, 9, iRow, 1, 1, &str, &status))
- {
- amdlibReturnFitsError("velTyp");
- }
-
- str = target->element[iRow-1].velDef;
- /* Write definition of radial velocity : "OPTICAL" or "RADIO" */
- if (fits_write_col(filePtr, TSTRING, 10, iRow, 1, 1, &str, &status))
- {
- amdlibReturnFitsError("velDef");
- }
-
- /* Write proper motion in RA */
- if (fits_write_col(filePtr, TDOUBLE, 11, iRow, 1, 1,
- &target->element[iRow-1].pmRa, &status))
- {
- amdlibReturnFitsError("pmRa");
- }
- /* Write proper motion in DEC */
- if (fits_write_col(filePtr, TDOUBLE, 12, iRow, 1, 1,
- &target->element[iRow-1].pmDec, &status))
- {
- amdlibReturnFitsError("pmDec");
- }
- /* Write error on pmRa */
- if (fits_write_col(filePtr, TDOUBLE, 13, iRow, 1, 1,
- &target->element[iRow-1].pmRaErr, &status))
- {
- amdlibReturnFitsError("pmRaErr");
- }
- /* Write error on pmDec */
- if (fits_write_col(filePtr, TDOUBLE, 14, iRow, 1, 1,
- &target->element[iRow-1].pmDecErr, &status))
- {
- amdlibReturnFitsError("pmDecErr");
- }
- /* Write parallax value */
- if (fits_write_col(filePtr, TDOUBLE, 15, iRow, 1, 1,
- &target->element[iRow-1].parallax, &status))
- {
- amdlibReturnFitsError("parallax");
- }
- /* Write error in parallax value */
- if (fits_write_col(filePtr, TDOUBLE, 16, iRow, 1, 1,
- &target->element[iRow-1].paraErr, &status))
- {
- amdlibReturnFitsError("paraErr");
- }
- /* Write spectral type */
- str = target->element[iRow-1].specTyp;
- if (fits_write_col(filePtr, TSTRING, 17, iRow, 1, 1, &str, &status))
- {
- amdlibReturnFitsError("specTyp");
- }
- }
- return amdlibSUCCESS;
-}
-
-
-/**
- * Write OI_WAVELENGTH table in OI-FITS file.
- *
- * This function writes the OI_WAVELENGTH binary table defined in the IAU
- * standard in the OI-FITS file given as parameter.
- *
- * @param filePtr pointer on the file to be created.
- * @param insName name of the instrument.
- * @param wave OI_WAVELENGTH produced.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibWriteOiWavelength(fitsfile *filePtr,
- char *insName,
- amdlibWAVELENGTH *wave,
- amdlibERROR_MSG errMsg)
-{
- int status = 0;
- char fitsioMsg[256];
- const int tfields = 2;
- char *ttype[] = {"EFF_WAVE", "EFF_BAND"};
- char *tform[] = {"E", "E"};
- char *tunit[] = {"m", "m"};
- char extname[] = "OI_WAVELENGTH";
- int revision = amdlib_OI_REVISION;
- int i;
- amdlibDOUBLE waveInM, bwInM;
-
- amdlibLogTrace("amdlibWriteOiWavelength()");
-
- /* Create binary table */
- if (fits_create_tbl (filePtr, BINARY_TBL, 1, tfields, ttype, tform, tunit,
- extname, &status))
- {
- amdlibReturnFitsError("Creating Binary Table");
- }
-
- /* Write revision number of the table definition */
- if (fits_write_key (filePtr, TINT, "OI_REVN", &revision,
- "Revision number of the table definition", &status))
- {
- amdlibReturnFitsError("OI_REVN");
- }
-
- /* Write spectral setup unique identifier */
- if (fits_write_key (filePtr, TSTRING, "INSNAME", insName,
- "Instrument name", &status))
- {
- amdlibReturnFitsError("INSNAME");
- }
-
- for (i = 1; i <= wave->nbWlen; i ++)
- {
- waveInM = (wave->wlen[i-1]) * amdlibNM_TO_M;
- bwInM = (wave->bandwidth[i-1]) * amdlibNM_TO_M;
- /* Write EFFective_WAVElengh table */
- if (fits_write_col (filePtr, TDOUBLE, 1, i, 1, 1, &waveInM, &status))
- {
- amdlibReturnFitsError("EFFective_WAVElengh");
- }
-
- /* Write EFFective_BANDwidth table */
- if (fits_write_col (filePtr, TDOUBLE, 2, i, 1, 1, &bwInM, &status))
- {
- amdlibReturnFitsError("EFFective_BANDwidth");
- }
- }
-
- return amdlibSUCCESS;
-}
-
-#define amdlibWriteOiVis_FREEALL() free(visError); free(flag); free(convertToDeg);
-
-/**
- * Write OI_VIS table in OI-FITS file
- *
- * This function writes the OI_VIS binary table defined in the IAU
- * standard in the OI-FITS file given as parameter.
- *
- * @param filePtr pointer on the file to be created
- * @param insName name of the detector
- * @param arrName array name
- * @param vis OI_VIS produced
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibWriteOiVis(fitsfile *filePtr,
- char *insName,
- char *arrName,
- amdlibVIS *vis,
- amdlibERROR_MSG errMsg)
-
-{
- /* Local Declarations */
-
- int nbWlen = vis->nbWlen;
- int lVis;
- double *convertToDeg;
- amdlibCOMPLEX *visError;
- unsigned char *flag;
- amdlibDOUBLE amdlibBval=amdlibBLANKING_VALUE;
-
- int status = 0;
- char fitsioMsg[256];
- const int tfields = 14;
- char *ttype[] = {"TARGET_ID", "TIME", "MJD", "INT_TIME",
- "VISDATA", "VISERR", "VISAMP", "VISAMPERR", "VISPHI", "VISPHIERR",
- "UCOORD", "VCOORD", "STA_INDEX", "FLAG"};
- char *Tform[] = {"I", "D", "D", "D", "?C", "?C", "?D", "?D",
- "?D", "?D", "1D", "1D", "2I", "?L"};
- char *tform[tfields];
- char *tunit[] = {"\0", "s", "day", "s", "\0", "\0", "\0", "\0",
- "deg", "deg", "m", "m", "\0", "\0"};
- char extname[] = "OI_VIS";
- int revision = amdlib_OI_REVISION;
- char tmp[16];
- int iFrame = 0, iBase = 0, iVis = 0, i = 0;
- double expTime;
-
- amdlibLogTrace("amdlibWriteOiVis()");
-
- /* Algorithm */
- if (vis->thisPtr != vis)
- {
- amdlibSetErrMsg("Unitialized vis structure");
- return amdlibFAILURE;
- }
-
- if (vis->nbFrames < 1)
- {
- return amdlibSUCCESS;
- }
-
- /* Create table structure: Make up Tform: substitute nbWlen for '?' */
- for (i = 0; i < tfields; i++)
- {
- if (Tform[i][0] == '?')
- {
- sprintf(tmp, "%d%s", nbWlen, &Tform[i][1]);
- tform[i] = calloc((strlen(tmp)+1), sizeof(char));
- strcpy(tform[i], tmp);
- }
- else
- {
- tform[i] = calloc((strlen(Tform[i])+1), sizeof(char));
- strcpy(tform[i], Tform[i]);
- }
- }
- if (fits_create_tbl(filePtr, BINARY_TBL, 0, tfields, ttype,
- tform, tunit, extname, &status))
- {
- amdlibReturnFitsError("BINARY_TBL");
- }
-
- for (i = 0; i < tfields; i++)
- {
- free(tform[i]);
- }
-
- /* Write revision number of the table definition */
- if (fits_write_key(filePtr, TINT, "OI_REVN", &revision,
- "Revision number of the table definition", &status))
- {
- amdlibReturnFitsError("OI_REVN");
- }
-
- /* Give date */
- if (fits_write_key(filePtr, TSTRING, "DATE-OBS", vis->dateObs,
- "UTC start date of observations", &status))
- {
- amdlibReturnFitsError("DATE-OBS");
- }
-
- /* Write names of array and detector */
- if (fits_write_key (filePtr, TSTRING, "ARRNAME", arrName,
- "Array Name", &status))
- {
- amdlibReturnFitsError("ARRNAME");
- }
- if (fits_write_key(filePtr, TSTRING, "INSNAME", insName,
- "Instrument name", &status))
- {
- amdlibReturnFitsError("INSNAME");
- }
-
- visError = calloc(nbWlen, sizeof(amdlibCOMPLEX));
- convertToDeg = calloc(nbWlen, sizeof(double));
- flag = calloc(nbWlen, sizeof(unsigned char));
-
- /* Write columns */
- for (iFrame = 0; iFrame < vis->nbFrames; iFrame++)
- {
- for (iBase = 0; iBase < vis->nbBases; iBase++)
- {
- iVis++;
-
- /* Write TARGET_IDentity as an index into IO_TARGET table */
- if (fits_write_col(filePtr, TINT, 1, iVis, 1, 1,
- &(vis->table[iVis-1].targetId), &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("TARGET_IDentity");
- }
-
- /* Write utc TIME of observation */
- if (fits_write_col(filePtr, TDOUBLE, 2, iVis, 1, 1,
- &(vis->table[iVis-1].time), &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("TIME");
- }
-
- /* Write observation date in ModifiedJulianDay */
- if (fits_write_col(filePtr, TDOUBLE, 3, iVis, 1, 1,
- &(vis->table[iVis-1].dateObsMJD), &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("ModifiedJulianDay");
- }
-
- /* Write INTegration_TIME (seconds) */
- expTime = (double)vis->table[iVis-1].expTime;
- if (fits_write_col(filePtr, TDOUBLE, 4, iVis, 1, 1,
- &expTime, &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("INTegration_TIME");
- }
-
- /* Writing ComPleXVISibility (no unit) */
- if (fits_write_col(filePtr,TDBLCOMPLEX, 5, iVis, 1, nbWlen,
- (double*)vis->table[iVis-1].vis, &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("ComPleXVISibility");
- }
-
- /* Write ComPleXVISibilityERRor (no unit) */
- /* Need to write Error, NOT sigma2 */
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- visError[lVis].re =
- amdlibSignedSqrt(vis->table[iVis-1].sigma2Vis[lVis].re);
- visError[lVis].im =
- amdlibSignedSqrt(vis->table[iVis-1].sigma2Vis[lVis].im);
- }
-
- if (fits_write_col(filePtr,TDBLCOMPLEX, 6, iVis, 1,
- nbWlen, (double *)visError, &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("ComPleXVISibilityERRor");
- }
-
- /* Write VISibilityAMPlitude (no unit) */
- if (fits_write_col(filePtr, TDOUBLE, 7, iVis, 1, nbWlen,
- vis->table[iVis-1].diffVisAmp, &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("VISibilityAMPlitude");
- }
-
- /* Write VISibilityAMPlitudeERRor (no unit) */
- if (fits_write_col(filePtr, TDOUBLE, 8, iVis, 1, nbWlen,
- vis->table[iVis-1].diffVisAmpErr, &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("VISibilityAMPlitudeERRor");
- }
-
- /* Write VISibilityPHI (degrees) */
- for(lVis = 0; lVis < nbWlen; lVis++)
- {
- if(vis->table[iVis-1].diffVisPhi[lVis]!=amdlibBLANKING_VALUE)
- {
- convertToDeg[lVis] = 180.0 / M_PI *
- vis->table[iVis-1].diffVisPhi[lVis];
- }
- else
- {
- convertToDeg[lVis] = amdlibBLANKING_VALUE;
- }
- }
-
- if (fits_write_colnull(filePtr, TDOUBLE, 9, iVis, 1, nbWlen,
- convertToDeg, &amdlibBval, &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("VISibilityPHI");
- }
-
- /* Write VISibilityPHIERRor (degrees) */
- for(lVis = 0; lVis < nbWlen; lVis++)
- {
- if(vis->table[iVis-1].diffVisPhiErr[lVis]!=amdlibBLANKING_VALUE)
- {
- convertToDeg[lVis] = 180.0 / M_PI *
- vis->table[iVis-1].diffVisPhiErr[lVis];
- }
- else
- {
- convertToDeg[lVis] = amdlibBLANKING_VALUE;
- }
- }
- if (fits_write_colnull(filePtr, TDOUBLE, 10, iVis, 1, nbWlen,
- convertToDeg, &amdlibBval, &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("VISibilityPHIERRor");
- }
- /* Write UCOORDinate (meters) */
- if (fits_write_col(filePtr, TDOUBLE, 11, iVis, 1, 1,
- &(vis->table[iVis-1].uCoord), &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("UCOORDinate");
- }
-
- /* Write VCOORDinates (meters) */
- if (fits_write_col(filePtr, TDOUBLE, 12, iVis, 1, 1,
- &(vis->table[iVis-1].vCoord), &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("VCOORDinates");
- }
-
- /* Write STAtion_INDEX contributing to the data */
- if (fits_write_col(filePtr, TINT, 13, iVis, 1, 2,
- vis->table[iVis-1].stationIndex, &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("STAtion_INDEX");
- }
-
- /* Write flag as unsigned char -- does not work with booleans */
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- flag[lVis] = vis->table[iVis-1].flag[lVis];
- }
-
- if (fits_write_col(filePtr, TLOGICAL, 14, iVis, 1, nbWlen,
- flag, &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("FLAG");
- }
- }
- }
- /* free allocated space at end of job */
- amdlibWriteOiVis_FREEALL();
- return amdlibSUCCESS;
-}
-#undef amdlibWriteOiVis_FREEALL
-
-#define amdlibWriteOiVis2_FREEALL() free(flag);
-/**
- * Write OI_VIS2 table in OI-FITS file
- *
- * This function writes the OI_VIS2 binary table defined in the IAU
- * standard in the OI-FITS file given as parameter.
- *
- * @param filePtr pointer on the file to be created
- * @param insName name of the detector
- * @param arrName array name
- * @param vis2 OI_VIS2 produced
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibWriteOiVis2( fitsfile *filePtr,
- char *insName,
- char *arrName,
- amdlibVIS2 *vis2,
- amdlibERROR_MSG errMsg)
-{
- int nbWlen = vis2->nbWlen;
- int lVis;
- int status = 0;
- char fitsioMsg[256];
- const int tfields = 10;
- char *ttype[] = {"TARGET_ID", "TIME", "MJD", "INT_TIME", "VIS2DATA",
- "VIS2ERR", "UCOORD", "VCOORD", "STA_INDEX", "FLAG"};
- char *Tform[] = {"I", "D", "D", "D", "?D", "?D", "1D", "1D", "2I",
- "?L"};
- char *tform[tfields];
- char *tunit[] = {"\0", "s", "day", "s", "\0", "\0", "m", "m", "\0",
- "\0"};
- char extname[] = "OI_VIS2";
- int revision = amdlib_OI_REVISION;
- int iFrame = 0, iBase = 0, iVis = 0, i = 0;
- char tmp[16];
- double expTime;
- unsigned char *flag;
-
- amdlibLogTrace("amdlibWriteOiVis2()");
-
- if (vis2->thisPtr != vis2)
- {
- amdlibSetErrMsg("Unitialized vis2 structure");
- return amdlibFAILURE;
- }
- if (vis2->nbFrames < 1)
- {
- return amdlibSUCCESS;
- }
-
- /* Create table structure. Make up Tform: substitute nbWlen for '?' */
- for (i = 0; i < tfields; i++)
- {
- if (Tform[i][0] == '?')
- {
- sprintf(tmp, "%d%s", nbWlen, &Tform[i][1]);
- tform[i] = calloc((strlen(tmp)+1), sizeof(char));
- strcpy(tform[i], tmp);
- }
- else
- {
- tform[i] = calloc((strlen(Tform[i])+1), sizeof(char));
- strcpy(tform[i], Tform[i]);
- }
- }
-
- if (fits_create_tbl (filePtr, BINARY_TBL, 0, tfields,
- ttype, tform, tunit, extname, &status))
- {
- amdlibReturnFitsError("BINARY_TBL");
- }
-
- for (i = 0; i < tfields; i++)
- {
- free(tform[i]);
- }
-
- /* Write revision number of the table definition */
- if (fits_write_key (filePtr, TINT, "OI_REVN", &revision,
- "Revision number of the table definition", &status))
- {
- amdlibReturnFitsError("OI_REVN");
- }
-
- /* Give date */
- if (fits_write_key(filePtr, TSTRING,"DATE-OBS", vis2->dateObs,
- "UTC start date of observations", &status))
- {
- amdlibReturnFitsError("DATE-OBS");
- }
-
- /* Write array and detector names */
- if (fits_write_key (filePtr, TSTRING, "ARRNAME", arrName,
- "Array Name", &status))
- {
- amdlibReturnFitsError("ARRNAME");
- }
- if (fits_write_key(filePtr, TSTRING, "INSNAME", insName,
- "Instrument name", &status))
- {
- amdlibReturnFitsError("INSNAME");
- }
-
- flag = calloc(nbWlen, sizeof(unsigned char));
-
- /* Write columns */
- for (iFrame = 0; iFrame < vis2->nbFrames; iFrame++)
- {
- for (iBase = 0; iBase < vis2->nbBases; iBase++)
- {
- iVis++;
- /* Write TARGET_IDentity */
- if (fits_write_col (filePtr, TINT, 1, iVis, 1, 1,
- &(vis2->table[iVis-1].targetId), &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("TARGET_IDentity");
- }
-
- /* Write time */
- if (fits_write_col (filePtr, TDOUBLE, 2, iVis, 1, 1,
- &(vis2->table[iVis-1].time), &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("Time");
- }
- if (fits_write_col (filePtr, TDOUBLE, 3, iVis, 1, 1,
- &(vis2->table[iVis-1].dateObsMJD), &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("dateObsMJD");
- }
- expTime = (double)vis2->table[iVis-1].expTime;
- if (fits_write_col (filePtr, TDOUBLE, 4, iVis, 1, 1,
- &expTime, &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("expTime");
- }
-
- /* Write squared visibility */
- if (fits_write_col(filePtr, TDOUBLE, 5, iVis, 1, nbWlen,
- vis2->table[iVis-1].vis2, &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("vis2");
- }
- /* Write error in the squared visibility */
- if (fits_write_col(filePtr, TDOUBLE, 6, iVis, 1, nbWlen,
- vis2->table[iVis-1].vis2Error, &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("vis2Error");
- }
-
- /* Write U and V coordinates on the data */
- if (fits_write_col (filePtr, TDOUBLE, 7, iVis, 1, 1,
- &(vis2->table[iVis-1].uCoord), &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("uCoord");
- }
- if (fits_write_col (filePtr, TDOUBLE, 8, iVis, 1, 1,
- &(vis2->table[iVis-1].vCoord), &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("vCoord");
- }
-
- /* Write station index */
- if (fits_write_col (filePtr, TINT, 9, iVis, 1, 2,
- vis2->table[iVis-1].stationIndex, &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("stationIndex");
- }
- /* Write flag as unsigned char -- does not work with booleans */
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- flag[lVis] = vis2->table[iVis-1].flag[lVis];
- }
- if (fits_write_col(filePtr, TLOGICAL, 10, iVis, 1, nbWlen,
- flag, &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("FLAG");
- }
-
- }
- }
- /* free allocated space at end of job */
- amdlibWriteOiVis2_FREEALL();
- return amdlibSUCCESS;
-}
-
-#define amdlibWriteOiVis3_FREEALL() free(flag); free(convertToDeg);
-/**
- * Write OI_T3 table in OI-FITS file.
- *
- * This function writes the OI_T3 binary table defined in the IAU
- * standard in the OI-FITS file given as parameter.
- *
- * @param filePtr pointer on the file to be created.
- * @param insName name of the detector.
- * @param arrName array name.
- * @param vis3 OI_T3 produced.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibWriteOiVis3(fitsfile *filePtr,
- char *insName,
- char *arrName,
- amdlibVIS3 *vis3,
- amdlibERROR_MSG errMsg)
-{
- int nbWlen =vis3->nbWlen;
- int lVis;
- int status = 0;
- char fitsioMsg[256];
- const int tfields = 14;
- char *ttype[] = {"TARGET_ID", "TIME", "MJD", "INT_TIME", "T3AMP",
- "T3AMPERR", "T3PHI", "T3PHIERR", "U1COORD", "V1COORD", "U2COORD",
- "V2COORD", "STA_INDEX", "FLAG"};
- char *Tform[] = {"I", "D", "D", "D", "?D", "?D", "?D", "?D", "1D",
- "1D", "1D", "1D", "3I", "?L"};
- char *tform[tfields];
- char *tunit[] = {"\0", "s", "day", "s", "\0", "\0", "deg", "deg",
- "m", "m", "m", "m", "\0", "\0"};
- char extname[] = "OI_T3";
- int revision = amdlib_OI_REVISION;
- int i;
- char tmp[16];
- double expTime;
- double *convertToDeg;
- unsigned char *flag;
- amdlibDOUBLE amdlibBval=amdlibBLANKING_VALUE;
-
- int iFrame = 0, iClos = 0, iT3 = 0;
-
- amdlibLogTrace("amdlibWriteOiVis3()");
-
- /*Vis3 may not be initialized (only 1 baseline), this is not a defect*/
- if (vis3->thisPtr != vis3)
- {
- return amdlibSUCCESS;
- }
- /*If initialized but empty, do nothing gracefully*/
- if (vis3->nbFrames < 1)
- {
- return amdlibSUCCESS;
- }
-
- /* Create table structure. Make up Tform: substitute nbWlen for '?' */
- for (i = 0; i < tfields; i++)
- {
- if (Tform[i][0] == '?')
- {
- sprintf(tmp, "%d%s", nbWlen, &Tform[i][1]);
- tform[i] = calloc((strlen(tmp)+1), sizeof(char));
- strcpy(tform[i], tmp);
- }
- else
- {
- tform[i] = calloc((strlen(Tform[i])+1), sizeof(char));
- strcpy(tform[i], Tform[i]);
- }
- }
- if (fits_create_tbl(filePtr, BINARY_TBL, 0, tfields, ttype, tform, tunit,
- extname, &status))
- {
- amdlibReturnFitsError("Creating Binary Table");
- }
-
- for (i = 0; i < tfields; i++)
- {
- free(tform[i]);
- }
-
- /* Write revision number of the table definition */
- if (fits_write_key (filePtr, TINT, "OI_REVN", &revision,
- "Revision number of the table definition", &status))
- {
- amdlibReturnFitsError("OI_REVN");
- }
-
- /* Give date */
- if (fits_write_key(filePtr, TSTRING,"DATE-OBS", vis3->dateObs,
- "UTC start date of observations", &status))
- {
- amdlibReturnFitsError("DATE-OBS");
- }
-
- /* Write names of detector and array */
- if (fits_write_key (filePtr, TSTRING, "ARRNAME", arrName,
- "Array Name", &status))
- {
- amdlibReturnFitsError("ARRNAME");
- }
- if (fits_write_key(filePtr, TSTRING, "INSNAME", insName,
- "Instrument name", &status))
- {
- amdlibReturnFitsError("INSNAME");
- }
-
- convertToDeg = calloc(nbWlen, sizeof(double));
- flag = calloc(nbWlen, sizeof(unsigned char));
-
- /* Write columns */
- for (iFrame = 0; iFrame < vis3->nbFrames; iFrame++)
- {
- for (iClos = 0; iClos < vis3->nbClosures; iClos++)
- {
- /* Write dtarget identity */
- if (fits_write_col(filePtr, TINT, 1, iT3+1, 1, 1,
- &(vis3->table[iT3].targetId), &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("TARGET_ID");
- }
-
- /* Write time */
- if (fits_write_col(filePtr, TDOUBLE, 2, iT3+1, 1, 1,
- &(vis3->table[iT3].time), &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("TIME");
- }
- if (fits_write_col(filePtr, TDOUBLE, 3, iT3+1, 1, 1,
- &(vis3->table[iT3].dateObsMJD), &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("DATEOBS");
- }
- expTime = (double)vis3->table[iT3].expTime;
- if (fits_write_col(filePtr, TDOUBLE, 4, iT3+1, 1, 1,
- &expTime, &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("EXPTIME");
- }
-
- /* Write visibility amplitude and its associated error */
- if (fits_write_col(filePtr, TDOUBLE, 5, iT3+1, 1, nbWlen,
- vis3->table[iT3].vis3Amplitude, &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("VIS3AMP");
- }
- if (fits_write_col(filePtr, TDOUBLE, 6, iT3+1, 1, nbWlen,
- vis3->table[iT3].vis3AmplitudeError,
- &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("VIS3AMPERR");
- }
-
- /* Write visibility phase and its associated error,
- * converted in degrees */
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- if(vis3->table[iT3].vis3Phi[lVis]!=amdlibBLANKING_VALUE)
- {
- convertToDeg[lVis] = 180.0 / M_PI *
- vis3->table[iT3].vis3Phi[lVis];
- }
- else
- {
- convertToDeg[lVis] =amdlibBLANKING_VALUE;
- }
-
- }
- if (fits_write_colnull(filePtr, TDOUBLE, 7, iT3+1, 1, nbWlen,
- convertToDeg, &amdlibBval, &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("VIS3PHI");
- }
- for(lVis = 0; lVis < nbWlen; lVis++)
- {
- if(vis3->table[iT3].vis3PhiError[lVis]!=amdlibBLANKING_VALUE)
- {
- convertToDeg[lVis] = 180.0 / M_PI *
- vis3->table[iT3].vis3PhiError[lVis];
- }
- else
- {
- convertToDeg[lVis] =amdlibBLANKING_VALUE;
- }
- }
- if (fits_write_colnull(filePtr, TDOUBLE, 8, iT3+1, 1, nbWlen,
- convertToDeg, &amdlibBval, &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("VIS3PHIERR");
- }
-
- /* Write U and V coordinates of the data */
- if (fits_write_col(filePtr, TDOUBLE, 9, iT3+1, 1, 1,
- &(vis3->table[iT3].u1Coord), &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("U1COORD");
- }
- if (fits_write_col(filePtr, TDOUBLE, 10, iT3+1, 1, 1,
- &(vis3->table[iT3].v1Coord), &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("V1COORD");
- }
- if (fits_write_col(filePtr, TDOUBLE, 11, iT3+1, 1, 1,
- &(vis3->table[iT3].u2Coord), &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("U2COORD");
- }
- if (fits_write_col(filePtr, TDOUBLE, 12, iT3+1, 1, 1,
- &(vis3->table[iT3].v2Coord), &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("V2COORD");
- }
-
- /* Write station index */
- if (fits_write_col(filePtr, TINT, 13, iT3+1, 1, 3,
- vis3->table[iT3].stationIndex, &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("STATINDEX");
- }
-
- /* Write flag as unsigned char -- does not work with booleans */
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- flag[lVis] = vis3->table[iT3].flag[lVis];
- }
- if (fits_write_col(filePtr, TLOGICAL, 14, iT3+1, 1, nbWlen,
- flag, &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("FLAG");
- }
-
- iT3++;
-
- }
- }
- amdlibWriteOiVis3_FREEALL();
-
- return amdlibSUCCESS;
-}
-
-#define amdlibWriteAmberData_FREEALL() free(errTempVal); \
- free(tempBandNumber);
-/**
- * Write AMBER_DATA table in OI-FITS file.
- *
- * This function writes the AMBER_DATA binary table in the OI-FITS file
- * given as parameter.
- *
- * @param filePtr pointer on the file to be created.
- * @param insName name of the detector.
- * @param photometry photometry data.
- * @param vis AMBER_DATA produced.
- * @param pst piston data.
- * @param wave structure containing the wavelengths.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibWriteAmberData(fitsfile *filePtr,
- char *insName,
- amdlibPHOTOMETRY *photometry,
- amdlibVIS *vis,
- amdlibPISTON *pst,
- amdlibWAVELENGTH *wave,
- amdlibERROR_MSG errMsg)
-{
- int nbWlen = photometry->nbWlen;
- int status = 0;
- char fitsioMsg[256];
- const int tfields = 13;
- amdlibDOUBLE amdlibBval=amdlibBLANKING_VALUE;
- char *Ttype[] =
- {
- "TARGET_ID", "TIME", "MJD", "INT_TIME",
- "FLUX_SUM", "FLUX_SUM_CORRECTION", "FLUX_RATIO",
- "FLUX_RATIO_CORRECTION", "FLUX_PRODUCT",
- "OPD", "OPD_ERR", "FRINGE_SNR", "STA_INDEX"
- };
-
- char *Tform[] = {"I", "D", "D", "D", "?D", "?D", "?D", "?D", "?D",
- "?E", "?E", "?D", "2I"};
-
- char *Tunit[] = {"\0", "s", "day", "s", "e-", "e-", "\0", "\0",
- "e-^2", "m", "m", "\0", "\0"};
-
- char *ttype[tfields];
- char *tform[tfields];
- char *tunit[tfields];
-
- char extname[] = "AMBER_DATA";
- int revision = amdlib_OI_REVISION;
- int colNum;
- int i;
- int lVis;
- char tmp[16];
- int iFrame = 0, iBase = 0, iVis = 0;
- double *errTempVal;
- int *tempBandNumber;
- int band, iBand;
- int nbBands = 0;
- amdlibBAND_DESC *bandDesc;
- amdlibDOUBLE bound;
- char keyName[amdlibKEYW_NAME_LEN+1];
- double expTime;
- amdlibDOUBLE pistonTmpVal[amdlibNB_BANDS];
- amdlibDOUBLE pstErrTmpVal[amdlibNB_BANDS];
- double frgTmpVal[amdlibNB_BANDS];
-
- amdlibLogTrace("amdlibWriteAmberData()");
-
- if (vis->thisPtr != vis)
- {
- amdlibSetErrMsg("Unitialized vis structure");
- return amdlibFAILURE;
- }
-
- /*If initialized but empty, do nothing gracefully*/
- if (vis->nbFrames < 1)
- {
- return amdlibSUCCESS;
- }
-
- if (photometry->thisPtr != photometry)
- {
- amdlibSetErrMsg("Unitialized photometry structure");
- return amdlibFAILURE;
- }
- /*If initialized but empty, do nothing gracefully*/
- if (photometry->nbFrames < 1)
- {
- return amdlibSUCCESS;
- }
-
- if (pst->thisPtr != pst)
- {
- amdlibSetErrMsg("Unitialized piston structure");
- return amdlibFAILURE;
- }
- /*If initialized but empty, do nothing gracefully*/
- if (pst->nbFrames < 1)
- {
- return amdlibSUCCESS;
- }
-
- /* Create table structure. Make up Tform: substitute nbWlen or
- * nbBands for '?' */
- /* (informational) check number of bands */
- nbBands=0;
- for (band = amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- if (pst->bandFlag[band] == amdlibTRUE)
- {
- nbBands++;
- }
- }
- for (i = 0; i < tfields; i++)
- {
- ttype[i] = calloc(strlen(Ttype[i])+1, sizeof(char));
- strcpy(ttype[i],Ttype[i]);
- tunit[i] = calloc(strlen(Tunit[i])+1, sizeof(char));
- strcpy(tunit[i],Tunit[i]);
-
- if (Tform[i][0] == '?')
- {
- if ((i == 9) || (i == 10) || (i == 11))
- {
- sprintf(tmp, "%d%s", nbBands, &Tform[i][1]);
- }
- else
- {
- sprintf(tmp, "%d%s", nbWlen, &Tform[i][1]);
- }
- tform[i] = calloc((strlen(tmp)+1), sizeof(char));
- strcpy(tform[i], tmp);
- }
- else
- {
- tform[i] = calloc((strlen(Tform[i])+1), sizeof(char));
- strcpy(tform[i], Tform[i]);
- }
- }
-
- if (fits_create_tbl(filePtr, BINARY_TBL, 0, tfields, ttype, tform, tunit,
- extname, &status))
- {
- amdlibReturnFitsError("Creating Binary Table");
- }
-
- for (i = 0; i < tfields; i++)
- {
- free(ttype[i]);
- free(tform[i]);
- free(tunit[i]);
- }
-
- /* Give date */
- if (fits_write_key(filePtr, TSTRING, "DATE-OBS", vis->dateObs,
- "UTC start date of observations", &status))
- {
- amdlibReturnFitsError("DATE-OBS");
- }
-
- /* Write detector name */
- if (fits_write_key (filePtr, TSTRING, "INSNAME", insName,
- "Instrument name", &status))
- {
- amdlibReturnFitsError("INSNAME");
- }
-
- /* Write revision number of the table definition */
- if (fits_write_key (filePtr, TINT, "AMB_REVN", &revision,
- "Revision number of the table definition", &status))
- {
- amdlibReturnFitsError("AMB_REVN");
- }
-
- /* Write information on spectral bands. */
- if (fits_write_key (filePtr, TINT, "HIERARCH ESO QC NBBANDS",
- &nbBands, "Number of spectral bands", &status))
- {
- amdlibReturnFitsError("HIERARCH ESO QC NBBANDS");
- }
-
- iBand = 1;
- for (band = amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- if (pst->bandFlag[band] == amdlibTRUE)
- {
- bandDesc = amdlibGetBandDescription(band);
- sprintf(keyName, "HIERARCH ESO QC BAND%d NAME", iBand);
- if (fits_write_key(filePtr, TSTRING, keyName, bandDesc->name,
- "Name of spectral band", &status))
- {
- amdlibReturnFitsError(keyName);
- }
- memset(keyName, '\0', (amdlibKEYW_NAME_LEN+1) * sizeof(char));
- sprintf(keyName, "HIERARCH ESO QC BAND%d LOWBOUND", iBand);
- bound = bandDesc->lowerBound/1000;
- if (fits_write_key(filePtr, TDOUBLE, keyName, &bound,
- "Lower bound of spectral band", &status))
- {
- amdlibReturnFitsError(keyName);
- }
- memset(keyName, '\0', (amdlibKEYW_NAME_LEN+1) * sizeof(char));
- sprintf(keyName, "HIERARCH ESO QC BAND%d UPBOUND", iBand);
- bound = bandDesc->upperBound/1000;
- if (fits_write_key(filePtr, TDOUBLE, keyName, &bound,
- "Upper bound of spectral band", &status))
- {
- amdlibReturnFitsError(keyName);
- }
- iBand++;
- }
-
- }
-
- errTempVal = calloc(nbWlen, sizeof(double));
- tempBandNumber = calloc(nbWlen, sizeof(int));
- /* Retrieve Band number for each Wlen */
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- tempBandNumber[lVis] = amdlibGetBand(wave->wlen[lVis]);
- }
-
- /* Write columns */
- for (iFrame = 0; iFrame < vis->nbFrames; iFrame++)
- {
- for (iBase = 0; iBase < vis->nbBases; iBase++)
- {
- colNum = 1;
- iVis++;
- /* Write target identity */
- if (fits_write_col(filePtr, TINT, colNum, iVis, 1, 1,
- &(vis->table[iVis-1].targetId), &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("Target Id");
- }
- colNum++;
-
- /* Write time */
- if (fits_write_col(filePtr, TDOUBLE, colNum, iVis, 1, 1,
- &(vis->table[iVis-1].time), &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("Time");
- }
- colNum++;
-
- if (fits_write_col(filePtr, TDOUBLE, colNum, iVis, 1, 1,
- &(vis->table[iVis-1].dateObsMJD), &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("dateObsMJD");
- }
- colNum++;
-
- expTime = (double)vis->table[iVis-1].expTime;
- if (fits_write_col(filePtr, TDOUBLE, 4, iVis, 1, 1,
- &expTime, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("expTime");
- }
- colNum++;
-
- /* Write information on photometry */
- /* Write fluxSumPiPj (number of electrons collected in the spectral
- * channel) and associated error */
- if (fits_write_colnull(filePtr, TDOUBLE, colNum, iVis, 1, nbWlen,
- photometry->table[iVis-1].fluxSumPiPj,
- &amdlibBval, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("baseFluxSum");
- }
- colNum++;
-
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- if (!(photometry->table[iVis-1].sigma2FluxSumPiPj[lVis] ==
- amdlibBLANKING_VALUE))
- {
- errTempVal[lVis] =
- sqrt(photometry->table[iVis-1].sigma2FluxSumPiPj[lVis]);
- }
- else
- {
- errTempVal[lVis] = amdlibBLANKING_VALUE;
- }
- }
-
- if (fits_write_colnull(filePtr, TDOUBLE, colNum, iVis, 1, nbWlen,
- errTempVal, &amdlibBval, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("baseFluxSumCorrection");
- }
- colNum++;
-
- /* Write flux ratio in the spectral channel and associated error */
- if (fits_write_colnull(filePtr, TDOUBLE, colNum, iVis, 1, nbWlen,
- photometry->table[iVis-1].fluxRatPiPj,
- &amdlibBval, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("baseFluxRatio");
- }
- colNum++;
-
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- if (!(photometry->table[iVis-1].sigma2FluxRatPiPj[lVis] ==
- amdlibBLANKING_VALUE))
- {
- errTempVal[lVis]=
- sqrt(photometry->table[iVis-1].sigma2FluxRatPiPj[lVis]);
- }
- else
- {
- errTempVal[lVis] = amdlibBLANKING_VALUE;
- }
- }
- if (fits_write_colnull(filePtr, TDOUBLE, colNum, iVis, 1, nbWlen,
- errTempVal, &amdlibBval, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("baseFluxRatioCorrection");
- }
- colNum++;
-
- /* Write flux product */
- if (fits_write_colnull(filePtr, TDOUBLE, colNum, iVis, 1, nbWlen,
- photometry->table[iVis-1].PiMultPj,
- &amdlibBval, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("baseFluxProduct");
- }
- colNum++;
-
- /* Write piston value and associated error */
- int i = 0;
- for (band = amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- if (pst->bandFlag[band] == amdlibTRUE )
- {
- if (!amdlibCompareDouble(pst->pistonOPDArray[band][iVis-1],amdlibBLANKING_VALUE))
- {
- pistonTmpVal[i] = pst->pistonOPDArray[band][iVis-1] *
- amdlibNM_TO_M;
- pstErrTmpVal[i] = pst->sigmaPistonArray[band][iVis-1] *
- amdlibNM_TO_M;
- }
- else
- {
- pistonTmpVal[i] = amdlibBLANKING_VALUE;
- pstErrTmpVal[i] = amdlibBLANKING_VALUE;
- }
- frgTmpVal[i] = vis->table[iVis-1].frgContrastSnrArray[band];
- i++;
- }
- }
- if (fits_write_colnull(filePtr, TDOUBLE, colNum, iVis, 1, nbBands,
- pistonTmpVal, &amdlibBval, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("piston");
- }
- colNum++;
-
- if (fits_write_colnull(filePtr, TDOUBLE, colNum, iVis, 1, nbBands,
- pstErrTmpVal, &amdlibBval, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("pistonErr");
- }
- colNum++;
-
- /* Write fringe contrast SNR */
- if (fits_write_col(filePtr, TDOUBLE, colNum, iVis, 1, nbBands,
- frgTmpVal, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("frgContrastSnr");
- }
- colNum++;
-
- /* Write station idexes corresponding to the baseline */
- if (fits_write_col(filePtr, TINT, colNum, iVis, 1, 2,
- vis->table[iVis-1].stationIndex, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("stationIndex");
- }
- colNum++;
- }
- }
- amdlibWriteAmberData_FREEALL();
- return amdlibSUCCESS;
-}
-#undef amdlibWriteAmberData_FREEALL
-
-/**
- * Read OI_WAVELENGTH table in OI-FITS file
- *
- * This function reads the OI_WAVELENGTH binary table defined in the IAU
- * standard in the OI-FITS file given as parameter.
- *
- * @param filePtr pointer on the file to be read
- * @param wave OI_WAVELENGTH produced
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibReadOiWavelength(fitsfile *filePtr,
- amdlibWAVELENGTH *wave,
- amdlibERROR_MSG errMsg)
-{
- int status = 0;
- char fitsioMsg[256];
- char comment[amdlibKEYW_CMT_LEN+1], insName[amdlibKEYW_VAL_LEN+1];
- amdlibDOUBLE null_amdlibDOUBLE = 0.0;
- const int revision = amdlib_OI_REVISION;
- int dataRevision;
- int colnum, anynull, i;
- long nbWlen;
-
- amdlibLogTrace("amdlibReadOiWavelength()");
-
- /* Go to OI_WAVELENGTH value of EXTNAME keyword */
- if (fits_movnam_hdu(filePtr, BINARY_TBL, "OI_WAVELENGTH", 0, &status))
- {
- amdlibReturnFitsError("No OI_WAVELENGTH table");
- }
-
- /* Read detector name */
- if (fits_read_key(filePtr, TSTRING, "INSNAME", insName,
- comment, &status))
- {
- amdlibReturnFitsError("No INSNAME keyword found");
- }
-
- /* Read revision number of the table definition */
- if (fits_read_key(filePtr, TINT, "OI_REVN", &dataRevision,
- comment, &status))
- {
- amdlibReturnFitsError("No OI_REVN keyword found");
- }
-
- if (dataRevision > revision)
- {
- amdlibSetErrMsg("Unable to read this OI revision of the data");
- return amdlibFAILURE;
- }
-
- /* Get number of channels */
- if (fits_get_num_rows(filePtr, &nbWlen, &status))
- {
- amdlibReturnFitsError("Getting the number of spectral channels");
- }
-
- /* Allocate memory wavelength */
- if (amdlibAllocateWavelength(wave, nbWlen, errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- wave->nbWlen = nbWlen;
-
- /* Read columns */
- /* Read effective wavelength of each channel */
- if (fits_get_colnum(filePtr, CASEINSEN, "EFF_WAVE", &colnum, &status))
- {
- amdlibReturnFitsError("number of cols of EFF_WAVE");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, 1, 1, wave->nbWlen, &null_amdlibDOUBLE,
- wave->wlen, &anynull, &status))
- {
- amdlibReturnFitsError("reading the col EFF_WAVE");
- }
-
- /* Read effective bandpass of each channel */
- if (fits_get_colnum(filePtr, CASEINSEN, "EFF_BAND", &colnum, &status))
- {
- amdlibReturnFitsError("number of cols of EFF_BAND");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, 1, 1, wave->nbWlen,
- &null_amdlibDOUBLE, wave->bandwidth, &anynull, &status))
- {
- amdlibReturnFitsError("reading the col EFF_BAND");
- }
- /* Convert wavelengths and bandpass into meters */
- for (i=0; i < wave->nbWlen; i++)
- {
- wave->wlen[i] /= amdlibNM_TO_M;
- wave->bandwidth[i] /= amdlibNM_TO_M;
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Read OI_VIS table in OI-FITS file
- *
- * This function reads the OI_VIS binary table defined in the IAU
- * standard in the OI-FITS file given as parameter.
- *
- * @param filePtr pointer on the file to be read
- * @param vis OI_VIS produced
- * @param nbBases input parameter giving the number of baselines.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibReadOiVis(fitsfile *filePtr,
- amdlibVIS *vis,
- int nbBases,
- amdlibERROR_MSG errMsg)
-{
- char comment[amdlibKEYW_CMT_LEN+1];
- int nullint = 0;
- double nulldouble = 0;
- amdlibDOUBLE amdlibBval=amdlibBLANKING_VALUE;
- amdlibBOOLEAN nulllogical = amdlibFALSE;
- const int revision = amdlib_OI_REVISION;
- int dataRevision;
- int iFrame, colnum, anynull;
- int status = 0;
- char fitsioMsg[256];
- long nbRows, nbWlen, nbFrames;
- char insName[amdlibKEYW_VAL_LEN+1], arrName[amdlibKEYW_VAL_LEN+1];
- char dateObsMJD[amdlibKEYW_VAL_LEN+1];
- char flagColSize[amdlibKEYW_VAL_LEN+1];
- unsigned char *flag;
- int lVis;
-
- amdlibLogTrace("amdlibReadOiVis()");
-
- /* Read the OI table */
- if (fits_movnam_hdu(filePtr, BINARY_TBL, "OI_VIS", 0, &status))
- {
- amdlibReturnFitsError("OI_VIS");
- }
-
- /* Read revision number of the table definition */
- if (fits_read_key(filePtr, TINT, "OI_REVN", &dataRevision,
- comment, &status))
- {
- amdlibReturnFitsError("OI_REVN");
- }
- if (dataRevision > revision)
- {
- amdlibSetErrMsg("Unable to read this OI revision of the data");
- return amdlibFAILURE;
- }
-
- /* Read observation date */
- if (fits_read_key(filePtr, TSTRING, "DATE-OBS", dateObsMJD,
- comment, &status))
- {
- amdlibLogWarning("No DATE-OBS keyword !");
- status = 0;
- }
-
- /* Read names of array and detector */
- if (fits_read_key(filePtr, TSTRING, "ARRNAME", arrName,
- comment, &status))
- {
- amdlibLogWarning("No ARRNAME keyword !");
- status = 0;
- }
- if (fits_read_key(filePtr, TSTRING, "INSNAME", insName,
- comment, &status))
- {
- amdlibLogWarning("No INSNAME keyword !");
- status = 0;
- }
-
- /* Get flag column dimension */
- if (fits_read_key(filePtr, TSTRING, "TFORM14", flagColSize,
- comment, &status))
- {
- amdlibLogWarning("No TFORM14 keyword !");
- status = 0;
- }
-
- /* Get number of rows */
- if (fits_get_num_rows(filePtr, &nbRows, &status))
- {
- amdlibReturnFitsError("nbRows");
- }
-
- /* Get value for nbWlen */
- /* Format specifies same repeat count for VIS* columns */
- if (fits_get_colnum(filePtr, CASEINSEN, "VISDATA", &colnum, &status))
- {
- amdlibReturnFitsError("VISDATA");
- }
-
- if (fits_get_coltype(filePtr, colnum, NULL, &nbWlen, NULL, &status))
- {
- amdlibReturnFitsError("VISDATA");
- }
-
- nbFrames = nbRows / nbBases;
-
- /* Allocate memory vis */
- if (amdlibAllocateVis(vis, nbFrames, nbBases, nbWlen) != amdlibSUCCESS)
- {
- amdlibReturnFitsError("Could not allocate memory for VIS");
- }
-
- strcpy(vis->dateObs, dateObsMJD);
-
- for (iFrame=1; iFrame <= nbRows; iFrame++)
- {
- int j;
- double im, re;
-
- /* Read target identity */
- if (fits_get_colnum(filePtr, CASEINSEN, "TARGET_ID", &colnum, &status))
- {
- amdlibReturnFitsError("TARGET_ID");
- }
- if (fits_read_col(filePtr, TINT, colnum, iFrame, 1, 1, &nullint,
- &vis->table[iFrame-1].targetId, &anynull, &status))
- {
- amdlibReturnFitsError("TARGET_ID");
- }
-
- /* Read time tag for the exposure */
- if (fits_get_colnum(filePtr, CASEINSEN, "TIME", &colnum, &status))
- {
- amdlibReturnFitsError("TIME");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, 1,
- &nulldouble, &vis->table[iFrame-1].time,
- &anynull, &status))
- {
- amdlibReturnFitsError("TIME");
- }
-
- /* Read observation date */
- if (fits_get_colnum(filePtr, CASEINSEN, "MJD", &colnum, &status))
- {
- amdlibReturnFitsError("MJD");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, 1,
- &nulldouble, &vis->table[iFrame-1].dateObsMJD,
- &anynull, &status))
- {
- amdlibReturnFitsError("MJD");
- }
-
- /* Read integration time */
- if (fits_get_colnum(filePtr, CASEINSEN, "INT_TIME", &colnum, &status))
- {
- amdlibReturnFitsError("INT_TIME");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, 1,
- &nulldouble, &vis->table[iFrame-1].expTime,
- &anynull, &status))
- {
- amdlibReturnFitsError("INT_TIME");
- }
-
- /* Read visibility and its associated error */
- if (fits_get_colnum(filePtr, CASEINSEN, "VISDATA", &colnum, &status))
- {
- amdlibReturnFitsError("VISDATA");
- }
- if (fits_read_col(filePtr, TDBLCOMPLEX, colnum, iFrame, 1, nbWlen,
- &amdlibBval, vis->table[iFrame-1].vis,
- &anynull, &status))
- {
- amdlibReturnFitsError("VISDATA");
- }
-
- if (fits_get_colnum(filePtr, CASEINSEN, "VISERR", &colnum, &status))
- {
- amdlibReturnFitsError("VISERR");
- }
- if (fits_read_col(filePtr, TDBLCOMPLEX, colnum, iFrame, 1, nbWlen,
- &amdlibBval, vis->table[iFrame-1].sigma2Vis,
- &anynull, &status))
- {
- amdlibReturnFitsError("VISERR");
- }
- /* Rectify read value */
- for (j=0; j < nbWlen; j++)
- {
- re = vis->table[iFrame-1].sigma2Vis[j].re;
- im = vis->table[iFrame-1].sigma2Vis[j].im;
- vis->table[iFrame-1].sigma2Vis[j].re *= re;
- vis->table[iFrame-1].sigma2Vis[j].im *= im;
- }
-
- if (fits_get_colnum(filePtr, CASEINSEN, "VISAMP", &colnum, &status))
- {
- amdlibReturnFitsError("VISAMP");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, nbWlen,
- &amdlibBval, vis->table[iFrame-1].diffVisAmp,
- &anynull, &status))
- {
- amdlibReturnFitsError("VISAMP");
- }
-
- if (fits_get_colnum(filePtr, CASEINSEN, "VISPHI", &colnum, &status))
- {
- amdlibReturnFitsError("VISPHI");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, nbWlen,
- &amdlibBval, vis->table[iFrame-1].diffVisPhi,
- &anynull, &status))
- {
- amdlibReturnFitsError("VISPHI");
- }
-
- if (fits_get_colnum(filePtr, CASEINSEN, "VISAMPERR", &colnum, &status))
- {
- amdlibReturnFitsError("VISAMPERR");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, nbWlen,
- &amdlibBval, vis->table[iFrame-1].diffVisAmpErr,
- &anynull, &status))
- {
- amdlibReturnFitsError("VISAMPERR");
- }
-
- if (fits_get_colnum(filePtr, CASEINSEN, "VISPHIERR", &colnum, &status))
- {
- amdlibReturnFitsError("VISPHIERR");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, nbWlen,
- &amdlibBval, vis->table[iFrame-1].diffVisPhiErr,
- &anynull, &status))
- {
- amdlibReturnFitsError("VISPHIERR");
- }
-
- /* Rectify read value */
- for (j=0; j < nbWlen; j++)
- {
- vis->table[iFrame-1].diffVisPhi[j] = M_PI / 180.0 *
- vis->table[iFrame-1].diffVisPhi[j];
- vis->table[iFrame-1].diffVisPhiErr[j] = M_PI / 180.0 *
- vis->table[iFrame-1].diffVisPhiErr[j];
- }
-
- /* Read validity flags */
- if (fits_get_colnum(filePtr, CASEINSEN, "FLAG", &colnum, &status))
- {
- amdlibReturnFitsError("FLAG");
- }
- if (strncmp(flagColSize, "0L", 2) != 0 )
- {
- flag = calloc(nbWlen, sizeof(unsigned char));
- if (fits_read_col(filePtr, TLOGICAL, colnum, iFrame, 1, nbWlen,
- &nulllogical, flag,
- &anynull, &status))
- {
- free(flag);
- amdlibReturnFitsError("FLAG");
- }
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- vis->table[iFrame-1].flag[lVis]=flag[lVis];
- }
- free(flag);
- }
-
- /* Read U and V coordinates of the data */
- if (fits_get_colnum(filePtr, CASEINSEN, "UCOORD", &colnum, &status))
- {
- amdlibReturnFitsError("UCOORD");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, 1,
- &nulldouble, &vis->table[iFrame-1].uCoord,
- &anynull, &status))
- {
- amdlibReturnFitsError("UCOORD");
- }
-
- if (fits_get_colnum(filePtr, CASEINSEN, "VCOORD", &colnum, &status))
- {
- amdlibReturnFitsError("VCOORD");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, 1,
- &nulldouble, &vis->table[iFrame-1].vCoord,
- &anynull, &status))
- {
- amdlibReturnFitsError("VCOORD");
- }
-
- /* Read station index */
- if (fits_get_colnum(filePtr, CASEINSEN, "STA_INDEX", &colnum, &status))
- {
- amdlibReturnFitsError("STA_INDEX");
- }
- if (fits_read_col(filePtr, TINT, colnum, iFrame, 1, 2, &nullint,
- vis->table[iFrame-1].stationIndex,
- &anynull, &status))
- {
- amdlibReturnFitsError("STA_INDEX");
- }
-
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Read OI_VIS2 table in OI-FITS file.
- *
- * This function reads the OI_VIS2 binary table defined in the IAU
- * standard in the OI-FITS file given as parameter.
- *
- * @param filePtr pointer on the file to be created.
- * @param vis2 OI_VIS2 produced.
- * @param nbBases input parameter giving the number of baselines.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibReadOiVis2(fitsfile *filePtr,
- amdlibVIS2 *vis2,
- int nbBases,
- amdlibERROR_MSG errMsg)
-{
- char comment[amdlibKEYW_CMT_LEN+1];
- char insName[amdlibKEYW_VAL_LEN+1], arrName[amdlibKEYW_VAL_LEN+1];
- char dateObsMJD[amdlibKEYW_VAL_LEN+1];
- int nullint = 0;
- double nulldouble = 0;
- amdlibDOUBLE amdlibBval=amdlibBLANKING_VALUE;
- amdlibBOOLEAN nulllogical = amdlibFALSE;
- const int revision = amdlib_OI_REVISION;
- int dataRevision;
- int iFrame, colnum, anynull;
- long nbRows, nbWlen, nbFrames;
- int status = 0;
- char fitsioMsg[256];
- char flagColSize[amdlibKEYW_VAL_LEN+1];
- unsigned char *flag;
- int lVis;
-
- amdlibLogTrace("amdlibReadOiVis2()");
-
- /* Read the OI table */
- if (fits_movnam_hdu(filePtr, BINARY_TBL, "OI_VIS2", 0, &status))
- {
- amdlibReturnFitsError("OI_VIS2");
- }
-
- /* Read revision number of the table definition */
- if (fits_read_key(filePtr, TINT, "OI_REVN", &dataRevision,
- comment, &status))
- {
- amdlibReturnFitsError("OI_REVN");
- }
- if (dataRevision > revision)
- {
- amdlibSetErrMsg("Unable to read this OI revision of the data");
- return amdlibFAILURE;
- }
-
- /* Read observation date */
- if (fits_read_key(filePtr, TSTRING, "DATE-OBS", dateObsMJD,
- comment, &status))
- {
- amdlibLogWarning("No DATE-OBS keyword !");
- status = 0;
- }
-
- /* Read names of array and detector */
- if (fits_read_key(filePtr, TSTRING, "ARRNAME", arrName,
- comment, &status))
- {
- amdlibLogWarning("No ARRNAME keyword !");
- status = 0;
- }
- if (fits_read_key(filePtr, TSTRING, "INSNAME", insName,
- comment, &status))
- {
- amdlibLogWarning("No INSNAME keyword !");
- status = 0;
- }
-
- /* Get flag column dimension */
- if (fits_read_key(filePtr, TSTRING, "TFORM10", flagColSize,
- comment, &status))
- {
- amdlibLogWarning("No TFORM10 keyword !");
- status = 0;
- }
-
- /* Get number of rows */
- if (fits_get_num_rows(filePtr, &nbRows, &status))
- {
- amdlibReturnFitsError("nbRows");
- }
-
- /* Get value for nbWlen. Format specifies same repeat count for VIS2DATA
- * & VIS2ERR columns */
- if (fits_get_colnum(filePtr, CASEINSEN, "VIS2DATA", &colnum, &status))
- {
- amdlibReturnFitsError("VIS2DATA");
- }
-
- if (fits_get_coltype(filePtr, colnum, NULL, &nbWlen, NULL, &status))
- {
- amdlibReturnFitsError("VIS2DATA");
- }
-
- nbFrames = nbRows / nbBases;
-
- /* Allocate memory vis */
- if (amdlibAllocateVis2(vis2, nbFrames, nbBases, nbWlen) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for VIS2");
- return amdlibFAILURE;
- }
-
- strcpy(vis2->dateObs, dateObsMJD);
-
- for (iFrame = 1; iFrame <= nbRows; iFrame++)
- {
- /* Read target identity */
- if (fits_get_colnum(filePtr, CASEINSEN, "TARGET_ID", &colnum, &status))
- {
- amdlibReturnFitsError("TARGET_ID");
- }
- if (fits_read_col(filePtr, TINT, colnum, iFrame, 1, 1, &nullint,
- &vis2->table[iFrame-1].targetId, &anynull, &status))
- {
- amdlibReturnFitsError("TARGET_ID");
- }
-
- /* Read time tag for the exposure */
- if (fits_get_colnum(filePtr, CASEINSEN, "TIME", &colnum, &status))
- {
- amdlibReturnFitsError("TIME");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, 1,
- &nulldouble, &vis2->table[iFrame-1].time,
- &anynull, &status))
- {
- amdlibReturnFitsError("TIME");
- }
-
- /* Read observation date */
- if (fits_get_colnum(filePtr, CASEINSEN, "MJD", &colnum, &status))
- {
- amdlibReturnFitsError("MJD");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, 1,
- &nulldouble, &vis2->table[iFrame-1].dateObsMJD,
- &anynull, &status))
- {
- amdlibReturnFitsError("MJD");
- }
-
- /* Read integration time */
- if (fits_get_colnum(filePtr, CASEINSEN, "INT_TIME", &colnum, &status))
- {
- amdlibReturnFitsError("INT_TIME");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, 1,
- &nulldouble, &vis2->table[iFrame-1].expTime,
- &anynull, &status))
- {
- amdlibReturnFitsError("INT_TIME");
- }
-
- /* Read visibility and its associated error */
- if (fits_get_colnum(filePtr, CASEINSEN, "VIS2DATA", &colnum, &status))
- {
- amdlibReturnFitsError("VIS2DATA");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, nbWlen,
- &amdlibBval, vis2->table[iFrame-1].vis2,
- &anynull, &status))
- {
- amdlibReturnFitsError("VIS2DATA");
- }
-
- if (fits_get_colnum(filePtr, CASEINSEN, "VIS2ERR", &colnum, &status))
- {
- amdlibReturnFitsError("VIS2ERR");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, nbWlen,
- &amdlibBval, vis2->table[iFrame-1].vis2Error,
- &anynull, &status))
- {
- amdlibReturnFitsError("VIS2ERR");
- }
-
- /* Read validity flags */
- if (fits_get_colnum(filePtr, CASEINSEN, "FLAG", &colnum, &status))
- {
- amdlibReturnFitsError("FLAG");
- }
- if (strncmp(flagColSize, "0L", 2) != 0 )
- {
- flag = calloc(nbWlen, sizeof(unsigned char));
- if (fits_read_col(filePtr, TLOGICAL, colnum, iFrame, 1, nbWlen,
- &nulllogical, flag,
- &anynull, &status))
- {
- free(flag);
- amdlibReturnFitsError("FLAG");
- }
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- vis2->table[iFrame-1].flag[lVis]=flag[lVis];
- }
- free(flag);
- }
-
- /* Read U and V coordinates of the data */
- if (fits_get_colnum(filePtr, CASEINSEN, "UCOORD", &colnum, &status))
- {
- amdlibReturnFitsError("UCOORD");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, 1,
- &nulldouble, &vis2->table[iFrame-1].uCoord,
- &anynull, &status))
- {
- amdlibReturnFitsError("UCOORD");
- }
-
- if (fits_get_colnum(filePtr, CASEINSEN, "VCOORD", &colnum, &status))
- {
- amdlibReturnFitsError("VCOORD");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, 1,
- &nulldouble, &vis2->table[iFrame-1].vCoord,
- &anynull, &status))
- {
- amdlibReturnFitsError("VCOORD");
- }
-
- /* Read station index */
- if (fits_get_colnum(filePtr, CASEINSEN, "STA_INDEX", &colnum, &status))
- {
- amdlibReturnFitsError("STA_INDEX");
- }
- if (fits_read_col(filePtr, TINT, colnum, iFrame, 1, 2, &nullint,
- vis2->table[iFrame-1].stationIndex,
- &anynull, &status))
- {
- amdlibReturnFitsError("STA_INDEX");
- }
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Read OI_T3 table in OI-FITS file.
- *
- * This function reads the OI_T3 binary table defined in the IAU
- * standard in the OI-FITS file given as parameter.
- *
- * @param filePtr pointer on the file to be read.
- * @param vis3 OI_T3 produced.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibReadOiVis3(fitsfile *filePtr,
- amdlibVIS3 *vis3,
- amdlibERROR_MSG errMsg)
-{
- char comment[amdlibKEYW_CMT_LEN+1];
- char insName[amdlibKEYW_VAL_LEN+1], arrName[amdlibKEYW_VAL_LEN+1];
- char dateObsMJD[amdlibKEYW_VAL_LEN+1];
- int nullint = 0;
- double nulldouble = 0;
- amdlibDOUBLE amdlibBval=amdlibBLANKING_VALUE;
- amdlibBOOLEAN nulllogical = amdlibFALSE;
- const int revision = amdlib_OI_REVISION;
- int dataRevision;
- long nbRows, nbWlen, nbFrames, nbClosures;
- int status = 0;
- char fitsioMsg[256];
- int iFrame, colnum, anynull, j;
- char flagColSize[amdlibKEYW_VAL_LEN+1];
- unsigned char *flag;
- int lVis;
-
- amdlibLogTrace("amdlibReadOiVis3()");
-
- /* Read the OI table */
- if (fits_movnam_hdu(filePtr, BINARY_TBL, "OI_T3", 0, &status))
- {
- amdlibLogWarning("No OI_T3 table, this is 2T data");
- return amdlibSUCCESS;
- }
-
- /* Read revision number of the table definition */
- if (fits_read_key(filePtr, TINT, "OI_REVN", &dataRevision,
- comment, &status))
- {
- amdlibReturnFitsError("OI_REVN");
- }
- if (dataRevision > revision)
- {
- amdlibSetErrMsg("Data too recent to be read with this routine");
- return amdlibFAILURE;
- }
-
- /* Read observation date */
- if (fits_read_key(filePtr, TSTRING, "DATE-OBS", dateObsMJD,
- comment, &status))
- {
- amdlibLogWarning("no DATE-OBS keyword");
- status = 0;
- }
-
- /* Read names of array and detector */
- if (fits_read_key(filePtr, TSTRING, "ARRNAME", arrName,
- comment, &status))
- {
- amdlibLogWarning("no ARRNAME keyword");
- status = 0;
- }
- if (fits_read_key(filePtr, TSTRING, "INSNAME", insName,
- comment, &status))
- {
- amdlibLogWarning("no INSNAME keyword");
- status = 0;
- }
-
- /* Get flag column dimension */
- if (fits_read_key(filePtr, TSTRING, "TFORM14", flagColSize,
- comment, &status))
- {
- amdlibLogWarning("no TFORM10 keyword");
- status = 0;
- }
-
- /* Get number of rows & allocate storage */
- if (fits_get_num_rows(filePtr, &nbRows, &status))
- {
- amdlibReturnFitsError("getting number of rows");
- }
-
- /* Get value for nbWlen. Format specifies same repeat count for T3AMP
- * & T3AMPERR columns */
- if (fits_get_colnum(filePtr, CASEINSEN, "T3AMP", &colnum, &status))
- {
- amdlibReturnFitsError("T3AMP");
- }
- if (fits_get_coltype(filePtr, colnum, NULL, &nbWlen, NULL, &status))
- {
- amdlibReturnFitsError("T3AMP");
- }
-
- nbFrames = nbRows;
- nbClosures = 1;
-
- /* Allocate memory vis */
- if (amdlibAllocateVis3(vis3, nbFrames, nbClosures, nbWlen) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for VIS3");
- return amdlibFAILURE;
- }
-
- strcpy(vis3->dateObs, dateObsMJD);
-
- /* Read rows */
- for (iFrame = 1; iFrame <= nbRows; iFrame++)
- {
- /* Read target identity */
- if (fits_get_colnum(filePtr, CASEINSEN, "TARGET_ID", &colnum, &status))
- {
- amdlibReturnFitsError("TARGET_ID");
- }
- if (fits_read_col(filePtr, TINT, colnum, iFrame, 1, 1,
- &nullint, &vis3->table[iFrame-1].targetId,
- &anynull, &status))
- {
- amdlibReturnFitsError("reading TARGET_ID");
- }
-
- /* Read time tag for the exposure */
- if (fits_get_colnum(filePtr, CASEINSEN, "TIME", &colnum, &status))
- {
- amdlibReturnFitsError("TIME");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, 1,
- &nulldouble, &vis3->table[iFrame-1].time,
- &anynull, &status))
- {
- amdlibReturnFitsError("reading TIME");
- }
-
- /* Read observation date */
- if (fits_get_colnum(filePtr, CASEINSEN, "MJD", &colnum, &status))
- {
- amdlibReturnFitsError("MJD");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, 1,
- &nulldouble, &vis3->table[iFrame-1].dateObsMJD,
- &anynull, &status))
- {
- amdlibReturnFitsError("reading MJD");
- }
-
- /* Read total integration time for this measured visibility */
- if (fits_get_colnum(filePtr, CASEINSEN, "INT_TIME", &colnum, &status))
- {
- amdlibReturnFitsError("INT_TIME");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, 1,
- &nulldouble, &vis3->table[iFrame-1].expTime,
- &anynull, &status))
- {
- amdlibReturnFitsError("reading INT_TIME");
- }
-
- /* Read visibility amplitude and its associated error */
- if (fits_get_colnum(filePtr, CASEINSEN, "T3AMP", &colnum, &status))
- {
- amdlibReturnFitsError("T3AMP");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, nbWlen,
- &amdlibBval, vis3->table[iFrame-1].vis3Amplitude,
- &anynull, &status))
- {
- amdlibReturnFitsError("T3AMP");
- }
-
- if (fits_get_colnum(filePtr, CASEINSEN, "T3AMPERR", &colnum,
- &status))
- {
- amdlibReturnFitsError("T3AMPERR");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1,
- nbWlen, &amdlibBval,
- vis3->table[iFrame-1].vis3AmplitudeError,
- &anynull, &status))
- {
- amdlibReturnFitsError("T3AMPERR");
- }
-
- /* Read visibility phase and its associated error */
- if (fits_get_colnum(filePtr, CASEINSEN, "T3PHI", &colnum, &status))
- {
- amdlibReturnFitsError("T3PHI");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, nbWlen,
- &amdlibBval, vis3->table[iFrame-1].vis3Phi,
- &anynull, &status))
- {
- amdlibReturnFitsError("T3PHI");
- }
-
- if (fits_get_colnum(filePtr, CASEINSEN, "T3PHIERR", &colnum, &status))
- {
- amdlibReturnFitsError("T3PHIERR");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, nbWlen,
- &amdlibBval, vis3->table[iFrame-1].vis3PhiError,
- &anynull, &status))
- {
- amdlibReturnFitsError("T3PHIERR");
- }
-
- /* Rectify read value */
- for (j=0; j < nbWlen; j++)
- {
- vis3->table[iFrame-1].vis3Phi[j] = M_PI / 180.0 *
- vis3->table[iFrame-1].vis3Phi[j];
- vis3->table[iFrame-1].vis3PhiError[j] = M_PI / 180.0 *
- vis3->table[iFrame-1].vis3PhiError[j];
- }
-
- /* Read validity flags */
- if (fits_get_colnum(filePtr, CASEINSEN, "FLAG", &colnum, &status))
- {
- amdlibReturnFitsError("FLAG");
- }
- if (strncmp(flagColSize, "0L", 2) != 0 )
- {
- flag = calloc(nbWlen, sizeof(unsigned char));
- if (fits_read_col(filePtr, TLOGICAL, colnum, iFrame, 1, nbWlen,
- &nulllogical, flag,
- &anynull, &status))
- {
- free(flag);
- amdlibReturnFitsError("FLAG");
- }
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- vis3->table[iFrame-1].flag[lVis]=flag[lVis];
- }
- free(flag);
- }
-
- /* Read U and V coordinates of the data */
- if (fits_get_colnum(filePtr, CASEINSEN, "U1COORD", &colnum, &status))
- {
- amdlibReturnFitsError("U1COORD");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, 1,
- &nulldouble, &vis3->table[iFrame-1].u1Coord,
- &anynull, &status))
- {
- amdlibReturnFitsError("U1COORD");
- }
-
- if (fits_get_colnum(filePtr, CASEINSEN, "V1COORD", &colnum, &status))
- {
- amdlibReturnFitsError("V1COORD");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, 1,
- &nulldouble, &vis3->table[iFrame-1].v1Coord,
- &anynull, &status))
- {
- amdlibReturnFitsError("V1COORD");
- }
-
- if (fits_get_colnum(filePtr, CASEINSEN, "U2COORD", &colnum, &status))
- {
- amdlibReturnFitsError("U2COORD");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, 1,
- &nulldouble, &vis3->table[iFrame-1].u2Coord,
- &anynull, &status))
- {
- amdlibReturnFitsError("U2COORD");
- }
-
- if (fits_get_colnum(filePtr, CASEINSEN, "V2COORD", &colnum, &status))
- {
- amdlibReturnFitsError("V2COORD");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, 1,
- &nulldouble, &vis3->table[iFrame-1].v2Coord,
- &anynull, &status))
- {
- amdlibReturnFitsError("V2COORD");
- }
-
- /* Read station index */
- if (fits_get_colnum(filePtr, CASEINSEN, "STA_INDEX", &colnum, &status))
- {
- amdlibReturnFitsError("STA_INDEX");
- }
- if (fits_read_col(filePtr, TINT, colnum, iFrame, 1, 3,
- &nullint, vis3->table[iFrame-1].stationIndex,
- &anynull, &status))
- {
- amdlibReturnFitsError("STA_INDEX");
- }
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Read AMBER_DATA table in OI-FITS file.
- *
- * This function reads the AMBER_DATA binary table in the OI-FITS file
- * given as parameter.
- *
- * @param filePtr pointer on the file to be created.
- * @param photometry photometry data.
- * @param vis AMBER_DATA produced.
- * @param pst piston data.
- * @param nbBases input parameter giving the number of baselines.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibReadAmberData(fitsfile *filePtr,
- amdlibPHOTOMETRY *photometry,
- amdlibVIS *vis,
- amdlibPISTON *pst,
- int nbBases,
- amdlibERROR_MSG errMsg)
-{
-
- char comment[amdlibKEYW_CMT_LEN+1];
- char keywName[amdlibKEYW_NAME_LEN+1];
- char keywVal[amdlibKEYW_VAL_LEN+1];
- const int revision = amdlib_OI_REVISION;
- int dataRevision;
- int iFrame, colnum, anynull;
- int status = 0;
- char fitsioMsg[256];
- long nbRows; /* Warning: notifies number of rows in bin table !! */
- long nbWlen, nbFrames;
- char insName[amdlibKEYW_VAL_LEN+1], dateObsMJD[amdlibKEYW_VAL_LEN+1];
- int lVis;
-
- int newData = 0;
- int bandInfo = 0;
- double nulldouble = 0;
- amdlibBAND band = amdlibUNKNOWN_BAND;
- amdlibDOUBLE *wlen;
- amdlibDOUBLE *pistonOPD, *sigmaPiston;
- double *frgContrastSnr;
- int nbBands, iBand;
- amdlibDOUBLE amdlibBval=amdlibBLANKING_VALUE;
-
- amdlibLogTrace("amdlibReadAmberData()");
-
- /* Suppose vis structure has already been allocated */
- if (vis->thisPtr != vis)
- {
- amdlibSetErrMsg("Unitialized vis structure");
- return amdlibFAILURE;
- }
-
- /* For compatibility : read the SPECTRUM column in the OI_VIS table
- * if it exists and fill the fluxSumPiPj value with it */
- if (fits_movnam_hdu (filePtr, BINARY_TBL, "OI_VIS", 0, &status))
- {
- amdlibReturnFitsError("OI_VIS");
- }
-
- /* Get value for nbWlen */
- /* Format specifies same repeat count for VIS* columns */
- if (fits_get_colnum(filePtr, CASEINSEN, "SPECTRUM", &colnum, &status))
- {
- newData = 1;
- }
- else
- {
- amdlibLogWarning("Found a SPECTRUM column in this OI_VIS table : "
- "this is OLD data, please consider recomputing your "
- "data with the last data processing version !");
- if (fits_get_coltype(filePtr, colnum, NULL, &nbWlen, NULL, &status))
- {
- amdlibReturnFitsError("nbWlen");
- }
-
- /* Get number of rows */
- if (fits_get_num_rows(filePtr, &nbRows, &status))
- {
- amdlibReturnFitsError("Getting nbRows");
- }
-
- nbFrames = nbRows / nbBases;
-
- /* Allocate photometry data structure */
- if (amdlibAllocatePhotometry(photometry, nbFrames, nbBases,
- nbWlen) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for photometry");
- return amdlibFAILURE;
- }
-
- for (iFrame=1; iFrame <= nbRows; iFrame++)
- {
- /* Read spectrum */
- if (fits_get_colnum(filePtr, CASEINSEN, "SPECTRUM",
- &colnum, &status))
- {
- amdlibReturnFitsError("SPECTRUM");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, nbWlen,
- &amdlibBval,
- photometry->table[iFrame-1].fluxSumPiPj,
- &anynull, &status))
- {
- amdlibReturnFitsError("reading spectrum");
- }
- }
- }
-
- status = 0;
-
- /* Read the AMBER_DATA table */
- if (fits_movnam_hdu(filePtr, BINARY_TBL, "AMBER_DATA", 0, &status))
- {
- amdlibReturnFitsError("AMBER_DATA");
- }
-
- /* Read revision number of the table definition */
- if (fits_read_key(filePtr, TINT, "AMB_REVN", &dataRevision,
- comment, &status))
- {
- amdlibLogWarning("no AMB_REVN keyword ! Setting it to current revision"
- " (could cause strange behaviour !)");
- status = 0;
- dataRevision = revision;
- }
- if (revision > dataRevision)
- {
- amdlibSetErrMsg("Unable to read this AMBER revision of the data");
- }
-
- /* Read observation date */
- if (fits_read_key(filePtr, TSTRING, "DATE-OBS", dateObsMJD,
- comment, &status))
- {
- amdlibLogWarning("no DATE-OBS keyword !");
- status = 0;
- }
-
- /* Read detector name */
- if (fits_read_key(filePtr, TSTRING, "INSNAME", insName,
- comment, &status))
- {
- amdlibLogWarning("no INSNAME keyword !");
- status = 0;
- }
-
- if (newData == 1)
- {
- /* Get number of wavelengths */
- if (fits_get_colnum(filePtr, CASEINSEN, "*FLUX_SUM",
- &colnum, &status))
- {
- /* Try old colunm name */
- status = 0;
- if (fits_get_colnum(filePtr, CASEINSEN, "FLUX_PI_MORE_PJ",
- &colnum, &status))
- {
- amdlibReturnFitsError("FLUX_SUM");
- }
- }
-
- if (fits_get_coltype(filePtr, colnum, NULL, &nbWlen, NULL, &status))
- {
- amdlibReturnFitsError("FLUX_SUM");
- }
- }
-
- /* Get number of rows */
- if (fits_get_num_rows(filePtr, &nbRows, &status))
- {
- amdlibReturnFitsError("Getting nbRows");
- }
-
- nbFrames = nbRows / nbBases;
-
- /* Allocate memory for Piston */
- if (amdlibAllocatePiston(pst, nbFrames, nbBases) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for piston");
- return amdlibFAILURE;
- }
-
- /* Check if data contain explicit information about band */
- /* OCS keywords has been changed to QC keywords ; first check OCS keywords
- * (for backward-compatibility), then try QC keyword */
- char *keywCatg = "OCS";
- if (fits_read_key(filePtr, TINT, "HIERARCH ESO OCS NBBANDS", &nbBands,
- comment, &status))
- {
- status = 0;
- keywCatg = "QC";
- }
- if ((strcmp(keywCatg, "QC") == 0) &&
- (fits_read_key(filePtr, TINT, "HIERARCH ESO QC NBBANDS", &nbBands,
- comment, &status)))
- {
- /* It is an old data, where there is necessary only one spectral band
- * per file */
- status = 0;
- nbBands = 1;
- /* Find current band */
- if (fits_movnam_hdu(filePtr, BINARY_TBL, "OI_WAVELENGTH", 0, &status))
- {
- amdlibReturnFitsError("unable to treat information");
- }
-
- if (fits_get_num_rows(filePtr, &nbWlen, &status))
- {
- amdlibReturnFitsError("number of cols of EFF_WAVE");
- }
- wlen = calloc(nbWlen, sizeof(amdlibDOUBLE));
- if (fits_get_colnum(filePtr, CASEINSEN, "EFF_WAVE", &colnum, &status))
- {
- amdlibReturnFitsError("number of cols of EFF_WAVE");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, 1, 1, nbWlen,
- &nulldouble, wlen, &anynull, &status))
- {
- amdlibReturnFitsError("reading the col EFF_WAVE");
- }
-
- band = amdlibGetBand(wlen[0] / amdlibNM_TO_M);
- free(wlen);
-
- /* Read the AMBER_DATA table */
- if (fits_movnam_hdu(filePtr, BINARY_TBL, "AMBER_DATA", 0, &status))
- {
- amdlibReturnFitsError("AMBER_DATA");
- }
- }
- else
- {
- bandInfo = 1;
-
- /* There is at least one band described in the header */
- for (iBand=1; iBand <= nbBands; iBand++)
- {
- sprintf(keywName, "HIERARCH ESO %s BAND%d NAME", keywCatg, iBand);
- if (fits_read_key(filePtr, TSTRING, keywName, keywVal,
- comment, &status))
- {
- amdlibReturnFitsError("Getting band name");
- }
- else
- {
- if (strstr(keywVal, "J") != NULL)
- {
- pst->bandFlag[amdlibJ_BAND] = amdlibTRUE;
- }
- else if (strstr(keywVal, "H") != NULL)
- {
- pst->bandFlag[amdlibH_BAND] = amdlibTRUE;
- }
- else if (strstr(keywVal, "K") != NULL)
- {
- pst->bandFlag[amdlibK_BAND] = amdlibTRUE;
- }
- else
- {
- amdlibSetErrMsg("Invalid band name '%s'", keywVal);
- return amdlibFAILURE;
- }
- }
- }
- }
-
- if (newData == 1)
- {
- /* Allocate photometry data structure */
- if ( amdlibAllocatePhotometry(photometry, nbFrames,
- nbBases, nbWlen) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for photometry");
- return amdlibFAILURE;
- }
- }
-
- pistonOPD = calloc(nbBands, sizeof(amdlibDOUBLE));
- sigmaPiston = calloc(nbBands, sizeof(amdlibDOUBLE));
- frgContrastSnr = calloc(nbBands, sizeof(double));
- /* Read rows */
- for (iFrame=1; iFrame <= nbRows; iFrame++)
- {
- if (bandInfo == 0)
- {
- pst->bandFlag[band] = amdlibTRUE;
- vis->table[iFrame-1].bandFlag[band] = amdlibTRUE;
- pistonOPD = &pst->pistonOPDArray[band][iFrame-1];
- sigmaPiston = &pst->sigmaPistonArray[band][iFrame-1];
- frgContrastSnr = &vis->table[iFrame-1].frgContrastSnrArray[band];
-
- if (fits_get_colnum(filePtr, CASEINSEN, "PISTON_OPD", &colnum,
- &status) != 0)
- {
- amdlibReturnFitsError("PISTON_OPD");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, 1,
- &amdlibBval, pistonOPD,
- &anynull, &status))
- {
- amdlibReturnFitsError("PISTON_OPD");
- }
- if (fits_get_colnum(filePtr, CASEINSEN, "PISTON_ERR", &colnum,
- &status))
- {
- amdlibReturnFitsError("PISTON_ERR");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, 1,
- &amdlibBval, sigmaPiston,
- &anynull, &status))
- {
- amdlibReturnFitsError("PISTON_ERR");
- }
- /* Convert pistonOPD and sigmaPiston into meters */
- if (!amdlibCompareDouble(*pistonOPD,amdlibBLANKING_VALUE))
- {
- *pistonOPD /= amdlibNM_TO_M;
- *sigmaPiston /= amdlibNM_TO_M;
- }
-
- /* Read frgContrastSnr */
- if (fits_get_colnum(filePtr, CASEINSEN, "FRINGE_CONTRAST_SNR",
- &colnum, &status))
- {
- amdlibReturnFitsError("FRINGE_CONTRAST_SNR");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, 1,
- &amdlibBval, frgContrastSnr,
- &anynull, &status))
- {
- amdlibReturnFitsError("FRINGE_CONTRAST_SNR");
- }
-
- pst->pistonOPD[iFrame-1] = *pistonOPD;
- pst->sigmaPiston[iFrame-1] = *sigmaPiston;
- vis->table[iFrame-1].frgContrastSnr = *frgContrastSnr;
- }
- else
- {
- for (iBand = amdlibJ_BAND; iBand <= amdlibK_BAND; iBand ++)
- {
- vis->table[iFrame-1].bandFlag[iBand] = pst->bandFlag[iBand];
- }
- /* Read piston and its associated error */
- if (fits_get_colnum(filePtr, CASEINSEN, "*OPD", &colnum,
- &status) != 0)
- {
- /* Try old colunm name */
- status = 0;
- if (fits_get_colnum(filePtr, CASEINSEN, "PISTON_OPD",
- &colnum, &status))
- {
- amdlibReturnFitsError("OPD");
- }
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, nbBands,
- &amdlibBval, pistonOPD,
- &anynull, &status))
- {
- amdlibReturnFitsError("OPD");
- }
-
- if (fits_get_colnum(filePtr, CASEINSEN, "*OPD_ERR", &colnum,
- &status))
- {
- /* Try old colunm name */
- status = 0;
- if (fits_get_colnum(filePtr, CASEINSEN, "PISTON_ERR",
- &colnum, &status))
- {
- amdlibReturnFitsError("OPD_ERR");
- }
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, nbBands,
- &amdlibBval, sigmaPiston,
- &anynull, &status))
- {
- amdlibReturnFitsError("OPD_ERR");
- }
- /* Read frgContrastSnr */
- if (fits_get_colnum(filePtr, CASEINSEN, "*FRINGE_SNR",
- &colnum, &status))
- {
- /* Try old colunm name */
- status = 0;
- if (fits_get_colnum(filePtr, CASEINSEN, "FRINGE_CONTRAST_SNR",
- &colnum, &status))
- {
- amdlibReturnFitsError("FRINGE_SNR");
- }
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, nbBands,
- &amdlibBval, frgContrastSnr,
- &anynull, &status))
- {
- amdlibReturnFitsError("FRINGE_SNR");
- }
-
- iBand = 0;
- for (band = amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- if (pst->bandFlag[band] == amdlibTRUE)
- {
- /* Copy pistonOPD, sigmaPiston and fringeContrastSnr
- * & convert pistonOPD and sigmaPiston into meters */
- if (!amdlibCompareDouble(pistonOPD[iBand],amdlibBLANKING_VALUE))
- {
- pst->pistonOPDArray[band][iFrame-1] =
- pistonOPD[iBand] / amdlibNM_TO_M;
- pst->sigmaPistonArray[band][iFrame-1] =
- sigmaPiston[iBand] / amdlibNM_TO_M;
- }
- else
- {
- pst->pistonOPDArray[band][iFrame-1] = pistonOPD[iBand];
- pst->sigmaPistonArray[band][iFrame-1] = sigmaPiston[iBand];
- }
- vis->table[iFrame-1].frgContrastSnrArray[band] =
- frgContrastSnr[iBand];
- iBand++;
-
- pst->pistonOPD[iFrame-1] =
- pst->pistonOPDArray[band][iFrame-1];
- pst->sigmaPiston[iFrame-1] =
- pst->sigmaPistonArray[band][iFrame-1];
- vis->table[iFrame-1].frgContrastSnr =
- vis->table[iFrame-1].frgContrastSnrArray[band];
- }
- }
- }
-
- if (newData == 1)
- {
- /* Read fluxSumPiPj (number of electrons collected in the spectral
- * channel) and associated error */
- if (fits_get_colnum(filePtr, CASEINSEN, "*FLUX_SUM",
- &colnum, &status))
- {
- /* Try old colunm name */
- status = 0;
- if (fits_get_colnum(filePtr, CASEINSEN, "FLUX_PI_MORE_PJ",
- &colnum, &status))
- {
- amdlibReturnFitsError("FLUX_SUM");
- }
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, nbWlen,
- &amdlibBval,
- photometry->table[iFrame-1].fluxSumPiPj,
- &anynull, &status))
- {
- amdlibReturnFitsError("FLUX_SUM");
- }
-
- if (fits_get_colnum(filePtr, CASEINSEN, "*FLUX_SUM_CORRECTION",
- &colnum, &status))
- {
- /* Try old colunm name */
- status = 0;
- if (fits_get_colnum(filePtr, CASEINSEN, "FLUX_PI_MORE_PJ_ERR",
- &colnum, &status))
- {
- amdlibReturnFitsError("FLUX_SUM_CORRECTION");
- }
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, nbWlen,
- &amdlibBval,
- photometry->table[iFrame-1].sigma2FluxSumPiPj,
- &anynull, &status))
- {
- amdlibReturnFitsError("FLUX_SUM_CORRECTION");
- }
-
- /* Read fluxRatPiPj (flux ratio in the spectral channel) and
- * associated error */
- if (fits_get_colnum(filePtr, CASEINSEN, "*FLUX_RATIO",
- &colnum, &status))
- {
- /* Try old colunm name */
- status = 0;
- if (fits_get_colnum(filePtr, CASEINSEN, "FLUX_RATIO_PI_PJ",
- &colnum, &status))
- {
- amdlibReturnFitsError("FLUX_RATIO");
- }
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, nbWlen,
- &amdlibBval,
- photometry->table[iFrame-1].fluxRatPiPj,
- &anynull, &status))
- {
- amdlibReturnFitsError("FLUX_RATIO");
- }
-
- if (fits_get_colnum(filePtr, CASEINSEN,"*FLUX_RATIO_CORRECTION",
- &colnum, &status))
- {
- /* Try old colunm name */
- status = 0;
- if (fits_get_colnum(filePtr, CASEINSEN, "FLUX_RATIO_PI_PJ_ERR",
- &colnum, &status))
- {
- amdlibReturnFitsError("FLUX_RATIO_CORRECTION");
- }
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, nbWlen,
- &amdlibBval,
- photometry->table[iFrame-1].sigma2FluxRatPiPj,
- &anynull, &status))
- {
- amdlibReturnFitsError("FLUX_RATIO_CORRECTION");
- }
-
- /* Correct values of errors */
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- if (!amdlibCompareDouble(photometry->table[iFrame-1].sigma2FluxSumPiPj[lVis],amdlibBLANKING_VALUE))
- {
- photometry->table[iFrame-1].sigma2FluxSumPiPj[lVis] =
- amdlibPow2(photometry->table[iFrame-1].sigma2FluxSumPiPj[lVis]);
-
- photometry->table[iFrame-1].sigma2FluxRatPiPj[lVis] =
- amdlibPow2(photometry->table[iFrame-1].sigma2FluxRatPiPj[lVis]);
- }
- }
-
- /* Read PiMultPj (photometric correction on the mks) */
- if (fits_get_colnum(filePtr, CASEINSEN, "*FLUX_PRODUCT",
- &colnum, &status))
- {
- /* Try old colunm name */
- status = 0;
- if (fits_get_colnum(filePtr, CASEINSEN, "PI_MULTIPLIED_BY_PJ",
- &colnum, &status))
- {
- amdlibReturnFitsError("FLUX_PRODUCT");
- }
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, iFrame, 1, nbWlen,
- &amdlibBval, photometry->table[iFrame-1].PiMultPj,
- &anynull, &status))
- {
- amdlibReturnFitsError("FLUX_PRODUCT");
- }
- }
- }
- free(pistonOPD);
- free(sigmaPiston);
- free(frgContrastSnr);
-
- return amdlibSUCCESS;
-}
-
-/**
- * Read OI_ARRAY table in OI-FITS file
- *
- * This function reads the OI_ARRAY binary table defined in the IAU standard
- * in the OI-FITS file given as parameter.
- *
- * @param filePtr pointer on the file to be read.
- * @param array OI_ARRAY produced.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibReadOiArray(fitsfile *filePtr,
- amdlibOI_ARRAY *array,
- amdlibERROR_MSG errMsg )
-{
- int status = 0;
- char fitsioMsg[256];
- char comment[amdlibKEYW_CMT_LEN+1], name[amdlibKEYW_VAL_LEN+1];
- char *p;
- char nullstring[] = "NULL";
- int nullint = 0;
- double nulldouble = 0.0;
- const int revision = amdlib_OI_REVISION;
- int dataRevision;
- int irow, colnum, anynull;
- long repeat;
-
- amdlibLogTrace("amdlibReadOiArray()");
-
- /* Read the OI_ARRAY table */
- if (fits_movnam_hdu(filePtr, BINARY_TBL, "OI_ARRAY", 0, &status))
- {
- amdlibLogWarning("No OI_ARRAY table, please consider recomputing "
- "your data !");
- return amdlibSUCCESS;
- }
-
- /* Read array name */
- if (fits_read_key(filePtr, TSTRING, "ARRNAME", name, comment, &status))
- {
- amdlibReturnFitsError("ARRNAME");
- }
-
- /* Read revision number of the table definition */
- if (fits_read_key(filePtr, TINT, "OI_REVN", &dataRevision, comment,
- &status))
- {
- amdlibReturnFitsError("OI_REVN");
- }
- if (dataRevision > revision)
- {
- amdlibSetErrMsg("Unable to read this revision of the OI_ARRAY data");
- return amdlibFAILURE;
- }
-
- /* Get number of rows */
- if (fits_get_num_rows(filePtr, &repeat, &status))
- {
- amdlibReturnFitsError("repeat");
- }
-
- /* Allocate structure array */
- if (amdlibAllocateOiArray(array, repeat, errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- array->nbStations = repeat;
- strcpy(array->arrayName, name);
-
- /* Read coordinate frame */
- if (fits_read_key(filePtr, TSTRING, "FRAME", array->coordinateFrame,
- comment, &status))
- {
- amdlibReturnFitsError("FRAME");
- }
-
- /* Read array center x, y and z coordinates */
- if (fits_read_key(filePtr, TDOUBLE, "ARRAYX",
- &array->arrayCenterCoordinates[0], comment, &status))
- {
- amdlibReturnFitsError("ARRAYX");
- }
- if (fits_read_key(filePtr, TDOUBLE, "ARRAYY",
- &array->arrayCenterCoordinates[1], comment, &status))
- {
- amdlibReturnFitsError("ARRAYY");
- }
- if (fits_read_key(filePtr, TDOUBLE, "ARRAYZ",
- &array->arrayCenterCoordinates[2], comment, &status))
- {
- amdlibReturnFitsError("ARRAYZ");
- }
-
- /* Read rows */
- for (irow=1; irow <= array->nbStations; irow++)
- {
- /* Read telescope name */
- if (fits_get_colnum(filePtr, CASEINSEN, "TEL_NAME", &colnum, &status))
- {
- amdlibReturnFitsError("TEL_NAME");
- }
- p = array->element[irow-1].telescopeName;
- if (fits_read_col(filePtr, TSTRING, colnum, irow, 1, 1,
- nullstring, &p, &anynull, &status))
- {
- amdlibReturnFitsError("TEL_NAME");
- }
-
- /* Read station name */
- if (fits_get_colnum(filePtr, CASEINSEN, "STA_NAME", &colnum, &status))
- {
- amdlibReturnFitsError("STA_NAME");
- }
- p = array->element[irow-1].stationName;
- if (fits_read_col(filePtr, TSTRING, colnum, irow, 1, 1,
- nullstring, &p, &anynull, &status))
- {
- amdlibReturnFitsError("STA_NAME");
- }
-
- /* Read station index */
- if (fits_get_colnum(filePtr, CASEINSEN, "STA_INDEX", &colnum, &status))
- {
- amdlibReturnFitsError("STA_INDEX");
- }
- if (fits_read_col(filePtr, TINT, colnum, irow, 1, 1, &nullint,
- &array->element[irow-1].stationIndex,
- &anynull, &status))
- {
- amdlibReturnFitsError("STA_INDEX");
- }
-
- /* Read diameter (metres) */
- if (fits_get_colnum(filePtr, CASEINSEN, "DIAMETER", &colnum, &status))
- {
- amdlibReturnFitsError("DIAMETER");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, irow, 1, 1,
- &nulldouble, &array->element[irow-1].elementDiameter,
- &anynull, &status))
- {
- amdlibReturnFitsError("DIAMETER");
- }
-
- /* Read station coordinates */
- if (fits_get_colnum(filePtr, CASEINSEN, "STAXYZ", &colnum,
- &status))
- {
- amdlibReturnFitsError("STAXYZ");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, irow, 1, 3,
- &nulldouble,
- &array->element[irow-1].stationCoordinates,
- &anynull, &status))
- {
- amdlibReturnFitsError("STAXYZ");
- }
-
- }
-
- return amdlibSUCCESS;
-
-}
-
-/**
- * Read OI_TARGET table in OI-FITS file.
- *
- * This function reads the OI_TARGET binary table defined in the IAU standard
- * in the OI-FITS file given as parameter.
- *
- * @param filePtr pointer on the file to be read.
- * @param target OI_TARGET produced.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibReadOiTarget(fitsfile *filePtr,
- amdlibOI_TARGET *target,
- amdlibERROR_MSG errMsg )
-{
- char fitsioMsg[256];
- char comment[amdlibKEYW_CMT_LEN+1];
- int status = 0;
- char *p;
- char nullstring[] = "NULL";
- int nullint = 0;
- double nulldouble = 0.0;
- const int revision = amdlib_OI_REVISION;
- int dataRevision;
- int irow, colnum, anynull;
- long repeat;
-
- amdlibLogTrace("amdlibReadOiTarget()");
-
- /* Read the OI_TARGET table */
- if (fits_movnam_hdu(filePtr, BINARY_TBL, "OI_TARGET", 0, &status))
- {
- amdlibLogWarning("No OI_TARGET table, please consider recomputing "
- "your data !");
- return amdlibSUCCESS;
- }
-
- /* Read revision number of the table definition */
- if (fits_read_key(filePtr, TINT, "OI_REVN", &dataRevision,
- comment, &status))
- {
- amdlibReturnFitsError("OI_REVN");
- }
- if (dataRevision > revision)
- {
- amdlibSetErrMsg("Unable to read this revision of the OI_TARGET data");
- return amdlibFAILURE;
- }
-
- /* Get number of rows */
- if (fits_get_num_rows(filePtr, &repeat, &status))
- {
- amdlibReturnFitsError("repeat");
- }
-
- /* Allocate structure */
- if (amdlibAllocateOiTarget(target, repeat) != amdlibSUCCESS)
- {
- amdlibReturnFitsError("Could not allocate memory for TARGET");
- }
-
- target->nbTargets = repeat;
-
- /* Now read rows */
- for (irow=1; irow <= target->nbTargets; irow++)
- {
- /* Read target identity */
- if (fits_get_colnum(filePtr, CASEINSEN, "TARGET_ID", &colnum, &status))
- {
- amdlibReturnFitsError("TARGET_ID");
- }
- if (fits_read_col(filePtr, TINT, colnum, irow, 1, 1, &nullint,
- &target->element[irow-1].targetId, &anynull, &status))
- {
- amdlibReturnFitsError("TARGET_ID");
- }
-
- /* Read target name */
- if (fits_get_colnum(filePtr, CASEINSEN, "TARGET", &colnum, &status))
- {
- amdlibReturnFitsError("TARGET");
- }
- p = target->element[irow-1].targetName;
- if (fits_read_col(filePtr, TSTRING, colnum, irow, 1, 1,
- nullstring, &p, &anynull, &status))
- {
- amdlibReturnFitsError("TARGET Name");
- }
-
- /* Read right ascension at mean equinox */
- if (fits_get_colnum(filePtr, CASEINSEN, "RAEP0", &colnum, &status))
- {
- amdlibReturnFitsError("RAEP0");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, irow, 1, 1,
- &nulldouble, &target->element[irow-1].raEp0,
- &anynull, &status))
- {
- amdlibReturnFitsError("RAEP0");
- }
-
- /* Read declination at mean equinox */
- if (fits_get_colnum(filePtr, CASEINSEN, "DECEP0", &colnum, &status))
- {
- amdlibReturnFitsError("DECEP0");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, irow, 1, 1,
- &nulldouble, &target->element[irow-1].decEp0,
- &anynull, &status))
- {
- amdlibReturnFitsError("DECEP0");
- }
-
- /* Read equinox of RAEP0 and DECEP0 */
- if (fits_get_colnum(filePtr, CASEINSEN, "EQUINOX", &colnum, &status))
- {
- amdlibReturnFitsError("EQUINOX");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, irow, 1, 1,
- &nulldouble, &target->element[irow-1].equinox,
- &anynull, &status))
- {
- amdlibReturnFitsError("EQUINOX");
- }
-
- /* Read errors associated to RAEP0 and DECEP0 */
- if (fits_get_colnum(filePtr, CASEINSEN, "RA_ERR", &colnum, &status))
- {
- amdlibReturnFitsError("RA_ERR");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, irow, 1, 1,
- &nulldouble, &target->element[irow-1].raErr,
- &anynull, &status))
- {
- amdlibReturnFitsError("RA_ERR");
- }
- if (fits_get_colnum(filePtr, CASEINSEN, "DEC_ERR", &colnum, &status))
- {
- amdlibReturnFitsError("DEC_ERR");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, irow, 1, 1,
- &nulldouble, &target->element[irow-1].decErr,
- &anynull, &status))
- {
- amdlibReturnFitsError("DEC_ERR");
- }
-
- /* Read systemic radial velocity */
- if (fits_get_colnum(filePtr, CASEINSEN, "SYSVEL", &colnum, &status))
- {
- amdlibReturnFitsError("SYSVEL");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, irow, 1, 1,
- &nulldouble, &target->element[irow-1].sysVel,
- &anynull, &status))
- {
- amdlibReturnFitsError("SYSVEL");
- }
-
- /* Read velocity type */
- if (fits_get_colnum(filePtr, CASEINSEN, "VELTYP", &colnum, &status))
- {
- amdlibReturnFitsError("VELTYP");
- }
- p = target->element[irow-1].velTyp;
- if (fits_read_col(filePtr, TSTRING, colnum, irow, 1, 1,
- nullstring, &p, &anynull, &status))
- {
- amdlibReturnFitsError("VELTYP");
- }
-
- /* Read definition of radial velocity */
- if (fits_get_colnum(filePtr, CASEINSEN, "VELDEF", &colnum, &status))
- {
- amdlibReturnFitsError("VELDEF");
- }
- p = target->element[irow-1].velDef;
- if (fits_read_col(filePtr, TSTRING, colnum, irow, 1, 1,
- nullstring, &p, &anynull, &status))
- {
- amdlibReturnFitsError("VELDEF");
- }
-
- /* Read proper motion in RA */
- if (fits_get_colnum(filePtr, CASEINSEN, "PMRA", &colnum, &status))
- {
- amdlibReturnFitsError("PMRA");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, irow, 1, 1,
- &nulldouble, &target->element[irow-1].pmRa,
- &anynull, &status))
- {
- amdlibReturnFitsError("PMRA");
- }
-
- /* Read proper motion in declination */
- if (fits_get_colnum(filePtr, CASEINSEN, "PMDEC", &colnum, &status))
- {
- amdlibReturnFitsError("PMDEC");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, irow, 1, 1,
- &nulldouble, &target->element[irow-1].pmDec,
- &anynull, &status))
- {
- amdlibReturnFitsError("PMDEC");
- }
-
- /* Read errors on PMRA and PMDEC */
- if (fits_get_colnum(filePtr, CASEINSEN, "PMRA_ERR", &colnum, &status))
- {
- amdlibReturnFitsError("PMRA_ERR");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, irow, 1, 1,
- &nulldouble, &target->element[irow-1].pmRaErr,
- &anynull, &status))
- {
- amdlibReturnFitsError("PMRA_ERR");
- }
- if (fits_get_colnum(filePtr, CASEINSEN, "PMDEC_ERR", &colnum, &status))
- {
- amdlibReturnFitsError("PMDEC_ERR");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, irow, 1, 1,
- &nulldouble, &target->element[irow-1].pmDecErr,
- &anynull, &status))
- {
- amdlibReturnFitsError("PMDEC_ERR");
- }
-
- /* Read parallax value and associated error */
- if (fits_get_colnum(filePtr, CASEINSEN, "PARALLAX", &colnum, &status))
- {
- amdlibReturnFitsError("PARALLAX");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, irow, 1, 1,
- &nulldouble, &target->element[irow-1].parallax,
- &anynull, &status))
- {
- amdlibReturnFitsError("PARALLAX");
- }
- if (fits_get_colnum(filePtr, CASEINSEN, "PARA_ERR", &colnum, &status))
- {
- amdlibReturnFitsError("PARA_ERR");
- }
- if (fits_read_col(filePtr, TDOUBLE, colnum, irow, 1, 1,
- &nulldouble, &target->element[irow-1].paraErr,
- &anynull, &status))
- {
- amdlibReturnFitsError("PARA_ERR");
- }
-
- /* Read spectral type */
- if (fits_get_colnum(filePtr, CASEINSEN, "SPECTYP", &colnum, &status))
- {
- amdlibReturnFitsError("SPECTYP");
- }
- p = target->element[irow-1].specTyp;
- if (fits_read_col(filePtr, TSTRING, colnum, irow, 1, 1,
- nullstring, &p, &anynull, &status))
- {
- amdlibReturnFitsError("specTyp");
- }
- }
- return amdlibSUCCESS;
-}
-
diff --git a/amber/amdlibOiStructures.c b/amber/amdlibOiStructures.c
deleted file mode 100644
index 2c57b29..0000000
--- a/amber/amdlibOiStructures.c
+++ /dev/null
@@ -1,4216 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Function to allocate/free OI structures
- */
-
-#define _POSIX_SOURCE 1
-
-/*
- * System Headers
- */
-#include <string.h>
-#include <math.h>
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/*
- * Local function declarations
- */
-static void amdlibFreePhotometry(amdlibPHOTOMETRY *photometry);
-static void amdlibFreeVis(amdlibVIS *vis);
-static void amdlibFreeVis2(amdlibVIS2 *vis2);
-static void amdlibFreeVis3(amdlibVIS3 *vis3);
-static void amdlibFreeWavelength(amdlibWAVELENGTH *wave);
-static void amdlibFreeOiTarget(amdlibOI_TARGET *target);
-static amdlibCOMPL_STAT amdlibReallocatePhotometry(amdlibPHOTOMETRY *photometry,
- const int nbFrames,
- const int nbBases,
- const int nbWlen);
-static amdlibCOMPL_STAT amdlibReallocateVis(amdlibVIS *vis,
- const int nbFrames,
- const int nbBases,
- const int nbWlen);
-static amdlibCOMPL_STAT amdlibReallocateVis2(amdlibVIS2 *vis2,
- const int nbFrames,
- const int nbBases,
- const int nbWlen);
-static amdlibCOMPL_STAT amdlibReallocateVis3(amdlibVIS3 *vis3,
- const int nbFrames,
- const int nbClosures,
- const int nbWlen);
-
-
-
-/*
- * Public functions
- */
-/**
- * Release memory allocated to store photometry, and reset the structure members
- * to zero.
- *
- * @param photometry pointer to amdlibPHOTOMETRY structure.
- */
-void amdlibReleasePhotometry(amdlibPHOTOMETRY *photometry)
-{
- amdlibLogTrace("amdlibReleasePhotometry()");
-
- amdlibFreePhotometry(photometry);
- memset (photometry, '\0', sizeof(amdlibPHOTOMETRY));
-}
-
-/**
- * Release memory allocated to store visibilities, and reset the structure
- * members to zero.
- *
- * @param vis pointer to amdlibVIS structure.
- */
-void amdlibReleaseVis(amdlibVIS *vis)
-{
- amdlibLogTrace("amdlibReleaseVis()");
-
- amdlibFreeVis(vis);
- memset (vis, '\0', sizeof(amdlibVIS));
-}
-
-/**
- * Release memory allocated to store squared visibilities, and reset the
- * structure members to zero.
- *
- * @param vis2 pointer to amdlibVIS2 structure.
- */
-void amdlibReleaseVis2(amdlibVIS2 *vis2)
-{
- amdlibLogTrace("amdlibReleaseVis2()");
-
- amdlibFreeVis2(vis2);
- memset (vis2, '\0', sizeof(amdlibVIS2));
-}
-
-/**
- * Release memory allocated to store phase closures, and reset the structure
- * members to zero.
- *
- * @param vis3 pointer to amdlibVIS3 structure.
- */
-void amdlibReleaseVis3(amdlibVIS3 *vis3)
-{
- amdlibLogTrace("amdlibReleaseVis3()");
-
- amdlibFreeVis3(vis3);
- memset (vis3, '\0', sizeof(amdlibVIS3));
-}
-
-
-/**
- * Release memory allocated to store wavelenghts, and reset the structure
- * members to zero.
- *
- * @param wave pointer to amdlibWAVELENGTH structure.
- */
-void amdlibReleaseWavelength(amdlibWAVELENGTH *wave)
-{
- amdlibLogTrace("amdlibReleaseWavelength()");
- amdlibFreeWavelength(wave);
- memset (wave, '\0', sizeof(amdlibWAVELENGTH));
-}
-
-/**
- * Release memory allocated to store observed targets, and reset the structure
- * members to zero.
- *
- * @param target pointer to amdlibOI_TARGET structure.
- */
-void amdlibReleaseOiTarget(amdlibOI_TARGET *target)
-{
- amdlibLogTrace("amdlibReleaseOiTarget()");
-
- amdlibFreeOiTarget(target);
- memset (target, '\0', sizeof(amdlibOI_TARGET));
-}
-
-/*
- * Protected functions
- */
-/**
- * Allocate memory for storing photometry.
- *
- * @param photometry pointer to amdlibPHOTOMETRY structure.
- * @param nbFrames number of frames
- * @param nbBases number of baselines
- * @param nbWlen number of spectral channels
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAllocatePhotometry(amdlibPHOTOMETRY *photometry,
- const int nbFrames,
- const int nbBases,
- const int nbWlen)
-{
- int dimArray;
- int i; /* loop */
- void *pointer;
- int nbSamples;
-
- amdlibLogTrace("amdlibAllocatePhotometry()");
-
- /* First free previous allocated memory */
- if (photometry->thisPtr == photometry)
- {
- amdlibFreePhotometry(photometry);
- }
-
- /* Init & Update thisPtr */
- photometry->thisPtr = memset(photometry, '\0', sizeof(*photometry));
- /* Set array size */
- photometry->nbFrames = nbFrames;
- photometry->nbBases = nbBases;
- photometry->nbWlen = nbWlen;
-
- /* Allocate table pointer list */
- nbSamples = nbFrames * nbBases;
- if (nbSamples<1)
- {
- amdlibLogError("Null-size photometry allocation in amdlibAllocatePhotometry()");
- return amdlibFAILURE;
- }
- photometry->table = calloc(nbSamples, sizeof(*(photometry->table)));
- if (photometry->table == NULL)
- {
- amdlibFreePhotometry(photometry);
- return amdlibFAILURE;
- }
-
- /* Allocate 'PiMultPj' in each table entry (double) as a whole */
- dimArray = sizeof(double) * nbWlen;
- photometry->table[0].PiMultPj = (double *)calloc(nbSamples, dimArray);
- if (photometry->table[0].PiMultPj == NULL)
- {
- amdlibFreePhotometry(photometry);
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = photometry->table[0].PiMultPj;
- i < nbSamples;
- i++, pointer += dimArray)
- {
- photometry->table[i].PiMultPj = pointer;
- }
-
- /* Allocate 'fluxRatPiPj' in each table entry (double) as a whole */
- dimArray = sizeof(double) * nbWlen;
- photometry->table[0].fluxRatPiPj = (double *)calloc(nbSamples, dimArray);
- if (photometry->table[0].fluxRatPiPj == NULL)
- {
- amdlibFreePhotometry(photometry);
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = photometry->table[0].fluxRatPiPj;
- i < nbSamples;
- i++, pointer += dimArray)
- {
- photometry->table[i].fluxRatPiPj = pointer;
- }
-
- /* Allocate 'sigma2FluxRatPiPj' in each table entry (double) as a whole */
- dimArray = sizeof(double) * nbWlen;
- photometry->table[0].sigma2FluxRatPiPj = (double *)calloc(nbSamples,
- dimArray);
- if (photometry->table[0].sigma2FluxRatPiPj == NULL)
- {
- amdlibFreePhotometry(photometry);
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = photometry->table[0].sigma2FluxRatPiPj;
- i < nbSamples;
- i++, pointer += dimArray)
- {
- photometry->table[i].sigma2FluxRatPiPj = pointer;
- }
-
- /* Allocate 'fluxSumPiPj' in each table entry (double) as a whole */
- dimArray = sizeof(double) * nbWlen;
- photometry->table[0].fluxSumPiPj = (double *)calloc(nbSamples, dimArray);
- if (photometry->table[0].fluxSumPiPj == NULL)
- {
- amdlibFreePhotometry(photometry);
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = photometry->table[0].fluxSumPiPj;
- i < nbSamples;
- i++, pointer += dimArray)
- {
- photometry->table[i].fluxSumPiPj = pointer;
- }
-
- /* Allocate 'sigma2FluxSumPiPj' in each table entry (double) as a whole */
- dimArray = sizeof(double) * nbWlen;
- photometry->table[0].sigma2FluxSumPiPj = (double *)calloc(nbSamples,
- dimArray);
- if (photometry->table[0].sigma2FluxSumPiPj == NULL)
- {
- amdlibFreePhotometry(photometry);
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = photometry->table[0].sigma2FluxSumPiPj;
- i<nbSamples;
- i++, pointer += dimArray)
- {
- photometry->table[i].sigma2FluxSumPiPj = pointer;
- }
-
- /* Return */
- return amdlibSUCCESS;
-}
-
-/**
- * Append amdlibPHOTOMETRY data structure.
- *
- * @param srcPhotometry pointer to source data structure
- * @param dstPhotometry pointer to destination data structure (append to)
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAppendPhotometry(amdlibPHOTOMETRY *dstPhotometry,
- amdlibPHOTOMETRY *srcPhotometry,
- amdlibERROR_MSG errMsg)
-{
- int sentry;
- int dentry;
- int oldNbFrames = dstPhotometry->nbFrames ;
- int newNbFrames = oldNbFrames + srcPhotometry->nbFrames;
- size_t arraySize = srcPhotometry->nbWlen * sizeof(double);
-
- amdlibLogTrace("amdlibAppendPhotometry()");
- /* Perform simple checks */
- if (dstPhotometry->nbBases != srcPhotometry->nbBases)
- {
- amdlibSetErrMsg("Different number of bases");
- return amdlibFAILURE;
- }
- if (dstPhotometry->nbWlen != srcPhotometry->nbWlen)
- {
- amdlibSetErrMsg("Different numbers of "
- "wavelengths (%d and %d) ", srcPhotometry->nbWlen,
- dstPhotometry->nbWlen);
- return amdlibFAILURE;
- }
-
- /* Reallocate memory to store additional data */
- if (amdlibReallocatePhotometry(dstPhotometry, newNbFrames,
- srcPhotometry->nbBases,
- srcPhotometry->nbWlen) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not reallocate memory for photometry");
- return amdlibFAILURE;
- }
-
-
- /* Append fields allocated dynamically */
- dentry = oldNbFrames * dstPhotometry->nbBases;
- for (sentry = 0;
- sentry < srcPhotometry->nbFrames * srcPhotometry->nbBases;
- sentry++)
- {
- memcpy(dstPhotometry->table[dentry].fluxSumPiPj,
- srcPhotometry->table[sentry].fluxSumPiPj, arraySize);
- memcpy(dstPhotometry->table[dentry].sigma2FluxSumPiPj,
- srcPhotometry->table[sentry].sigma2FluxSumPiPj, arraySize);
-
- memcpy(dstPhotometry->table[dentry].fluxRatPiPj,
- srcPhotometry->table[sentry].fluxRatPiPj, arraySize);
- memcpy(dstPhotometry->table[dentry].sigma2FluxRatPiPj,
- srcPhotometry->table[sentry].sigma2FluxRatPiPj, arraySize);
-
- memcpy(dstPhotometry->table[dentry].PiMultPj,
- srcPhotometry->table[sentry].PiMultPj, arraySize);
-
- dentry++;
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Insert an amdlibPHOTOMETRY data structure in another (larger) one.
- *
- * @param srcPhotometry pointer to source data structure
- * @param dstPhotometry pointer to destination data structure (insert in)
- * @param index index in structure where to insert
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibInsertPhotometry(amdlibPHOTOMETRY *dstPhotometry,
- amdlibPHOTOMETRY *srcPhotometry,
- int insertIndex,
- amdlibERROR_MSG errMsg)
-{
- int sentry;
- int dentry;
- int dstNbFrames = dstPhotometry->nbFrames ;
- int finalIndex = insertIndex + srcPhotometry->nbFrames;
- size_t arraySize = srcPhotometry->nbWlen * sizeof(double);
-
- amdlibLogTrace("amdlibInsertPhotometry()");
- /* Perform simple checks */
- if (insertIndex<0 || insertIndex>=dstPhotometry->nbFrames)
- {
- amdlibSetErrMsg("Invalid insertion index %d for amdlibInsertPhotometry",insertIndex);
- return amdlibFAILURE;
- }
- if (dstPhotometry->nbBases != srcPhotometry->nbBases)
- {
- amdlibSetErrMsg("Different number of bases");
- return amdlibFAILURE;
- }
- if (dstPhotometry->nbWlen != srcPhotometry->nbWlen)
- {
- amdlibSetErrMsg("Different numbers of "
- "wavelengths (%d and %d) ", srcPhotometry->nbWlen,
- dstPhotometry->nbWlen);
- return amdlibFAILURE;
- }
- if (dstNbFrames < finalIndex)
- {
- amdlibSetErrMsg("Number of frames (%d) in destination structure"
- "too small to enable insertion of %d frames at position %d",
- dstNbFrames,srcPhotometry->nbFrames,insertIndex);
- return amdlibFAILURE;
- }
-
- /* Insert src in dst at frame insertIndex */
- dentry = insertIndex * dstPhotometry->nbBases;
- for (sentry = 0;
- sentry < srcPhotometry->nbFrames * srcPhotometry->nbBases;
- sentry++)
- {
- memcpy(dstPhotometry->table[dentry].fluxSumPiPj,
- srcPhotometry->table[sentry].fluxSumPiPj, arraySize);
- memcpy(dstPhotometry->table[dentry].sigma2FluxSumPiPj,
- srcPhotometry->table[sentry].sigma2FluxSumPiPj, arraySize);
-
- memcpy(dstPhotometry->table[dentry].fluxRatPiPj,
- srcPhotometry->table[sentry].fluxRatPiPj, arraySize);
- memcpy(dstPhotometry->table[dentry].sigma2FluxRatPiPj,
- srcPhotometry->table[sentry].sigma2FluxRatPiPj, arraySize);
-
- memcpy(dstPhotometry->table[dentry].PiMultPj,
- srcPhotometry->table[sentry].PiMultPj, arraySize);
-
- dentry++;
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Merge photometries.
- *
- * This function merges photometries and stores the result in the first one.
- *
- * @param phot1 pointer to first photometry structure.
- * @param phot2 pointer to second photometry structure (to merge).
- * @param isInverted boolean indicating in which order the structures have to
- * be merged.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibMergePhotometry(amdlibPHOTOMETRY *phot1,
- amdlibPHOTOMETRY *phot2,
- amdlibBOOLEAN isInverted,
- amdlibERROR_MSG errMsg)
-{
- amdlibPHOTOMETRY mergedPhot = {NULL};
- amdlibPHOTOMETRY *p1, *p2;
-
- amdlibLogTrace("amdlibMergePhotometry()");
-
- /* Check phot1 and phot2 have same number of baselines */
- if (phot1->nbBases != phot2->nbBases)
- {
- amdlibSetErrMsg("Different number of baselines (%d and %d)",
- phot1->nbBases, phot2->nbBases);
- return amdlibFAILURE;
- }
-
- if (isInverted == amdlibTRUE)
- {
- p1 = phot2;
- p2 = phot1;
- }
- else
- {
- p1 = phot1;
- p2 = phot2;
- }
-
- /* Allocate memory for dstPhot */
- if (amdlibAllocatePhotometry(&mergedPhot, p1->nbFrames, p1->nbBases,
- p1->nbWlen + p2->nbWlen) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for photometry ");
- return amdlibFAILURE;
- }
-
- if (amdlibCopyPhotFrom(&mergedPhot, p1, 0, p1->nbWlen,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- if (amdlibCopyPhotFrom(&mergedPhot, p2, p1->nbWlen, p2->nbWlen,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- free(phot1->table[0].fluxSumPiPj);
- free(phot1->table[0].sigma2FluxSumPiPj);
- free(phot1->table[0].fluxRatPiPj);
- free(phot1->table[0].sigma2FluxRatPiPj);
- free(phot1->table[0].PiMultPj);
- free(phot1->table);
- phot1->nbWlen = mergedPhot.nbWlen;
- phot1->nbFrames = mergedPhot.nbFrames;
- phot1->table = mergedPhot.table;
-
- return amdlibSUCCESS;
-}
-
-/**
- * Duplicate photometry if index = 0 or add information relative to wavelengths
- * in first structure else.
- *
- * @param dstPhot pointer to first photometry structure.
- * @param srcPhot pointer to second photometry structure (to be copied).
- * @param index index on the location to place information.
- * @param nbOfElem number of elements to store.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibCopyPhotFrom(amdlibPHOTOMETRY *dstPhot,
- amdlibPHOTOMETRY *srcPhot,
- int index,
- int nbOfElem,
- amdlibERROR_MSG errMsg)
-{
- int i, j;
- amdlibLogTrace("amdlibCopyPhotFrom()");
-
- if ((dstPhot->thisPtr == NULL) && (index != 0))
- {
- amdlibSetErrMsg("Could not copy non-initialized data from index %d",
- index);
- return amdlibFAILURE;
- }
-
- if (srcPhot->thisPtr == NULL)
- {
- /* Nothing to do */
- return amdlibSUCCESS;
- }
-
- if (index == 0)
- {
- for (i=0; i < srcPhot->nbFrames * srcPhot->nbBases; i++)
- {
- for (j=0; j < srcPhot->nbWlen; j++)
- {
- dstPhot->table[i].fluxSumPiPj[j] =
- srcPhot->table[i].fluxSumPiPj[j];
- dstPhot->table[i].sigma2FluxSumPiPj[j] =
- srcPhot->table[i].sigma2FluxSumPiPj[j];
- dstPhot->table[i].fluxRatPiPj[j] =
- srcPhot->table[i].fluxRatPiPj[j];
- dstPhot->table[i].sigma2FluxRatPiPj[j] =
- srcPhot->table[i].sigma2FluxRatPiPj[j];
- dstPhot->table[i].PiMultPj[j] =
- srcPhot->table[i].PiMultPj[j];
- }
- }
- }
- else
- {
- if (dstPhot->nbFrames != srcPhot->nbFrames)
- {
- amdlibSetErrMsg("Different number of frames! (%d and %d)",
- dstPhot->nbFrames, srcPhot->nbFrames);
- return amdlibFAILURE;
- }
- if (dstPhot->nbBases != srcPhot->nbBases)
- {
- amdlibSetErrMsg("Different of bases (%d and %d)",
- dstPhot->nbBases, srcPhot->nbBases);
- return amdlibFAILURE;
- }
- for (i=0; i < srcPhot->nbFrames * srcPhot->nbBases; i++)
- {
- for (j = 0; j < nbOfElem; j++)
- {
- dstPhot->table[i].fluxSumPiPj[index+j] =
- srcPhot->table[i].fluxSumPiPj[j];
-
- dstPhot->table[i].sigma2FluxSumPiPj[index+j] =
- srcPhot->table[i].sigma2FluxSumPiPj[j];
-
- dstPhot->table[i].fluxRatPiPj[index+j] =
- srcPhot->table[i].fluxRatPiPj[j];
-
- dstPhot->table[i].sigma2FluxRatPiPj[index+j] =
- srcPhot->table[i].sigma2FluxRatPiPj[j];
-
- dstPhot->table[i].PiMultPj[index+j] =
- srcPhot->table[i].PiMultPj[j];
- }
- }
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Display photometry structure.
- *
- * @param photometry pointer to amdlibPHOTOMETRY structure.
- */
-void amdlibDisplayPhotometry(amdlibPHOTOMETRY *photometry)
-{
- int nbFrames, nbBases, nbWlen;
- int iFrame, iBase, iCell, iWave;
- amdlibPHOTOMETRY_TABLE_ENTRY cell;
- double fluxSumPiPj;
- double sigma2FluxSumPiPj;
- double fluxRatPiPj;
- double sigma2FluxRatPiPj;
- double PiMultPj;
-
- amdlibLogTrace("amdlibDisplayPhotometry()");
-
- /* Display number of frames */
- nbFrames = photometry->nbFrames;
- printf("nbFrames = %d\n", nbFrames);
-
- /* Display number of base */
- nbBases = photometry->nbBases;
- printf("nbBases = %d\n", nbBases);
-
- /* Display number of wavelength */
- nbWlen = photometry->nbWlen;
- printf("nbWlen = %d\n", nbWlen);
-
- /* Display different arrays[nbFrames][nbBases][nbWlen] */
- for (iFrame = 0; iFrame < nbFrames; iFrame++)
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- /* Set cell[iFrame][iBase] */
- iCell = iFrame * nbBases + iBase;
- cell = photometry->table[iCell];
- printf("---> cell frame/base[%d][%d]\n", iFrame, iBase);
-
- /* Display arrays[nbWlen] */
- for (iWave = 0; iWave < nbWlen; iWave++)
- {
- /* fluxSumPiPj */
- fluxSumPiPj = cell.fluxSumPiPj[iWave];
- printf("fluxSumPiPj[%d][%d][%d] = %f - ", iFrame, iBase, iWave,
- fluxSumPiPj);
- /* sigma2FluxSumPiPj */
- sigma2FluxSumPiPj = cell.sigma2FluxSumPiPj[iWave];
- printf("sigma2FluxSumPiPj[%d][%d][%d] = %f\n", iFrame, iBase,
- iWave, sigma2FluxSumPiPj);
-
- /* fluxRatPiPj */
- fluxRatPiPj = cell.fluxRatPiPj[iWave];
- printf("fluxRatPiPj[%d][%d][%d] = %f - ", iFrame, iBase,
- iWave, fluxRatPiPj);
-
- /* sigma2FluxRatPiPj */
- sigma2FluxRatPiPj = cell.sigma2FluxRatPiPj[iWave];
- printf("sigma2FluxRatPiPj[%d][%d][%d] = %f\n", iFrame, iBase,
- iWave, sigma2FluxRatPiPj);
-
- /* PiMultPj */
- PiMultPj = cell.PiMultPj[iWave];
- printf("PiMultPj[%d][%d][%d] = %f\n", iFrame, iBase, iWave,
- PiMultPj);
- }
- }
- }
-}
-
-/**
- * Split amdlibPHOTOMETRY input data structure into 3 structures, 1 per spectral
- * band. Each new structure only contains information relative to its associated
- * spectral band .
- *
- * @param srcPhot pointer on photometry structure to split.
- * @param dstPhot array of splitted photometry structures.
- * @param idxFirstWlen array containing the indexes of the first wavelength
- * belonging to each spectral band.
- * @param nbWlen array containing the number of wavelengths per spectral band.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibSplitPhot(amdlibPHOTOMETRY *srcPhot,
- amdlibPHOTOMETRY *dstPhot,
- int *idxFirstWlen,
- int *nbWlen,
- amdlibERROR_MSG errMsg)
-{
- int band, index, i, j;
-
- amdlibLogTrace("amdlibSplitPhot()");
- for (band=amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- if (nbWlen[band] == 0)
- {
- dstPhot[band].thisPtr = NULL;
- }
- else
- {
- /* Allocate memory for dstPhot */
- if (amdlibAllocatePhotometry(&dstPhot[band], srcPhot->nbFrames,
- srcPhot->nbBases,
- nbWlen[band]) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for photometry ");
- return amdlibFAILURE;
- }
- for (i=0; i < srcPhot->nbFrames * srcPhot->nbBases; i++)
- {
- index = idxFirstWlen[band];
- for (j=0; j < nbWlen[band]; j++)
- {
- dstPhot[band].table[i].fluxSumPiPj[j] =
- srcPhot->table[i].fluxSumPiPj[index];
- dstPhot[band].table[i].sigma2FluxSumPiPj[j] =
- srcPhot->table[i].sigma2FluxSumPiPj[index];
- dstPhot[band].table[i].fluxRatPiPj[j] =
- srcPhot->table[i].fluxRatPiPj[index];
- dstPhot[band].table[i].sigma2FluxRatPiPj[j] =
- srcPhot->table[i].sigma2FluxRatPiPj[index];
- dstPhot[band].table[i].PiMultPj[j] =
- srcPhot->table[i].PiMultPj[index];
- index++;
- }
- }
-
- }
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Allocate memory for storing visibilities.
- *
- * @param vis pointer to amdlibVIS structure.
- * @param nbFrames number of frames
- * @param nbBases number of baselines
- * @param nbWlen number of spectral channels
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAllocateVis(amdlibVIS *vis,
- const int nbFrames,
- const int nbBases,
- const int nbWlen)
-{
- int dimArray;
- int i; /* loop */
- void *pointer;
- int nbSamples;
- int band;
-
- amdlibLogTrace("amdlibAllocateVis()");
-
- /* First free previous allocated memory */
- if (vis->thisPtr == vis)
- {
- amdlibFreeVis(vis);
- }
-
- /* Init & Update thisPtr */
- vis->thisPtr = memset(vis, '\0', sizeof(*vis));
- /* Set array size */
- vis->nbFrames = nbFrames;
- vis->nbBases = nbBases;
- vis->nbWlen = nbWlen;
-
- /* Allocate table pointer list */
- nbSamples = nbFrames * nbBases;
- vis->table = calloc(nbSamples, sizeof(*(vis->table)));
- if (vis->table == NULL)
- {
- amdlibFreeVis(vis);
- return amdlibFAILURE;
- }
-
- /* Allocate 'vis' in each table entry (amdlibCOMPLEX) as a whole */
- dimArray = sizeof(amdlibCOMPLEX) * nbWlen;
- vis->table[0].vis = (amdlibCOMPLEX *)calloc(nbSamples, dimArray);
- if (vis->table[0].vis == NULL)
- {
- amdlibFreeVis(vis);
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = vis->table[0].vis;
- i < nbSamples;
- i++, pointer += dimArray)
- {
- vis->table[i].vis = pointer;
- }
-
- /* Allocate 'sigma2Vis' in each table entry (amdlibCOMPLEX) as a whole */
- dimArray = sizeof(amdlibCOMPLEX) * nbWlen;
- vis->table[0].sigma2Vis = (amdlibCOMPLEX *)calloc(nbSamples, dimArray);
- if (vis->table[0].sigma2Vis == NULL)
- {
- amdlibFreeVis(vis);
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = vis->table[0].sigma2Vis;
- i < nbSamples;
- i++, pointer += dimArray)
- {
- vis->table[i].sigma2Vis = pointer;
- }
-
- /* Allocate 'visCovRI' in each table entry (double) as a whole */
- dimArray = sizeof(double) * nbWlen;
- vis->table[0].visCovRI = (double *)calloc(nbSamples, dimArray);
- if (vis->table[0].visCovRI == NULL)
- {
- amdlibFreeVis(vis);
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = vis->table[0].visCovRI;
- i < nbSamples;
- i++, pointer += dimArray)
- {
- vis->table[i].visCovRI = pointer;
- }
-
- /* Allocate 'diffVisAmp' in each table entry (double) as a whole */
- dimArray = sizeof(double) * nbWlen;
- vis->table[0].diffVisAmp = (double *)calloc(nbSamples, dimArray);
- if (vis->table[0].diffVisAmp == NULL)
- {
- amdlibFreeVis(vis);
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = vis->table[0].diffVisAmp;
- i < nbSamples;
- i++, pointer += dimArray)
- {
- vis->table[i].diffVisAmp = pointer;
- }
-
- /* Allocate 'diffVisAmpErr' in each table entry (double) as a whole */
- dimArray = sizeof(double) * nbWlen;
- vis->table[0].diffVisAmpErr = (double *)calloc(nbSamples, dimArray);
- if (vis->table[0].diffVisAmpErr == NULL)
- {
- amdlibFreeVis(vis);
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = vis->table[0].diffVisAmpErr;
- i < nbSamples;
- i++, pointer += dimArray)
- {
- vis->table[i].diffVisAmpErr = pointer;
- }
-
- /* Allocate 'diffVisPhi' in each table entry (double) as a whole */
- dimArray = sizeof(double) * nbWlen;
- vis->table[0].diffVisPhi = (double *)calloc(nbSamples, dimArray);
- if (vis->table[0].diffVisPhi == NULL)
- {
- amdlibFreeVis(vis);
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = vis->table[0].diffVisPhi;
- i < nbSamples;
- i++, pointer += dimArray)
- {
- vis->table[i].diffVisPhi = pointer;
- }
-
- /* Allocate 'diffVisPhiErr' in each table entry (double) as a whole */
- dimArray = sizeof(double) * nbWlen;
- vis->table[0].diffVisPhiErr = (double *)calloc(nbSamples, dimArray);
- if (vis->table[0].diffVisPhiErr == NULL)
- {
- amdlibFreeVis(vis);
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = vis->table[0].diffVisPhiErr;
- i < nbSamples;
- i++, pointer += dimArray)
- {
- vis->table[i].diffVisPhiErr = pointer;
- }
-
- /* Set all band flags to false */
- for (i=0; i < nbSamples; i++)
- {
- for (band = 0; band < amdlibNB_BANDS; band++)
- {
- vis->table[i].bandFlag[band] = amdlibFALSE;
- }
- }
-
- /* Allocate 'flag' in each table entry (boolean) as a whole */
- dimArray = sizeof(amdlibBOOLEAN) * nbWlen;
- vis->table[0].flag = (amdlibBOOLEAN *)calloc(nbSamples, dimArray);
- if (vis->table[0].flag == NULL)
- {
- amdlibFreeVis(vis);
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = vis->table[0].flag;
- i < nbSamples;
- i++, pointer += dimArray)
- {
- vis->table[i].flag = pointer;
- }
-
- /* Return */
- return amdlibSUCCESS;
-}
-
-
-
-/**
- * Append amdlibVIS data structure.
- *
- * @param srcVis pointer to source data structure
- * @param dstVis pointer to destination data structure (append to)
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAppendVis(amdlibVIS *dstVis,
- amdlibVIS *srcVis,
- amdlibERROR_MSG errMsg)
-{
- int sentry;
- int dentry;
- int band = 0;
- size_t visSize = srcVis->nbWlen * sizeof(amdlibCOMPLEX);
- size_t doubleArraySize = srcVis->nbWlen * sizeof(double);
- int oldNbFrames = dstVis->nbFrames;
-
- amdlibLogTrace("amdlibAppendVis()");
- /* Perform simple checks */
- if (dstVis->nbBases != srcVis->nbBases)
- {
- amdlibSetErrMsg("Different number of bases (%d and %d)",
- srcVis->nbBases, dstVis->nbBases);
- return amdlibFAILURE;
- }
- if (dstVis->nbWlen != srcVis->nbWlen)
- {
- amdlibSetErrMsg("Different number of wavelengths (%d and %d)",
- srcVis->nbWlen, dstVis->nbWlen);
- return amdlibFAILURE;
- }
-
-
- /* Reallocate memory to store additional data */
- if (amdlibReallocateVis(dstVis, oldNbFrames + srcVis->nbFrames,
- srcVis->nbBases, srcVis->nbWlen) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not reallocate memory for visibility structure");
- return amdlibFAILURE;
- }
-
- /* Append fields allocated dynamically */
- dentry = oldNbFrames * dstVis->nbBases;
- for (sentry = 0; sentry < srcVis->nbFrames * srcVis->nbBases; sentry++)
- {
- dstVis->table[dentry].targetId = srcVis->table[sentry].targetId;
-
- dstVis->table[dentry].time = srcVis->table[sentry].time;
-
- dstVis->table[dentry].dateObsMJD = srcVis->table[sentry].dateObsMJD;
-
- dstVis->table[dentry].expTime = srcVis->table[sentry].expTime;
-
- dstVis->table[dentry].uCoord = srcVis->table[sentry].uCoord;
-
- dstVis->table[dentry].vCoord = srcVis->table[sentry].vCoord;
-
- dstVis->table[dentry].stationIndex[0] =
- srcVis->table[sentry].stationIndex[0];
-
- dstVis->table[dentry].stationIndex[1] =
- srcVis->table[sentry].stationIndex[1];
-
- for (band=0; band < amdlibNB_BANDS; band++)
- {
- dstVis->table[dentry].bandFlag[band] =
- srcVis->table[sentry].bandFlag[band];
- dstVis->table[dentry].frgContrastSnrArray[band] =
- srcVis->table[sentry].frgContrastSnrArray[band];
- }
- dstVis->table[dentry].frgContrastSnr =
- srcVis->table[sentry].frgContrastSnr;
-
- memcpy(dstVis->table[dentry].vis, srcVis->table[sentry].vis, visSize);
- memcpy(dstVis->table[dentry].sigma2Vis,
- srcVis->table[sentry].sigma2Vis, visSize);
-
- memcpy(dstVis->table[dentry].visCovRI, srcVis->table[sentry].visCovRI,
- doubleArraySize);
- memcpy(dstVis->table[dentry].diffVisAmp,
- srcVis->table[sentry].diffVisAmp, doubleArraySize);
- memcpy(dstVis->table[dentry].diffVisAmpErr,
- srcVis->table[sentry].diffVisAmpErr, doubleArraySize);
- memcpy(dstVis->table[dentry].diffVisPhi,
- srcVis->table[sentry].diffVisPhi, doubleArraySize);
- memcpy(dstVis->table[dentry].diffVisPhiErr,
- srcVis->table[sentry].diffVisPhiErr, doubleArraySize);
-
- memcpy(dstVis->table[dentry].flag, srcVis->table[sentry].flag,
- srcVis->nbWlen * sizeof(amdlibBOOLEAN));
-
- dentry++;
- }
-
- return amdlibSUCCESS;
-}
-
-
-/**
- * Insert amdlibVIS data structure.
- *
- * @param srcVis pointer to source data structure
- * @param dstVis pointer to destination data structure (insert at)
- * @param insertIndex
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibInsertVis(amdlibVIS *dstVis,
- amdlibVIS *srcVis,
- int insertIndex,
- amdlibERROR_MSG errMsg)
-{
- int sentry;
- int dentry;
- int band = 0;
- size_t visSize = srcVis->nbWlen * sizeof(amdlibCOMPLEX);
- size_t doubleArraySize = srcVis->nbWlen * sizeof(double);
- int dstNbFrames = dstVis->nbFrames;
- int finalIndex = insertIndex + srcVis->nbFrames;
-
- amdlibLogTrace("amdlibInsertVis()");
- /* Perform simple checks */
- if (insertIndex<0 || insertIndex>=dstVis->nbFrames)
- {
- amdlibSetErrMsg("Invalid insertion index %d for amdlibInsertVis",insertIndex);
- return amdlibFAILURE;
- }
- if (dstVis->nbBases != srcVis->nbBases)
- {
- amdlibSetErrMsg("Different number of bases (%d and %d)",
- srcVis->nbBases, dstVis->nbBases);
- return amdlibFAILURE;
- }
- if (dstVis->nbWlen != srcVis->nbWlen)
- {
- amdlibSetErrMsg("Different number of wavelengths (%d and %d)",
- srcVis->nbWlen, dstVis->nbWlen);
- return amdlibFAILURE;
- }
- if (dstNbFrames < finalIndex)
- {
- amdlibSetErrMsg("Number of frames (%d) in destination structure"
- "too small to enable insertion of %d frames at position %d",
- dstNbFrames,srcVis->nbFrames,insertIndex);
- return amdlibFAILURE;
- }
-
- strcpy(dstVis->dateObs, srcVis->dateObs);
- /* Insert src in dst at frame insertIndex */
- dentry = insertIndex * dstVis->nbBases;
- for (sentry = 0; sentry < srcVis->nbFrames * srcVis->nbBases; sentry++)
- {
- dstVis->table[dentry].targetId = srcVis->table[sentry].targetId;
-
- dstVis->table[dentry].time = srcVis->table[sentry].time;
-
- dstVis->table[dentry].dateObsMJD = srcVis->table[sentry].dateObsMJD;
-
- dstVis->table[dentry].expTime = srcVis->table[sentry].expTime;
-
- dstVis->table[dentry].uCoord = srcVis->table[sentry].uCoord;
-
- dstVis->table[dentry].vCoord = srcVis->table[sentry].vCoord;
-
- dstVis->table[dentry].stationIndex[0] =
- srcVis->table[sentry].stationIndex[0];
-
- dstVis->table[dentry].stationIndex[1] =
- srcVis->table[sentry].stationIndex[1];
-
- memcpy(dstVis->table[dentry].vis, srcVis->table[sentry].vis, visSize);
- memcpy(dstVis->table[dentry].sigma2Vis,
- srcVis->table[sentry].sigma2Vis, visSize);
-
- memcpy(dstVis->table[dentry].visCovRI, srcVis->table[sentry].visCovRI,
- doubleArraySize);
- memcpy(dstVis->table[dentry].diffVisAmp,
- srcVis->table[sentry].diffVisAmp, doubleArraySize);
- memcpy(dstVis->table[dentry].diffVisAmpErr,
- srcVis->table[sentry].diffVisAmpErr, doubleArraySize);
- memcpy(dstVis->table[dentry].diffVisPhi,
- srcVis->table[sentry].diffVisPhi, doubleArraySize);
- memcpy(dstVis->table[dentry].diffVisPhiErr,
- srcVis->table[sentry].diffVisPhiErr, doubleArraySize);
-
- for (band=0; band < amdlibNB_BANDS; band++)
- {
- dstVis->table[dentry].frgContrastSnrArray[band] =
- srcVis->table[sentry].frgContrastSnrArray[band];
- dstVis->table[dentry].bandFlag[band] =
- srcVis->table[sentry].bandFlag[band];
- }
-
- dstVis->table[dentry].frgContrastSnr =
- srcVis->table[sentry].frgContrastSnr;
-
- memcpy(dstVis->table[dentry].flag, srcVis->table[sentry].flag,
- srcVis->nbWlen * sizeof(amdlibBOOLEAN));
-
- dentry++;
- }
- return amdlibSUCCESS;
-}
-
-
-/**
- * Merge OI-VIS.
- *
- * @param vis1 pointer to first OI-VIS structure.
- * @param vis2 pointer to second OI-VIS structure (to merge).
- * @param isInverted boolean indicating in which order the structures have to
- * be merged.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibMergeVis(amdlibVIS *vis1,
- amdlibVIS *vis2,
- amdlibBOOLEAN isInverted,
- amdlibERROR_MSG errMsg)
-{
- amdlibVIS mergedVis = {NULL};
- amdlibVIS *v1, *v2;
-
- amdlibLogTrace("amdlibMergeVis()");
-
- /* Check phot1 and phot2 have same number of baselines */
- if (vis1->nbBases != vis2->nbBases)
- {
- amdlibSetErrMsg("Different number of baselines (%d and %d)",
- vis1->nbBases, vis2->nbBases);
- return amdlibFAILURE;
- }
-
- if (isInverted == amdlibTRUE)
- {
- v1 = vis2;
- v2 = vis1;
- }
- else
- {
- v1 = vis1;
- v2 = vis2;
- }
-
- /* Allocate memory for mergedVis */
- mergedVis.thisPtr = NULL;
- if (amdlibAllocateVis(&mergedVis, v1->nbFrames, v1->nbBases,
- v1->nbWlen + v2->nbWlen) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for merged OI-VIS structure");
- return amdlibFAILURE;
- }
-
- if (amdlibCopyVisFrom(&mergedVis, v1, 0, v1->nbWlen,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- if (amdlibCopyVisFrom(&mergedVis, v2, v1->nbWlen, v2->nbWlen,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- free(vis1->table[0].vis);
- free(vis1->table[0].sigma2Vis);
- free(vis1->table[0].visCovRI);
- free(vis1->table[0].diffVisAmp);
- free(vis1->table[0].diffVisAmpErr);
- free(vis1->table[0].diffVisPhi);
- free(vis1->table[0].diffVisPhiErr);
- free(vis1->table[0].flag);
- free(vis1->table);
- vis1->nbWlen = mergedVis.nbWlen;
- vis1->nbFrames = mergedVis.nbFrames;
- vis1->table = mergedVis.table;
-
- return amdlibSUCCESS;
-}
-
-/**
- * Split amdlibVIS input data structure into 3 structures, 1 per spectral
- * band. Each new structure only contains information relative to its associated
- * spectral band .
- *
- * @param srcVis pointer on visibility structure to split.
- * @param dstVis array of splitted visibility structures.
- * @param idxFirstWlen array containing the indexes of the first wavelength
- * belonging to each spectral band.
- * @param nbWlen array containing the number of wavelengths per spectral band.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibSplitVis(amdlibVIS *srcVis,
- amdlibVIS *dstVis,
- int *idxFirstWlen,
- int *nbWlen,
- amdlibERROR_MSG errMsg)
-{
- int band, index, i, j;
-
- amdlibLogTrace("amdlibSplitVis()");
- for (band=amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- if (nbWlen[band] == 0)
- {
- dstVis[band].thisPtr = NULL;
- }
- else
- {
- /* Allocate memory for dstVis */
- if (amdlibAllocateVis(&dstVis[band], srcVis->nbFrames,
- srcVis->nbBases,
- nbWlen[band]) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for oivis");
- return amdlibFAILURE;
- }
-
- strcpy(dstVis[band].dateObs, srcVis->dateObs);
- for (i=0; i < srcVis->nbFrames * srcVis->nbBases; i++)
- {
- dstVis[band].table[i].targetId = srcVis->table[i].targetId;
- dstVis[band].table[i].time = srcVis->table[i].time;
- dstVis[band].table[i].dateObsMJD = srcVis->table[i].dateObsMJD;
- dstVis[band].table[i].expTime = srcVis->table[i].expTime;
- dstVis[band].table[i].uCoord = srcVis->table[i].uCoord;
- dstVis[band].table[i].vCoord = srcVis->table[i].vCoord;
- dstVis[band].table[i].stationIndex[0] =
- srcVis->table[i].stationIndex[0];
- dstVis[band].table[i].stationIndex[1] =
- srcVis->table[i].stationIndex[1];
-
- for (j=amdlibJ_BAND; j <= amdlibK_BAND; j++)
- {
- dstVis[band].table[i].bandFlag[j] =
- srcVis->table[i].bandFlag[j];
- dstVis[band].table[i].frgContrastSnrArray[j] =
- srcVis->table[i].frgContrastSnrArray[j];
- }
- dstVis[band].table[i].frgContrastSnr =
- srcVis->table[i].frgContrastSnr;
-
- index = idxFirstWlen[band];
- for (j=0; j < nbWlen[band]; j++)
- {
- dstVis[band].table[i].vis[j].re =
- srcVis->table[i].vis[index].re;
- dstVis[band].table[i].vis[j].im =
- srcVis->table[i].vis[index].im;
- dstVis[band].table[i].sigma2Vis[j].re =
- srcVis->table[i].sigma2Vis[index].re;
- dstVis[band].table[i].sigma2Vis[j].im =
- srcVis->table[i].sigma2Vis[index].im;
- dstVis[band].table[i].visCovRI[j] =
- srcVis->table[i].visCovRI[index];
- dstVis[band].table[i].diffVisAmp[j] =
- srcVis->table[i].diffVisAmp[index];
- dstVis[band].table[i].diffVisAmpErr[j] =
- srcVis->table[i].diffVisAmpErr[index];
- dstVis[band].table[i].diffVisPhi[j] =
- srcVis->table[i].diffVisPhi[index];
- dstVis[band].table[i].diffVisPhiErr[j] =
- srcVis->table[i].diffVisPhiErr[index];
- dstVis[band].table[i].flag[j] =
- srcVis->table[i].flag[index];
- index++;
- }
- }
-
- }
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Duplicate visibility if index = 0 or add information relative to wavelengths
- * in first structure else.
- *
- * @param dstVis pointer to first visibility structure.
- * @param srcVis pointer to second visibility structure (to be copied).
- * @param index index on the location to place information.
- * @param nbOfElem number of elements to store.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibCopyVisFrom(amdlibVIS *dstVis,
- amdlibVIS *srcVis,
- int index,
- int nbOfElem,
- amdlibERROR_MSG errMsg)
-{
- int i, j;
- amdlibLogTrace("amdlibCopyVisFrom()");
-
- if ((dstVis->thisPtr == NULL) && (index != 0))
- {
- amdlibSetErrMsg("Could not copy non-initialized data from index %d",
- index);
- return amdlibFAILURE;
- }
-
- if (srcVis->thisPtr == NULL)
- {
- /* Nothing to do */
- return amdlibSUCCESS;
- }
-
- if (index == 0)
- {
- strcpy(dstVis->dateObs, srcVis->dateObs);
- for (i=0; i < srcVis->nbFrames * srcVis->nbBases; i++)
- {
- dstVis->table[i].targetId = srcVis->table[i].targetId;
- dstVis->table[i].time = srcVis->table[i].time;
- dstVis->table[i].dateObsMJD = srcVis->table[i].dateObsMJD;
- dstVis->table[i].expTime = srcVis->table[i].expTime;
- dstVis->table[i].uCoord = srcVis->table[i].uCoord;
- dstVis->table[i].vCoord = srcVis->table[i].vCoord;
- dstVis->table[i].stationIndex[0] =
- srcVis->table[i].stationIndex[0];
- dstVis->table[i].stationIndex[1] =
- srcVis->table[i].stationIndex[1];
-
- for (j=amdlibJ_BAND; j <= amdlibK_BAND; j++)
- {
- dstVis->table[i].bandFlag[j] = srcVis->table[i].bandFlag[j];
- dstVis->table[i].frgContrastSnrArray[j] =
- srcVis->table[i].frgContrastSnrArray[j];
- }
- dstVis->table[i].frgContrastSnr =
- srcVis->table[i].frgContrastSnr;
-
- for (j=0; j < srcVis->nbWlen; j++)
- {
- dstVis->table[i].vis[j].re = srcVis->table[i].vis[j].re;
- dstVis->table[i].vis[j].im = srcVis->table[i].vis[j].im;
- dstVis->table[i].sigma2Vis[j].re =
- srcVis->table[i].sigma2Vis[j].re;
- dstVis->table[i].sigma2Vis[j].im =
- srcVis->table[i].sigma2Vis[j].im;
- dstVis->table[i].visCovRI[j] = srcVis->table[i].visCovRI[j];
- dstVis->table[i].diffVisAmp[j] =
- srcVis->table[i].diffVisAmp[j];
- dstVis->table[i].diffVisAmpErr[j] =
- srcVis->table[i].diffVisAmpErr[j];
- dstVis->table[i].diffVisPhi[j] =
- srcVis->table[i].diffVisPhi[j];
- dstVis->table[i].diffVisPhiErr[j] =
- srcVis->table[i].diffVisPhiErr[j];
- dstVis->table[i].flag[j] = srcVis->table[i].flag[j];
- }
- }
- }
- else
- {
- if (dstVis->nbFrames != srcVis->nbFrames)
- {
- amdlibSetErrMsg("Different number of frames! (%d and %d)",
- dstVis->nbFrames, srcVis->nbFrames);
- return amdlibFAILURE;
- }
- if (dstVis->nbBases != srcVis->nbBases)
- {
- amdlibSetErrMsg("Different number of bases (%d and %d)",
- dstVis->nbBases, srcVis->nbBases);
- return amdlibFAILURE;
- }
- for (i=0; i < srcVis->nbFrames * srcVis->nbBases; i++)
- {
-
-
- for (j=amdlibK_BAND; j >=amdlibJ_BAND; j--)
- {
- if (dstVis->table[i].bandFlag[j] == amdlibTRUE)
- {
- break;
- }
- else if (srcVis->table[i].bandFlag[j] == amdlibTRUE)
- {
- dstVis->table[i].frgContrastSnr =
- srcVis->table[i].frgContrastSnr;
- continue;
- }
- }
- for (j=amdlibJ_BAND; j <= amdlibK_BAND; j++)
- {
- if ((srcVis->table[i].bandFlag[j] == amdlibTRUE) &&
- (dstVis->table[i].bandFlag[j]) == amdlibFALSE)
- {
- dstVis->table[i].bandFlag[j] = amdlibTRUE;
- dstVis->table[i].frgContrastSnrArray[j] =
- srcVis->table[i].frgContrastSnrArray[j];
- }
- }
- dstVis->table[i].frgContrastSnr = srcVis->table[i].frgContrastSnr;
- for (j = 0; j < nbOfElem; j++)
- {
- dstVis->table[i].vis[index+j].re =
- srcVis->table[i].vis[j].re;
- dstVis->table[i].vis[index+j].im =
- srcVis->table[i].vis[j].im;
-
- dstVis->table[i].sigma2Vis[index+j].re =
- srcVis->table[i].sigma2Vis[j].re;
- dstVis->table[i].sigma2Vis[index+j].im =
- srcVis->table[i].sigma2Vis[j].im;
-
- dstVis->table[i].visCovRI[index+j] =
- srcVis->table[i].visCovRI[j];
- dstVis->table[i].diffVisAmp[index+j] =
- srcVis->table[i].diffVisAmp[j];
- dstVis->table[i].diffVisAmpErr[index+j] =
- srcVis->table[i].diffVisAmpErr[j];
- dstVis->table[i].diffVisPhi[index+j] =
- srcVis->table[i].diffVisPhi[j];
- dstVis->table[i].diffVisPhiErr[index+j] =
- srcVis->table[i].diffVisPhiErr[j];
- dstVis->table[i].flag[index+j] =
- srcVis->table[i].flag[j];
- }
- }
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Display visibility structure.
- *
- * @param vis pointer to amdlibVIS structure.
- */
-void amdlibDisplayVis(amdlibVIS *vis)
-{
- int nbFrames, nbBases, nbWlen;
- int iFrame, iBase, iCell, iWave, iBand;
- amdlibVIS_TABLE_ENTRY cell;
- double visRe;
- double visIm;
- double sigma2VisRe;
- double sigma2VisIm;
- double visCovRI;
- double diffVisAmp;
- double diffVisAmpErr;
- double diffVisPhi;
- double diffVisPhiErr;
- double bandFrgContrastSnr;
- amdlibBOOLEAN bandFlag;
-
- amdlibLogTrace("amdlibDisplayVis()");
-
- /* Display number of frames */
- nbFrames = vis->nbFrames;
- printf("nbFrames = %d\n", nbFrames);
-
- /* Display number of base */
- nbBases = vis->nbBases;
- printf("nbBases = %d\n", nbBases);
-
- /* Display number of wavelength */
- nbWlen = vis->nbWlen;
- printf("nbWlen = %d\n", nbWlen);
-
- /* Display different arrays[nbFrames][nbBases][nbWlen] */
- for (iFrame = 0; iFrame < nbFrames; iFrame++)
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- /* Set cell[iFrame][iBase] */
- iCell = iFrame * nbBases + iBase;
- cell = vis->table[iCell];
- printf("---> cell frame/base[%d][%d]\n", iFrame, iBase);
- printf("time = %lf\n",cell.time);
- printf("dateObsMJD = %lf\n",cell.dateObsMJD);
- printf("expTime = %lf\n",cell.expTime);
- printf("uCoord = %lf\n",cell.uCoord);
- printf("vCoord = %lf\n",cell.vCoord);
- printf("stationIndex = %d %d\n",cell.stationIndex[0],cell.stationIndex[1]);
- printf("frgContrastSnr = %lf\n",cell.frgContrastSnr);
-
- /* Display arrays[nbWlen] */
- for (iWave = 0; iWave < nbWlen; iWave++)
- {
- /* vis re */
- visRe = cell.vis[iWave].re;
- printf("visRe[%d][%d][%d] = %f - ", iFrame, iBase, iWave,
- visRe);
- /* sigma2Vis re */
- sigma2VisRe = cell.sigma2Vis[iWave].re;
- printf("sigma2VisRe[%d][%d][%d] = %f\n", iFrame, iBase, iWave,
- sigma2VisRe);
-
- /* vis im */
- visIm = cell.vis[iWave].im;
- printf("visIm[%d][%d][%d] = %f - ", iFrame, iBase, iWave,
- visIm);
-
- /* sigma2Vis im */
- sigma2VisIm = cell.sigma2Vis[iWave].im;
- printf("sigma2VisIm[%d][%d][%d] = %f\n", iFrame, iBase, iWave,
- sigma2VisIm);
- /* visCovRI */
- visCovRI = cell.visCovRI[iWave];
- printf("visCovRI[%d][%d][%d] = %f\n", iFrame, iBase, iWave,
- visCovRI);
-
- /* diffVisAmp */
- diffVisAmp = cell.diffVisAmp[iWave];
- printf("diffVisAmp[%d][%d][%d] = %f - ", iFrame, iBase, iWave,
- diffVisAmp);
-
- /* diffVisAmpErr */
- diffVisAmpErr = cell.diffVisAmpErr[iWave];
- printf("diffVisAmpErr[%d][%d][%d] = %f\n", iFrame, iBase, iWave, diffVisAmpErr);
-
- /* diffVisPhi */
- diffVisPhi = cell.diffVisPhi[iWave];
- printf("diffVisPhi[%d][%d][%d] = %f - ", iFrame, iBase, iWave,
- diffVisPhi);
-
- /* diffVisPhiErr */
- diffVisPhiErr = cell.diffVisPhiErr[iWave];
- printf("diffVisPhiErr[%d][%d][%d] = %f\n", iFrame, iBase, iWave, diffVisPhiErr);
- }
-
- /* Display arrays[amdlibNB_BAND] */
- for (iBand = 0; iBand < amdlibNB_BANDS; iBand++)
- {
- /* frgContrastSnrArray */
- bandFrgContrastSnr = cell.frgContrastSnrArray[iBand];
- printf("bandFrgContrastSnr[%d][%d][%d] = %f - ", iFrame, iBase,
- iBand,
- bandFrgContrastSnr);
-
- /* bandFlag */
- bandFlag = cell.bandFlag[iBand];
- printf("bandFlag[%d][%d][%d] = %d\n", iFrame, iBase, iBand,
- bandFlag);
- }
- }
- }
-}
-
-/**
- * Allocate memory for storing squared visibilities.
- *
- * @param vis2 pointer to amdlibVIS2 structure.
- * @param nbFrames number of frames
- * @param nbBases number of baselines
- * @param nbWlen number of spectral channels
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAllocateVis2(amdlibVIS2 *vis2,
- const int nbFrames,
- const int nbBases,
- const int nbWlen)
-{
- int dimArray;
- int i; /* loop */
- void *pointer;
- int nbSamples;
-
- amdlibLogTrace("amdlibAllocateVis2()");
-
- /* First free previous allocated memory */
- if (vis2->thisPtr == vis2)
- {
- amdlibFreeVis2(vis2);
- }
-
- /* Update thisPtr */
- vis2->thisPtr=memset(vis2, '\0', sizeof(*vis2));
-
- /* Set array size */
- vis2->nbFrames = nbFrames;
- vis2->nbBases = nbBases;
- vis2->nbWlen = nbWlen;
-
- /* Allocate table pointer list */
- nbSamples = nbFrames * nbBases;
- vis2->table = calloc(nbSamples, sizeof(*(vis2->table)));
- if (vis2->table == NULL)
- {
- amdlibFreeVis2(vis2);
- return amdlibFAILURE;
- }
-
- /* Allocate 'vis2' in each table entry as a whole */
- dimArray = sizeof(double) * nbWlen;
- vis2->table[0].vis2 = (double *)calloc(nbSamples, dimArray);
- if (vis2->table[0].vis2 == NULL)
- {
- amdlibFreeVis2(vis2);
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = vis2->table[0].vis2;
- i < nbSamples;
- i++, pointer += dimArray)
- {
- vis2->table[i].vis2 = pointer;
- }
-
- /* Allocate 'vis2Error' in each table entry (amdlibCOMPLEX) as a whole */
- dimArray = sizeof(double) * nbWlen;
- vis2->table[0].vis2Error = (double *)calloc(nbSamples, dimArray);
- if (vis2->table[0].vis2Error == NULL)
- {
- amdlibFreeVis2(vis2);
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = vis2->table[0].vis2Error;
- i < nbSamples;
- i++, pointer += dimArray)
- {
- vis2->table[i].vis2Error = pointer;
- }
-
- /* Allocate 'flag' in each table entry (boolean) as a whole */
- dimArray = sizeof(amdlibBOOLEAN) * nbWlen;
- vis2->table[0].flag = (amdlibBOOLEAN *)calloc(nbSamples, dimArray);
- if (vis2->table[0].flag == NULL)
- {
- amdlibFreeVis2(vis2);
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = vis2->table[0].flag;
- i < nbSamples;
- i++, pointer += dimArray)
- {
- vis2->table[i].flag = pointer;
- }
-
- /* Return */
- return amdlibSUCCESS;
-}
-
-
-/**
- * Append amdlibVIS2 data structure.
- *
- * @param srcVis2 pointer to source data structure
- * @param dstVis2 pointer to destination data structure (append to)
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAppendVis2 (amdlibVIS2 *dstVis2,
- amdlibVIS2 *srcVis2,
- amdlibERROR_MSG errMsg)
-{
- int sentry;
- int dentry;
- size_t vis2Size = srcVis2->nbWlen * sizeof(double);
- int oldNbFrames = dstVis2->nbFrames;
-
- amdlibLogTrace("amdlibAppendVis2()");
- /* Perform simple checks */
- if (dstVis2->nbBases != srcVis2->nbBases)
- {
- amdlibSetErrMsg("Different number of bases (%d and %d)",
- srcVis2->nbBases, dstVis2->nbBases);
- return amdlibFAILURE;
- }
- if (dstVis2->nbWlen != srcVis2->nbWlen)
- {
- amdlibSetErrMsg("Different number of wavelengths (%d and %d)",
- srcVis2->nbWlen, dstVis2->nbWlen);
- return amdlibFAILURE;
- }
-
- /* Reallocate memory to store additional data */
- if (amdlibReallocateVis2(dstVis2, oldNbFrames + srcVis2->nbFrames,
- dstVis2->nbBases,
- dstVis2->nbWlen) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not reallocate memory for visibility structure");
- return amdlibFAILURE;
- }
-
- /* Append fields allocated dynamically */
- dentry = oldNbFrames * dstVis2->nbBases;
- for (sentry = 0; sentry < srcVis2->nbFrames * srcVis2->nbBases; sentry++)
- {
- dstVis2->table[dentry].targetId = srcVis2->table[sentry].targetId;
-
- dstVis2->table[dentry].time = srcVis2->table[sentry].time;
-
- dstVis2->table[dentry].dateObsMJD = srcVis2->table[sentry].dateObsMJD;
-
- dstVis2->table[dentry].expTime = srcVis2->table[sentry].expTime;
-
- dstVis2->table[dentry].uCoord = srcVis2->table[sentry].uCoord;
-
- dstVis2->table[dentry].vCoord = srcVis2->table[sentry].vCoord;
-
- dstVis2->table[dentry].stationIndex[0] =
- srcVis2->table[sentry].stationIndex[0];
-
- dstVis2->table[dentry].stationIndex[1] =
- srcVis2->table[sentry].stationIndex[1];
-
- memcpy (dstVis2->table[dentry].vis2,
- srcVis2->table[sentry].vis2, vis2Size);
- memcpy (dstVis2->table[dentry].vis2Error,
- srcVis2->table[sentry].vis2Error, vis2Size);
-
- memcpy(dstVis2->table[dentry].flag, srcVis2->table[sentry].flag,
- srcVis2->nbWlen * sizeof(amdlibBOOLEAN));
-
- dentry++;
- }
- /* Update dst fixed size fields */
- dstVis2->vis12 = srcVis2->nbFrames * srcVis2->vis12 +
- oldNbFrames * dstVis2->vis12;
- dstVis2->vis23 = srcVis2->nbFrames * srcVis2->vis23 +
- oldNbFrames * dstVis2->vis23;
- dstVis2->vis31 = srcVis2->nbFrames * srcVis2->vis31 +
- oldNbFrames * dstVis2->vis31;
-
- dstVis2->sigmaVis12 = srcVis2->nbFrames * srcVis2->sigmaVis12 +
- oldNbFrames * dstVis2->sigmaVis12;
- dstVis2->sigmaVis23 = srcVis2->nbFrames * srcVis2->sigmaVis23 +
- oldNbFrames * dstVis2->sigmaVis23;
- dstVis2->sigmaVis31 = srcVis2->nbFrames * srcVis2->sigmaVis31 +
- oldNbFrames * dstVis2->sigmaVis31;
-
-
- dstVis2->vis12 /= dstVis2->nbFrames;
- dstVis2->vis23 /= dstVis2->nbFrames;
- dstVis2->vis31 /= dstVis2->nbFrames;
- dstVis2->sigmaVis12 /= dstVis2->nbFrames;
- dstVis2->sigmaVis23 /= dstVis2->nbFrames;
- dstVis2->sigmaVis31 /= dstVis2->nbFrames;
-
- return amdlibSUCCESS;
-}
-
-
-/**
- * Insert amdlibVIS2 data structure.
- *
- * @param srcVis2 pointer to source data structure
- * @param dstVis2 pointer to destination data structure (insert to)
- * @param insertIndex
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibInsertVis2 (amdlibVIS2 *dstVis2,
- amdlibVIS2 *srcVis2,
- int insertIndex,
- amdlibERROR_MSG errMsg)
-{
- int sentry;
- int dentry;
- size_t vis2Size = srcVis2->nbWlen * sizeof(double);
- int dstNbFrames = dstVis2->nbFrames;
- int finalIndex = insertIndex + srcVis2->nbFrames;
-
- amdlibLogTrace("amdlibInsertVis2()");
- /* Perform simple checks */
- if (insertIndex<0 || insertIndex>=dstVis2->nbFrames)
- {
- amdlibSetErrMsg("Invalid insertion index %d for amdlibInsertVis2",insertIndex);
- return amdlibFAILURE;
- }
- if (dstVis2->nbBases != srcVis2->nbBases)
- {
- amdlibSetErrMsg("Different number of bases (%d and %d)",
- srcVis2->nbBases, dstVis2->nbBases);
- return amdlibFAILURE;
- }
- if (dstVis2->nbWlen != srcVis2->nbWlen)
- {
- amdlibSetErrMsg("Different number of wavelengths (%d and %d)",
- srcVis2->nbWlen, dstVis2->nbWlen);
- return amdlibFAILURE;
- }
- if (dstNbFrames < finalIndex)
- {
- amdlibSetErrMsg("Number of frames (%d) in destination structure"
- "too small to enable insertion of %d frames at position %d",
- dstNbFrames,srcVis2->nbFrames,insertIndex);
- return amdlibFAILURE;
- }
-
- strcpy(dstVis2->dateObs, srcVis2->dateObs);
- /* Insert src in dst at frame insertIndex */
- dentry = insertIndex * dstVis2->nbBases;
- for (sentry = 0; sentry < srcVis2->nbFrames * srcVis2->nbBases; sentry++)
- {
- dstVis2->table[dentry].targetId = srcVis2->table[sentry].targetId;
-
- dstVis2->table[dentry].time = srcVis2->table[sentry].time;
-
- dstVis2->table[dentry].dateObsMJD = srcVis2->table[sentry].dateObsMJD;
-
- dstVis2->table[dentry].expTime = srcVis2->table[sentry].expTime;
-
- memcpy (dstVis2->table[dentry].vis2,
- srcVis2->table[sentry].vis2, vis2Size);
- memcpy (dstVis2->table[dentry].vis2Error,
- srcVis2->table[sentry].vis2Error, vis2Size);
-
- dstVis2->table[dentry].uCoord = srcVis2->table[sentry].uCoord;
-
- dstVis2->table[dentry].vCoord = srcVis2->table[sentry].vCoord;
-
- dstVis2->table[dentry].stationIndex[0] =
- srcVis2->table[sentry].stationIndex[0];
- dstVis2->table[dentry].stationIndex[1] =
- srcVis2->table[sentry].stationIndex[1];
-
- memcpy(dstVis2->table[dentry].flag, srcVis2->table[sentry].flag,
- srcVis2->nbWlen * sizeof(amdlibBOOLEAN));
-
- dentry++;
- }
- /* Update dst fixed size fields by averaging past and added values*/
- dstVis2->vis12 = srcVis2->nbFrames * srcVis2->vis12 +
- insertIndex * dstVis2->vis12;
- dstVis2->vis23 = srcVis2->nbFrames * srcVis2->vis23 +
- insertIndex * dstVis2->vis23;
- dstVis2->vis31 = srcVis2->nbFrames * srcVis2->vis31 +
- insertIndex * dstVis2->vis31;
-
- dstVis2->sigmaVis12 = srcVis2->nbFrames * srcVis2->sigmaVis12 +
- insertIndex * dstVis2->sigmaVis12;
- dstVis2->sigmaVis23 = srcVis2->nbFrames * srcVis2->sigmaVis23 +
- insertIndex * dstVis2->sigmaVis23;
- dstVis2->sigmaVis31 = srcVis2->nbFrames * srcVis2->sigmaVis31 +
- insertIndex * dstVis2->sigmaVis31;
-
-
- dstVis2->vis12 /= (srcVis2->nbFrames+insertIndex);
- dstVis2->vis23 /= (srcVis2->nbFrames+insertIndex);
- dstVis2->vis31 /= (srcVis2->nbFrames+insertIndex);
- dstVis2->sigmaVis12 /= (srcVis2->nbFrames+insertIndex);
- dstVis2->sigmaVis23 /= (srcVis2->nbFrames+insertIndex);
- dstVis2->sigmaVis31 /= (srcVis2->nbFrames+insertIndex);
-
- return amdlibSUCCESS;
-}
-
-/**
- * Merge OI-VIS2.
- *
- * @param vis1 pointer to first OI-VIS2 structure.
- * @param vis2 pointer to second OI-VIS2 structure (to merge).
- * @param isInverted boolean indicating in which order the structures have to
- * be merged.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibMergeVis2(amdlibVIS2 *vis1,
- amdlibVIS2 *vis2,
- amdlibBOOLEAN isInverted,
- amdlibERROR_MSG errMsg)
-{
- amdlibVIS2 mergedVis2 = {NULL};
- amdlibVIS2 *v1, *v2;
-
- amdlibLogTrace("amdlibMergeVis2()");
-
- /* Check phot1 and phot2 have same number of baselines */
- if (vis1->nbBases != vis2->nbBases)
- {
- amdlibSetErrMsg("Different number of baselines (%d and %d)",
- vis1->nbBases, vis2->nbBases);
- return amdlibFAILURE;
- }
-
-
- if (isInverted == amdlibTRUE)
- {
- v1 = vis2;
- v2 = vis1;
- }
- else
- {
- v1 = vis1;
- v2 = vis2;
- }
-
- /* Allocate memory for mergedPhot */
- mergedVis2.thisPtr = NULL;
- if (amdlibAllocateVis2(&mergedVis2, vis1->nbFrames, vis1->nbBases,
- vis1->nbWlen + vis2->nbWlen) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for merged OI-VIS2 structure");
- return amdlibFAILURE;
- }
- if (amdlibCopyVis2From(&mergedVis2, v1, 0, v1->nbWlen,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- if (amdlibCopyVis2From(&mergedVis2, v2, v1->nbWlen, v2->nbWlen,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- free(vis1->table[0].vis2);
- free(vis1->table[0].vis2Error);
- free(vis1->table[0].flag);
-
- free(vis1->table);
- vis1->nbWlen = mergedVis2.nbWlen;
- vis1->nbFrames = mergedVis2.nbFrames;
- vis1->table = mergedVis2.table;
-
- return amdlibSUCCESS;
-}
-
-/**
- * Split amdlibVIS2 input data structure into 3 structures, 1 per spectral
- * band. Each new structure only contains information relative to its associated
- * spectral band .
- *
- * @param srcVis2 pointer on squared visibility structure to split.
- * @param dstVis2 array of splitted squared visibility structures.
- * @param idxFirstWlen array containing the indexes of the first wavelength
- * belonging to each spectral band.
- * @param nbWlen array containing the number of wavelengths per spectral band.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibSplitVis2(amdlibVIS2 *srcVis2,
- amdlibVIS2 *dstVis2,
- int *idxFirstWlen,
- int *nbWlen,
- amdlibERROR_MSG errMsg)
-{
- int band, index, i, j;
-
- amdlibLogTrace("amdlibSplitVis2()");
- for (band=amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- if (nbWlen[band] == 0)
- {
- dstVis2[band].thisPtr = NULL;
- }
- else
- {
- /* Allocate memory for dstVis2 */
- if (amdlibAllocateVis2(&dstVis2[band], srcVis2->nbFrames,
- srcVis2->nbBases,
- nbWlen[band]) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for oivis2 ");
- return amdlibFAILURE;
- }
-
- strcpy(dstVis2[band].dateObs, srcVis2->dateObs);
- dstVis2[band].vis12 = srcVis2->vis12;
- dstVis2[band].vis23 = srcVis2->vis23;
- dstVis2[band].vis31 = srcVis2->vis31;
- dstVis2[band].sigmaVis12 = srcVis2->sigmaVis12;
- dstVis2[band].sigmaVis23 = srcVis2->sigmaVis23;
- dstVis2[band].sigmaVis31 = srcVis2->sigmaVis31;
- for (i=0; i < dstVis2[band].nbFrames * dstVis2[band].nbBases; i++)
- {
- dstVis2[band].table[i].targetId = srcVis2->table[i].targetId;
- dstVis2[band].table[i].time = srcVis2->table[i].time;
- dstVis2[band].table[i].dateObsMJD =
- srcVis2->table[i].dateObsMJD;
- dstVis2[band].table[i].expTime = srcVis2->table[i].expTime;
- dstVis2[band].table[i].uCoord = srcVis2->table[i].uCoord;
- dstVis2[band].table[i].vCoord = srcVis2->table[i].vCoord;
- dstVis2[band].table[i].stationIndex[0] =
- srcVis2->table[i].stationIndex[0];
- dstVis2[band].table[i].stationIndex[1] =
- srcVis2->table[i].stationIndex[1];
-
- index = idxFirstWlen[band];
- for (j=0; j < nbWlen[band]; j++)
- {
- dstVis2[band].table[i].vis2[j] =
- srcVis2->table[i].vis2[index];
- dstVis2[band].table[i].vis2Error[j] =
- srcVis2->table[i].vis2Error[index];
-
- dstVis2[band].table[i].flag[j] =
- srcVis2->table[i].flag[index];
- index++;
- }
-
- }
- }
- }
- return amdlibSUCCESS;
-
-}
-
-/**
- * Duplicate OI-VIS2 if index = 0 or add information relative to wavelengths
- * in first structure else.
- *
- * @param dstVis2 pointer to first OI-VIS2 structure.
- * @param srcVis2 pointer to second OI-VIS2 structure (to be copied).
- * @param index index on the location to place information.
- * @param nbOfElem number of elements to store.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibCopyVis2From(amdlibVIS2 *dstVis2,
- amdlibVIS2 *srcVis2,
- int index,
- int nbOfElem,
- amdlibERROR_MSG errMsg)
-{
- int i, j;
- amdlibLogTrace("amdlibCopyVis2From()");
-
- if ((dstVis2->thisPtr == NULL) && (index != 0))
- {
- amdlibSetErrMsg("Could not copy non-initialized data from index %d",
- index);
- return amdlibFAILURE;
- }
-
- if (srcVis2->thisPtr == NULL)
- {
- /* Nothing to do */
- return amdlibSUCCESS;
- }
-
- if (index == 0)
- {
- strcpy(dstVis2->dateObs, srcVis2->dateObs);
- dstVis2->vis12 = srcVis2->vis12;
- dstVis2->vis23 = srcVis2->vis23;
- dstVis2->vis31 = srcVis2->vis31;
- dstVis2->sigmaVis12 = srcVis2->sigmaVis12;
- dstVis2->sigmaVis23 = srcVis2->sigmaVis23;
- dstVis2->sigmaVis31 = srcVis2->sigmaVis31;
- for (i=0; i < dstVis2->nbFrames * dstVis2->nbBases; i++)
- {
- dstVis2->table[i].targetId = srcVis2->table[i].targetId;
- dstVis2->table[i].time = srcVis2->table[i].time;
- dstVis2->table[i].dateObsMJD = srcVis2->table[i].dateObsMJD;
- dstVis2->table[i].expTime = srcVis2->table[i].expTime;
- dstVis2->table[i].uCoord = srcVis2->table[i].uCoord;
- dstVis2->table[i].vCoord = srcVis2->table[i].vCoord;
- dstVis2->table[i].stationIndex[0] =
- srcVis2->table[i].stationIndex[0];
- dstVis2->table[i].stationIndex[1] =
- srcVis2->table[i].stationIndex[1];
-
- for (j=0; j < srcVis2->nbWlen; j++)
- {
- dstVis2->table[i].vis2[j] = srcVis2->table[i].vis2[j];
- dstVis2->table[i].vis2Error[j] = srcVis2->table[i].vis2Error[j];
- dstVis2->table[i].flag[j] = srcVis2->table[i].flag[j];
- }
- }
- }
- else
- {
- if (dstVis2->nbFrames != srcVis2->nbFrames)
- {
- amdlibSetErrMsg("Different number of frames! (%d and %d)",
- dstVis2->nbFrames, srcVis2->nbFrames);
- return amdlibFAILURE;
- }
- if (dstVis2->nbBases != srcVis2->nbBases)
- {
- amdlibSetErrMsg("Different number of bases (%d and %d)",
- dstVis2->nbBases, srcVis2->nbBases);
- return amdlibFAILURE;
- }
- for (i=0; i < srcVis2->nbFrames * srcVis2->nbBases; i++)
- {
- dstVis2->table[i].targetId = srcVis2->table[i].targetId;
- dstVis2->table[i].time = srcVis2->table[i].time;
- dstVis2->table[i].dateObsMJD = srcVis2->table[i].dateObsMJD;
- dstVis2->table[i].expTime = srcVis2->table[i].expTime;
- dstVis2->table[i].uCoord = srcVis2->table[i].uCoord;
- dstVis2->table[i].vCoord = srcVis2->table[i].vCoord;
- dstVis2->table[i].stationIndex[0]=srcVis2->table[i].stationIndex[0];
- dstVis2->table[i].stationIndex[1]=srcVis2->table[i].stationIndex[1];
- for (j=0; j < nbOfElem; j++)
- {
- dstVis2->table[i].vis2[index+j] = srcVis2->table[i].vis2[j];
- dstVis2->table[i].vis2Error[index+j] =
- srcVis2->table[i].vis2Error[j];
- dstVis2->table[i].flag[index+j] = srcVis2->table[i].flag[j];
- }
- }
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Display squared visibility structure.
- *
- * @param vis2 pointer to amdlibVIS2 structure.
- */
-void amdlibDisplayVis2(amdlibVIS2 *vis2)
-{
- int nbFrames, nbBases, nbWlen;
- int iFrame, iBase, iCell, iWave;
- amdlibDOUBLE vis12;
- amdlibDOUBLE vis23;
- amdlibDOUBLE vis31;
- amdlibDOUBLE sigmaVis12;
- amdlibDOUBLE sigmaVis23;
- amdlibDOUBLE sigmaVis31;
- amdlibVIS2_TABLE_ENTRY cell;
- double visibility2;
- double visibility2Error;
-
- amdlibLogTrace("amdlibDisplayVis2()");
-
- /* Display number of frames */
- nbFrames = vis2->nbFrames;
- printf("nbFrames = %d\n", nbFrames);
-
- /* Display number of base */
- nbBases = vis2->nbBases;
- printf("nbBases = %d\n", nbBases);
-
- /* Display number of wavelength */
- nbWlen = vis2->nbWlen;
- printf("nbWlen = %d\n", nbWlen);
-
- /* Display mean visibility with corresponding error */
- vis12 = vis2->vis12;
- vis23 = vis2->vis23;
- vis31= vis2->vis31;
- sigmaVis12 = vis2->sigmaVis12;
- sigmaVis23 = vis2->sigmaVis23;
- sigmaVis31= vis2->sigmaVis31;
- printf("vis12 = %f - sigmaVis12 = %f\n", vis12, sigmaVis12);
- printf("vis23 = %f - sigmaVis23 = %f\n", vis23, sigmaVis23);
- printf("vis31 = %f - sigmaVis31 = %f\n", vis31, sigmaVis31);
-
- /* Display different arrays[nbFrames][nbBases][nbWlen] */
- for (iFrame = 0; iFrame < nbFrames; iFrame++)
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- /* Set cell[iFrame][iBase] */
- iCell = iFrame * nbBases + iBase;
- cell = vis2->table[iCell];
- printf("---> cell frame/base[%d][%d]\n", iFrame, iBase);
-
- /* Display arrays[nbWlen] */
- for (iWave = 0; iWave < nbWlen; iWave++)
- {
- /* vis2 */
- visibility2 = cell.vis2[iWave];
- printf("vis2[%d][%d][%d] = %f - ", iFrame, iBase, iWave,
- visibility2);
-
- /* vis2Error */
- visibility2Error = cell.vis2Error[iWave];
- printf("vis2Error[%d][%d][%d] = %f\n", iFrame, iBase, iWave,
- visibility2Error);
- }
- }
- }
-}
-
-/**
- * Allocate memory for storing phase closures.
- *
- * @param vis3 pointer to amdlibVIS3 structure.
- * @param nbFrames number of frames
- * @param nbClosures number of phase closures
- * @param nbWlen number of spectral channels
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAllocateVis3(amdlibVIS3 *vis3,
- const int nbFrames,
- const int nbClosures,
- const int nbWlen)
-{
- int dimArray;
- int i; /* loop */
- void *pointer;
- int nbSamples;
-
- amdlibLogTrace("amdlibAllocateVis3()");
-
- /* First free previous allocated memory */
- if (vis3->thisPtr == vis3)
- {
- amdlibFreeVis3(vis3);
- }
-
- /* Update thisPtr */
- vis3->thisPtr= memset(vis3, '\0', sizeof(*vis3));;
-
- /* Set array size */
- vis3->nbFrames = nbFrames;
- vis3->nbClosures = nbClosures;
- vis3->nbWlen = nbWlen;
-
- /* Allocate table pointer list */
- nbSamples=nbFrames * nbClosures;
- vis3->table = calloc(nbSamples, sizeof(*(vis3->table)));
- if (vis3->table == NULL)
- {
- amdlibFreeVis3(vis3);
- return amdlibFAILURE;
- }
-
- /* Allocate 'vis3Amplitude' in each table entry (double) as a whole */
- dimArray = sizeof(double) * nbWlen;
- vis3->table[0].vis3Amplitude = (double *)calloc(nbSamples, dimArray);
- if (vis3->table[0].vis3Amplitude == NULL)
- {
- amdlibFreeVis3(vis3);
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = vis3->table[0].vis3Amplitude;
- i < nbSamples;
- i++, pointer += dimArray)
- {
- vis3->table[i].vis3Amplitude = pointer;
- }
-
- /* Allocate 'vis3AmplitudeError' in each table entry (double) as a whole */
- dimArray = sizeof(double) * nbWlen;
- vis3->table[0].vis3AmplitudeError = (double *)calloc(nbSamples, dimArray);
- if (vis3->table[0].vis3AmplitudeError == NULL)
- {
- amdlibFreeVis3(vis3);
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = vis3->table[0].vis3AmplitudeError;
- i < nbSamples;
- i++, pointer += dimArray)
- {
- vis3->table[i].vis3AmplitudeError=pointer;
- }
- /* Allocate 'vis3Phi' in each table entry (double) as a whole */
- dimArray = sizeof(double) * nbWlen;
- vis3->table[0].vis3Phi = (double *)calloc(nbSamples, dimArray);
- if (vis3->table[0].vis3Phi == NULL)
- {
- amdlibFreeVis3(vis3);
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = vis3->table[0].vis3Phi;
- i < nbSamples;
- i++, pointer += dimArray)
- {
- vis3->table[i].vis3Phi = pointer;
- }
-
- /* Allocate 'vis3PhiError' in each table entry (amdlibCOMPLEX) as a whole */
- dimArray = sizeof(double) * nbWlen;
- vis3->table[0].vis3PhiError = (double *)calloc(nbSamples, dimArray);
- if (vis3->table[0].vis3PhiError == NULL)
- {
- amdlibFreeVis3(vis3);
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = vis3->table[0].vis3PhiError;
- i < nbSamples;
- i++, pointer += dimArray)
- {
- vis3->table[i].vis3PhiError = pointer;
- }
-
- /* Allocate 'flag' in each table entry (boolean) as a whole */
- dimArray = sizeof(amdlibBOOLEAN) * nbWlen;
- vis3->table[0].flag = (amdlibBOOLEAN *)calloc(nbSamples, dimArray);
- if (vis3->table[0].flag == NULL)
- {
- amdlibFreeVis3(vis3);
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = vis3->table[0].flag;
- i < nbSamples;
- i++, pointer += dimArray)
- {
- vis3->table[i].flag = pointer;
- }
-
- /* Return */
- return amdlibSUCCESS;
-}
-
-
-/**
- * Append amdlibVIS3 data structure.
- *
- * @param srcVis3 pointer to source data structure
- * @param dstVis3 pointer to destination data structure (append to)
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAppendVis3(amdlibVIS3 *dstVis3,
- amdlibVIS3 *srcVis3,
- amdlibERROR_MSG errMsg)
-{
- int sentry;
- int dentry;
- size_t arraySize = srcVis3->nbWlen * sizeof(double);
- int oldNbFrames = dstVis3->nbFrames;
-
- amdlibLogTrace("amdlibAppendVis3()");
- /* Perform simple checks */
- if (dstVis3->nbWlen != srcVis3->nbWlen)
- {
- amdlibSetErrMsg("Different number of wavelengths (%d and %d)",
- srcVis3->nbWlen, dstVis3->nbWlen);
- return amdlibFAILURE;
- }
- if (dstVis3->nbClosures != srcVis3->nbClosures)
- {
- amdlibSetErrMsg("Different number of closures (%d and %d)",
- srcVis3->nbClosures, dstVis3->nbClosures);
- return amdlibFAILURE;
- }
-
- /* Reallocate memory to store additional data */
- if (amdlibReallocateVis3(dstVis3,
- oldNbFrames + srcVis3->nbFrames,
- srcVis3->nbClosures,
- srcVis3->nbWlen) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not reallocate memory for visibility structure");
- return amdlibFAILURE;
- }
-
- /* Append fields allocated dynamically */
- dentry = oldNbFrames * dstVis3->nbClosures;
- for (sentry = 0; sentry < srcVis3->nbFrames * srcVis3->nbClosures; sentry++)
- {
- dstVis3->table[dentry].targetId = srcVis3->table[sentry].targetId;
-
- dstVis3->table[dentry].time = srcVis3->table[sentry].time;
-
- dstVis3->table[dentry].dateObsMJD = srcVis3->table[sentry].dateObsMJD;
-
- dstVis3->table[dentry].expTime = srcVis3->table[sentry].expTime;
-
- dstVis3->table[dentry].u1Coord = srcVis3->table[sentry].u1Coord;
- dstVis3->table[dentry].v1Coord = srcVis3->table[sentry].v1Coord;
- dstVis3->table[dentry].u2Coord = srcVis3->table[sentry].u2Coord;
- dstVis3->table[dentry].v2Coord = srcVis3->table[sentry].v2Coord;
-
- dstVis3->table[dentry].stationIndex[0] =
- srcVis3->table[sentry].stationIndex[0];
- dstVis3->table[dentry].stationIndex[1] =
- srcVis3->table[sentry].stationIndex[1];
- dstVis3->table[dentry].stationIndex[2] =
- srcVis3->table[sentry].stationIndex[2];
-
- memcpy(dstVis3->table[dentry].vis3Amplitude,
- srcVis3->table[sentry].vis3Amplitude, arraySize);
- memcpy(dstVis3->table[dentry].vis3AmplitudeError,
- srcVis3->table[sentry].vis3AmplitudeError, arraySize);
-
- memcpy(dstVis3->table[dentry].vis3Phi,
- srcVis3->table[sentry].vis3Phi, arraySize);
- memcpy(dstVis3->table[dentry].vis3PhiError,
- srcVis3->table[sentry].vis3PhiError, arraySize);
-
- memcpy(dstVis3->table[dentry].flag, srcVis3->table[sentry].flag,
- srcVis3->nbWlen * sizeof(amdlibBOOLEAN));
-
- dentry++;
- }
-
- /* Update fixed size fields */
- dstVis3->averageClosure = srcVis3->nbFrames * srcVis3->averageClosure +
- oldNbFrames * dstVis3->averageClosure;
-
- dstVis3->averageClosure /= dstVis3->nbFrames;
-
- dstVis3->averageClosureError = srcVis3->nbFrames * srcVis3->averageClosureError +
- oldNbFrames * dstVis3->averageClosureError;
-
- dstVis3->averageClosureError /= dstVis3->nbFrames;
-
- return amdlibSUCCESS;
-}
-
-/**
- * Insert amdlibVIS3 data structure.
- *
- * @param srcVis3 pointer to source data structure
- * @param dstVis3 pointer to destination data structure (insert to)
- * @param insertIndex
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibInsertVis3(amdlibVIS3 *dstVis3,
- amdlibVIS3 *srcVis3,
- int insertIndex,
- amdlibERROR_MSG errMsg)
-{
- int sentry;
- int dentry;
- size_t vis3Size = srcVis3->nbWlen * sizeof(double);
- int dstNbFrames = dstVis3->nbFrames;
- int finalIndex = insertIndex + srcVis3->nbFrames;
-
- amdlibLogTrace("amdlibInsertVis3()");
- /* Perform simple checks */
- if (insertIndex<0 || insertIndex>=dstVis3->nbFrames)
- {
- amdlibSetErrMsg("Invalid insertion index %d for amdlibInsertVis3",insertIndex);
- return amdlibFAILURE;
- }
- if (dstVis3->nbWlen != srcVis3->nbWlen)
- {
- amdlibSetErrMsg("Different number of wavelengths (%d and %d)",
- srcVis3->nbWlen, dstVis3->nbWlen);
- return amdlibFAILURE;
- }
- if (dstVis3->nbClosures != srcVis3->nbClosures)
- {
- amdlibSetErrMsg("Different number of closures (%d and %d)",
- srcVis3->nbClosures, dstVis3->nbClosures);
- return amdlibFAILURE;
- }
- if (dstNbFrames < finalIndex)
- {
- amdlibSetErrMsg("Number of frames (%d) in destination structure"
- "too small to enable insertion of %d frames at position %d",
- dstNbFrames,srcVis3->nbFrames,insertIndex);
- return amdlibFAILURE;
- }
-
- strcpy(dstVis3->dateObs, srcVis3->dateObs);
- /* Insert src in dst at frame insertIndex */
- dentry = insertIndex * dstVis3->nbClosures;
- for (sentry = 0; sentry < srcVis3->nbFrames * srcVis3->nbClosures; sentry++)
- {
- dstVis3->table[dentry].targetId = srcVis3->table[sentry].targetId;
-
- dstVis3->table[dentry].time = srcVis3->table[sentry].time;
-
- dstVis3->table[dentry].dateObsMJD = srcVis3->table[sentry].dateObsMJD;
-
- dstVis3->table[dentry].expTime = srcVis3->table[sentry].expTime;
-
- memcpy(dstVis3->table[dentry].vis3Amplitude,
- srcVis3->table[sentry].vis3Amplitude, vis3Size);
- memcpy(dstVis3->table[dentry].vis3AmplitudeError,
- srcVis3->table[sentry].vis3AmplitudeError, vis3Size);
-
- memcpy(dstVis3->table[dentry].vis3Phi,
- srcVis3->table[sentry].vis3Phi, vis3Size);
- memcpy(dstVis3->table[dentry].vis3PhiError,
- srcVis3->table[sentry].vis3PhiError, vis3Size);
-
- dstVis3->table[dentry].u1Coord = srcVis3->table[sentry].u1Coord;
- dstVis3->table[dentry].v1Coord = srcVis3->table[sentry].v1Coord;
- dstVis3->table[dentry].u2Coord = srcVis3->table[sentry].u2Coord;
- dstVis3->table[dentry].v2Coord = srcVis3->table[sentry].v2Coord;
-
- dstVis3->table[dentry].stationIndex[0] =
- srcVis3->table[sentry].stationIndex[0];
- dstVis3->table[dentry].stationIndex[1] =
- srcVis3->table[sentry].stationIndex[1];
- dstVis3->table[dentry].stationIndex[2] =
- srcVis3->table[sentry].stationIndex[2];
-
- memcpy(dstVis3->table[dentry].flag, srcVis3->table[sentry].flag,
- srcVis3->nbWlen * sizeof(amdlibBOOLEAN));
-
- dentry++;
- }
-
- /* Update fixed size fields */
- dstVis3->averageClosure = srcVis3->nbFrames * srcVis3->averageClosure +
- insertIndex * dstVis3->averageClosure;
- dstVis3->averageClosure /= (srcVis3->nbFrames+insertIndex);
-
- dstVis3->averageClosureError = srcVis3->nbFrames * srcVis3->averageClosureError +
- insertIndex * dstVis3->averageClosureError;
- dstVis3->averageClosureError /= (srcVis3->nbFrames+insertIndex);
-
- return amdlibSUCCESS;
-}
-
-
-/**
- * Merge amdlibVIS3.
- *
- * @param vis1 pointer to first OI-VIS3 structure.
- * @param vis2 pointer to second OI-VIS3 structure (to merge).
- * @param isInverted boolean indicating in which order the structures have to
- * be merged.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibMergeVis3(amdlibVIS3 *vis1,
- amdlibVIS3 *vis2,
- amdlibBOOLEAN isInverted,
- amdlibERROR_MSG errMsg)
-{
- amdlibVIS3 mergedVis3 = {NULL};
- amdlibVIS3 *v1, *v2;
-
- amdlibLogTrace("amdlibMergeVis3()");
-
- /* Check phot1 and phot2 have same number of baselines */
- if (vis1->nbClosures != vis2->nbClosures)
- {
- amdlibSetErrMsg("Different number of closures (%d and %d)",
- vis1->nbClosures, vis2->nbClosures);
- return amdlibFAILURE;
- }
-
- /* Allocate memory for mergedPhot */
- mergedVis3.thisPtr = NULL;
- if (amdlibAllocateVis3(&mergedVis3, vis1->nbFrames, vis1->nbClosures,
- vis1->nbWlen + vis2->nbWlen) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for merged OI-VIS3 structure");
- return amdlibFAILURE;
- }
-
- if (isInverted == amdlibTRUE)
- {
- v1 = vis2;
- v2 = vis1;
- }
- else
- {
- v1 = vis1;
- v2 = vis2;
- }
-
- if (amdlibCopyVis3From(&mergedVis3, v1, 0, v1->nbWlen,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- if (amdlibCopyVis3From(&mergedVis3, v2, v1->nbWlen, v2->nbWlen,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
-
- free(vis1->table[0].vis3Amplitude);
- free(vis1->table[0].vis3AmplitudeError);
- free(vis1->table[0].vis3Phi);
- free(vis1->table[0].vis3PhiError);
- free(vis1->table[0].flag);
-
- free(vis1->table);
- vis1->nbWlen = mergedVis3.nbWlen;
- vis1->nbFrames = mergedVis3.nbFrames;
- vis1->table = mergedVis3.table;
-
- return amdlibSUCCESS;
-}
-
-/**
- * Split amdlibVIS3 input data structure into 3 structures, 1 per spectral
- * band. Each new structure only contains information relative to its associated
- * spectral band .
- *
- * @param srcVis3 pointer on closure phases structure to split.
- * @param dstVis3 array of splitted closure phases structures.
- * @param idxFirstWlen array containing the indexes of the first wavelength
- * belonging to each spectral band.
- * @param nbWlen array containing the number of wavelengths per spectral band.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibSplitVis3(amdlibVIS3 *srcVis3,
- amdlibVIS3 *dstVis3,
- int *idxFirstWlen,
- int *nbWlen,
- amdlibERROR_MSG errMsg)
-{
- int band, index, i, j;
-
- amdlibLogTrace("amdlibSplitVis3()");
-
- for (band=amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- if (nbWlen[band] == 0)
- {
- dstVis3[band].thisPtr = NULL;
- }
- else
- {
- /* Allocate memory for dstVis3 */
- if (amdlibAllocateVis3(&dstVis3[band], srcVis3->nbFrames,
- srcVis3->nbClosures,
- nbWlen[band]) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for oivis3");
- return amdlibFAILURE;
- }
-
- strcpy(dstVis3[band].dateObs, srcVis3->dateObs);
- dstVis3[band].averageClosure = srcVis3->averageClosure;
- dstVis3[band].averageClosureError = srcVis3->averageClosureError;
-
- /* Copy values in destVis3[band] */
- for (i=0; i < srcVis3->nbFrames * srcVis3->nbClosures; i++)
- {
- dstVis3[band].table[i].targetId = srcVis3->table[i].targetId;
- dstVis3[band].table[i].time = srcVis3->table[i].time;
- dstVis3[band].table[i].dateObsMJD =
- srcVis3->table[i].dateObsMJD;
- dstVis3[band].table[i].expTime = srcVis3->table[i].expTime;
- dstVis3[band].table[i].u1Coord = srcVis3->table[i].u1Coord;
- dstVis3[band].table[i].u2Coord = srcVis3->table[i].u2Coord;
- dstVis3[band].table[i].v1Coord = srcVis3->table[i].v1Coord;
- dstVis3[band].table[i].v2Coord = srcVis3->table[i].v2Coord;
- dstVis3[band].table[i].stationIndex[0] =
- srcVis3->table[i].stationIndex[0];
- dstVis3[band].table[i].stationIndex[1] =
- srcVis3->table[i].stationIndex[1];
- dstVis3[band].table[i].stationIndex[2] =
- srcVis3->table[i].stationIndex[2];
-
- index = idxFirstWlen[band];
- for (j=0; j < nbWlen[band]; j++)
- {
- dstVis3[band].table[i].vis3Amplitude[j] =
- srcVis3->table[i].vis3Amplitude[index];
- dstVis3[band].table[i].vis3AmplitudeError[j] =
- srcVis3->table[i].vis3AmplitudeError[index];
- dstVis3[band].table[i].vis3Phi[j] =
- srcVis3->table[i].vis3Phi[index];
- dstVis3[band].table[i].vis3PhiError[j] =
- srcVis3->table[i].vis3PhiError[index];
- dstVis3[band].table[i].flag[j] =
- srcVis3->table[i].flag[index];
- index ++;
- }
- }
- }
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Duplicate OI-VIS3 if index = 0 or add information relative to wavelengths
- * in first structure else.
- *
- * @param dstVis3 pointer to first OI-VIS3 structure.
- * @param srcVis3 pointer to second OI-VIS3 structure (to be copied).
- * @param index index on the location to place information.
- * @param nbOfElem number of elements to store.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibCopyVis3From(amdlibVIS3 *dstVis3,
- amdlibVIS3 *srcVis3,
- int index,
- int nbOfElem,
- amdlibERROR_MSG errMsg)
-{
- int i, j;
- amdlibLogTrace("amdlibCopyVis3From()");
-
- if ((dstVis3->thisPtr == NULL) && (index != 0))
- {
- amdlibSetErrMsg("Could not copy non-initialized data from index %d",
- index);
- return amdlibFAILURE;
- }
-
- if (srcVis3->thisPtr == NULL)
- {
- /* Nothing to do */
- return amdlibSUCCESS;
- }
-
- if (index == 0)
- {
- strcpy(dstVis3->dateObs, srcVis3->dateObs);
- dstVis3->averageClosure = srcVis3->averageClosure;
- dstVis3->averageClosureError = srcVis3->averageClosureError;
-
- /* Copy values in mergedVis3 */
- for (i=0; i < srcVis3->nbFrames * srcVis3->nbClosures; i++)
- {
- dstVis3->table[i].targetId = srcVis3->table[i].targetId;
- dstVis3->table[i].time = srcVis3->table[i].time;
- dstVis3->table[i].dateObsMJD = srcVis3->table[i].dateObsMJD;
- dstVis3->table[i].expTime = srcVis3->table[i].expTime;
- dstVis3->table[i].u1Coord = srcVis3->table[i].u1Coord;
- dstVis3->table[i].u2Coord = srcVis3->table[i].u2Coord;
- dstVis3->table[i].v1Coord = srcVis3->table[i].v1Coord;
- dstVis3->table[i].v2Coord = srcVis3->table[i].v2Coord;
- dstVis3->table[i].stationIndex[0] =
- srcVis3->table[i].stationIndex[0];
- dstVis3->table[i].stationIndex[1] =
- srcVis3->table[i].stationIndex[1];
- dstVis3->table[i].stationIndex[2] =
- srcVis3->table[i].stationIndex[2];
-
- for (j=0; j < srcVis3->nbWlen; j++)
- {
- dstVis3->table[i].vis3Amplitude[j] =
- srcVis3->table[i].vis3Amplitude[j];
- dstVis3->table[i].vis3AmplitudeError[j] =
- srcVis3->table[i].vis3AmplitudeError[j];
- dstVis3->table[i].vis3Phi[j] = srcVis3->table[i].vis3Phi[j];
- dstVis3->table[i].vis3PhiError[j] =
- srcVis3->table[i].vis3PhiError[j];
- dstVis3->table[i].flag[j] = srcVis3->table[i].flag[j];
- }
- }
- }
- else
- {
- if (dstVis3->nbFrames != srcVis3->nbFrames)
- {
- amdlibSetErrMsg("Different number of frames! (%d and %d)",
- dstVis3->nbFrames, srcVis3->nbFrames);
- return amdlibFAILURE;
- }
- if (dstVis3->nbClosures != srcVis3->nbClosures)
- {
- amdlibSetErrMsg("Different number of bases (%d and %d)",
- dstVis3->nbClosures, srcVis3->nbClosures);
- return amdlibFAILURE;
- }
- for (i=0; i < dstVis3->nbFrames * dstVis3->nbClosures; i++)
- {
- for (j=0; j < nbOfElem; j++)
- {
- dstVis3->table[i].vis3Amplitude[index+j] =
- srcVis3->table[i].vis3Amplitude[j];
- dstVis3->table[i].vis3AmplitudeError[index+j] =
- srcVis3->table[i].vis3AmplitudeError[j];
- dstVis3->table[i].vis3Phi[index+j] =
- srcVis3->table[i].vis3Phi[j];
- dstVis3->table[i].vis3PhiError[index+j] =
- srcVis3->table[i].vis3PhiError[j];
- dstVis3->table[i].flag[index+j] = srcVis3->table[i].flag[j];
- }
- }
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Display phase closure structure.
- *
- * @param vis3 pointer to amdlibVIS3 structure.
- */
-void amdlibDisplayVis3(amdlibVIS3 *vis3)
-{
- int nbFrames, nbClosures, nbWlen;
- int iFrame, iClosure, iCell, iWave;
- amdlibDOUBLE averageClosure;
- amdlibDOUBLE averageClosureError;
- amdlibVIS3_TABLE_ENTRY cell;
- double vis3Amplitude;
- double vis3AmplitudeError;
- double vis3Phi;
- double vis3PhiError;
-
- amdlibLogTrace("amdlibDisplayVis3()");
-
- /* Display number of frames */
- nbFrames = vis3->nbFrames;
- printf("nbFrames = %d\n", nbFrames);
-
- /* Display number of closure phase */
- nbClosures = vis3->nbClosures;
- printf("nbClosures = %d\n", nbClosures);
-
- /* Display number of wavelength */
- nbWlen = vis3->nbWlen;
- printf("nbWlen = %d\n", nbWlen);
-
- /* Display mean visibility with corresponding error */
- averageClosure = vis3->averageClosure;
- averageClosureError = vis3->averageClosureError;
- printf("averageClosure = %f - ", averageClosure);
- printf("averageClosureError = %f\n", averageClosureError);
-
- /* Display different arrays[nbFrames][nbBases][nbWlen] */
- for (iFrame = 0; iFrame < nbFrames; iFrame++)
- {
- for (iClosure = 0; iClosure < nbClosures; iClosure++)
- {
- /* Set cell[iFrame][iBase] */
- iCell = iFrame * nbClosures + iClosure;
- cell = vis3->table[iCell];
- printf("---> cell frame/base[%d][%d]\n", iFrame, iClosure);
-
- /* Display arrays[nbWlen] */
- for (iWave = 0; iWave < nbWlen; iWave++)
- {
- /* vis3Amplitude */
- vis3Amplitude = cell.vis3Amplitude[iWave];
- printf("vis3Amplitude[%d][%d][%d] = %f - ", iFrame, iClosure,
- iWave, vis3Amplitude);
-
- /* vis3AmplitudeError */
- vis3AmplitudeError = cell.vis3AmplitudeError[iWave];
- printf("vis3AmplitudeError[%d][%d][%d] = %f\n", iFrame,
- iClosure, iWave, vis3AmplitudeError);
- /* vis3Phi */
- vis3Phi = cell.vis3Phi[iWave];
- printf("vis3Phi[%d][%d][%d] = %f - ", iFrame, iClosure,
- iWave, vis3Phi);
-
- /* vis3PhiError */
- vis3PhiError = cell.vis3PhiError[iWave];
- printf("vis3PhiError[%d][%d][%d] = %f\n", iFrame, iClosure,
- iWave, vis3PhiError);
- }
- }
- }
-}
-
-/**
- * Allocate memory for storing wavelenghts.
- *
- * @param wave pointer to amdlibWAVELENGTH structure.
- * @param nbWlen number of spectral channels
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAllocateWavelength(amdlibWAVELENGTH *wave,
- const int nbWlen,
- amdlibERROR_MSG errMsg)
-{
- amdlibLogTrace("amdlibAllocateWavelength()");
-
- /* First free previous allocated memory */
- if (wave->thisPtr == wave)
- {
- amdlibFreeWavelength(wave);
- }
-
- /* Init data structure */
- wave->thisPtr = memset(wave, '\0', sizeof(*wave));
- /* Set array size */
- wave->nbWlen = nbWlen;
-
- /* Allocate table pointer list */
- wave->wlen = calloc(nbWlen, sizeof(amdlibDOUBLE));
- if (wave->wlen == NULL)
- {
- amdlibFreeWavelength(wave);
- amdlibSetErrMsg("%s wavelength array : %ld required",
- amdlibERR_ALLOC_MEM, (long)(nbWlen * sizeof(amdlibDOUBLE)));
- return amdlibFAILURE;
- }
-
- wave->bandwidth = calloc(nbWlen, sizeof(amdlibDOUBLE));
- if (wave->bandwidth == NULL)
- {
- amdlibFreeWavelength(wave);
- amdlibSetErrMsg("%s bandwidth array : %ld required",
- amdlibERR_ALLOC_MEM, (long)(nbWlen * sizeof(amdlibDOUBLE)));
- return amdlibFAILURE;
- }
- /* Return */
- return amdlibSUCCESS;
-}
-
-/**
- * Check if input wavelenghts are similar.
- *
- * @param wave1 pointer to first amdlibWAVELENGTH structure.
- * @param wave2 pointer to second amdlibWAVELENGTH structure.
- * @param errMsg error description message returned if function fails or if
- * wavelengths differ.
- *
- * @return
- * amdlibTRUE if both structures are identical, amdlibFALSE if they are not.
- */
-amdlibBOOLEAN amdlibCompareWavelengths(amdlibWAVELENGTH *wave1,
- amdlibWAVELENGTH *wave2,
- amdlibERROR_MSG errMsg)
-{
- int l;
-
- amdlibLogTrace("amdlibCompareWavelengths()");
-
- if ((wave1 == NULL) || (wave2 == NULL))
- {
- amdlibSetErrMsg("Invalid input parameter: NULL value");
- return amdlibFALSE;
- }
-
- if (wave1->nbWlen != wave2->nbWlen)
- {
- amdlibSetErrMsg("Different number of wavelengths");
- return amdlibFALSE;
- }
-
- for (l = 0; l < wave1->nbWlen; l++)
- {
- if (wave1->wlen[l] != wave2->wlen[l])
- {
- amdlibSetErrMsg("Different values in wlen array found");
- return amdlibFALSE;
- }
- }
-
- for (l = 0; l < wave1->nbWlen; l++)
- {
- if (wave1->bandwidth[l] != wave2->bandwidth[l])
- {
- amdlibSetErrMsg("Different in bandwidth array found");
- return amdlibFALSE;
- }
- }
-
- return amdlibTRUE;
-}
-
-/**
- * Merge wavelength structures.
- *
- * This function merges input wavelength structures and store the result in the
- * first one.
- *
- * @param wave1 pointer to first amdlibWAVELENGTH structure.
- * @param wave2 pointer to second amdlibWAVELENGTH structure (to merge).
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibMergeWavelengths(amdlibWAVELENGTH *wave1,
- amdlibWAVELENGTH *wave2,
- amdlibERROR_MSG errMsg)
-{
- amdlibWAVELENGTH *w1, *w2;
- amdlibWAVELENGTH merge = {NULL};
- amdlibDOUBLE upperBound1, upperBound2, lowerBound1, lowerBound2;
- int isIncresing1, isIncresing2;
- int i, j;
-
- amdlibLogTrace("amdlibMergeWavelengths()");
- /* Check wavelengths are sorted both increasing or both decreasing */
- if (wave1->wlen[wave1->nbWlen-1] - wave1->wlen[0] > 0)
- {
- upperBound1 = wave1->wlen[wave1->nbWlen-1];
- lowerBound1 = wave1->wlen[0];
- isIncresing1 = 1;
- }
- else
- {
- upperBound1 = wave1->wlen[0];
- lowerBound1 = wave1->wlen[wave1->nbWlen-1];
- isIncresing1 = 0;
- }
- if (wave2->wlen[wave2->nbWlen-1] - wave2->wlen[0] > 0)
- {
- upperBound2 = wave2->wlen[wave2->nbWlen-1];
- lowerBound2 = wave2->wlen[0];
- isIncresing2 = 1;
- }
- else
- {
- upperBound2 = wave2->wlen[0];
- lowerBound2 = wave2->wlen[wave2->nbWlen-1];
- isIncresing2 = 0;
- }
-
- if (isIncresing1 != isIncresing2)
- {
- amdlibSetErrMsg("Wavelengths are not sorted in the same order");
- return amdlibFAILURE;
- }
-
- /* Order the structures to be copied */
- if (upperBound1 < upperBound2)
- {
- /* Check there is no cover in wavelengths */
- if (upperBound1 >= lowerBound2)
- {
- amdlibSetErrMsg("Wavelengths are incompatible");
- return amdlibFAILURE;
- }
- w1 = wave2;
- w2 = wave1;
- }
- else
- {
- /* Check there is no cover in wavelengths */
- if (upperBound2 >= lowerBound1)
- {
- amdlibSetErrMsg("Wavelengths are incompatible");
- return amdlibFAILURE;
- }
- w1 = wave1;
- w2 = wave2;
- }
-
- /* Allocate memory for merged structure */
- if (amdlibAllocateWavelength(&merge, w1->nbWlen + w2->nbWlen, errMsg) !=
- amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- /* Copy good values into result structure */
- i = 0;
- while (i < w1->nbWlen)
- {
- merge.wlen[i] = w1->wlen[i];
- merge.bandwidth[i] = w1->bandwidth[i];
- i++;
- }
- for (j = 0; j < w2->nbWlen; j++)
- {
- merge.wlen[i+j] = w2->wlen[j];
- merge.bandwidth[i+j] = w2->bandwidth[j];
- }
-
- wave1->nbWlen = merge.nbWlen;
- free(wave1->wlen);
- free(wave1->bandwidth);
- wave1->wlen = merge.wlen;
- wave1->bandwidth = merge.bandwidth;
-
- return amdlibSUCCESS;
-}
-
-/**
- * Split amdlibWAVELENGTH input data structure into 3 structures, 1 per spectral
- * band. Each new structure only contains information relative to its associated
- * spectral band .
- *
- * @param srcWave pointer on wavelength structure to split.
- * @param dstWave array of splitted wavelength structures.
- * @param idxFirstWlen array containing the indexes of the first wavelength
- * belonging to each spectral band.
- * @param nbWlen array containing the number of wavelengths per spectral band.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibSplitWavelength(amdlibWAVELENGTH *srcWave,
- amdlibWAVELENGTH *dstWave,
- int *idxFirstWlen,
- int *nbWlen,
- amdlibERROR_MSG errMsg)
-{
- int band, index, j;
-
- amdlibLogTrace("amdlibSplitWavelength()");
-
- for (band=amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- if (nbWlen[band] == 0)
- {
- dstWave[band].thisPtr = NULL;
- }
- else
- {
- /* Allocate memory for dstWave */
- if (amdlibAllocateWavelength(&dstWave[band], nbWlen[band], errMsg)
- != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- index = idxFirstWlen[band];
- for (j=0; j < nbWlen[band]; j++)
- {
- dstWave[band].wlen[j] = srcWave->wlen[index];
- dstWave[band].bandwidth[j] = srcWave->bandwidth[index];
- index ++;
- }
- }
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Display spectral dispersion structure.
- *
- * @param wavelength pointer to amdlibWAVELENGTH structure.
- */
-void amdlibDisplayWavelength(amdlibWAVELENGTH *wavelength)
-{
- int nbWlen, i;
-
- amdlibLogTrace("amdlibDisplayWavelength()");
-
- /* Display number of wavelength */
- nbWlen = wavelength->nbWlen;
- printf("nbWlen = %d\n", nbWlen);
-
- /* Display wavelength array and corresponding bandwidth array */
- for (i = 0; i < nbWlen; i++)
- {
- printf("nbWlen[%d] = %f - ", i, wavelength->wlen[i]);
- printf("bandWidth[%d] = %f\n", i, wavelength->bandwidth[i]);
- }
-}
-
-/**
- * Allocate memory for storing observed targets.
- *
- * @param target pointer to amdlibOI_TARGET structure.
- * @param nbElements number of observed targets
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAllocateOiTarget(amdlibOI_TARGET *target,
- const int nbElements)
-{
- amdlibLogTrace("amdlibAllocateOiTarget()");
-
- /* First free previous allocated memory */
- if (target->thisPtr == target)
- {
- amdlibFreeOiTarget(target);
- }
-
- /* Init data structure */
- target->thisPtr = memset(target, '\0', sizeof(*target));
- /* Set array size */
- target->nbTargets = nbElements;
-
- /* Allocate table pointer list */
- if (nbElements > 0)
- {
- target->element = calloc(nbElements, sizeof(*(target->element)));
- if (target->element == NULL)
- {
- amdlibFreeOiTarget(target);
- return amdlibFAILURE;
- }
- }
- /* Return */
- return amdlibSUCCESS;
-}
-
-/**
- * Merge structures containing information on different bands.
- *
- * @param wave pointer on merged wavelength data structure.
- * @param imdWave pointer on wavelength data structure to merge.
- * @param phot pointer on merged photometry data structure.
- * @param imdPhot pointer on photometry data structure to merge.
- * @param vis pointer on merged OI-VIS data structure.
- * @param imdVis pointer on OI-VIS data structure to merge.
- * @param vis2 pointer on merged OI-VIS2 data structure.
- * @param imdVis2 pointer on OI-VIS2 data structure to merge.
- * @param vis3 pointer on merged OI-VIS3 data structure.
- * @param imdVis3 pointer on OI-VIS3 data structure to merge.
- * @param opd pointer on merged piston data structure.
- * @param imdOpd pointer on piston data structure to merge.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibMergeOiStructures(amdlibWAVELENGTH *wave,
- amdlibWAVELENGTH *imdWave,
- amdlibPHOTOMETRY *phot,
- amdlibPHOTOMETRY *imdPhot,
- amdlibVIS *vis,
- amdlibVIS *imdVis,
- amdlibVIS2 *vis2,
- amdlibVIS2 *imdVis2,
- amdlibVIS3 *vis3,
- amdlibVIS3 *imdVis3,
- amdlibPISTON *opd,
- amdlibPISTON *imdOpd,
- amdlibERROR_MSG errMsg)
-{
- amdlibBOOLEAN isInverted = amdlibFALSE;
- int i;
-
- amdlibLogTrace("amdlibMergeOiStructures()");
- /* Merge wavelength data structures */
- if (wave->thisPtr == NULL)
- {
- if (imdWave->thisPtr == NULL)
- {
- amdlibSetErrMsg("No wavelength structures");
- return amdlibFAILURE;
- }
- else
- {
- /* Copy imdWave in wave */
- if (amdlibAllocateWavelength(wave, imdWave->nbWlen, errMsg) !=
- amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- for (i = 0; i < wave->nbWlen; i++)
- {
- wave->wlen[i] = imdWave->wlen[i];
- wave->bandwidth[i] = imdWave->bandwidth[i];
- }
- }
- }
- else
- {
- if(imdWave->thisPtr != NULL)
- {
- if (amdlibMergeWavelengths(wave, imdWave, errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- if (wave->wlen[0] == imdWave->wlen[0])
- {
- isInverted = amdlibTRUE;
- }
- }
- }
-
- /* Merge photometries */
- if (phot->thisPtr == NULL)
- {
- if (imdPhot->thisPtr == NULL)
- {
- amdlibSetErrMsg("No photometry structures");
- return amdlibFAILURE;
- }
- else
- {
- /* Allocate memory for phot */
- if (amdlibAllocatePhotometry(phot, imdPhot->nbFrames,
- imdPhot->nbBases,
- imdPhot->nbWlen) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for photometry");
- return amdlibFAILURE;
- }
-
- /* Copy imdPhot in phot */
- if (amdlibCopyPhotFrom(phot, imdPhot, 0, imdPhot->nbWlen,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- }
- }
- else
- {
- if (imdPhot->thisPtr != NULL)
- {
- if (amdlibMergePhotometry(phot, imdPhot, isInverted,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- }
- }
-
- /* Merge vis */
- if (vis->thisPtr == NULL)
- {
- if (imdVis->thisPtr == NULL)
- {
- amdlibSetErrMsg("No vis structures");
- return amdlibFAILURE;
- }
- else
- {
- /* Copy imdVis in vis */
- if (amdlibAllocateVis(vis, imdVis->nbFrames,
- imdVis->nbBases,
- imdVis->nbWlen) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for vis");
- return amdlibFAILURE;
- }
- if (amdlibCopyVisFrom(vis, imdVis, 0, imdVis->nbWlen,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- }
- }
- else
- {
- if (imdVis->thisPtr != NULL)
- {
- if (amdlibMergeVis(vis, imdVis, isInverted,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- }
- }
-
- /* Merge vis2 */
- if (vis2->thisPtr == NULL)
- {
- if (imdVis2->thisPtr == NULL)
- {
- amdlibLogWarning("No vis2 structures");
- }
- else
- {
- /* Copy imdVis2 in vis2 */
- if (amdlibAllocateVis2(vis2, imdVis2->nbFrames, imdVis2->nbBases,
- imdVis2->nbWlen) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for vis2");
- return amdlibFAILURE;
- }
- if (amdlibCopyVis2From(vis2, imdVis2, 0, imdVis2->nbWlen,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- }
- }
- else
- {
- if (imdVis2->thisPtr != NULL)
- {
- if (amdlibMergeVis2(vis2, imdVis2, isInverted,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- }
- }
-
- /* Merge vis3 */
- if (vis3->thisPtr == NULL)
- {
- if (imdVis3->thisPtr == NULL)
- {
- amdlibLogWarning("No vis3 structures");
- }
- else
- {
- /* Copy imdVis3 in vis3 */
- if (amdlibAllocateVis3(vis3, imdVis3->nbFrames, imdVis3->nbClosures,
- imdVis3->nbWlen) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for vis3");
- return amdlibFAILURE;
- }
- if (amdlibCopyVis3From(vis3, imdVis3, 0, imdVis3->nbWlen,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- }
- }
- else
- {
- if (imdVis3->thisPtr != NULL)
- {
- if (amdlibMergeVis3(vis3, imdVis3, isInverted,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- }
- }
-
- if (opd->thisPtr == NULL)
- {
- if (imdOpd->thisPtr == NULL)
- {
- amdlibLogWarning("No opd structures");
- }
- else
- {
- /* Copy imdOpd in opd */
- if (amdlibAllocatePiston(opd, imdOpd->nbFrames,
- imdOpd->nbBases) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for opd");
- return amdlibFAILURE;
- }
- for (i=0; i < amdlibNB_BANDS; i++)
- {
- opd->bandFlag[i] = imdOpd->bandFlag[i];
- memcpy(opd->pistonOPDArray[i], imdOpd->pistonOPDArray[i],
- opd->nbFrames * opd->nbBases * sizeof(amdlibDOUBLE));
- memcpy(opd->sigmaPistonArray[i], imdOpd->sigmaPistonArray[i],
- opd->nbFrames * opd->nbBases * sizeof(amdlibDOUBLE));
- }
- memcpy(opd->pistonOPD, imdOpd->pistonOPD,
- opd->nbFrames * opd->nbBases * sizeof(amdlibDOUBLE));
- memcpy(opd->sigmaPiston, imdOpd->sigmaPiston,
- opd->nbFrames * opd->nbBases * sizeof(amdlibDOUBLE));
- }
- }
- else
- {
- if (imdOpd->thisPtr != NULL)
- {
- if (amdlibMergePiston(opd, imdOpd,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- }
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Split oi-data into structures containing information on different bands.
- *
- * @param wave pointer on input wavelength data structure.
- * @param imdWave array of result wavelength data structures.
- * @param phot pointer on input photometry data structure.
- * @param imdPhot array of result photometry data structures.
- * @param vis pointer on input OI-VIS data structure.
- * @param imdVis array of result OI-VIS data structures.
- * @param vis2 pointer on input OI-VIS2 data structure.
- * @param imdVis2 array of result OI-VIS2 data structures.
- * @param vis3 pointer on input OI-VIS3 data structure.
- * @param imdVis3 array of result OI-VIS3 data structures.
- * @param opd pointer on input piston data structure.
- * @param imdOpd array of result piston data structures.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibSplitOiStructures(amdlibWAVELENGTH *wave,
- amdlibWAVELENGTH *imdWave,
- amdlibPHOTOMETRY *phot,
- amdlibPHOTOMETRY *imdPhot,
- amdlibVIS *vis,
- amdlibVIS *imdVis,
- amdlibVIS2 *vis2,
- amdlibVIS2 *imdVis2,
- amdlibVIS3 *vis3,
- amdlibVIS3 *imdVis3,
- amdlibPISTON *opd,
- amdlibPISTON *imdOpd,
- amdlibERROR_MSG errMsg)
-{
- int idxFirstWlen[amdlibNB_BANDS] = {-1, -1, -1};
- int nbWlen[amdlibNB_BANDS] = {0, 0, 0};
- int i, band;
-
- amdlibLogTrace("amdlibSplitOiStructures()");
- for (i=0; i < wave->nbWlen; i++)
- {
- band = amdlibGetBand(wave->wlen[i]);
- if (band == amdlibUNKNOWN_BAND)
- {
- amdlibSetErrMsg("Unknown spectral band for wavelength %f",
- wave->wlen[i]);
- return amdlibFAILURE;
- }
- if (idxFirstWlen[band] == -1)
- {
- idxFirstWlen[band] = i;
- }
- nbWlen[band]++;
- }
-
- if (amdlibSplitPhot(phot, imdPhot, idxFirstWlen, nbWlen,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- if (amdlibSplitVis(vis, imdVis, idxFirstWlen, nbWlen,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- if (amdlibSplitVis2(vis2, imdVis2, idxFirstWlen, nbWlen,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- if (vis3->nbClosures != 0)
- {
- if (amdlibSplitVis3(vis3, imdVis3, idxFirstWlen, nbWlen,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- }
- else
- {
- amdlibLogWarning("No vis3 structures");
- }
-
-
- if (amdlibSplitPiston(opd, imdOpd, nbWlen, errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- if (amdlibSplitWavelength(wave, imdWave, idxFirstWlen, nbWlen,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- return amdlibSUCCESS;
-}
-
-
-/*
- * Local functions
- */
-/**
- * Free memory allocated for photometry.
- *
- * @param photometry pointer to amdlibPHOTOMETRY structure.
- */
-void amdlibFreePhotometry(amdlibPHOTOMETRY *photometry)
-{
- amdlibLogTrace("amdlibFreePhotometry()");
-
- /* Check thisPtr and do nothing if unitialized */
- if (photometry->thisPtr != photometry)
- {
- return;
- }
- if (photometry->table != NULL)
- {
- /* There were 5 array defined allocated as a whole */
- if (photometry->table[0].PiMultPj != NULL)
- {
- free(photometry->table[0].PiMultPj);
- }
- if (photometry->table[0].fluxRatPiPj != NULL)
- {
- free(photometry->table[0].fluxRatPiPj);
- }
- if (photometry->table[0].sigma2FluxRatPiPj != NULL)
- {
- free(photometry->table[0].sigma2FluxRatPiPj);
- }
- if (photometry->table[0].fluxSumPiPj != NULL)
- {
- free(photometry->table[0].fluxSumPiPj);
- }
- if (photometry->table[0].sigma2FluxSumPiPj != NULL)
- {
- free(photometry->table[0].sigma2FluxSumPiPj);
- }
- }
-
- /* Free the table[...] array */
- free(photometry->table);
- photometry->table = NULL;
- photometry->thisPtr = NULL;
-}
-
-/**
- * Reallocate memory to store photometry.
- *
- * @param photometry pointer to amdlibPHOTOMETRY structure.
- * @param nbFrames number of frames
- * @param nbBases number of baselines
- * @param nbWlen number of spectral channels
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibReallocatePhotometry(amdlibPHOTOMETRY *photometry,
- const int nbFrames,
- const int nbBases,
- const int nbWlen)
-{
- int arraySize = nbWlen * sizeof(double);
- int nbSamples = nbFrames * nbBases;
- int i;
- void *pointer;
-
- photometry->table = realloc(photometry->table,
- nbSamples *
- sizeof(amdlibPHOTOMETRY_TABLE_ENTRY));
- if (photometry->table == NULL)
- {
- return amdlibFAILURE;
- }
-
- photometry->table[0].fluxSumPiPj =
- realloc(photometry->table[0].fluxSumPiPj, nbSamples * arraySize);
- if (photometry->table[0].fluxSumPiPj == NULL)
- {
- return amdlibFAILURE;
- }
- for (i = 0, pointer = photometry->table[0].fluxSumPiPj;
- i < nbSamples; i++, pointer += arraySize)
- {
- photometry->table[i].fluxSumPiPj = pointer;
- }
-
- photometry->table[0].sigma2FluxSumPiPj =
- realloc(photometry->table[0].sigma2FluxSumPiPj,
- nbFrames * nbBases * arraySize);
- if (photometry->table[0].sigma2FluxSumPiPj == NULL)
- {
- return amdlibFAILURE;
- }
- for (i = 0, pointer = photometry->table[0].sigma2FluxSumPiPj;
- i < nbSamples; i++, pointer += arraySize)
- {
- photometry->table[i].sigma2FluxSumPiPj = pointer;
- }
-
- photometry->table[0].fluxRatPiPj =
- realloc(photometry->table[0].fluxRatPiPj,
- nbFrames * nbBases * arraySize);
- if (photometry->table[0].fluxRatPiPj == NULL)
- {
- return amdlibFAILURE;
- }
- for (i = 0, pointer = photometry->table[0].fluxRatPiPj;
- i < nbSamples; i++, pointer += arraySize)
- {
- photometry->table[i].fluxRatPiPj = pointer;
- }
-
- photometry->table[0].sigma2FluxRatPiPj =
- realloc(photometry->table[0].sigma2FluxRatPiPj,
- nbFrames * nbBases * arraySize);
- if (photometry->table[0].sigma2FluxRatPiPj == NULL)
- {
- return amdlibFAILURE;
- }
- for (i = 0, pointer = photometry->table[0].sigma2FluxRatPiPj;
- i < nbSamples; i++, pointer += arraySize)
- {
- photometry->table[i].sigma2FluxRatPiPj = pointer;
- }
-
- photometry->table[0].PiMultPj =
- realloc(photometry->table[0].PiMultPj,
- nbFrames * nbBases * arraySize);
- if (photometry->table[0].PiMultPj == NULL)
- {
- return amdlibFAILURE;
- }
- for (i = 0, pointer = photometry->table[0].PiMultPj;
- i < nbSamples; i++, pointer += arraySize)
- {
- photometry->table[i].PiMultPj = pointer;
- }
-
- photometry->nbFrames = nbFrames;
- return amdlibSUCCESS;
-}
-
-/**
- * Free memory allocated for visibilities.
- *
- * @param vis pointer to amdlibVIS structure.
- */
-void amdlibFreeVis(amdlibVIS *vis)
-{
- amdlibLogTrace("amdlibFreeVis()");
-
- /* Check thisPtr and do nothing if unitialized */
- if (vis->thisPtr != vis)
- {
- return;
- }
- if (vis->table != NULL)
- {
- /* There were 3 array defined allocated as a whole */
- if (vis->table[0].vis != NULL)
- {
- free(vis->table[0].vis);
- }
- if (vis->table[0].sigma2Vis != NULL)
- {
- free(vis->table[0].sigma2Vis);
- }
- if (vis->table[0].visCovRI != NULL)
- {
- free(vis->table[0].visCovRI);
- }
- if (vis->table[0].diffVisAmp != NULL)
- {
- free(vis->table[0].diffVisAmp);
- }
- if (vis->table[0].diffVisAmpErr != NULL)
- {
- free(vis->table[0].diffVisAmpErr);
- }
- if (vis->table[0].diffVisPhi != NULL)
- {
- free(vis->table[0].diffVisPhi);
- }
- if (vis->table[0].diffVisPhiErr != NULL)
- {
- free(vis->table[0].diffVisPhiErr);
- }
- if (vis->table[0].flag != NULL)
- {
- free(vis->table[0].flag);
- }
- }
-
- /* Free the table[...] array */
- free(vis->table);
- vis->table = NULL;
- vis->thisPtr = NULL;
-}
-
-/**
- * Reallocate memory for storing visibilities.
- *
- * @param vis pointer to amdlibVIS structure.
- * @param nbFrames number of frames
- * @param nbBases number of baselines
- * @param nbWlen number of spectral channels
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibReallocateVis(amdlibVIS *vis,
- const int nbFrames,
- const int nbBases,
- const int nbWlen)
-{
- int arraySize = nbWlen * sizeof(amdlibCOMPLEX);
- int nbSamples = nbFrames * nbBases;
- int i;
- void *pointer;
-
- vis->table = realloc(vis->table,
- nbSamples * sizeof(amdlibVIS_TABLE_ENTRY));
- if (vis->table == NULL)
- {
- return amdlibFAILURE;
- }
-
- vis->table[0].vis = realloc(vis->table[0].vis, nbSamples * arraySize);
- if (vis->table[0].vis == NULL)
- {
- return amdlibFAILURE;
- }
- for (i = 0, pointer = vis->table[0].vis;
- i < nbSamples;
- i++, pointer += arraySize)
- {
- vis->table[i].vis = pointer;
- }
-
- vis->table[0].sigma2Vis = realloc(vis->table[0].sigma2Vis,
- nbSamples * arraySize);
-
- if (vis->table[0].sigma2Vis == NULL)
- {
- return amdlibFAILURE;
- }
- for (i = 0, pointer = vis->table[0].sigma2Vis;
- i < nbSamples;
- i++, pointer += arraySize)
- {
- vis->table[i].sigma2Vis = pointer;
- }
-
- arraySize = nbWlen * sizeof(double);
- vis->table[0].visCovRI = realloc(vis->table[0].visCovRI,
- nbSamples * arraySize);
- if (vis->table[0].visCovRI == NULL)
- {
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = vis->table[0].visCovRI;
- i < nbSamples;
- i++, pointer += arraySize)
- {
- vis->table[i].visCovRI = pointer;
- }
-
- vis->table[0].diffVisAmp = realloc(vis->table[0].diffVisAmp,
- nbSamples * arraySize);
- if (vis->table[0].diffVisAmp == NULL)
- {
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = vis->table[0].diffVisAmp;
- i < nbSamples;
- i++, pointer += arraySize)
- {
- vis->table[i].diffVisAmp = pointer;
- }
- vis->table[0].diffVisAmpErr = realloc(vis->table[0].diffVisAmpErr,
- nbSamples * arraySize);
- if (vis->table[0].diffVisAmpErr == NULL)
- {
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = vis->table[0].diffVisAmpErr;
- i < nbSamples;
- i++, pointer += arraySize)
- {
- vis->table[i].diffVisAmpErr = pointer;
- }
-
- vis->table[0].diffVisPhi = realloc(vis->table[0].diffVisPhi,
- nbSamples * arraySize);
- if (vis->table[0].diffVisPhi == NULL)
- {
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = vis->table[0].diffVisPhi;
- i < nbSamples;
- i++, pointer += arraySize)
- {
- vis->table[i].diffVisPhi = pointer;
- }
-
- vis->table[0].diffVisPhiErr = realloc(vis->table[0].diffVisPhiErr,
- nbSamples * arraySize);
- if (vis->table[0].diffVisPhiErr == NULL)
- {
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = vis->table[0].diffVisPhiErr;
- i < nbSamples;
- i++, pointer += arraySize)
- {
- vis->table[i].diffVisPhiErr = pointer;
- }
-
- arraySize = nbWlen * sizeof(amdlibBOOLEAN);
- vis->table[0].flag = realloc(vis->table[0].flag, nbSamples * arraySize);
- if (vis->table[0].flag == NULL)
- {
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = vis->table[0].flag;
- i < nbSamples;
- i++, pointer += arraySize)
- {
- vis->table[i].flag = pointer;
- }
-
- vis->nbFrames = nbFrames;
- return amdlibSUCCESS;
-}
-
-/**
- * Free memory allocated for squared visibilities.
- *
- * @param vis2 pointer to amdlibVIS2 structure.
- */
-void amdlibFreeVis2(amdlibVIS2 *vis2)
-{
- amdlibLogTrace("amdlibFreeVis2()");
-
- /* Check thisPtr and do nothing if unitialized*/
- if (vis2->thisPtr != vis2)
- {
- return;
- }
- if (vis2->table != NULL)
- { /* there were 2 arrays defined allocated as a whole */
- if (vis2->table[0].vis2 != NULL)
- {
- free(vis2->table[0].vis2);
- }
- if (vis2->table[0].vis2Error != NULL)
- {
- free(vis2->table[0].vis2Error);
- }
- if (vis2->table[0].flag != NULL)
- {
- free(vis2->table[0].flag);
- }
- }
-
- /* Free the table[...] array */
- free(vis2->table);
- vis2->table = NULL;
- vis2->thisPtr = NULL;
-}
-
-/**
- * Reallocate memory for storing squared visibilities.
- *
- * @param vis2 pointer to amdlibVIS2 structure.
- * @param nbFrames number of frames
- * @param nbBases number of baselines
- * @param nbWlen number of spectral channels
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibReallocateVis2(amdlibVIS2 *vis2,
- const int nbFrames,
- const int nbBases,
- const int nbWlen)
-{
- int arraySize = nbWlen * sizeof(double);
- int nbSamples = nbFrames * nbBases;
- int i;
- void *pointer;
-
- vis2->table = realloc(vis2->table,
- nbSamples * sizeof(amdlibVIS2_TABLE_ENTRY));
- if (vis2->table == NULL)
- {
- return amdlibFAILURE;
- }
-
- vis2->table[0].vis2 = realloc(vis2->table[0].vis2, nbSamples * arraySize);
- if (vis2->table[0].vis2 == NULL)
- {
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = vis2->table[0].vis2;
- i < nbSamples;
- i++, pointer += arraySize)
- {
- vis2->table[i].vis2 = pointer;
- }
-
- vis2->table[0].vis2Error = realloc(vis2->table[0].vis2Error,
- nbSamples * arraySize);
- if (vis2->table[0].vis2Error == NULL)
- {
- amdlibFreeVis2(vis2);
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = vis2->table[0].vis2Error;
- i < nbSamples;
- i++, pointer += arraySize)
- {
- vis2->table[i].vis2Error = pointer;
- }
-
- arraySize = nbWlen * sizeof(amdlibBOOLEAN);
- vis2->table[0].flag = realloc(vis2->table[0].flag, nbSamples * arraySize);
- if (vis2->table[0].flag == NULL)
- {
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = vis2->table[0].flag;
- i < nbSamples;
- i++, pointer += arraySize)
- {
- vis2->table[i].flag = pointer;
- }
-
- vis2->nbFrames = nbFrames;
- return amdlibSUCCESS;
-}
-
-/**
- * Free memory allocated for phase closures.
- *
- * @param vis3 pointer to amdlibVIS3 structure.
- */
-void amdlibFreeVis3(amdlibVIS3 *vis3)
-{
- amdlibLogTrace("amdlibFreeVis3()");
-
- /* Check thisPtr and do nothing if unitialized*/
- if (vis3->thisPtr != vis3)
- {
- return;
- }
- if (vis3->table != NULL)
- {
- if (vis3->table[0].vis3Amplitude != NULL)
- {
- free(vis3->table[0].vis3Amplitude);
- }
- if (vis3->table[0].vis3AmplitudeError != NULL)
- {
- free(vis3->table[0].vis3AmplitudeError);
- }
- if (vis3->table[0].vis3Phi != NULL)
- {
- free(vis3->table[0].vis3Phi);
- }
- if (vis3->table[0].vis3PhiError != NULL)
- {
- free(vis3->table[0].vis3PhiError);
- }
- if (vis3->table[0].flag != NULL)
- {
- free(vis3->table[0].flag);
- }
- }
- /* free the table[...] array */
- free(vis3->table);
- vis3->table = NULL;
- vis3->thisPtr = NULL;
-}
-
-/**
- * Reallocate memory for storing phase closures.
- *
- * @param vis3 pointer to amdlibVIS3 structure.
- * @param nbFrames number of frames
- * @param nbClosures number of phase closures
- * @param nbWlen number of spectral channels
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibReallocateVis3(amdlibVIS3 *vis3,
- const int nbFrames,
- const int nbClosures,
- const int nbWlen)
-{
- int arraySize = nbWlen * sizeof(double);
- int nbSamples = nbFrames * nbClosures;
- int i;
- void *pointer;
-
- vis3->table = realloc(vis3->table, nbSamples * sizeof(*(vis3->table)));
- if (vis3->table == NULL)
- {
- return amdlibFAILURE;
- }
-
- vis3->table[0].vis3Amplitude = realloc(vis3->table[0].vis3Amplitude,
- nbSamples * arraySize);
- if (vis3->table[0].vis3Amplitude == NULL)
- {
- return amdlibFAILURE;
- }
- for (i = 0, pointer = vis3->table[0].vis3Amplitude;
- i < nbSamples;
- i++, pointer += arraySize)
- {
- vis3->table[i].vis3Amplitude = pointer;
- }
-
- vis3->table[0].vis3AmplitudeError =
- realloc(vis3->table[0].vis3AmplitudeError, nbSamples * arraySize);
- if (vis3->table[0].vis3AmplitudeError == NULL)
- {
- return amdlibFAILURE;
- }
- for (i = 0, pointer = vis3->table[0].vis3AmplitudeError;
- i < nbSamples;
- i++, pointer += arraySize)
- {
- vis3->table[i].vis3AmplitudeError = pointer;
- }
-
- vis3->table[0].vis3Phi = realloc(vis3->table[0].vis3Phi,
- nbSamples * arraySize);
- if (vis3->table[0].vis3Phi == NULL)
- {
- return amdlibFAILURE;
- }
- for (i = 0, pointer = vis3->table[0].vis3Phi;
- i < nbSamples;
- i++, pointer += arraySize)
- {
- vis3->table[i].vis3Phi = pointer;
- }
-
- vis3->table[0].vis3PhiError = realloc(vis3->table[0].vis3PhiError,
- nbSamples * arraySize);
- if (vis3->table[0].vis3PhiError == NULL)
- {
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = vis3->table[0].vis3PhiError;
- i < nbSamples;
- i++, pointer += arraySize)
- {
- vis3->table[i].vis3PhiError = pointer;
- }
-
- arraySize = nbWlen * sizeof(amdlibBOOLEAN);
- vis3->table[0].flag = realloc(vis3->table[0].flag, nbSamples * arraySize);
- if (vis3->table[0].flag == NULL)
- {
- return amdlibFAILURE;
- }
- /* Then dispatch the other pointers accordingly */
- for (i = 0, pointer = vis3->table[0].flag;
- i < nbSamples;
- i++, pointer += arraySize)
- {
- vis3->table[i].flag = pointer;
- }
-
- vis3->nbFrames = nbFrames;
- return amdlibSUCCESS;
-}
-
-/**
- * Free memory allocated for wavelenghts.
- *
- * @param wave pointer to amdlibWAVELENGTH structure.
- */
-void amdlibFreeWavelength(amdlibWAVELENGTH *wave)
-{
- amdlibLogTrace("amdlibFreeWavelength()");
-
- /* Check thisPtr and do nothing if unitialized*/
- if (wave->thisPtr != wave)
- {
- return;
- }
- if (wave->wlen != NULL)
- {
- free(wave->wlen);
- }
- if (wave->bandwidth != NULL)
- {
- free(wave->bandwidth);
- }
-
- wave->wlen = NULL;
- wave->bandwidth = NULL;
- wave->thisPtr = NULL;
-}
-
-
-/**
- * Free memory allocated for observed targets.
- *
- * @param target pointer to amdlibOI_TARGET structure.
- */
-
-void amdlibFreeOiTarget(amdlibOI_TARGET *target)
-{
- amdlibLogTrace("amdlibFreeOiTarget()");
-
- /* Check thisPtr and do nothing if unitialized*/
- if (target->thisPtr != target)
- {
- return;
- }
- if (target->element != NULL)
- {
- free(target->element);
- }
- memset (target, '\0', sizeof(*target));
-}
-
diff --git a/amber/amdlibP2vm.c b/amber/amdlibP2vm.c
deleted file mode 100644
index fa23c5c..0000000
--- a/amber/amdlibP2vm.c
+++ /dev/null
@@ -1,3678 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Functions to handle and compute the P2VM.
- */
-
-#define _POSIX_SOURCE 1
-
-/*
- * System Headers
- */
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "fitsio.h"
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/* Local functions */
-static void amdlibInitP2VM(amdlibP2VM_MATRIX *p2vm);
-static amdlibCOMPL_STAT amdlibAllocateP2VM(amdlibP2VM_MATRIX *p2vm,
- const int nx, const int nbTel,
- const int nbBases,
- const int nbChannels,
- amdlibERROR_MSG errMsg);
-static void amdlibFreeP2VM(amdlibP2VM_MATRIX *p2vm);
-void amdlibLinearize(int n, double *y, double *wy);
-void amdlibBoxCarSmooth(int n, double *y, int w);
-static double amdlibEstimateCWVariance(double *ikb,
- double *ikg,
- double *v1,
- double *v2,
- double P1b,
- double P2b,
- double P1g,
- double P2g,
- amdlibDOUBLE ron, /* Hope ron did not change */
- int nx); /* Width of the I channel */
-
-/* Public functions */
-/**
- * Release memory allocated to store P2VM
- *
- * @param p2vm structure where P2VM is stored
- */
-void amdlibReleaseP2VM(amdlibP2VM_MATRIX *p2vm)
-{
- amdlibLogTrace("amdlibReleaseP2VM()");
-
- amdlibFreeP2VM(p2vm);
- memset(p2vm, '\0', sizeof(amdlibP2VM_MATRIX));
-}
-/**
- * A rather correct ron value for CW code
- */
-#define amdlibTYPICAL_RON 10.0
-/**
- * A value for bad ck or dks. 0 should do.
- */
-#define amdlibInvalidCkDkValue 0.0
-/**
- * Minimum accepted SNR for P2VM computation. Should NOT BE ZERO
- */
-#define amdlibMIN_SNR_FOR_P2VM 10.0
-/**
- * The wavelength of the center of the H-K phase jump in Low_JHK mode
- */
-#define amdlibWAVELENGTH_HK_PHASE_JUMP 1942.0000
-
-#define amdlibComputeP2VM_FREEALL() amdlibFree2DArrayDouble(interf_v); \
- amdlibFree2DArrayDouble(interf_0); amdlibFree2DArrayDouble(interf_1); \
- amdlibFree2DArrayDouble(photo_v); amdlibFree2DArrayDouble(photo_0); \
- amdlibFree2DArrayDouble(photo_1); amdlibFree2DArrayDouble(mu_k_1); \
- amdlibFree2DArrayDouble(mu_k_2); amdlibFree2DArrayDouble(ck); \
- amdlibFree2DArrayDouble(dk); amdlibFree2DArrayDouble(sigma2CW);\
- free(vect);free(vect2);free(mat);amdlibFree2DArrayDouble(gamma0);\
- amdlibFree2DArrayDouble(gamma0w);amdlibFree2DArrayDouble(phaseDerivative);\
- amdlibFree3DArrayDouble(unormalizedP2vmInternalCopy);
-/**
- * Computes the P2VM
- *
- * This function computes the P2VM.
- *
- * @param p2vmData input data for P2VM computation.
- * @param p2vmType P2VM type : amdlibP2VM_2T or amdlibP2VM_3T
- * @param waveData data structure containing spectral dispersion table
- * @param p2vm pointer to structure where resulting P2VM will be stored
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibComputeP2VM(amdlibP2VM_INPUT_DATA *p2vmData,
- amdlibP2VM_TYPE p2vmType,
- amdlibWAVEDATA *waveData,
- amdlibP2VM_MATRIX *p2vm,
- amdlibERROR_MSG errMsg)
-{
- int i;
- int j;
- int k;
- int l;
- int baseline;
- int nx;
- int nl, nlValid, nlByBand[amdlibNB_BANDS];
- int image;
- int nbTel;
- int t;
- int nbBases;
- double meanFlux[amdlibNB_TEL][amdlibNB_BANDS];
- amdlibDOUBLE **badPixels;
- amdlibDOUBLE **flatField;
-
- amdlibSCIENCE_DATA *scienceData;
- int band;
- double nbVis[amdlibNBASELINE];
- double nbVisInBand[amdlibNBASELINE][amdlibNB_BANDS];
-
- /* In the following comments, the number of shutter closed
- * apply in the 3 telescope case*/
- double **interf_v = NULL;
- /* This matrix contains the IC for every tel. sEparately (2 shutters
- * closed) */
- double **interf_0 = NULL;
- /* This matrix contains the IC for two tel. combinated (1 shutter
- * closed) */
- double **interf_1 = NULL;
- /* This matrix contains the IC for two tel. combinated, w/ phase
- * shift (1 shutter closed) */
- double** photo_v = NULL;
- /* This matrix contains the PC for every tel. separately (2 shutters closed) */
- double **photo_0 = NULL;
- /* This matrix contains the 3 PCs for 2 tel. combinated (1 shutter closed) */
- double **photo_1 = NULL;
- /* This matrix contains the 3 PCs for 2 tel. combinated w/ phase shift (1 shutter closed) */
- /* The first index indicates the tel., the second the baseline! */
- double **mu_k_1 = NULL;
- double **mu_k_2 = NULL;
- double **sigma2CW = NULL;
- double **ck = NULL;
- double **dk = NULL;
- double cosgamm0, singamm0, sumck, sumdk, sumck2, sumckdk;
- double **gamma0 = NULL;
- double **gamma0w = NULL;
- double *mat = NULL;
- double *vect = NULL,*vect2 = NULL;
- char keywValue[amdlibKEYW_VAL_LEN+1];
- int isLowJHK=0;
- double wlenShift;
- int boxcar;
- double fwhm;
- double **phaseDerivative=NULL;
- double ***unormalizedP2vmInternalCopy=NULL;
-
- amdlibLogTrace("amdlibComputeP2VM()");
-
- /* Init the number of telescopes and baselines according to P2VM type */
- if (p2vmType == amdlibP2VM_2T)
- {
- nbTel = 2;
- nbBases = 1;
- }
- else if (p2vmType == amdlibP2VM_3T)
- {
- nbTel = 3;
- nbBases = 3;
- }
- else
- {
- amdlibSetErrMsg("Invalid P2VM type %d "
- "(see amdlibP2VM_TYPE)", (int)p2vmType);
- return amdlibFAILURE;
- }
-
- /* Reset error message */
- memset(errMsg, '\0', sizeof(amdlibERROR_MSG));
-
- /* Check the science data have been stored and calibrated */
- for (image = 0; image < 9; image++)
- {
- int frameType = image;
-
- /* Skip check of the unused frames for 2T */
- if ((nbTel == 2) &&
- ((frameType == amdlibTEL3_FRAME) ||
- (frameType == amdlibTEL23_FRAME) ||
- (frameType == amdlibTEL13_FRAME) ||
- (frameType == amdlibTEL23Q_FRAME) ||
- (frameType == amdlibTEL13Q_FRAME)))
- {
- continue;
- }
-
- /* Check the corresponding science data has been loaded */
- if (p2vmData->dataLoaded[image] == amdlibFALSE)
- {
- amdlibSetErrMsg("Missing data file corresponding "
- "to the image %d (see amdlibFRAME_TYPE)", frameType);
- return amdlibFAILURE;
- }
- }
-
- /* If P2VM data structure is not initialized, do it */
- if (p2vm->thisPtr != p2vm)
- {
- amdlibInitP2VM(p2vm);
- }
-
- /* Set the number of pixels in interferometric channel, the number of
- * spectral channels and the start pixel */
- nx = p2vmData->scienceData[0].col[amdlibINTERF_CHANNEL].nbPixels;
- nl = p2vm->nbChannels = p2vmData->scienceData[0].nbChannels;
- p2vm->firstChannel = p2vmData->scienceData[0].channelNo[0];
-
- /* Allocate memory */
- if (amdlibAllocateP2VM(p2vm, nx, nbTel, nbBases,
- nl, errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- /* Store P2VM type */
- p2vm->type = p2vmType;
- p2vm->nbFrames = p2vmData->nbFrames;
-
- /* Clear list of P2VM keywords */
- amdlibClearInsCfg(&p2vm->insCfg);
-
- /* Copy array containing instrument configuration into P2VM structure, and
- * MJD-OBS keyword which is required for archiving */
- scienceData = &p2vmData->scienceData[1];
- for (i=0; i < scienceData->insCfg.nbKeywords; i++)
- {
- if ((strstr(scienceData->insCfg.keywords[i].name, "MJD-OBS") != NULL) ||
- (strstr(scienceData->insCfg.keywords[i].name, "DATE-OBS") !=NULL) ||
- (strstr(scienceData->insCfg.keywords[i].name, "EXPTIME") != NULL) ||
- (strstr(scienceData->insCfg.keywords[i].name, "ORIGIN") != NULL) ||
- (strstr(scienceData->insCfg.keywords[i].name, "INSTRUME") != NULL)||
- (strstr(scienceData->insCfg.keywords[i].name, "UTC") != NULL) ||
- (strstr(scienceData->insCfg.keywords[i].name, "OBSERVER") != NULL)||
- (strstr(scienceData->insCfg.keywords[i].name, "PI-COI") != NULL) ||
- (strstr(scienceData->insCfg.keywords[i].name,
- "HIERARCH ESO INS") != NULL) ||
- (strstr(scienceData->insCfg.keywords[i].name,
- "HIERARCH ESO OBS") != NULL) ||
- (strstr(scienceData->insCfg.keywords[i].name,
- "HIERARCH ESO OCS") != NULL) ||
- (strstr(scienceData->insCfg.keywords[i].name,
- "HIERARCH ESO TPL") != NULL) ||
- (strstr(scienceData->insCfg.keywords[i].name,
- "HIERARCH ESO DET") != NULL))
- {
- /* Excluded keyword : shutter and MCS which change during P2VM
- * calibration */
- if ((strstr(scienceData->insCfg.keywords[i].name,
- "HIERARCH ESO INS SHUT") == NULL) &&
- (strstr(scienceData->insCfg.keywords[i].name,
- "HIERARCH ESO INS OPTI4") == NULL))
- {
- if (amdlibSetInsCfgKeyword(
- &p2vm->insCfg,
- scienceData->insCfg.keywords[i].name,
- scienceData->insCfg.keywords[i].value,
- scienceData->insCfg.keywords[i].comment,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- }
- }
- }
-
- /* Get instrument configuration to test Low_JHK mode*/
- memset(keywValue, '\0', (amdlibKEYW_VAL_LEN+1)*sizeof(char));
- if (amdlibGetInsCfgKeyword(&scienceData->insCfg,
- "HIERARCH ESO OCS OBS SPECCONF",
- keywValue, errMsg) != amdlibSUCCESS)
- {
-/* return amdlibFAILURE; */
- }
-
- if (strstr(keywValue, "Low_JHK ") != NULL) isLowJHK=1;
-
- memset(keywValue, '\0', (amdlibKEYW_VAL_LEN+1)*sizeof(char));
- sprintf(keywValue, " %f", waveData->photoOffset[0]);
- if (amdlibSetInsCfgKeyword(&p2vm->insCfg, "HIERARCH ESO QC P1 OFFSETY",
- keywValue, "", errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- memset(keywValue, '\0', (amdlibKEYW_VAL_LEN+1)*sizeof(char));
- sprintf(keywValue, " %f", waveData->photoOffset[1]);
- if (amdlibSetInsCfgKeyword(&p2vm->insCfg, "HIERARCH ESO QC P2 OFFSETY",
- keywValue, "", errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- memset(keywValue, '\0', (amdlibKEYW_VAL_LEN+1)*sizeof(char));
- sprintf(keywValue, " %f", waveData->photoOffset[2]);
- if (amdlibSetInsCfgKeyword(&p2vm->insCfg, "HIERARCH ESO QC P3 OFFSETY",
- keywValue, "", errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- /* Copy bad pixel map corresponding to the interferometric channel */
- badPixels = amdlibGetBadPixelMapRegion(
- p2vmData->scienceData[0].col[amdlibINTERF_CHANNEL].startPixel-1,
- p2vm->firstChannel,
- nx, p2vm->nbChannels, errMsg);
- if (badPixels != NULL)
- {
- for (l = 0; l < nl; l++)
- {
- for (i=0; i < nx; i++)
- {
- p2vm->badPixelsPt[l][i] = (unsigned char) badPixels[l][i];
- }
- }
- }
- else
- {
- for (l = 0; l < nl; l++)
- {
- for (i = 0; i < nx; i++)
- {
- p2vm->badPixelsPt[l][i] = amdlibGOOD_PIXEL_FLAG;
- }
- }
- }
- amdlibFree2DArrayDouble(badPixels);
-
- /* Copy flat field map corresponding to the interferometric channel */
- flatField = amdlibGetFlatFieldMapRegion(
- p2vmData->scienceData[0].col[amdlibINTERF_CHANNEL].startPixel-1,
- p2vm->firstChannel,
- nx, p2vm->nbChannels, errMsg);
- if (flatField != NULL)
- {
- for (l=0; l < nl; l++)
- {
- for (i=0; i < nx; i++)
- {
- p2vm->flatFieldPt[l][i] = flatField[l][i];
- }
- }
- }
- else
- {
-
- for (l=0; l < nl; l++)
- {
- for (i=0; i < nx; i++)
- {
- p2vm->flatFieldPt[l][i] = 1.0;
- }
- }
- }
- amdlibFree2DArrayDouble(flatField);
-
- /* Eventually shift wavelengths with user value */
- if (amdlibGetUserPref(amdlibSHIFT_WLENTABLE).set==amdlibTRUE)
- {
- /* If a spectral shift of the wlen table has been requested, do it. */
- amdlibDOUBLE *temp;
- temp=calloc(amdlibNB_SPECTRAL_CHANNELS,sizeof(double));
- /* Copy array containing wavelengths into P2VM structure */
- for (l = 0; l < amdlibNB_SPECTRAL_CHANNELS; l++)
- {
- temp[l] = waveData->wlen[l];
- }
- wlenShift=amdlibGetUserPref(amdlibSHIFT_WLENTABLE).value;
- if (amdlibShift(amdlibNB_SPECTRAL_CHANNELS,temp,wlenShift,waveData->wlen,errMsg) == amdlibFAILURE)
- {
- amdlibLogError("while shifting wavelength table by %f",wlenShift);
- free(temp);
- return amdlibFAILURE;
- }
- free(temp);
- }
- /* Copy array (eventually shifted) containing wavelengths
- * into P2VM structure */
- for (l = 0; l < nl; l++)
- {
- p2vm->wlen[l] = waveData->wlen[p2vmData->scienceData[0].channelNo[l]];
- }
-
-
- /***** Check photometry, and flag spectral where there is no enough flux */
- /* First check SNR of flux coming from each telescope */
- for (l=0; l < nl; l++)
- {
- if (p2vmData->scienceData[0].frame[0].snrPhoto1
- < amdlibMIN_SNR_FOR_P2VM)
- {
- amdlibSetErrMsg("SNR (%.1f) on photometric channel %d of frame %d "
- "too low. Should be greater than %.1f",
- p2vmData->scienceData[0].frame[0].snrPhoto1,
- 1, 1, amdlibMIN_SNR_FOR_P2VM);
- return amdlibFAILURE;
- }
- if (p2vmData->scienceData[1].frame[0].snrPhoto2
- < amdlibMIN_SNR_FOR_P2VM)
- {
- amdlibSetErrMsg("SNR (%.1f) on photometric channel %d of frame %d "
- "too low. Should be greater than %.1f",
- p2vmData->scienceData[1].frame[0].snrPhoto2,
- 1, 2, amdlibMIN_SNR_FOR_P2VM);
- return amdlibFAILURE;
- }
-
- if (nbTel == 3)
- {
- if (p2vmData->scienceData[2].frame[0].snrPhoto3
- < amdlibMIN_SNR_FOR_P2VM)
- {
- amdlibSetErrMsg("SNR (%.1f) on photometric channel %d of frame %d "
- "too low. Should be greater than %.1f",
- p2vmData->scienceData[2].frame[0].snrPhoto3,
- 1, 3, amdlibMIN_SNR_FOR_P2VM);
- return amdlibFAILURE;
- }
- }
- }
-
- /* Then retrieve flux coming from each telescope; flux is retrieved from
- * amdlibTEL1_FRAME, amdlibTEL2_FRAME and amdlibTEL3_FRAME frames */
- for (l = 0; l < nl; l++)
- {
- p2vm->photometryPt[0][0][l] =
- p2vmData->scienceData[amdlibTEL1_FRAME].frame[0].photo1[l];
- p2vm->photometryPt[0][1][l] =
- p2vmData->scienceData[amdlibTEL2_FRAME].frame[0].photo2[l];
- if (nbTel == 3)
- {
- p2vm->photometryPt[0][2][l] =
- p2vmData->scienceData[amdlibTEL3_FRAME].frame[0].photo3[l];
- }
- else
- {
- p2vm->photometryPt[0][2][l] = 0.0;
- }
- }
-
- /* Flag all channels with lambda = 0 (happens in JHK mode)*/
- for (l = 0; l < nl; l++)
- {
- if (p2vm->wlen[l] <= 0.0)
- {
- p2vm->flag[l] = amdlibFALSE;
- }
- else
- {
- p2vm->flag[l] = amdlibTRUE;
- }
- }
-
- /* Then, compute mean flux (for each band) coming from each telescope */
- for (t = 0; t < amdlibNB_TEL; t++)
- {
- meanFlux[t][0] = 0.0;
- meanFlux[t][1] = 0.0;
- meanFlux[t][2] = 0.0;
- }
- for (t = 0; t < amdlibNB_BANDS; t++)
- {
- nlByBand[t] = 0;
- }
- for (l = 0; l < nl; l++)
- {
- amdlibBAND theBand;
- theBand = amdlibGetBand(p2vm->wlen[l]);
- if (theBand != amdlibUNKNOWN_BAND)
- {
- for (t = 0; t < nbTel; t++)
- {
- if (p2vm->photometryPt[0][t][l] > 0)
- {
- meanFlux[t][theBand] += p2vm->photometryPt[0][t][l];
- nlByBand[theBand] += 1;
- }
- }
- }
- }
- for (t = 0; t < nbTel; t++)
- {
- for (band = 0; band < amdlibNB_BANDS; band++)
- {
- if (nlByBand[band] != 0)
- {
- meanFlux[t][band] /= nlByBand[band];
- }
- }
- }
-
- /* Check flux for each spectral channel and flag accordingly. Channel with
- * flux less than 10% of the mean flux is marked as bad. */
- for (l = 0; l < nl; l++)
- {
- amdlibBAND theBand;
- theBand = amdlibGetBand(p2vm->wlen[l]);
- if (theBand != -1)
- {
- p2vm->flag[l] = amdlibTRUE;
- for (t = 0; t < nbTel; t++)
- {
- if (p2vm->photometryPt[0][t][l] < (0.1 * meanFlux[t][theBand]))
- {
- p2vm->flag[l] = amdlibFALSE;
- }
- }
- }
- else
- {
- p2vm->flag[l] = amdlibFALSE;
- }
- }
-
- /* Get the number of valid channels */
- nlValid = 0;
- for (l = 0; l < nl; l++)
- {
- if (p2vm->flag[l] == amdlibTRUE)
- {
- nlValid++;
- }
- }
- if (nlValid == 0)
- {
- amdlibSetErrMsg("No flux detected on photometric channels") ;
- return amdlibFAILURE;
- }
-
- /* Check SNR of flux coming from each telescope for each interferogram */
- for (l = 0; l < nl; l++)
- {
- amdlibFRAME_SCIENCE_DATA *frame;
- /* The first index of photo_0/1 refers to the baseline, the
- * second to the telescope. */
- /* Baseline 1-2 */
- frame = &p2vmData->scienceData[amdlibTEL12_FRAME].frame[0];
- if (frame->snrPhoto1 < amdlibMIN_SNR_FOR_P2VM)
- {
- amdlibSetErrMsg("SNR (%.1f) on photometric "
- "channel %d of frame %d too low. Should be greater "
- "than %.1f", frame->snrPhoto1, 1, amdlibTEL12_FRAME,
- amdlibMIN_SNR_FOR_P2VM);
- return amdlibFAILURE;
- }
- if (frame->snrPhoto2 < amdlibMIN_SNR_FOR_P2VM)
- {
- amdlibSetErrMsg("SNR (%.1f) on photometric "
- "channel %d of frame %d too low. Should be greater "
- "than %.1f", frame->snrPhoto2, 2, amdlibTEL12_FRAME,
- amdlibMIN_SNR_FOR_P2VM);
- return amdlibFAILURE;
- }
- /* Baseline 1-2 with delay*/
- frame = &p2vmData->scienceData[amdlibTEL12Q_FRAME].frame[0];
- if (frame->snrPhoto1 < amdlibMIN_SNR_FOR_P2VM)
- {
- amdlibSetErrMsg("SNR (%.1f) on photometric "
- "channel %d of frame %d too low. Should be greater "
- "than %.1f", frame->snrPhoto1, 1, amdlibTEL12Q_FRAME,
- amdlibMIN_SNR_FOR_P2VM);
- return amdlibFAILURE;
- }
- if (frame->snrPhoto2 < amdlibMIN_SNR_FOR_P2VM)
- {
- amdlibSetErrMsg("SNR (%.1f) on photometric "
- "channel %d of frame %d too low. Should be greater "
- "than %.1f", frame->snrPhoto2, 2, amdlibTEL12Q_FRAME,
- amdlibMIN_SNR_FOR_P2VM);
- return amdlibFAILURE;
- }
-
- if (nbTel == 3)
- {
- /* Baseline 2-3 */
- frame = &p2vmData->scienceData[amdlibTEL23_FRAME].frame[0];
- if (frame->snrPhoto2 < amdlibMIN_SNR_FOR_P2VM)
- {
- amdlibSetErrMsg("SNR (%.1f) on photometric "
- "channel %d of frame %d too low. "
- "Should be greater than %.1f", frame->snrPhoto2, 2,
- amdlibTEL23_FRAME, amdlibMIN_SNR_FOR_P2VM);
- return amdlibFAILURE;
- }
- if (frame->snrPhoto3 < amdlibMIN_SNR_FOR_P2VM)
- {
- amdlibSetErrMsg("SNR (%.1f) on photometric "
- "channel %d of frame %d too low. "
- "Should be greater than %.1f", frame->snrPhoto3, 3,
- amdlibTEL23_FRAME, amdlibMIN_SNR_FOR_P2VM);
- return amdlibFAILURE;
- }
-
- /* Baseline 2-3 with delay*/
- frame = &p2vmData->scienceData[amdlibTEL23Q_FRAME].frame[0];
- if (frame->snrPhoto2 < amdlibMIN_SNR_FOR_P2VM)
- {
- amdlibSetErrMsg("SNR (%.1f) on photometric "
- "channel %d of frame %d too low. "
- "Should be greater than %.1f", frame->snrPhoto2, 2,
- amdlibTEL23Q_FRAME, amdlibMIN_SNR_FOR_P2VM);
- return amdlibFAILURE;
- }
- if (frame->snrPhoto3 < amdlibMIN_SNR_FOR_P2VM)
- {
- amdlibSetErrMsg("SNR (%.1f) on photometric "
- "channel %d of frame %d too low. "
- "Should be greater than %.1f", frame->snrPhoto3, 3,
- amdlibTEL23Q_FRAME, amdlibMIN_SNR_FOR_P2VM);
- return amdlibFAILURE;
- }
-
- /* Baseline 3-1 */
- frame = &p2vmData->scienceData[amdlibTEL13_FRAME].frame[0];
- if (frame->snrPhoto3 < amdlibMIN_SNR_FOR_P2VM)
- {
- amdlibSetErrMsg("SNR (%.1f) on photometric "
- "channel %d of frame %d too low. "
- "Should be greater than %.1f", frame->snrPhoto3, 3,
- amdlibTEL13_FRAME, amdlibMIN_SNR_FOR_P2VM);
- return amdlibFAILURE;
- }
- if (frame->snrPhoto1 < amdlibMIN_SNR_FOR_P2VM)
- {
- amdlibSetErrMsg("SNR (%.1f) on photometric "
- "channel %d of frame %d too low. "
- "Should be greater than %.1f", frame->snrPhoto1, 1,
- amdlibTEL13_FRAME, amdlibMIN_SNR_FOR_P2VM);
- return amdlibFAILURE;
- }
-
- /* Baseline 3-1 with delay*/
- frame = &p2vmData->scienceData[amdlibTEL13Q_FRAME].frame[0];
- if (frame->snrPhoto3 < amdlibMIN_SNR_FOR_P2VM)
- {
- amdlibSetErrMsg("SNR (%.1f) on photometric "
- "channel %d of frame %d too low. "
- "Should be greater than %.1f", frame->snrPhoto3, 3,
- amdlibTEL13Q_FRAME, amdlibMIN_SNR_FOR_P2VM);
- return amdlibFAILURE;
- }
- if (frame->snrPhoto1 < amdlibMIN_SNR_FOR_P2VM)
- {
- amdlibSetErrMsg("SNR (%.1f) on photometric "
- "channel %d of frame %d too low. "
- "Should be greater than %.1f", frame->snrPhoto1, 1,
- amdlibTEL13Q_FRAME, amdlibMIN_SNR_FOR_P2VM);
- return amdlibFAILURE;
- }
- }
- }
-
- /* Retrieve flux coming from each telescope for each interferogram */
- for (l = 0; l < nl; l++)
- {
- amdlibFRAME_SCIENCE_DATA *frame;
- /* The first index of photo_0/1 refers to the baseline, the
- * second to the telescope. */
- /* Baseline 1-2 */
- frame = &p2vmData->scienceData[amdlibTEL12_FRAME].frame[0];
- p2vm->photometryPt[1][0][l] = frame->photo1[l];
- p2vm->photometryPt[1][1][l] = frame->photo2[l];
- for (j = 0; j < nx; j++)
- {
- p2vm->photometryPt[1][2][l] += frame->intf[l*nx+j];
- }
- /* Baseline 1-2 with delay*/
- frame = &p2vmData->scienceData[amdlibTEL12Q_FRAME].frame[0];
- p2vm->photometryPt[2][0][l] = frame->photo1[l];
- p2vm->photometryPt[2][1][l] = frame->photo2[l];
- for (j = 0; j < nx; j++)
- {
- p2vm->photometryPt[2][2][l] += frame->intf[l*nx+j];
- }
-
- if (nbTel == 3)
- {
- /* Baseline 2-3 */
- frame = &p2vmData->scienceData[amdlibTEL23_FRAME].frame[0];
- p2vm->photometryPt[3][0][l] = frame->photo2[l];
- p2vm->photometryPt[3][1][l] = frame->photo3[l];
- for (j = 0; j < nx; j++)
- {
- p2vm->photometryPt[3][2][l] += frame->intf[l*nx+j];
- }
- /* Baseline 2-3 with delay*/
- frame = &p2vmData->scienceData[amdlibTEL23Q_FRAME].frame[0];
- p2vm->photometryPt[4][0][l] = frame->photo2[l];
- p2vm->photometryPt[4][1][l] = frame->photo3[l];
- for (j = 0; j < nx; j++)
- {
- p2vm->photometryPt[4][2][l] += frame->intf[l*nx+j];
- }
- /* Baseline 3-1 */
- frame = &p2vmData->scienceData[amdlibTEL13_FRAME].frame[0];
- p2vm->photometryPt[5][0][l] = frame->photo1[l];
- p2vm->photometryPt[5][1][l] = frame->photo3[l];
- for (j = 0; j < nx; j++)
- {
- p2vm->photometryPt[5][2][l] += frame->intf[l*nx+j];
- }
- /* Baseline 3-1 with delay*/
- frame = &p2vmData->scienceData[amdlibTEL13Q_FRAME].frame[0];
- p2vm->photometryPt[6][0][l] = frame->photo1[l];
- p2vm->photometryPt[6][1][l] = frame->photo3[l];
- for (j = 0; j < nx; j++)
- {
- p2vm->photometryPt[6][2][l] += frame->intf[l*nx+j];
- }
- }
- }
-
- scienceData = p2vmData->scienceData;
-
- for (baseline = 0; baseline < nbBases; baseline++)
- {
- p2vm->insVis[baseline] = 0;
- p2vm->insVisErr[baseline] = 0;
- nbVis[baseline] = 0.0;
- for (band = 0; band < amdlibNB_BANDS; band++)
- {
- p2vm->insVisInBand[baseline][band] = 0;
- p2vm->insVisErrInBand[baseline][band] = 0;
- nbVisInBand[baseline][band] = 0.0;
- }
- }
-
- interf_v = amdlibAlloc2DArrayDouble(nx, nbTel, errMsg);
- if (interf_v == NULL)
- {
- amdlibComputeP2VM_FREEALL();
- return amdlibFAILURE;
- }
- interf_0 = amdlibAlloc2DArrayDouble(nx, nbBases, errMsg);
- if (interf_0 == NULL)
- {
- amdlibComputeP2VM_FREEALL();
- return amdlibFAILURE;
- }
- interf_1 = amdlibAlloc2DArrayDouble(nx, nbBases, errMsg);
- if (interf_1 == NULL)
- {
- amdlibComputeP2VM_FREEALL();
- return amdlibFAILURE;
- }
- photo_v = amdlibAlloc2DArrayDouble(nbTel, nbTel, errMsg);
- if (photo_v == NULL)
- {
- amdlibComputeP2VM_FREEALL();
- return amdlibFAILURE;
- }
-
- /* The first index of photo_0/1 refers to the baseline, the
- * second to the telescope. These are NOT contiguous arrays!
- * Must be equivalent to photo_0[nbTel][nbBases]
- * (are contiguous only in 3tel/3baseline case)*/
- photo_0 = amdlibAlloc2DArrayDouble(nbBases, nbTel, errMsg);
- if (photo_0 == NULL)
- {
- amdlibComputeP2VM_FREEALL();
- return amdlibFAILURE;
- }
- photo_1 = amdlibAlloc2DArrayDouble(nbBases, nbTel, errMsg);
- if (photo_1 == NULL)
- {
- amdlibComputeP2VM_FREEALL();
- return amdlibFAILURE;
- }
- mu_k_1 = amdlibAlloc2DArrayDouble(nx, nbBases, errMsg);
- if (mu_k_1 == NULL)
- {
- amdlibComputeP2VM_FREEALL();
- return amdlibFAILURE;
- }
- mu_k_2 = amdlibAlloc2DArrayDouble(nx, nbBases, errMsg);
- if (mu_k_2 == NULL)
- {
- amdlibComputeP2VM_FREEALL();
- return amdlibFAILURE;
- }
- ck = amdlibAlloc2DArrayDouble(nx, nbBases, errMsg);
- if (ck == NULL)
- {
- amdlibComputeP2VM_FREEALL();
- return amdlibFAILURE;
- }
- dk = amdlibAlloc2DArrayDouble(nx, nbBases, errMsg);
- if (dk == NULL)
- {
- amdlibComputeP2VM_FREEALL();
- return amdlibFAILURE;
- }
- sigma2CW = amdlibAlloc2DArrayDouble(nbBases, nl, errMsg);
- if (sigma2CW == NULL)
- {
- amdlibComputeP2VM_FREEALL();
- return amdlibFAILURE;
- }
- mat=calloc(nbTel*nbTel, sizeof(double));
- vect=calloc(nbTel,sizeof(double));
- vect2=calloc(nbTel,sizeof(double));
- gamma0=amdlibAlloc2DArrayDouble(nl, nbBases, errMsg);
- if (gamma0 == NULL)
- {
- amdlibComputeP2VM_FREEALL();
- return amdlibFAILURE;
- }
- gamma0w=amdlibAlloc2DArrayDouble(nl, nbBases, errMsg);
- if (gamma0w == NULL)
- {
- amdlibComputeP2VM_FREEALL();
- return amdlibFAILURE;
- }
- phaseDerivative=amdlibAlloc2DArrayDouble(nl, nbBases, errMsg);
- if (phaseDerivative == NULL)
- {
- amdlibComputeP2VM_FREEALL();
- return amdlibFAILURE;
- }
- unormalizedP2vmInternalCopy=amdlibAlloc3DArrayDouble(2*nbBases,nx,nl,errMsg);
- if (unormalizedP2vmInternalCopy == NULL)
- {
- amdlibComputeP2VM_FREEALL();
- return amdlibFAILURE;
- }
-
- /* clean start with default values for all elements in the p2vm */
- /* l = spectral channels */
- for (l = 0; l < nl; l++)
- {
- /* Set vk and sumVk to 0 */
- for (t = 0; t < nbTel; t++)
- {
- for (j = 0; j < nx; j++)
- {
- p2vm->vkPt[t][l][j] = 0;
- }
- }
- p2vm->sumVkPt[0][l] = 0.0;
- if (nbTel == 3)
- {
- p2vm->sumVkPt[1][l] = 0.0;
- p2vm->sumVkPt[2][l] = 0.0;
- }
- /* Set ck to 1 and dk to invalid */
- for (baseline = 0; baseline < nbBases; baseline++)
- {
- for (j = 0; j < nx; j++)
- {
- p2vm->matrixPt[l][j][baseline] = amdlibInvalidCkDkValue;
- p2vm->matrixPt[l][j][baseline+nbBases] = amdlibInvalidCkDkValue;
- unormalizedP2vmInternalCopy[l][j][baseline] = amdlibInvalidCkDkValue;
- unormalizedP2vmInternalCopy[l][j][baseline+nbBases] = amdlibInvalidCkDkValue;
- }
- p2vm->phasePt[baseline][l] = 0.0;
- gamma0[baseline][l]=0.0;
- gamma0w[baseline][l]=0.0;
- }
- }
-
- /* l = spectral channels */
- for (l = 0; l < nl; l++)
- { /* begin for-loop for each wavelength */
- /* In the following comments, the number of shutter closed
- * apply in the 3 telescope case*/
-
- /* Get photometry info, and copy them into P2VM data structure */
- for (t=0; t<nbTel; t++)
- {
- photo_v[t][0] = scienceData[t].frame[0].photo1[l];
- photo_v[t][1] = scienceData[t].frame[0].photo2[l];
- if (nbTel == 3) photo_v[t][2] = scienceData[t].frame[0].photo3[l];
- }
- for (baseline = 0; baseline < nbBases; baseline++)
- {
- /* The second index of photo_0/1 refers to the baseline, the
- * first to the telescope. */
- photo_0[0][baseline] =
- scienceData[baseline + 3].frame[0].photo1[l];
- photo_0[1][baseline] =
- scienceData[baseline + 3].frame[0].photo2[l];
- if (nbTel == 3)
- {
- photo_0[2][baseline] =
- scienceData[baseline + 3].frame[0].photo3[l];
- }
- photo_1[0][baseline] =
- scienceData[baseline + 6].frame[0].photo1[l];
- photo_1[1][baseline] =
- scienceData[baseline + 6].frame[0].photo2[l];
- if (nbTel == 3)
- {
- photo_1[2][baseline] =
- scienceData[baseline + 6].frame[0].photo3[l];
- }
- for (j = 0; j < nx; j++)
- {
- interf_0[baseline][j] =
- scienceData[baseline + 3].frame[0].intf[l * nx + j];
- interf_1[baseline][j] =
- scienceData[baseline + 6].frame[0].intf[l * nx + j];
- }
- }
- for (t = 0; t < nbTel; t++)
- {
- for (j = 0; j < nx; j++)
- {
- interf_v[t][j] = scienceData[t].frame[0].intf[l * nx + j];
- }
- }
- if (nbTel == 3)
- {
- mat[0]=photo_v[0][0];
- mat[1]=photo_v[0][1];
- mat[2]=photo_v[0][2];
- mat[3]=photo_v[1][0];
- mat[4]=photo_v[1][1];
- mat[5]=photo_v[1][2];
- mat[6]=photo_v[2][0];
- mat[7]=photo_v[2][1];
- mat[8]=photo_v[2][2];
- } else {
- mat[0]=photo_v[0][0];
- mat[1]=photo_v[0][1];
- mat[2]=photo_v[1][0];
- mat[3]=photo_v[1][1];
- }
- amdlibInvertMatrix(mat, nbTel);
-
- /* The Following will differentiate then between flagged and
- * not flagged wavelengths:
- */
- if (p2vm->flag[l] == amdlibTRUE)
- {
- /* Computation of the vk coefficients for this wavelength (for all
- * telescopes), taking into account the possible Ghosts.*/
- /* Ghost removal scheme: find the true vki as
- * I1 = v1k*P11 + v2k*P12 + v3k*P13
- * I2 = v1k*P21 + v2k*P22 + v3k*P23
- * I3 = v1k*P31 + v2k*P32 + v3k*P33
- * by inverting the matrix, etc.
- */
- for (j = 0; j < nx; j++)
- {
- double v1,v2,v3;
- if (p2vm->badPixelsPt[l][j] == amdlibGOOD_PIXEL_FLAG)
- {
- if (nbTel == 3)
- {
- vect[0]=interf_v[0][j];
- vect[1]=interf_v[1][j];
- vect[2]=interf_v[2][j];
- if (amdlibProductMatrix(mat, vect, vect2, nbTel, nbTel,1) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Product matrix error.");
- return amdlibFAILURE;
- }
- v1=vect2[0];
- v2=vect2[1];
- v3=vect2[2];
- p2vm->vkPt[0][l][j] = v1;
- p2vm->vkPt[1][l][j] = v2;
- p2vm->vkPt[2][l][j] = v3;
- } else {
- vect[0]=interf_v[0][j];
- vect[1]=interf_v[1][j];
- if (amdlibProductMatrix(mat, vect, vect2, nbTel, nbTel,1) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Product matrix error.");
- return amdlibFAILURE;
- }
- v1=vect2[0];
- v2=vect2[1];
- p2vm->vkPt[0][l][j] = v1;
- p2vm->vkPt[1][l][j] = v2;
- }
- } else {
- for (t = 0; t < nbTel; t++)
- {
- p2vm->vkPt[t][l][j] = 0.0;
- }
- }
- }
- /* Compute theoretical SNR on (yet to come) instrumental
- * visibilities here. Note SNR will really be computed at end */
- /* baseline 1-2 */
- sigma2CW[l][0] = amdlibEstimateCWVariance(
- &interf_0[0][0],
- &interf_1[0][0],
- &p2vm->vkPt[0][l][0],
- &p2vm->vkPt[1][l][0],
- photo_0[0][0],
- photo_0[1][0],
- photo_1[0][0],
- photo_1[1][0],
- amdlibTYPICAL_RON,
- nx);
- if (nbTel == 3)
- {
- /* Baseline 2-3 */
- sigma2CW[l][1] = amdlibEstimateCWVariance(
- &interf_0[1][0],
- &interf_1[1][0],
- &p2vm->vkPt[1][l][0],
- &p2vm->vkPt[2][l][0],
- photo_0[1][1],
- photo_0[2][1],
- photo_1[1][1],
- photo_1[2][1],
- amdlibTYPICAL_RON,
- nx);
- /* Baseline 3-1 */
- sigma2CW[l][2] = amdlibEstimateCWVariance(
- &interf_0[2][0],
- &interf_1[2][0],
- &p2vm->vkPt[2][l][0],
- &p2vm->vkPt[0][l][0],
- photo_0[2][2],
- photo_0[0][2],
- photo_1[2][2],
- photo_1[0][2],
- amdlibTYPICAL_RON,
- nx);
- }
- /* Computation of the mu coefficients: */
- for (j = 0; j < nx; j++) /* j is the spatial extent parameter */
- {
- if (p2vm->badPixelsPt[l][j] == amdlibGOOD_PIXEL_FLAG)
- {
- if (nbTel == 3)
- {
- /* baseline 1-2 */
- mu_k_1[0][j] = interf_0[0][j] -
- photo_0[0][0] * p2vm->vkPt[0][l][j] -
- photo_0[1][0] * p2vm->vkPt[1][l][j] -
- photo_0[2][0] * p2vm->vkPt[2][l][j];
- mu_k_2[0][j] = interf_1[0][j] -
- photo_1[0][0] * p2vm->vkPt[0][l][j] -
- photo_1[1][0] * p2vm->vkPt[1][l][j] -
- photo_1[2][0] * p2vm->vkPt[2][l][j];
- /* baseline 2-3 */
- mu_k_1[1][j] = interf_0[1][j] -
- photo_0[0][1] * p2vm->vkPt[0][l][j] -
- photo_0[1][1] * p2vm->vkPt[1][l][j] -
- photo_0[2][1] * p2vm->vkPt[2][l][j];
- mu_k_2[1][j] = interf_1[1][j] -
- photo_1[0][1] * p2vm->vkPt[0][l][j] -
- photo_1[1][1] * p2vm->vkPt[1][l][j] -
- photo_1[2][1] * p2vm->vkPt[2][l][j];
- /* baseline 3-1 */
- mu_k_1[2][j] = interf_0[2][j] -
- photo_0[0][2] * p2vm->vkPt[0][l][j] -
- photo_0[1][2] * p2vm->vkPt[1][l][j] -
- photo_0[2][2] * p2vm->vkPt[2][l][j];
- mu_k_2[2][j] = interf_1[2][j] -
- photo_1[0][2] * p2vm->vkPt[0][l][j] -
- photo_1[1][2] * p2vm->vkPt[1][l][j] -
- photo_1[2][2] * p2vm->vkPt[2][l][j];
- }
- else
- {
- /* baseline 1-2 : we do not have the ghost information on 3rd beam alas!*/
- mu_k_1[0][j] = interf_0[0][j] -
- photo_0[0][0] * p2vm->vkPt[0][l][j] -
- photo_0[1][0] * p2vm->vkPt[1][l][j];
- mu_k_2[0][j] = interf_1[0][j] -
- photo_1[0][0] * p2vm->vkPt[0][l][j] -
- photo_1[1][0] * p2vm->vkPt[1][l][j];
- }
- }
- else
- {
- for (baseline = 0; baseline < nbBases; baseline++)
- {
- mu_k_1[baseline][j] = 0.0;
- mu_k_2[baseline][j] = 0.0;
- }
- }
- }
-
- /* Computation of sumv1v2 (for all baselines). Bad Pix Vks are
- * already at 0, so sumvk is OK : */
- p2vm->sumVkPt[0][l] = 0.0;
- if (nbTel == 3)
- {
- p2vm->sumVkPt[1][l] = 0.0;
- p2vm->sumVkPt[2][l] = 0.0;
- }
- for (j = 0; j < nx; j++)
- {
- /* Baseline 1-2 */
- p2vm->sumVkPt[0][l] += p2vm->vkPt[0][l][j] *
- p2vm->vkPt[1][l][j];
-
- if (nbTel == 3)
- {
- /* Baseline 2-3 */
- p2vm->sumVkPt[1][l] += p2vm->vkPt[1][l][j] *
- p2vm->vkPt[2][l][j];
- /* Baseline 3-1 */
- p2vm->sumVkPt[2][l] += p2vm->vkPt[2][l][j] *
- p2vm->vkPt[0][l][j];
- }
- }
-
- /* Computation of cks and first use of dk (to be modified after)
- * bad pixel's ck and dk are at 0 since mu_k_1 and 2 are 0 */
- for (j = 0; j < nx; j++)
- {
- /* Baseline 1-2 */
- ck[0][j] = 0.5 * mu_k_1[0][j] /
- amdlibSignedSqrt(photo_0[0][0] * photo_0[1][0] * p2vm->sumVkPt[0][l]);
- if (nbTel == 3)
- {
- /* Baseline 2-3 */
- ck[1][j] = 0.5 * mu_k_1[1][j] /
- amdlibSignedSqrt(photo_0[1][1] * photo_0[2][1] * p2vm->sumVkPt[1][l]);
- /* Baseline 3-1 */
- ck[2][j] = 0.5 * mu_k_1[2][j] /
- amdlibSignedSqrt(photo_0[2][2] * photo_0[0][2] * p2vm->sumVkPt[2][l]);
- }
- /* Baseline 1-2 */
- dk[0][j] = 0.5 * mu_k_2[0][j] /
- amdlibSignedSqrt(photo_1[0][0] * photo_1[1][0] * p2vm->sumVkPt[0][l]);
- if (nbTel == 3)
- {
- /* Baseline 2-3 */
- dk[1][j] = 0.5 * mu_k_2[1][j] /
- amdlibSignedSqrt(photo_1[1][1] * photo_1[2][1] * p2vm->sumVkPt[1][l]);
- /* Baseline 3-1 */
- dk[2][j] = 0.5 * mu_k_2[2][j] /
- amdlibSignedSqrt(photo_1[2][2] * photo_1[0][2] * p2vm->sumVkPt[2][l]);
- }
- }
-
- /* Estimate the correct gamma0 and compute the dks*/
- for (baseline = 0; baseline < nbBases; baseline++)
- {
- sumck2 = 0;
- sumckdk = 0;
- for (j = 0; j < nx; j++)
- {
- sumck2 += amdlibPow2(ck[baseline][j]);
- }
- for (j = 0; j < nx; j++)
- {
- sumckdk += ck[baseline][j] * dk[baseline][j];
- }
- cosgamm0 = sumckdk / sumck2;
- /* If gamma0 is invalid (may be NaN) */
- if ((cosgamm0==cosgamm0) && cosgamm0 >= -1.0 && cosgamm0 <= 1.0 )
- {
- gamma0[baseline][l]=acos(cosgamm0);
- gamma0w[baseline][l]=1.0;
- }
- for (j = 0; j < nx; j++)
- {
- p2vm->matrixPt[l][j][baseline] = ck[baseline][j];
- p2vm->matrixPt[l][j][baseline+nbBases] = dk[baseline][j];
- unormalizedP2vmInternalCopy[l][j][baseline] = ck[baseline][j];
- unormalizedP2vmInternalCopy[l][j][baseline+nbBases] = dk[baseline][j];
- }
- }
- }
- } /* End for-loop for each wavelength */
-
- if (amdlibGetUserPref(amdlibGAUSSSMOOTH_P2VM_PHASE).set==amdlibTRUE)
- {
- if (isLowJHK==0)
- {
- fwhm=amdlibGetUserPref(amdlibGAUSSSMOOTH_P2VM_PHASE).value;
- amdlibGaussSmooth(nl, gamma0[0], fwhm);
- if (nbTel == 3)
- {
- amdlibGaussSmooth(nl, gamma0[1], fwhm);
- amdlibGaussSmooth(nl, gamma0[2], fwhm);
- }
- }
- }
- else if (amdlibGetUserPref(amdlibBOXCARSMOOTH_P2VM_PHASE).set==amdlibTRUE)
- {
- if (isLowJHK==0)
- {
- boxcar=floor(amdlibGetUserPref(amdlibBOXCARSMOOTH_P2VM_PHASE).value);
- /* Boxcar Smoothing of the gamma0 values (HR and MR only)*/
- if (boxcar>2 && boxcar<nl/10 ) {
- amdlibBoxCarSmooth(nl, gamma0[0], boxcar);
- if (nbTel == 3)
- {
- amdlibBoxCarSmooth(nl, gamma0[1], boxcar);
- amdlibBoxCarSmooth(nl, gamma0[2], boxcar);
- }
- }
- else
- {
- amdlibLogWarning("Unappropriate Boxcar Smoothing width, ignored.");
- }
- }
- }
- else if (amdlibGetUserPref(amdlibLINEARIZE_P2VM_PHASE).set==amdlibTRUE)
- {
- if (isLowJHK==0)
- {
- /* fit a 1st deg function in the gamma0 values in HR and MR mode*/
- amdlibLinearize(nl, gamma0[0],gamma0w[0]);
- if (nbTel == 3)
- {
- amdlibLinearize(nl, gamma0[1],gamma0w[1]);
- amdlibLinearize(nl, gamma0[2],gamma0w[2]);
- }
- }
- }
- /* recompute ck and dk after changes of vlaues of the phase (linear, smooth, etc) */
- for (l = 0; l < nl; l++)
- {
- for (baseline = 0; baseline < nbBases; baseline++)
- {
- if (gamma0w[baseline][l]==1)
- {
- cosgamm0 = cos(gamma0[baseline][l]);
- singamm0 = amdlibSignedSqrt(1.0-(cosgamm0 * cosgamm0));
- sumck=0;
- sumdk=0;
- for (j = 0; j < nx; j++)
- {
- ck[baseline][j]=p2vm->matrixPt[l][j][baseline];
- dk[baseline][j]=p2vm->matrixPt[l][j][baseline+nbBases];
- sumck+=amdlibPow2(ck[baseline][j]);
- dk[baseline][j] = -ck[baseline][j]*cosgamm0/singamm0+dk[baseline][j]/singamm0; /*rotate dk*/
- sumdk+=amdlibPow2(dk[baseline][j]);
- }
-
- /* If we want to Normalize the P2VM to V=1 */
- /* First save unomrlized values in the internal copy:*/
- for (j = 0; j < nx; j++)
- {
- unormalizedP2vmInternalCopy[l][j][baseline]=ck[baseline][j];
- unormalizedP2vmInternalCopy[l][j][baseline+nbBases]=dk[baseline][j];
- }
- /* then apply normalisation if any */
- if (amdlibGetUserPref(amdlibNORMALIZE_P2VM).set==amdlibTRUE)
- {
- sumck=amdlibSignedSqrt(2*sumck);
- sumdk=amdlibSignedSqrt(2*sumdk);
- }
- else
- {
- sumck=1.0;
- sumdk=1.0;
- }
- for (j = 0; j < nx; j++)
- {
- ck[baseline][j] /= sumck;
- dk[baseline][j] /= sumdk;
- p2vm->matrixPt[l][j][baseline]=ck[baseline][j];
- p2vm->matrixPt[l][j][baseline+nbBases]=dk[baseline][j];
- }
- p2vm->phasePt[baseline][l] = gamma0[baseline][l];
- }
- }
- }
- /*in LR mode, tag regions where the bands surperpose :*/
- /* it suffices to look where the derivative of gamma0*lambda (aka the piezo displacement) has big drops */
- if (isLowJHK==1 && amdlibGetUserPref(amdlibZAP_JHK_DISCONTINUTIES).set==amdlibTRUE)
- {
- double median[3];
- int weight;
- for (baseline = 0; baseline < nbBases; baseline++)
- {
- for (l = 1; l < nl; l++)
- {
- phaseDerivative[baseline][l]=fabs(p2vm->phasePt[baseline][l]*p2vm->wlen[l]-p2vm->phasePt[baseline][l-1]*p2vm->wlen[l-1])/2.0l/M_PI;
- }
- median[baseline]=amdlibQuickSelectDble(&phaseDerivative[baseline][1],nl-1);
- }
- for (l = 1; l < nl; l++)
- {
- weight=0;
- for (baseline = 0; baseline < nbBases; baseline++)
- {
- if (phaseDerivative[baseline][l]>8*median[baseline])
- {
- weight++;
- }
- } /* to be valid, displacement must be confirmed on 2 or more baselines for 3t,
- * 1 baseline for 2T */
- if (((double)(weight)/(double)(nbBases))>0.5)
- {
- p2vm->flag[l] = amdlibFALSE;
- for (k = 0; k < nbBases; k++)
- {
- for (j = 0; j < nx; j++)
- {
- p2vm->vkPt[k][l][j] = 0;
- p2vm->matrixPt[l][j][k] = amdlibInvalidCkDkValue;
- p2vm->matrixPt[l][j][k+nbBases] = amdlibInvalidCkDkValue;
- }
- p2vm->sumVkPt[k][l] = 0.0;
- p2vm->phasePt[k][l] = 0.0;
- gamma0[k][l]=0.0;
- gamma0w[k][l]=0.0;
- }
- }
- }
- /*Optionally, compute Offset as difference between 1st wl of K band and a fixed value.*/
- if (amdlibGetUserPref(amdlibAUTO_SHIFT_JHK).set==amdlibTRUE)
- {
- double offset;
- l=0;
- /* jump eventual flagged end of K Band */
- while (p2vm->flag[l]==amdlibFALSE && l< nl)
- {
- l++;
- }
- /* find jump if any */
- while (p2vm->flag[l]==amdlibTRUE && l< nl)
- {
- l++;
- }
- if (l<nl)
- {
- offset=(p2vm->wlen[l-1]-amdlibWAVELENGTH_HK_PHASE_JUMP);
- /* perform this shift */
- for (l = 0; l < nl; l++)
- {
- p2vm->wlen[l]-=offset;
- }
- amdlibLogInfo("Performed shift of %lf nm to align wavelength table on H-K discontinuity.",offset);
- }
- else
- {
- amdlibLogInfo("H-K discontinuity not found, requested automatic wavelength shift not performed, sorry.");
- }
- }
- }
-
- /* Compute fringe contrasts on unormalized values */
- for (l = 0; l < nl; l++)
- {
- for (baseline = 0; baseline < nbBases; baseline++)
- {
- if (gamma0w[baseline][l]==1)
- {
- double vis = 0.0;
- for (j = 0; j < nx; j++)
- {
- ck[baseline][j]=unormalizedP2vmInternalCopy[l][j][baseline];
- dk[baseline][j]=unormalizedP2vmInternalCopy[l][j][baseline+nbBases];
- vis += ck[baseline][j] * ck[baseline][j] +
- dk[baseline][j] * dk[baseline][j];
- }
- if ((sigma2CW[l][baseline] * vis) != 0)
- {
- /* Filter out value with Err/Vis > 0.2%) */
- if ((sigma2CW[l][baseline] / amdlibSignedSqrt(vis)) < 0.002)
- {
- p2vm->insVis[baseline] += amdlibSignedSqrt(vis);
- p2vm->insVisErr[baseline] +=
- 1 / (4 * sigma2CW[l][baseline] * vis);
- nbVis[baseline] += 1;
- amdlibBAND theBand;
- theBand = amdlibGetBand(p2vm->wlen[l]);
- if (theBand != -1)
- {
- p2vm->insVisInBand[baseline][theBand] +=
- amdlibSignedSqrt(vis);
- p2vm->insVisErrInBand[baseline][theBand] +=
- 1 / (4 * sigma2CW[l][baseline] * vis);
- nbVisInBand[baseline][theBand] += 1;
- }
- }
- }
- }
- }
- }
- /* final estimate of fringe contrast per base, per band.*/
- for (baseline = 0; baseline < nbBases; baseline++)
- {
- if (nbVis[baseline] != 0)
- {
- p2vm->insVis[baseline] = p2vm->insVis[baseline] / nbVis[baseline];
- p2vm->insVisErr[baseline] = 1/p2vm->insVisErr[baseline];
- }
- else
- {
- p2vm->insVis[baseline] = 0.0;
- p2vm->insVisErr[baseline] = 0.0;
- }
- for (band = 0; band < amdlibNB_BANDS; band++)
- {
- if (nbVisInBand[baseline][band] != 0)
- {
- p2vm->insVisInBand[baseline][band] =
- p2vm->insVisInBand[baseline][band] /
- nbVisInBand[baseline][band];
- p2vm->insVisErrInBand[baseline][band] =
- 1/p2vm->insVisErrInBand[baseline][band];
- }
- else
- {
- p2vm->insVisInBand[baseline][band] = 0.0;
- p2vm->insVisErrInBand[baseline][band] = 0.0;
- }
- }
- }
-
- amdlibComputeP2VM_FREEALL();
-
- /* Set the P2VM Id */
- p2vm->id = p2vmData->p2vmId;
-
- return amdlibSUCCESS;
-}
-
-/**
- * Check whether the given channel is valid in P2VM or not.
- *
- * This function check that the given channel belows to P2VM and is valid; i.e.
- * the corresponding flag is true. If it is a valid channel; this function
- * returns the correponding index in P2VM matrix.
- *
- * @param p2vm pointer to the P2VM
- * @param channelNo spectral channel number
- * @param iChannel spectral channel index in P2VM.
- *
- * @return
- * spectral channel validity flag.
- */
-amdlibBOOLEAN amdlibIsValidChannel(amdlibP2VM_MATRIX *p2vm,
- int channelNo,
- int *iChannel)
-{
- /* Compute spectral channel index in P2VM */
- int iP2vmChannel = channelNo - p2vm->firstChannel;
- if ((iP2vmChannel < 0) ||
- (iP2vmChannel >= p2vm->nbChannels) ||
- (p2vm->flag[iP2vmChannel] == amdlibFALSE) ||
- (p2vm->wlen[iP2vmChannel] <= 0.0))
- {
- *iChannel = -1;
- return amdlibFALSE;
- }
- else
- {
- *iChannel = iP2vmChannel;
- return amdlibTRUE;
- }
-}
-
-/**
- * Check compatibility between the science data and P2VM,
- *
- * This function checks compatibility between the science data and P2VM, and
- * returns true if the P2VM can be used to process science data with (in this
- * case) the percentage of spectral channels covered by P2VM.
- *
- * @param scienceData structure where science data is stored
- * @param p2vm structure where P2VM is stored
- * @param percentage percentage of covered channels used as threshold.
- *
- * @return
- * True if P2VM can be used, and false otherwise.
- */
-amdlibBOOLEAN amdlibIsP2VMUsable(amdlibSCIENCE_DATA *scienceData,
- amdlibP2VM_MATRIX *p2vm,
- amdlibDOUBLE *percentage)
-{
- amdlibBOOLEAN isUsable;
- int l;
- int nbCovSpecChannels; /* Number of channels covered by P2VM */
- int nbTel;
- isUsable = amdlibTRUE;
-
- amdlibLogTrace("amdlibIsP2VMUsable()");
-
- /* If P2VM data structure is not initailized, do it */
- if (p2vm->thisPtr != p2vm)
- {
- amdlibInitP2VM(p2vm);
- }
-
- /* Check the number of telescopes and baselines */
- nbTel = scienceData->nbCols-1;
- if (nbTel == 1)
- {
- isUsable = amdlibFALSE;
- *percentage = 0.0;
- }
- else if ((nbTel == 3) && (p2vm->type == amdlibP2VM_2T))
- {
- isUsable = amdlibFALSE;
- *percentage = 0.0;
- }
- /* Check interferometric channel width */
- else if (p2vm->nx != scienceData->col[amdlibINTERF_CHANNEL].nbPixels)
- {
- isUsable = amdlibFALSE;
- *percentage = 0.0;
- }
- else
- {
- /* Get total number of spectral channels */
- nbCovSpecChannels = 0;
- /* For all channels of the science data */
- for (l = 0; l < scienceData->nbChannels; l++)
- {
- /* If channel belongs to P2VM */
- if ((scienceData->channelNo[l] >= p2vm->firstChannel) &&
- (scienceData->channelNo[l] <= (p2vm->firstChannel +
- p2vm->nbChannels)))
- {
- /* Increase number of covered channels */
- nbCovSpecChannels++;
- }
- }
-
- /* The percentage of spectral channels covered by P2VM */
- if (nbCovSpecChannels != 0)
- {
- isUsable = amdlibTRUE;
- *percentage = 100.0 *
- (amdlibDOUBLE)nbCovSpecChannels/(amdlibDOUBLE)scienceData->nbChannels;
- }
- else
- {
- isUsable = amdlibFALSE;
- *percentage = 0.0;
- }
- isUsable = amdlibTRUE;
- }
- return (isUsable);
-}
-
-/**
- * Save P2VM into a file.
- *
- * This function creates FITS file containing P2VM stored in a binary table.
- *
- * @param filename name of the FITS file where 2D images will be stored.
- * @param p2vm structure where P2VM is stored
- * @param accuracy P2VM accuracy (amdlibP2VM_STD_ACC or amdlibP2VM_HIGH_ACC)
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibSaveP2VM(const char *filename,
- amdlibP2VM_MATRIX *p2vm,
- amdlibP2VM_ACCURACY accuracy,
- amdlibERROR_MSG errMsg)
-{
- char *ttype[] = {"EFF_WAVE", "MATRIX", "VK", "SUM_VK",
- "BAD_PIXELS", "PHOTOMETRY", "FLAG",
- "CALIB_PHASE", "FLAT_FIELD"};
- char *tform[9];
- char tform1[36];
- char tform2[36];
- char tform3[36];
- char tform4[36];
- char tform5[36];
- char tform6[36];
- char tform7[36];
- char tform8[36];
- char tform9[36];
- char *tunit[] = {"m", "", "", "", "", "e-", "", "deg", ""};
- int i, j, k;
- int status = 0;
- fitsfile *p2vmFile;
- char fitsioMsg[256];
-#ifndef ESO_CPL_PIPELINE_VARIANT
- struct stat statBuf;
-#endif
- amdlibDOUBLE* theTable;
-
- int nbTel;
- int nbBases;
-
- char keywName[amdlibKEYW_NAME_LEN+1];
- char keywValue[amdlibKEYW_VAL_LEN+1];
- double obsDate;
-
- int colNum;
- char tDim[32];
- char tDimVal[32];
-
- time_t timeSecs;
-
- struct tm *timeNow;
- char strTime[256];
-
- int nl, inl; /*number of wlen and initial number of wlen*/
- int sp, ep; /*start, end pixel of subset written in fits file*/
- int nx;
- char *startTime;
- char version[32];
- int band, baseline;
-
- amdlibLogTrace("amdlibSaveP2VM()");
-
- /* Check the P2VM is initialised and computed */
- if (p2vm->thisPtr != p2vm)
- {
- amdlibSetErrMsg("P2VM is not initialised");
- return amdlibFAILURE;
- }
- if ((p2vm->type != amdlibP2VM_2T) && (p2vm->type != amdlibP2VM_3T))
- {
- amdlibSetErrMsg("P2VM has not been computed");
- return amdlibFAILURE;
- }
-
- /* Init the number of telescopes and baselines according to P2VM type */
- if (p2vm->type == amdlibP2VM_2T)
- {
- nbTel = 2;
- nbBases = 1;
- }
- else
- {
- nbTel = 3;
- nbBases = 3;
- }
-
- /* Reset error message */
- memset(errMsg, '\0', sizeof(amdlibERROR_MSG));
-
-#ifndef ESO_CPL_PIPELINE_VARIANT
- /*
- * amdlib will create the file on its own
- */
- /* First remove previous P2VM file (if any) */
- if (stat(filename, &statBuf) == 0)
- {
- if (remove(filename) != 0)
- {
- amdlibSetErrMsg("Could not overwrite file %s", filename);
- return amdlibFAILURE;
- }
- }
-
- /* Create new FITS file */
- if (fits_create_file(&p2vmFile, filename, &status) != 0)
- {
- amdlibReturnFitsError(filename);
- }
-#else
- /*
- * The ESO pipeline will create that file and prepare the header
- * with DMD compliant keywords. Hence amdlib shall just append to it
- */
-
- printf( "Opening File %s for appending...\n", filename );
-
- /* Append to FITS file */
- if( fits_open_file(&p2vmFile, filename, READWRITE, &status) )
- {
- printf( "%s->fits_open_file cannot open in append mode\n", filename );
- amdlibReturnFitsError(filename );
- }
- else
- {
- printf( "%s->fits_open_file append OK\n", filename);
- }
-#endif
-
- /* Reduce the size of the written P2VM in case spectral channels at start
- * or end have a zero lambda (normally, only JHK mode). This defines a new
- * setup of the camera when this library is used by the AMBER OS.
- */
- /* compute start and length of valid (lambda non-null) spectral window */
- inl = p2vm->nbChannels;
- sp = 0;
- while (sp < inl && p2vm->wlen[sp] <= 0.0)
- {
- sp++;
- }
- ep = inl - 1;
- while (ep >= 0 && p2vm->wlen[ep] <= 0.0)
- {
- ep--;
- }
- nl = ep + 1 - sp;
- nx = p2vm->nx;
-
- /***** Create the binary table */
- sprintf(tform1,"%dE", nl);
- sprintf(tform2,"%dD", nl*nx*2*nbBases); /* Matrix */
- sprintf(tform3,"%dD", nl*nx*nbTel); /* Vk */
- sprintf(tform4,"%dD", nl*nbBases); /* Sum of Vk */
- sprintf(tform5,"%dB", nl*nx); /* Bad pixels */
- sprintf(tform6,"%dD", nl*(2*nbBases+1)*3); /* Photometry */
- sprintf(tform7,"%dB", nl); /* Validity flag */
- sprintf(tform8,"%dD", nl*nbBases); /* Phase */
- sprintf(tform9,"%dE", nl*nx); /* FlatField */
- tform[0] = tform1;
- tform[1] = tform2;
- tform[2] = tform3;
- tform[3] = tform4;
- tform[4] = tform5;
- tform[5] = tform6;
- tform[6] = tform7;
- tform[7] = tform8;
- tform[8] = tform9;
- if (fits_create_tbl(p2vmFile, BINARY_TBL, 1, 9, ttype,
- tform, tunit, "P2VM", &status) != 0)
- {
- amdlibGetFitsError("P2VM");
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
-
- /***** Write the new binary table */
- /* Wavelengths table, subset extraction is easy... */
- colNum = 1;
- amdlibDOUBLE wlenInM[nl];
- for (i = 0; i < nl; i++)
- {
- wlenInM[i] = p2vm->wlen[sp + i] * amdlibNM_TO_M;
- }
- if (fits_write_col(p2vmFile, TDOUBLE, colNum, 1 ,1 , nl,
- wlenInM, &status) != 0)
- {
- amdlibGetFitsError("EFF_WAVE");
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
-
- /* Matrix : convert double to amdlibDOUBLE (subset is just an index shift), then
- * write */
- colNum = 2;
- /* Allocate amdlibDOUBLE table */
- theTable = calloc(p2vm->nbChannels * p2vm->nx * 6,
- sizeof(*theTable));
- if (theTable == NULL)
- {
- fits_close_file(p2vmFile, &status);
- amdlibSetErrMsg("Could not allocate memory for temporary buffer");
- return amdlibFAILURE;
- }
- for (i = 0; i < nl * nx * 2 * nbBases; i++)
- {
- theTable[i] = (amdlibDOUBLE)p2vm->matrix[2 * nbBases * nx * sp + i];
- }
- if (fits_write_col(p2vmFile, TDOUBLE, colNum, 1 ,1 ,
- nl * nx * 2*nbBases, theTable, &status) != 0)
- {
- free(theTable);
- amdlibGetFitsError("MATRIX");
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
- sprintf(tDim, "TDIM%d", colNum);
- sprintf(tDimVal, "(%d,%d,%d)", 2 * nbBases, nx, nl);
- if (fits_write_key(p2vmFile, TSTRING, tDim, tDimVal,
- "Dimensions of the array 'Matrix'", &status) != 0)
- {
- free(theTable);
- amdlibGetFitsError(tDim);
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
- /* vk : convert double to amdlibDOUBLE, extracting subset, then write */
- colNum = 3;
- for (k = 0; k < nbTel; k++)
- {
- for (i = 0; i < nl; i++)
- {
- for (j = 0; j < nx ; j++)
- {
- theTable[k*nx*nl + i*nx + j] = (amdlibDOUBLE)p2vm->vkPt[k][i+sp][j];
- }
- }
- }
- if (fits_write_col(p2vmFile, TDOUBLE, colNum, 1 ,1 ,
- nl *nx * nbTel, theTable, &status) != 0)
- {
- free(theTable);
- amdlibGetFitsError("VK");
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
- sprintf(tDim, "TDIM%d", colNum);
- sprintf(tDimVal, "(%d,%d,%d)", nx, nl, nbTel);
- if (fits_write_key(p2vmFile, TSTRING, tDim, tDimVal,
- "Dimensions of the array 'Vk'", &status) != 0)
- {
- free(theTable);
- amdlibGetFitsError(tDim);
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
- /* sumVk : convert double to amdlibDOUBLE, extract subset, then write */
- colNum = 4;
- for (j = 0; j < nbBases ; j++)
- {
- for (i = 0; i < nl; i++)
- {
- theTable[j*nl + i] = (amdlibDOUBLE)p2vm->sumVkPt[j][i+sp];
- }
- }
- if (fits_write_col(p2vmFile, TDOUBLE, colNum, 1 ,1 ,
- nl * nbBases, theTable, &status) != 0)
- {
- free(theTable);
- amdlibGetFitsError("SUM_VK");
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
- sprintf(tDim, "TDIM%d", colNum);
- sprintf(tDimVal, "(%d,%d)", nl, nbBases);
- if (fits_write_key(p2vmFile, TSTRING, tDim, tDimVal,
- "Dimensions of the array 'Sum_of_Vk'", &status) != 0)
- {
- amdlibGetFitsError(tDim);
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
- /* Bad pixel table. fortunately subset is just an index shift */
- colNum = 5;
- if (fits_write_col(p2vmFile, TBYTE, colNum, 1 ,1 , nl * nx,
- &p2vm->badPixelsPt[0][sp], &status) != 0)
- {
- free(theTable);
- amdlibGetFitsError("BAD_PIXELS");
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
- sprintf(tDim, "TDIM%d", colNum);
- sprintf(tDimVal, "(%d,%d)", nx, nl);
- if (fits_write_key(p2vmFile, TSTRING, tDim, tDimVal,
- "Dimensions of the array 'Bad_pixels'", &status) != 0)
- {
- free(theTable);
- amdlibGetFitsError(tDim);
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
- /* Photometry : convert double to amdlibDOUBLE, extract subset, then write */
- colNum = 6;
- for (i = 0; i < nl; i++)
- {
- for (j = 0; j < (2 * nbBases + 1) * 3 ; j++)
- {
- theTable[j*nl+i] = (amdlibDOUBLE) p2vm->photometry[j*inl+(i+sp)];
- }
- }
- if (fits_write_col(p2vmFile, TDOUBLE, colNum, 1 ,1 ,
- nl * (2 * nbBases + 1) * 3, theTable, &status) != 0)
- {
- free(theTable);
- amdlibGetFitsError("PHOTOMETRY");
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
- sprintf(tDim, "TDIM%d", colNum);
- sprintf(tDimVal, "(%d,%d,%d)", nl, 3, 2*nbBases+1);
- if (fits_write_key(p2vmFile, TSTRING, tDim, tDimVal,
- "Dimensions of the array 'Photometry'", &status) != 0)
- {
- free(theTable);
- amdlibGetFitsError(tDim);
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
- /* Validity flag, subset is a shift */
- colNum = 7;
- if (fits_write_col(p2vmFile, TBYTE, colNum, 1 ,1 ,
- nl, &p2vm->flag[sp], &status) != 0)
- {
- free(theTable);
- amdlibGetFitsError("FLAG");
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
- /* Phase : convert double to amdlibDOUBLE and radians to degrees, extract subset,
- * then write */
- colNum = 8;
- for (j = 0; j < nbBases ; j++)
- {
- for (i = 0; i < nl; i++)
- {
- theTable[j*nl + i] = (amdlibDOUBLE)p2vm->phasePt[j][i+sp] * 180.0 / M_PI;
- }
- }
- if (fits_write_col(p2vmFile, TDOUBLE, colNum, 1 ,1 ,
- nl * nbBases, theTable, &status) != 0)
- {
- free(theTable);
- amdlibGetFitsError("CALIB_PHASE");
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
- /* Free not used anymore theTable*/
- free(theTable);
-
- sprintf(tDim, "TDIM%d", colNum);
- sprintf(tDimVal, "(%d,%d)", nl, nbBases);
- if (fits_write_key(p2vmFile, TSTRING, tDim, tDimVal,
- "Dimensions of the array 'Phase'", &status)!=0)
- {
- amdlibGetFitsError(tDim);
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
-
- /* Flat Field table. fortunately subset is just an index shift */
- colNum = 9;
- if (fits_write_col(p2vmFile, TDOUBLE, colNum, 1 ,1 , nl * nx,
- &p2vm->flatFieldPt[0][sp], &status) != 0)
- {
- free(theTable);
- amdlibGetFitsError("FLAT_FIELD");
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
- sprintf(tDim, "TDIM%d", colNum);
- sprintf(tDimVal, "(%d,%d)", nx, nl);
- if (fits_write_key(p2vmFile, TSTRING, tDim, tDimVal,
- "Dimensions of the array 'FlatField'", &status) != 0)
- {
- free(theTable);
- amdlibGetFitsError(tDim);
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
-
- /* Complete binary table header */
- if (fits_write_key(p2vmFile, TINT, "NWAVE", &nl,
- "Number of spectral channels", &status) != 0)
- {
- amdlibGetFitsError("NWAVE");
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
- if (fits_write_key(p2vmFile, TINT, "WINTERF", &p2vm->nx,
- "Width of the interferometric channel", &status) != 0)
- {
- amdlibGetFitsError("WINTERF");
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
- /* Update start pixel */
- sp = (p2vm->firstChannel + 1) + sp;
- if (fits_write_key(p2vmFile, TINT, "STARTPIX", &sp,
- "First pixel on detector on Y axis for this P2VM",
- &status) != 0)
- {
- amdlibGetFitsError("STARTPIX");
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
-
- /* Complete main header */
- if (fits_movabs_hdu(p2vmFile, 1, 0, &status) != 0)
- {
- amdlibGetFitsError("Main header");
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
-
- /* Add DATE */
- timeSecs = time(NULL);
- timeNow = gmtime(&timeSecs);
- strftime(strTime, sizeof(strTime), "%Y-%m-%dT%H:%M:%S", timeNow);
- if (fits_update_key(p2vmFile, TSTRING, "DATE", strTime,
- "Date this file was written", &status) != 0)
- {
- amdlibGetFitsError("DATE");
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
-
- /* Add MJD-OBS and DATE-OBS */
- memset(keywValue, '\0', (amdlibKEYW_VAL_LEN+1)*sizeof(char));
- if (amdlibGetInsCfgKeyword(&(p2vm->insCfg), "MJD-OBS", keywValue,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- sscanf(keywValue, "%lf", &obsDate);
- /* Add 1 second to not have duplicated MJD-OBS */
- obsDate += 1.0/(24.0*3600.0);
- if (fits_update_key(p2vmFile, TDOUBLE, "MJD-OBS", &obsDate,
- "Observation start", &status))
- {
- amdlibGetFitsError("MJD-OBS");
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
- startTime = amdlibMJD2ISODate(obsDate);
- if (fits_update_key(p2vmFile, TSTRING, "DATE-OBS", startTime,
- "Observing date", &status) != 0)
- {
- amdlibGetFitsError("DATE-OBS");
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
-
-#ifndef ESO_CPL_PIPELINE_VARIANT
- /* Copy array containing instrument configuration into P2VM structure */
- for (i=0; i < p2vm->insCfg.nbKeywords; i++)
- {
- amdlibKEYW_LINE keywLine;
- if (((strstr(p2vm->insCfg.keywords[i].name,
- "HIERARCH ESO INS") != NULL) ||
- (strstr(p2vm->insCfg.keywords[i].name,
- "HIERARCH ESO OBS") != NULL) ||
- (strstr(p2vm->insCfg.keywords[i].name,
- "HIERARCH ESO OCS") != NULL) ||
- (strstr(p2vm->insCfg.keywords[i].name,
- "HIERARCH ESO DET") != NULL) ||
- (strstr(p2vm->insCfg.keywords[i].name,
- "HIERARCH ESO QC P1 ") != NULL) ||
- (strstr(p2vm->insCfg.keywords[i].name,
- "HIERARCH ESO QC P2 ") != NULL) ||
- (strstr(p2vm->insCfg.keywords[i].name,
- "HIERARCH ESO QC P3 ") != NULL) ||
- (strstr(p2vm->insCfg.keywords[i].name,
- "HIERARCH ESO TPL") != NULL) ||
- (strstr(p2vm->insCfg.keywords[i].name, "ORIGIN ") != NULL) ||
- (strstr(p2vm->insCfg.keywords[i].name, "EXPTIME ") != NULL) ||
- (strstr(p2vm->insCfg.keywords[i].name, "INSTRUME") != NULL) ||
- (strstr(p2vm->insCfg.keywords[i].name, "PI-COI ") != NULL) ||
- (strstr(p2vm->insCfg.keywords[i].name, "OBSERVER") != NULL) ||
- (strstr(p2vm->insCfg.keywords[i].name, "UTC ") != NULL)) &&
- (strstr(p2vm->insCfg.keywords[i].name,
- "HIERARCH ESO OCS P2VM") == NULL))
- {
- sprintf((char*)keywLine, "%s=%s/%s", p2vm->insCfg.keywords[i].name,
- p2vm->insCfg.keywords[i].value,
- p2vm->insCfg.keywords[i].comment);
- if (fits_write_record(p2vmFile, keywLine, &status) != 0)
- {
- amdlibGetFitsError(p2vm->insCfg.keywords[i].name);
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
- }
- }
-
-#endif
-
- /* Add amdlib version */
- amdlibGetVersion(version);
- if (fits_write_key(p2vmFile, TSTRING, "HIERARCH ESO OCS DRS VERSION",
- version,
- "Data Reduction SW version", &status) != 0)
- {
- amdlibGetFitsError("HIERARCH ESO OCS DRS VERSION");
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
-
- if (fits_write_key(p2vmFile, TINT, "HIERARCH ESO OCS P2VM NTEL", &nbTel,
- "Number of telescopes", &status) != 0)
- {
- amdlibGetFitsError("HIERARCH ESO OCS P2VM NTEL");
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
- if (fits_write_key(p2vmFile, TINT, "HIERARCH ESO OCS P2VM NINTERF",
- &nbBases,
- "Number of interferometric baselines", &status) != 0)
- {
- amdlibGetFitsError("HIERARCH ESO OCS P2VM NINTERF");
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
-
-#ifndef ESO_CPL_PIPELINE_VARIANT
- /* Add DPR keywords */
- if (fits_write_key(p2vmFile, TSTRING, "HIERARCH ESO DPR CATG", "CALIB",
- "Observation category", &status) != 0)
- {
- amdlibGetFitsError("HIERARCH ESO DPR CATG");
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
- if (fits_write_key(p2vmFile, TSTRING, "HIERARCH ESO DPR TECH",
- "INTERFEROMETRY", "Observation technique", &status) != 0)
- {
- amdlibGetFitsError("HIERARCH ESO DPR TECH");
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
-#endif
- if (fits_update_key(p2vmFile, TSTRING, "HIERARCH ESO DPR TYPE", "P2VM",
- "Observation type", &status) != 0)
- {
- amdlibGetFitsError("HIERARCH ESO DPR TYPE");
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
-
- /* Add P2VM Id */
- strcpy (keywName, "HIERARCH ESO OCS P2VM ID");
- if (fits_update_key(p2vmFile, TINT, keywName, &p2vm->id,
- "Unique P2VM id", &status) != 0)
- {
- amdlibGetFitsError(keywName);
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
-
-#ifndef ESO_CPL_PIPELINE_VARIANT /* TLICHA appears twice in pipline mode */
- /* Add accuracy keyword */
- strcpy (keywName, "HIERARCH ESO OCS P2VM ACCURACY");
- switch (accuracy)
- {
- case amdlibP2VM_STD_ACC :
- strcpy (keywValue, "std");
- break;
- case amdlibP2VM_HIGH_ACC :
- strcpy (keywValue, "high");
- break;
- default :
- strcpy (keywValue, "unknown");
- break;
- }
- if (fits_write_key(p2vmFile, TSTRING, keywName, keywValue,
- "P2VM accuracy", &status) != 0)
- {
- amdlibGetFitsError(keywName);
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
-#endif
-
- /* Add instrument visibility keywords */
- /* Check for 'nan' value, warn if found and force them to 0 */
- for (i=0; i<nbBases; i++)
- {
- if (isnan(p2vm->insVis[i]))
- {
- amdlibLogWarning("Instrument visibility is NaN at "
- "baseline %d", i);
- p2vm->insVis[i] = 0.0;
- }
- if (isnan(p2vm->insVisErr[i]))
- {
- amdlibLogWarning("Instrument visibility Error is NaN at "
- "baseline %d", i);
- p2vm->insVisErr[i] = 0.0;
- }
- for (band = 0; band < amdlibNB_BANDS; band++)
- {
- if (isnan(p2vm->insVisInBand[i][band]))
- {
- amdlibLogWarning("Instrument visibility is NaN at "
- "baseline %d in band %c", i,
- amdlibBandNumToStr(band));
- p2vm->insVisInBand[i][band] = 0.0;
- }
- if (isnan(p2vm->insVisErrInBand[i][band]))
- {
- amdlibLogWarning("Instrument visibility Error is NaN at "
- "baseline %d in band %c", i,
- amdlibBandNumToStr(band));
- p2vm->insVisErrInBand[i][band] = 0.0;
- }
- }
- }
-
- for (baseline = 0; baseline < nbBases; baseline++)
- {
- int baselineNum[amdlibNBASELINE] = {12, 23, 31};
- char comment[128];
- sprintf(keywName, "HIERARCH ESO QC P2VM VIS%d", baselineNum[baseline]);
- sprintf(comment, "Inst. visibility for the baseline %d",
- baselineNum[baseline]);
- if (fits_write_key(p2vmFile, TDOUBLE, keywName,
- &p2vm->insVis[baseline], comment, &status) != 0)
- {
- amdlibGetFitsError(keywName);
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
- sprintf(keywName, "HIERARCH ESO QC P2VM ERRVIS%d",
- baselineNum[baseline]);
- sprintf(comment, "Inst. vis. error for the baseline %d",
- baselineNum[baseline]);
- if (fits_write_key(p2vmFile, TDOUBLE, keywName,
- &p2vm->insVisErr[baseline], comment, &status) != 0)
- {
- amdlibGetFitsError(keywName);
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
-
- for (band = 0; band < amdlibNB_BANDS; band++)
- {
- char comment[128];
- sprintf(keywName, "HIERARCH ESO QC P2VM %c VIS%d",
- amdlibBandNumToStr(band), baselineNum[baseline]);
- sprintf(comment, "Inst. vis. for %d in %c",
- baselineNum[baseline], amdlibBandNumToStr(band));
- if (fits_write_key(p2vmFile, TDOUBLE, keywName,
- &p2vm->insVisInBand[baseline][band],
- comment, &status) != 0)
- {
- amdlibGetFitsError(keywName);
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
- sprintf(keywName, "HIERARCH ESO QC P2VM %c ERRVIS%d",
- amdlibBandNumToStr(band), baselineNum[baseline]);
- sprintf(comment, "Inst. vis. error for %d in %c",
- baselineNum[baseline], amdlibBandNumToStr(band));
- if (fits_write_key(p2vmFile, TDOUBLE, keywName,
- &p2vm->insVisErrInBand[baseline][band],
- comment, &status) != 0)
- {
- amdlibGetFitsError(keywName);
- fits_close_file(p2vmFile, &status);
- return amdlibFAILURE;
- }
- }
- }
-
- /* Close FITS file */
- if (fits_close_file(p2vmFile, &status))
- {
- amdlibReturnFitsError(filename);
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Load P2VM from file.
- *
- * This function loads the P2VM from file.
- *
- * @param filename name of the FITS file containing P2VM.
- * @param p2vm structure where P2VM will be stored
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibLoadP2VM(const char *filename,
- amdlibP2VM_MATRIX *p2vm,
- amdlibERROR_MSG errMsg)
-{
- int i,j,k;
- int status = 0;
- int anynull = 0;
- fitsfile *filePtr;
- char fitsioMsg[256];
- struct stat statBuf;
-
- amdlibDOUBLE *theTable;
-
- int nbTel;
- int nbBases;
-
- char keywName[amdlibKEYW_NAME_LEN+1];
- char keywValue[amdlibKEYW_VAL_LEN+1];
-
- int keysExist = 0;
- int moreKeys = 0;
- int nbKeywords = 0;
- amdlibKEYW_LINE record;
-
- amdlibBOOLEAN convert;
-
- int index = 0;
-
- amdlibLogTrace("amdlibLoadP2VM()");
-
- /* If P2VM data structure is not initailized, do it */
- if (p2vm->thisPtr != p2vm)
- {
- amdlibInitP2VM(p2vm);
- }
-
- /* Reset error message */
- memset(errMsg, '\0', sizeof(amdlibERROR_MSG));
-
- /* Check the file exists */
- if (stat(filename, &statBuf) != 0)
- {
- amdlibSetErrMsg("File '%.80s' does not exist", filename);
- return amdlibFAILURE;
- }
-
- /* Open FITS file */
- if (fits_open_file(&filePtr, filename, READONLY, &status) != 0)
- {
- amdlibReturnFitsError(filename);
- }
-
-#ifndef ESO_CPL_PIPELINE_VARIANT /* TLICHA: for pipline prefer the DET NTEL, OCS P2VM NTEL cannot be found?!? */
- /* Main header : get number of telescopes and baselines */
- if (fits_read_key(filePtr, TINT, "HIERARCH ESO OCS P2VM NTEL", &nbTel,
- NULL, &status) != 0)
- {
- status = 0;
- if (fits_read_key(filePtr, TINT, "NTEL", &nbTel, NULL, &status) != 0)
- {
- amdlibGetFitsError("HIERARCH ESO OCS P2VM NTEL");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
-#else
- /* Main header : get number of telescopes and baselines */
- if (fits_read_key(filePtr, TINT, "HIERARCH ESO DET NTEL", &nbTel,
- NULL, &status) != 0)
- {
- status = 0;
- if (fits_read_key(filePtr, TINT, "NTEL", &nbTel, NULL, &status) != 0)
- {
- amdlibGetFitsError("HIERARCH ESO DET NTEL");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
-#endif
-
-
- if (fits_read_key(filePtr, TINT, "HIERARCH ESO OCS P2VM NINTERF", &nbBases,
- NULL , &status) != 0)
- {
- status = 0;
- if (fits_read_key(filePtr, TINT, "NINTERF", &nbBases,
- NULL , &status) != 0)
- {
- amdlibGetFitsError("HIERARCH ESO OCS P2VM NINTERF");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
-
-
- if ((nbTel == 2) && (nbBases == 1))
- {
- p2vm->type = amdlibP2VM_2T;
- }
- else if ((nbTel == 3) && (nbBases == 3))
- {
- p2vm->type = amdlibP2VM_3T;
- }
- else
- {
- fits_close_file(filePtr, &status);
- amdlibSetErrMsg("Number of telescopes (%d) and number of "
- "interferometric baselines (%d) are inconsistent",
- nbTel, nbBases);
- return amdlibFAILURE;
- }
-
- /* Main header : get id */
- strcpy (keywName, "HIERARCH ESO OCS P2VM ID");
- if (fits_read_key (filePtr, TINT, keywName, &p2vm->id,
- NULL, &status) != 0)
- {
- p2vm->id = 0;
- status = 0;
- }
-
- /* Main header : get ndit */
- strcpy (keywName, "HIERARCH ESO DET NDIT");
- if (fits_read_key (filePtr, TINT, keywName, &p2vm->nbFrames,
- NULL, &status) != 0)
- {
- p2vm->id = 0;
- status = 0;
- }
-
- /* Main header : get accuracy */
- strcpy (keywName, "HIERARCH ESO OCS P2VM ACCURACY");
- memset(keywValue, '\0', (amdlibKEYW_VAL_LEN+1)*sizeof(char));
- if (fits_read_key (filePtr, TSTRING, keywName, keywValue,
- NULL, &status) != 0)
- {
- p2vm->accuracy = amdlibP2VM_UNKNOWN_ACC;
- status = 0;
- }
- if (strcmp (keywValue, "std") == 0)
- {
- p2vm->accuracy = amdlibP2VM_STD_ACC;
- }
- else if (strcmp (keywValue, "high") == 0)
- {
- p2vm->accuracy = amdlibP2VM_HIGH_ACC;
- }
- else
- {
- p2vm->accuracy = amdlibP2VM_UNKNOWN_ACC;
- }
- /* Main header : get instrument visibilities */
- /* Check for 'nan' value. If 'nan' force them to 0 */
- for (i=0; i<nbBases; i++)
- {
- if (isnan(p2vm->insVis[i]))
- {
- p2vm->insVis[i] = 0.0;
- }
- if (isnan(p2vm->insVisErr[i]))
- {
- p2vm->insVisErr[i] = 0.0;
- }
- }
-
- strcpy (keywName, "HIERARCH ESO QC P2VM VIS12");
- if (fits_read_key(filePtr, TDOUBLE, keywName, &p2vm->insVis[0],
- NULL, &status) != 0)
- {
- /* Try old keyword */
- status = 0;
- strcpy (keywName, "HIERARCH ESO OCS P2VM VIS12");
- if (fits_read_key(filePtr, TDOUBLE, keywName, &p2vm->insVis[0],
- NULL, &status) != 0)
- {
- p2vm->insVis[0] = -1;
- status = 0;
- }
- }
- strcpy (keywName, "HIERARCH ESO QC P2VM ERRVIS12");
- if (fits_read_key(filePtr, TDOUBLE, keywName, &p2vm->insVisErr[0],
- NULL, &status) != 0)
- {
- /* Try old keyword */
- status = 0;
- strcpy (keywName, "HIERARCH ESO OCS P2VM ERRVIS12");
- if (fits_read_key(filePtr, TDOUBLE, keywName, &p2vm->insVisErr[0],
- NULL, &status) != 0)
- {
- p2vm->insVisErr[0] = 0.0;
- status = 0;
- }
- }
- if (nbBases == 3)
- {
- strcpy (keywName, "HIERARCH ESO QC P2VM VIS23");
- if (fits_read_key(filePtr, TDOUBLE, keywName, &p2vm->insVis[1],
- NULL, &status) != 0)
- {
- /* Try old keyword */
- status = 0;
- strcpy (keywName, "HIERARCH ESO OCS P2VM VIS23");
- if (fits_read_key(filePtr, TDOUBLE, keywName, &p2vm->insVis[1],
- NULL, &status) != 0)
- {
- p2vm->insVis[1] = -1;
- status = 0;
- }
- }
- strcpy (keywName, "HIERARCH ESO QC P2VM ERRVIS23");
- if (fits_read_key(filePtr, TDOUBLE, keywName, &p2vm->insVisErr[1],
- NULL, &status) != 0)
- {
- /* Try old keyword */
- status = 0;
- strcpy (keywName, "HIERARCH ESO OCS P2VM ERRVIS23");
- if (fits_read_key(filePtr, TDOUBLE, keywName, &p2vm->insVisErr[1],
- NULL, &status) != 0)
- {
- p2vm->insVisErr[1] = 0.0;
- status = 0;
- }
- }
- strcpy (keywName, "HIERARCH ESO QC P2VM VIS31");
- if (fits_read_key(filePtr, TDOUBLE, keywName, &p2vm->insVis[2],
- NULL, &status) != 0)
- {
- /* Try old keyword */
- status = 0;
- strcpy (keywName, "HIERARCH ESO OCS P2VM VIS31");
- if (fits_read_key(filePtr, TDOUBLE, keywName, &p2vm->insVis[2],
- NULL, &status) != 0)
- {
- p2vm->insVis[2] = -1;
- status = 0;
- }
- }
- strcpy (keywName, "HIERARCH ESO QC P2VM ERRVIS31");
- if (fits_read_key(filePtr, TDOUBLE, keywName, &p2vm->insVisErr[2],
- NULL, &status) != 0)
- {
- /* Try old keyword */
- status = 0;
- strcpy (keywName, "HIERARCH ESO OCS P2VM ERRVIS31");
- if (fits_read_key(filePtr, TDOUBLE, keywName, &p2vm->insVisErr[2],
- NULL, &status) != 0)
- {
- p2vm->insVisErr[2] = 0.0;
- status = 0;
- }
- }
- }
- else
- {
- p2vm->insVis[1] = 0;
- p2vm->insVis[2] = 0;
- p2vm->insVisErr[1] = 0;
- p2vm->insVisErr[2] = 0;
- }
-
- /* Main header : get instrument configuration */
- /* Clear list of P2VM keywords */
- amdlibClearInsCfg(&p2vm->insCfg);
-
- /* Get the number of keywords in HDU */
- keysExist=0;
- moreKeys=0;
- if (fits_get_hdrspace(filePtr, &keysExist, &moreKeys,
- &status) != 0)
- {
- status = 0;
- }
- /* For each keyword */
- nbKeywords=0;
- for (i=1; i<=keysExist; i++)
- {
- /* Read keyword line #i */
- if (fits_read_record(filePtr, i, record, &status) != 0)
- {
- status = 0;
- }
- else
- {
- /* If it is not a simple comment or a primary keyword */
- if ((strstr(record, "MJD-OBS") != NULL) ||
- (strstr(record, "HIERARCH ESO") != NULL))
- {
- /* Store keyword */
- if (amdlibAddInsCfgKeyword(&p2vm->insCfg,
- record, errMsg) == amdlibFAILURE)
- {
- return amdlibFAILURE;
- }
- }
- }
- }
-
- /* Go to the P2VM binary table */
- convert = amdlibTRUE; /* Assume it is the new table */
- if (fits_movnam_hdu(filePtr, BINARY_TBL, "P2VM", 0, &status) != 0)
- {
- /* Try old colunm name */
- status = 0;
- if (fits_movnam_hdu(filePtr, BINARY_TBL,
- "P2VM_MATRIX", 0, &status) != 0)
- {
- amdlibGetFitsError("P2VM");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- convert = amdlibFALSE; /* It is the old table */
- }
-
- /* Get table dimensions from binary table header */
- if (fits_read_key(filePtr, TINT, "NWAVE", &p2vm->nbChannels,
- NULL, &status) != 0)
- {
- amdlibGetFitsError("NWAVE");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- if (fits_read_key(filePtr, TINT, "WINTERF", &p2vm->nx,
- NULL, &status) != 0)
- {
- amdlibGetFitsError("WINTERF");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- if (fits_read_key(filePtr, TINT, "STARTPIX", &p2vm->firstChannel,
- NULL, &status) != 0)
- {
- amdlibGetFitsError("STARTPIX");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- p2vm->firstChannel --;
-
- /* If P2VM data structure is not initailized, do it */
- if (p2vm->thisPtr != p2vm)
- {
- amdlibInitP2VM(p2vm);
- }
-
- /* Allocate memory */
- if (amdlibAllocateP2VM(p2vm, p2vm->nx, nbTel, nbBases,
- p2vm->nbChannels, errMsg) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- /* allocate amdlibDOUBLE table */
- theTable=calloc(p2vm->nbChannels*p2vm->nx*6,sizeof(*theTable));
- if (theTable == NULL)
- {
- fits_close_file(filePtr, &status);
- amdlibSetErrMsg("Could not allocate memory for temporary buffer");
- return amdlibFAILURE;
- }
-
- /***** Read the binary table */
- /* Wavelengths table */
- if (fits_read_col(filePtr, TDOUBLE, 1, 1 ,1 , p2vm->nbChannels, NULL,
- p2vm->wlen, &anynull, &status) != 0)
- {
- free(theTable);
- amdlibGetFitsError("EFF_WAVE");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- if (convert == amdlibTRUE)
- {
- /* Convert m to nm */
- for (i = 0; i < p2vm->nbChannels; i++)
- {
- p2vm->wlen[i] = p2vm->wlen[i] / amdlibNM_TO_M;
- }
- }
-
- /* Matrix : read, then convert amdlibDOUBLE to double */
- if (fits_read_col(filePtr, TDOUBLE, 2, 1 ,1 , p2vm->nbChannels *
- p2vm->nx * 2 * nbBases, NULL, theTable,
- &anynull, &status) != 0)
- {
- free(theTable);
- amdlibGetFitsError("MATRIX");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- index = 0;
- for (i = 0; i < p2vm->nbChannels; i++)
- {
- for (j = 0; j < p2vm->nx; j++)
- {
- for (k = 0; k < 2 * nbBases; k++)
- {
- p2vm->matrixPt[i][j][k] = (double)theTable[index];
- index ++;
- }
- }
- }
-
- /* vk : read, then convert amdlibDOUBLE to double */
- if (fits_read_col(filePtr, TDOUBLE, 3, 1 ,1 , p2vm->nbChannels *
- p2vm->nx * nbTel, NULL, theTable,
- &anynull, &status) != 0)
- {
- free(theTable);
- amdlibGetFitsError("VK");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- index = 0;
- for (i = 0; i < nbTel; i++)
- {
- for (j = 0; j < p2vm->nbChannels; j++)
- {
- for (k = 0; k < p2vm->nx; k++)
- {
- p2vm->vkPt[i][j][k] = (double)theTable[index];
- index ++;
- }
- }
- }
- /* sumVk : read, then convert amdlibDOUBLE to double */
- if (fits_read_col(filePtr, TDOUBLE, 4, 1 ,1 , p2vm->nbChannels * nbBases,
- NULL, theTable, &anynull, &status) != 0)
- {
- free(theTable);
- amdlibGetFitsError("SUM_VK");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- index = 0;
- for (i = 0; i < nbBases; i++)
- {
- for(j = 0; j < p2vm->nbChannels; j++)
- {
- p2vm->sumVkPt[i][j] = (double)theTable[index];
- index++;
- }
- }
-
- /* Bad pixel table : If not found mark all pixels as good */
- if (fits_read_col(filePtr, TBYTE, 5, 1 ,1 , p2vm->nbChannels * p2vm->nx,
- NULL, p2vm->badPixelsPt[0], &anynull, &status) != 0)
- {
- for (i = 0; i < p2vm->nbChannels; i++)
- {
- for (j = 0; j < p2vm->nx; j++)
- {
- p2vm->badPixelsPt[i][j] = amdlibGOOD_PIXEL_FLAG;
- }
- }
- status = 0;
- }
-
- /* Photometry table : If not found set photometry to 0 */
- memset(theTable , '\0',
- sizeof(double)*p2vm->nbChannels * (2 * nbBases + 1) * 3);
- if (fits_read_col(filePtr, TDOUBLE, 6, 1 ,1 ,
- p2vm->nbChannels * (2 * nbBases + 1) * 3,
- NULL, theTable, &anynull, &status) != 0)
- {
- status = 0;
- if (fits_read_col(filePtr, TDOUBLE, 6, 1 ,1 ,
- p2vm->nbChannels * nbTel,
- NULL, theTable, &anynull, &status) != 0)
- {
- memset(theTable , '\0',
- sizeof(double)*p2vm->nbChannels * (2 * nbBases + 1) * 3);
- status = 0;
- }
- }
- index = 0;
- for (i = 0; i < 2 * nbBases + 1; i++)
- {
- for (j = 0; j < 3; j++)
- {
- for (k = 0; k < p2vm->nbChannels; k++)
- {
- p2vm->photometryPt[i][j][k] = (double)theTable[index];
- index++;
- }
- }
- }
-
- /* Validity flag table : If not found set all flag to true */
- if (fits_read_col(filePtr, TBYTE, 7, 1 ,1 , p2vm->nbChannels,
- NULL, p2vm->flag, &anynull, &status) != 0)
- {
- for (i = 0; i < p2vm->nbChannels; i++)
- {
- p2vm->flag[i] = amdlibTRUE;
- }
- status = 0;
- }
-
- /* Phase : read, then convert amdlibDOUBLE to double
- * If not found set all phases to 0 */
- if (fits_read_col(filePtr, TDOUBLE, 8, 1 ,1 , p2vm->nbChannels * nbBases,
- NULL, theTable, &anynull, &status) != 0)
- {
- for (i = 0; i < p2vm->nbChannels* nbBases; i++)
- {
- theTable[i] = 0.0;
- }
- status = 0;
- }
- index = 0;
- for (i = 0; i < nbBases; i++)
- {
- for (j = 0; j < p2vm->nbChannels; j++)
- {
- if (convert == amdlibTRUE)
- {
- p2vm->phasePt[i][j] = (double)theTable[index] * M_PI / 180.0;
- }
- else
- {
- p2vm->phasePt[i][j] = (double)theTable[index];
- }
- index ++;
- }
- }
-
- /* Release previously allocated memory */
- free(theTable);
-
- /* FlatField table : If not found mark all pixels as 1.0 */
- if (fits_read_col(filePtr, TDOUBLE, 9, 1 ,1 ,
- p2vm->nbChannels * p2vm->nx,
- NULL, p2vm->flatFieldPt[0], &anynull, &status) != 0)
- {
- for (i = 0; i < p2vm->nbChannels; i++)
- {
- for (j = 0; j < p2vm->nx; j++)
- {
- p2vm->flatFieldPt[i][j] = 1.0;
- }
- }
- status = 0;
- }
-
- /* Close FITS file */
- if ( fits_close_file(filePtr, &status))
- {
- amdlibReturnFitsError(filename);
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Duplicate P2VM.
- *
- * This function duplicates P2VM; i.e. it allocates memory for new P2VM, and
- * then copies the source P2VM into the new one.
- *
- * @param srcP2vm source P2VM.
- * @param dstP2vm pointer to the new P2VM
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibDuplicateP2VM (amdlibP2VM_MATRIX *srcP2vm,
- amdlibP2VM_MATRIX *dstP2vm,
- amdlibERROR_MSG errMsg)
-{
- int nbTel;
- int nbBases;
-
- amdlibLogTrace("amdlibDuplicateP2VM()");
-
- /* If P2VM data structure is not initailized, do it */
- if (dstP2vm->thisPtr != dstP2vm)
- {
- amdlibInitP2VM(dstP2vm);
- }
-
- if (srcP2vm->type == amdlibP2VM_2T)
- {
- nbTel = 2;
- nbBases = 1;
- }
- else if (srcP2vm->type == amdlibP2VM_3T)
- {
- nbTel = 3;
- nbBases = 3;
- }
- else
- {
- amdlibSetErrMsg("Invalid P2VM type");
- amdlibReleaseP2VM(dstP2vm);
- return amdlibFAILURE;
- }
-
- if (amdlibAllocateP2VM(dstP2vm, srcP2vm->nx, nbTel, nbBases,
- srcP2vm->nbChannels, errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- if (amdlibCopyP2VM(srcP2vm, dstP2vm, errMsg) != amdlibSUCCESS)
- {
- amdlibReleaseP2VM(dstP2vm);
- return amdlibFAILURE;
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Merge P2VM.
- *
- * This function creates a new P2VM by merging two P2VM. It allocates memory for
- * the merged P2VM.
- *
- * @param firstP2vm first P2VM.
- * @param secondP2vm second P2VM.
- * @param mergedP2vm pointer to the new P2VM
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibMergeP2VM(amdlibP2VM_MATRIX *firstP2vm,
- amdlibP2VM_MATRIX *secondP2vm,
- amdlibP2VM_MATRIX *mergedP2vm,
- amdlibERROR_MSG errMsg)
-{
- amdlibP2VM_MATRIX *p2vm1;
- amdlibP2VM_MATRIX *p2vm2;
- amdlibP2VM_MATRIX *currentP2vm;
- int nx;
- int nbTels;
- int nbBases;
- int nbChannels;
- int coveringPixBegin;
- int coveringPixEnd;
- int currentPixel;
- int iPix;
- int iPix2;
- int i;
- int j;
-
- amdlibLogTrace("amdlibMergeP2VM()");
-
- /* Ordering firstP2vm and secondP2vm relative to their start pixels */
- if (firstP2vm->firstChannel < secondP2vm->firstChannel)
- {
- p2vm1 = firstP2vm;
- p2vm2 = secondP2vm;
- }
- else
- {
- p2vm1 = secondP2vm;
- p2vm2 = firstP2vm;
- }
-
- /* Check there is no error in the given parametres -
- * check p2vm1 and p2vm2 have the same configuration */
- if (p2vm1->id == p2vm2->id)
- {
- amdlibSetErrMsg("Wrong input data - same p2vm ids");
- return amdlibFAILURE;
- }
-
- if ((p2vm1->type == 1 && p2vm2->type != 1)
- || (p2vm1->type != 1 && p2vm2->type == 1))
- {
- amdlibSetErrMsg("Wrong input data - different p2vm types");
- return amdlibFAILURE;
- }
- if (p2vm1->accuracy != p2vm2->accuracy)
- {
- amdlibSetErrMsg("Wrong input data - different accuracies");
- return amdlibFAILURE;
- }
- if (p2vm1->nx != p2vm2->nx)
- {
- amdlibSetErrMsg("Wrong input data - different number of pixels "
- "in columns");
- return amdlibFAILURE;
- }
-
- /* Check the compatibility between wave lengths */
- if ((p2vm1->firstChannel + p2vm1->nbChannels) > p2vm2->firstChannel)
- {
- amdlibSetErrMsg("Incompatible wave lengths");
- return amdlibFAILURE;
- }
-
- /* Allocate mergedP2vm */
- nx = p2vm1->nx;
- coveringPixBegin = p2vm2->firstChannel;
- if (p2vm1->firstChannel + p2vm1->nbChannels == p2vm2->firstChannel)
- {
- coveringPixEnd = p2vm2->firstChannel;
- nbChannels = p2vm1->nbChannels + p2vm2->nbChannels;
- }
- else
- {
- coveringPixEnd = p2vm1->firstChannel + p2vm1->nbChannels;
- nbChannels = p2vm1->nbChannels + p2vm2->nbChannels
- - (coveringPixEnd - coveringPixBegin + 1);
- }
- if (p2vm1->type == amdlibP2VM_2T)
- {
- nbTels = 2;
- nbBases = 1;
- }
- else if (p2vm1->type == amdlibP2VM_3T)
- {
- nbTels = 3;
- nbBases = 3;
- }
- else
- {
- amdlibSetErrMsg("Invalid P2VM type");
- return amdlibFAILURE;
- }
-
- /* If mergedP2vm is not initialized, do it */
- if (mergedP2vm->thisPtr != mergedP2vm)
- {
- amdlibInitP2VM(mergedP2vm);
- }
- /* Allocate memory */
- if (amdlibAllocateP2VM(mergedP2vm, nx, nbTels, nbBases,
- nbChannels, errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- /* Initialize id, inscfg, startPixel, type and accuracy */
- mergedP2vm->id = p2vm1->id + p2vm2->id;
-
- amdlibClearInsCfg(&mergedP2vm->insCfg);
- for (i = 0; i < p2vm1->insCfg.nbKeywords; i++)
- {
- if (strstr(p2vm1->insCfg.keywords[i].name,
- "HIERARCH ESO OCS P2VM") == NULL)
- {
- if (amdlibSetInsCfgKeyword(&mergedP2vm->insCfg,
- p2vm1->insCfg.keywords[i].name,
- p2vm1->insCfg.keywords[i].value,
- p2vm1->insCfg.keywords[i].comment,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- }
- }
-
- mergedP2vm->firstChannel = p2vm1->firstChannel;
- mergedP2vm->type = p2vm1->type;
- mergedP2vm->accuracy = p2vm1->accuracy;
-
- /* Initialize arrays */
- iPix2 = -1;
- for (currentPixel = 0; currentPixel < nbChannels; currentPixel++)
- {
- /* Choice of the p2vm values to be copied */
- if (currentPixel < coveringPixBegin - p2vm1->firstChannel)
- {
- currentP2vm = p2vm1;
- iPix = currentPixel;
- }
- else if (currentPixel < coveringPixEnd - p2vm1->firstChannel)
- {
- iPix2 ++;
- if (p2vm1->flag[currentPixel] == amdlibTRUE
- && p2vm2->flag[iPix2] == amdlibTRUE)
- {
- amdlibSetErrMsg("Inconsistent data in "
- "covered spectral channels zone");
- amdlibReleaseP2VM(mergedP2vm);
- return amdlibFAILURE;
- }
- else if (p2vm1->flag[currentPixel] == amdlibTRUE)
- {
- currentP2vm = p2vm1;
- iPix = currentPixel;
- }
- else
- {
- currentP2vm = p2vm2;
- iPix = iPix2;
- }
- }
- else
- {
- currentP2vm = p2vm2;
- iPix2 ++;
- iPix = iPix2;
- }
-
- /* Copying values */
- mergedP2vm->wlen[currentPixel] = currentP2vm->wlen[iPix];
- mergedP2vm->flag[currentPixel] = currentP2vm->flag[iPix];
- for(i = 0; i < nbBases; i++)
- {
- mergedP2vm->sumVkPt[i][currentPixel] =
- currentP2vm->sumVkPt[i][iPix];
- mergedP2vm->phasePt[i][currentPixel] =
- currentP2vm->phasePt[i][iPix];
- }
- for (i = 0; i < nx; i++)
- {
- mergedP2vm->badPixelsPt[currentPixel][i]
- = currentP2vm->badPixelsPt[iPix][i];
- mergedP2vm->flatFieldPt[currentPixel][i]
- = currentP2vm->flatFieldPt[iPix][i];
-
- for(j = 0; j < 2 * nbBases; j++)
- {
- mergedP2vm->matrixPt[currentPixel][i][j]
- = currentP2vm->matrixPt[iPix][i][j];
- }
- }
- for (i = 0; i < nbTels; i++)
- {
- for (j = 0; j < nx; j++)
- {
- mergedP2vm->vkPt[i][currentPixel][j]
- = currentP2vm->vkPt[i][iPix][j];
- }
- }
- for (i = 0; i < 2 * nbBases + 1; i++)
- {
- for (j = 0; j < 3; j ++)
- {
- mergedP2vm->photometryPt[i][j][currentPixel]
- = currentP2vm->photometryPt[i][j][iPix];
- }
- }
- }
-
- /* TODO tbx insVis et insVisErr */
- for (i = 0; i < amdlibNBASELINE; i++)
- {
- mergedP2vm->insVis[i] = p2vm1->insVis[i];
- mergedP2vm->insVisErr[i] = p2vm1->insVisErr[i];
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Copy P2VM.
- *
- * This function copies P2VM the source P2VM into the destination one.
- *
- * @param srcP2vm source P2VM.
- * @param dstP2vm pointer to the destination P2VM
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibCopyP2VM (amdlibP2VM_MATRIX *srcP2vm,
- amdlibP2VM_MATRIX *dstP2vm,
- amdlibERROR_MSG errMsg)
-{
- int nbTel;
- int nbBases;
- int i;
-
- amdlibLogTrace("amdlibCopyP2VM()");
-
- /* Init the number of telescopes and baselines according to P2VM type */
- if (srcP2vm->type == amdlibP2VM_2T)
- {
- nbTel = 2;
- nbBases = 1;
- }
- else
- {
- nbTel = 3;
- nbBases = 3;
- }
-
- /* Copy fixed size fields */
- for (i = 0; i < srcP2vm->insCfg.nbKeywords; i++)
- {
- if (amdlibSetInsCfgKeyword(&dstP2vm->insCfg,
- srcP2vm->insCfg.keywords[i].name,
- srcP2vm->insCfg.keywords[i].value,
- srcP2vm->insCfg.keywords[i].comment,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- }
- dstP2vm->type = srcP2vm->type;
- dstP2vm->id = srcP2vm->id;
- dstP2vm->firstChannel = srcP2vm->firstChannel;
- dstP2vm->nx = srcP2vm->nx;
- dstP2vm->nbChannels = srcP2vm->nbChannels;
- for (i = 0; i < amdlibNBASELINE; i++)
- {
- dstP2vm->insVis[i] = srcP2vm->insVis[i];
- dstP2vm->insVisErr[i] = srcP2vm->insVisErr[i];
- }
-
- /* Copy fields allocated dynamically */
- memcpy (dstP2vm->wlen, srcP2vm->wlen,
- srcP2vm->nbChannels * sizeof(amdlibDOUBLE));
- memcpy (dstP2vm->matrix, srcP2vm->matrix,
- 2*srcP2vm->nx * srcP2vm->nbChannels * nbBases * sizeof(double));
- memcpy (dstP2vm->vk, srcP2vm->vk,
- srcP2vm->nx * srcP2vm->nbChannels * nbTel * sizeof(double));
- memcpy (dstP2vm->sumVk, srcP2vm->sumVk,
- srcP2vm->nbChannels * nbBases * sizeof(double));
- memcpy (dstP2vm->photometry, srcP2vm->photometry,
- srcP2vm->nbChannels * (2 * nbBases + 1) * 3 * sizeof(double));
- memcpy (dstP2vm->badPixels, srcP2vm->badPixels,
- srcP2vm->nx * srcP2vm->nbChannels * sizeof(char));
- memcpy (dstP2vm->flatField, srcP2vm->flatField,
- srcP2vm->nx * srcP2vm->nbChannels * sizeof(amdlibDOUBLE));
- memcpy (dstP2vm->flag, srcP2vm->flag,
- srcP2vm->nbChannels * sizeof(char));
- memcpy (dstP2vm->phase, srcP2vm->phase,
- srcP2vm->nbChannels * nbBases * sizeof(double));
-
- return amdlibSUCCESS;
-}
-
-/*
- * Local functions definitions
- */
-
-/**
- * Initialize P2VM structure.
- *
- * @param p2vm pointer to P2VM structure
- */
-void amdlibInitP2VM(amdlibP2VM_MATRIX *p2vm)
-{
- amdlibLogTrace("amdlibInitP2VM()");
-
- /* Initialize data structure */
- memset (p2vm, '\0', sizeof(amdlibP2VM_MATRIX));
- p2vm->thisPtr = p2vm;
-}
-
-/**
- * Allocate memory for storing P2VM.
- *
- * This functionallocates memory, according to the number of pixels of the
- * interferometric column 'nx' and the number of spectral channels
- * 'nbChannels', for the arrays of the 'p2vm' data structure. If memory has
- * been previously allocated, it is first freed.
- *
- * @param p2vm pointer to P2VM structure
- * @param nx width of the interferometric channel.
- * @param nbTel number of telescopes.
- * @param nbBases number of baselines.
- * @param nbChannels number of spectral channels.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAllocateP2VM(amdlibP2VM_MATRIX *p2vm, const int nx,
- const int nbTel, const int nbBases,
- const int nbChannels,
- amdlibERROR_MSG errMsg)
-{
- amdlibLogTrace("amdlibAllocateP2VM()");
-
- /* First free previous allocated memory */
- amdlibFreeP2VM(p2vm);
-
- /* Array containing the wavelengths */
- p2vm->wlen = (amdlibDOUBLE *)calloc(nbChannels, sizeof(amdlibDOUBLE));
- if (p2vm->wlen == NULL)
- {
- amdlibSetErrMsg("Could not allocate %ld bytes for wlen",
- (long)(nbChannels * sizeof(amdlibDOUBLE)));
- amdlibFreeP2VM(p2vm);
- return amdlibFAILURE;
- }
-
- /* Array containing the ck and dk coefficients */
- p2vm->matrixPt =
- amdlibAlloc3DArrayDouble( 2 * nbBases, nx, nbChannels, errMsg);
- if (p2vm->matrixPt == NULL)
- {
- amdlibFreeP2VM(p2vm);
- return amdlibFAILURE;
- }
- p2vm->matrix = p2vm->matrixPt[0][0];
-
- /* Arrays containing the vk coefficients */
- p2vm->vkPt = amdlibAlloc3DArrayDouble(nx, nbChannels, nbTel, errMsg);
- if (p2vm->vkPt == NULL)
- {
- amdlibFreeP2VM(p2vm);
- return amdlibFAILURE;
- }
- p2vm->vk = p2vm->vkPt[0][0];
-
- /* Arrays containing the sumVk */
- p2vm->sumVkPt =
- amdlibAlloc2DArrayDouble(nbChannels, nbBases, errMsg);
- if (p2vm->sumVkPt == NULL)
- {
- amdlibFreeP2VM(p2vm);
- return amdlibFAILURE;
- }
- p2vm->sumVk = p2vm->sumVkPt[0];
-
- /* Arrays containing the photometry */
- /* double photometry[2*nbase+1][3][nl] */
- p2vm->photometryPt =
- amdlibAlloc3DArrayDouble(nbChannels, 3, 2 * nbBases + 1, errMsg);
- if (p2vm->photometryPt == NULL)
- {
- amdlibFreeP2VM(p2vm);
- return amdlibFAILURE;
- }
- p2vm->photometry = p2vm->photometryPt[0][0];
-
-
- /* Arrays containing the bad pixel flags */
- p2vm->badPixelsPt =
- amdlibAlloc2DArrayUnsignedChar(nx, nbChannels, errMsg);
- if (p2vm->badPixelsPt == NULL)
- {
- amdlibFreeP2VM(p2vm);
- return amdlibFAILURE;
- }
- p2vm->badPixels = p2vm->badPixelsPt[0];
-
- /* Arrays containing the FlatField */
- p2vm->flatFieldPt = amdlibAlloc2DArrayDouble(nx, nbChannels, errMsg);
- if (p2vm->flatFieldPt == NULL)
- {
- amdlibFreeP2VM(p2vm);
- return amdlibFAILURE;
- }
- p2vm->flatField = p2vm->flatFieldPt[0];
-
- /* Arrays containing the validity flags for spectral channels */
- p2vm->flag = (unsigned char *)calloc(nbChannels, sizeof(char));
- if (p2vm->flag == NULL)
- {
- amdlibSetErrMsg("Could not allocate %ld bytes for flag",
- (long)(nbChannels * sizeof(amdlibDOUBLE)));
- amdlibFreeP2VM(p2vm);
- return amdlibFAILURE;
- }
-
- /* Arrays containing the phase */
- p2vm->phasePt =
- amdlibAlloc2DArrayDouble(nbChannels, nbBases, errMsg);
- if (p2vm->phasePt == NULL)
- {
- amdlibFreeP2VM(p2vm);
- return amdlibFAILURE;
- }
- p2vm->phase = p2vm->phasePt[0];
-
- /* Set array size */
- p2vm->nx = nx;
- p2vm->nbChannels = nbChannels;
-
- /* Return the new pointer */
- return amdlibSUCCESS;
-}
-
-/**
- * Free memory allocated for P2VM.
- *
- * This function frees memory previously allocated by amdlibAllocateP2VM()
- * function.
- *
- * @param p2vm pointer to P2VM structure
- */
-void amdlibFreeP2VM(amdlibP2VM_MATRIX *p2vm)
-{
- amdlibLogTrace("amdlibFreeP2VM()");
-
- /* Free allocated memory */
- if (p2vm->wlen != NULL)
- {
- free(p2vm->wlen);
- p2vm->wlen = NULL;
- }
- if (p2vm->matrix != NULL)
- {
- amdlibFree3DArrayDouble(p2vm->matrixPt);
- p2vm->matrix = NULL;
- }
- if (p2vm->vk != NULL)
- {
- amdlibFree3DArrayDouble(p2vm->vkPt);
- p2vm->vk = NULL;
- }
- if (p2vm->sumVk != NULL)
- {
- amdlibFree2DArrayDouble(p2vm->sumVkPt);
- p2vm->sumVk = NULL;
- }
- if (p2vm->photometry != NULL)
- {
- amdlibFree3DArrayDouble(p2vm->photometryPt);
- p2vm->photometry = NULL;
- }
- if (p2vm->badPixels != NULL)
- {
- amdlibFree2DArrayUnsignedChar(p2vm->badPixelsPt);
- p2vm->badPixels = NULL;
- }
- if (p2vm->flatField != NULL)
- {
- amdlibFree2DArrayDouble(p2vm->flatFieldPt);
- p2vm->flatField = NULL;
- }
- if (p2vm->flag != NULL)
- {
- free(p2vm->flag);
- p2vm->flag = NULL;
- }
- if (p2vm->phase != NULL)
- {
- amdlibFree2DArrayDouble(p2vm->phasePt);
- p2vm->phase = NULL;
- }
- /* Reset array size */
- p2vm->nx = 0;
- p2vm->nbChannels = 0;
-}
-
-/**
- * Computes the variance of (the square of the) instrumental contrast.
- *
- * This function computes the variance of (the square of the) instrumental
- * contrast of the p2vm. Based on memo AMB-IGR-022
- *
- * @return
- * Variance of (the square of the) instrumental contrast
- */
-double amdlibEstimateCWVariance(double *ikb,
- double *ikg,
- double *v1,
- double *v2,
- double P1b,
- double P2b,
- double P1g,
- double P2g,
- amdlibDOUBLE ron, /* hope ron did not change*/
- int nx) /*width of the I channel */
-
-{
- /* b (resp. g) last char in name refer to measurements without (resp. with)
- * the lambda/4 phase shift*/
- double sig2_P1b=P1b;
- double sig2_P2b=P2b;
- double sig2_P1g=P1g;
- double sig2_P2g=P2g;
- double mean_mukb;
- double mean_mukg;
- double tkb;
- double tkg;
- double v1k;
- double v2k;
- double sumvk=0.0;
- double s1g, s2g, s1b, s2b;
- double E_mu4_beta, E_mu4_gamma, E_mu2_2_beta, E_mu2_2_gamma;
- double sig2_muk2_beta,sig2_muk2_gamma;
- double sig2_muk2_p1p2_beta,sig2_muk2_p1p2_gamma;
- double sig2_CWk=0.0;
- int i;
-
- amdlibLogTrace("amdlibEstimateCWVariance()");
-
- /* Compute sumvk */
- for (i=0; i<nx ; i++)
- {
- sumvk+= v1[i]*v2[i];
- }
-
- /* In order to keep formula short enough, we substitute indexed variables
- * with static variables */
- for (i=0; i<nx ; i++)
- {
- v1k=v1[i];
- v2k=v2[i];
- tkb=ikb[i];
- tkg=ikg[i];
-
- /* Standard sigma squared on photometry + detector noise. To be replaced
- * by a correct value for snr on each photometry channel (to be computed
- * in amdlibScienceData: for example, nx below may not be the number of
- * pixels used in the photometric channel.
- */
- mean_mukb = tkb - v1k*P1b - v2k*P2b;
- mean_mukg = tkg - v1k*P1g - v2k*P2g;
-
- s1b = -4.0*tkb*v2k*v2k*v2k*
- (P2b*P2b*P2b+3.0*P2b*P2b+P2b+3.0*P2b*nx*ron*ron)+
- tkb*tkb*tkb*tkb+6.0*tkb*tkb*tkb+7.0*tkb*tkb+tkb+
- 6.0*(tkb*tkb+tkb)*ron*ron+
- 3.0*ron*ron*ron*ron+
- 4.0*v1k*v1k*v1k*
- (P1b*P1b*P1b+3.0*P1b*P1b+P1b+3.0*P1b*nx*ron*ron)*v2k*P2b+
- 6.0*v1k*v1k*(P1b*P1b+P1b+nx*ron*ron)*
- v2k*v2k*(P2b*P2b+P2b+nx*ron*ron)+
- 4.0*v1k*P1b*v2k*v2k*v2k*
- (P2b*P2b*P2b+3.0*P2b*P2b+P2b+3.0*P2b*nx*ron*ron);
-
- s2b = s1b-4.0*(tkb*tkb*tkb+3.0*tkb*tkb+tkb+3.0*tkb*ron*ron)*
- v1k*P1b-4.0*(tkb*tkb*tkb+3.0*tkb*tkb+tkb+3.0*tkb*ron*ron)*
- v2k*P2b+6.0*(tkb*tkb+tkb+ron*ron)*v1k*v1k*
- (P1b*P1b+P1b+nx*ron*ron)+6.0*(tkb*tkb+tkb+ron*ron)*
- v2k*v2k*(P2b*P2b+P2b+nx*ron*ron);
-
- E_mu4_beta = s2b-4.0*tkb*v1k*v1k*v1k*
- (P1b*P1b*P1b+3.0*P1b*P1b+P1b+3.0*P1b*nx*ron*ron)+
- v1k*v1k*v1k*v1k*
- (P1b*P1b*P1b*P1b+6.0*P1b*P1b*P1b+7.0*P1b*P1b+P1b+
- 6.0*(P1b*P1b+P1b)*nx*ron*ron+(3.0*nx+2.0*nx*nx)*
- ron*ron*ron*ron)+
- v2k*v2k*v2k*v2k*
- (P2b*P2b*P2b*P2b+6.0*P2b*P2b*P2b+7.0*P2b*P2b+P2b+
- 6.0*(P2b*P2b+P2b)*nx*ron*ron+(3.0*nx+2.0*nx*nx)*
- ron*ron*ron*ron)+
- 12.0*(tkb*tkb+tkb+ron*ron)*
- v1k*P1b*v2k*P2b-12.0*tkb*v1k*v1k*(P1b*P1b+P1b+nx*ron*ron)*
- v2k*P2b-12.0*tkb*v1k*P1b*v2k*v2k*(P2b*P2b+P2b+nx*ron*ron);
-
- E_mu2_2_beta = tkb*tkb+tkb+ron*ron-
- 2.0*tkb*v1k*P1b-2.0*tkb*v2k*P2b+v1k*v1k*
- (P1b*P1b+P1b+nx*ron*ron)+2.0*
- v1k*P1b*v2k*P2b+v2k*v2k*
- (P2b*P2b+P2b+nx*ron*ron);
-
- sig2_muk2_beta = E_mu4_beta - E_mu2_2_beta;
-
- s1g = -4.0*tkg*v2k*v2k*v2k*
- (P2g*P2g*P2g+3.0*P2g*P2g+P2g+3.0*P2g*nx*ron*ron)+
- tkg*tkg*tkg*tkg+6.0*tkg*tkg*tkg+7.0*tkg*tkg+tkg+
- 6.0*(tkg*tkg+tkg)*ron*ron+
- 3.0*ron*ron*ron*ron+
- 4.0*v1k*v1k*v1k*
- (P1g*P1g*P1g+3.0*P1g*P1g+P1g+3.0*P1g*nx*ron*ron)*v2k*P2g+
- 6.0*v1k*v1k*(P1g*P1g+P1g+nx*ron*ron)*
- v2k*v2k*(P2g*P2g+P2g+nx*ron*ron)+
- 4.0*v1k*P1g*v2k*v2k*v2k*
- (P2g*P2g*P2g+3.0*P2g*P2g+P2g+3.0*P2g*nx*ron*ron);
-
- s2g = s1g-4.0*(tkg*tkg*tkg+3.0*tkg*tkg+tkg+3.0*tkg*ron*ron)*
- v1k*P1g-4.0*(tkg*tkg*tkg+3.0*tkg*tkg+tkg+3.0*tkg*ron*ron)*
- v2k*P2g+6.0*(tkg*tkg+tkg+ron*ron)*v1k*v1k*
- (P1g*P1g+P1g+nx*ron*ron)+6.0*(tkg*tkg+tkg+ron*ron)*
- v2k*v2k*(P2g*P2g+P2g+nx*ron*ron);
-
- E_mu4_gamma = s2g-4.0*tkg*v1k*v1k*v1k*
- (P1g*P1g*P1g+3.0*P1g*P1g+P1g+3.0*P1g*nx*ron*ron)+
- v1k*v1k*v1k*v1k*
- (P1g*P1g*P1g*P1g+6.0*P1g*P1g*P1g+7.0*P1g*P1g+P1g+
- 6.0*(P1g*P1g+P1g)*nx*ron*ron+(3.0*nx+2.0*nx*nx)*
- ron*ron*ron*ron)+
- v2k*v2k*v2k*v2k*
- (P2g*P2g*P2g*P2g+6.0*P2g*P2g*P2g+7.0*P2g*P2g+P2g+
- 6.0*(P2g*P2g+P2g)*nx*ron*ron+(3.0*nx+2.0*nx*nx)*
- ron*ron*ron*ron)+
- 12.0*(tkg*tkg+tkg+ron*ron)*
- v1k*P1g*v2k*P2g-12.0*tkg*v1k*v1k*(P1g*P1g+P1g+nx*ron*ron)*
- v2k*P2g-12.0*tkg*v1k*P1g*v2k*v2k*(P2g*P2g+P2g+nx*ron*ron);
-
- E_mu2_2_gamma = tkg*tkg+tkg+ron*ron-
- 2.0*tkg*v1k*P1g-2.0*tkg*v2k*P2g+v1k*v1k*
- (P1g*P1g+P1g+nx*ron*ron)+2.0*
- v1k*P1g*v2k*P2g+v2k*v2k*
- (P2g*P2g+P2g+nx*ron*ron);
-
- sig2_muk2_gamma = E_mu4_gamma - E_mu2_2_gamma;
-
- /* Lets use Papoulis formula*/
- sig2_muk2_p1p2_beta = sig2_muk2_beta/(P1b*P1b*P2b*P2b) +
- (sig2_P1b/(P1b*P1b))*(pow(mean_mukb,4.0)/(P1b*P1b*P2b*P2b)) +
- sig2_P2b/(P2b*P2b)*(pow(mean_mukb,4.0)/(P1b*P1b*P2b*P2b));
- sig2_muk2_p1p2_gamma = sig2_muk2_gamma/(P1g*P1g*P2g*P2g) +
- (sig2_P1g/(P1g*P1g))*(pow(mean_mukg,4.0)/(P1g*P1g*P2g*P2g)) +
- sig2_P2g/(P2g*P2g)*(pow(mean_mukg,4.0)/(P1g*P1g*P2g*P2g));
-
- /* Sum Errors on carrying wave */
- sig2_CWk += (1.0/amdlibPow2(16.0*sumvk))*
- (sig2_muk2_p1p2_beta+sig2_muk2_p1p2_gamma);
- }
-
- return sig2_CWk;
-}
-
-/**
- * Display P2VM
- *
- * @param p2vm pointer to P2VM structure
- */
-void amdlibDisplayP2vm(amdlibP2VM_MATRIX *p2vm)
-{
- int i, j, k;
- int nbTel, nbBases;
-
- if (p2vm->type == amdlibP2VM_2T)
- {
- nbTel = 2;
- nbBases = 1;
- }
- else
- {
- nbTel = 3;
- nbBases = 3;
- }
-
-#if 0
- /* Results for insCfg */
- printf("insCfg :\n");
- printf("p2vm->insCfg.nbKeywords = %d\n", p2vm->insCfg.nbKeywords);
- for (i = 0; i < p2vm->insCfg.nbKeywords; i ++)
- {
- printf("i = %d, name = %s, value = %s, comment = %s\n", i,
- p2vm->insCfg.keywords[i].name, p2vm->insCfg.keywords[i].value,
- p2vm->insCfg.keywords[i].comment);
- }
-#endif
-
- /* Fixed sized values */
- printf("type = %d\n", p2vm->type);
- printf("accuracy = %d\n", p2vm->accuracy);
- printf("firstChannel = %d\n", p2vm->firstChannel);
- printf("nx = %d\n", p2vm->nx);
- printf("nbChannels = %d\n", p2vm->nbChannels);
-
-#if 1
- /* wlen table */
- printf("wlen : \n");
- for (i = 0; i < p2vm->nbChannels; i++)
- {
- printf("wlen[%d] = %f, flag = %d\n", i, p2vm->wlen[i], p2vm->flag[i]);
- }
- /* matrix */
- printf("matrix : \n");
- for (i = 0; i < 2 * nbBases; i++)
- {
- for (j = 0; j < p2vm->nx; j++)
- {
- for (k = 0; k < p2vm->nbChannels; k ++)
- {
- printf("matrix[%d][%d][%d] = %f\n", i, j, k,
- p2vm->matrixPt[k][j][i]);
- }
- }
- }
-#endif
- /* vk */
- printf("vk :\n");
- for (i = 0; i < p2vm->nx; i++)
- {
- for (j = 0; j < p2vm->nbChannels; j ++)
- {
- for (k = 0; k < nbTel; k ++)
- {
- printf("vk[%d][%d][%d] = %f\n", i, j, k, p2vm->vkPt[k][j][i]);
- }
- }
- }
- /* sumvk */
- printf("sumVk :\n");
- for (i = 0; i < p2vm->nbChannels; i ++)
- {
- for (j = 0; j < nbBases; j ++)
- {
- printf("sumVk[%d][%d] = %f\n", i, j, p2vm->sumVkPt[j][i]);
- }
- }
-#if 1
- /* bpm */
- printf("bpm :\n");
- for (i = 0; i < p2vm->nbChannels; i ++)
- {
- for (j = 0; j < p2vm->nx; j ++)
- {
- printf("badPixels[%d][%d] = %d\n", i, j, p2vm->badPixelsPt[i][j]);
- }
- }
- /* ffm */
- printf("ffm :\n");
- for (i = 0; i < p2vm->nbChannels; i ++)
- {
- for (j = 0; j < p2vm->nx; j ++)
- {
- printf("flatField[%d][%d] = %f\n", i, j, p2vm->flatFieldPt[i][j]);
- }
- }
- /* photometry */
- printf("photometry :\n");
- for (i = 0; i < p2vm->nbChannels; i++)
- {
- for (j = 0; j < 3; j ++)
- {
- for (k = 0; k < 2*nbBases+1; k ++)
- {
- printf("photometry[%d][%d][%d] = %f\n", i, j, k,
- p2vm->photometryPt[k][j][i]);
- }
- }
- }
-
- /* phase */
- printf("Phase :\n");
- for (i = 0; i < p2vm->nbChannels; i ++)
- {
- for (j = 0; j < nbBases; j ++)
- {
- printf("phase[%d][%d] = %f\n", i, j, p2vm->phasePt[j][i]);
- }
- }
-#endif
-}
-/*___oOo__*/
diff --git a/amber/amdlibP2vmData.c b/amber/amdlibP2vmData.c
deleted file mode 100644
index c158c79..0000000
--- a/amber/amdlibP2vmData.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Functions to handle data used for P2VM computation.
- */
-
-#define _POSIX_SOURCE 1
-
-/*
- * System Headers
- */
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "fitsio.h"
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/* Local functions declaration */
-static void amdlibInitP2vmData(amdlibP2VM_INPUT_DATA *p2vmData);
-
-/*
- * Public functions
- */
-/**
- * Add data to P2Vm data structure.
- *
- * This function converts the given raw data, which should be calibrated, to
- * science data, and then stores into the P2VM data structure.
- *
- * @param rawData raw data to be added to P2VM calibration data.
- * @param waveData wave data used during science data conversion; could be null
- * pointer, see amdlibRawData2ScienceData().
- * @param p2vmData structure where data for P2VM calibration will be stored
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAddToP2vmData (amdlibRAW_DATA *rawData,
- amdlibWAVEDATA *waveData,
- amdlibP2VM_INPUT_DATA *p2vmData,
- amdlibERROR_MSG errMsg)
-{
- int i, j;
-
- amdlibLogTrace("amdlibAddToP2vmData()");
-
- /* If data structure is not initialized, do it */
- if (p2vmData->thisPtr != p2vmData)
- {
- /* Initialise data structure */
- amdlibInitP2vmData(p2vmData);
- }
-
- /* Check raw data structure contains data */
- if (rawData->dataLoaded == amdlibFALSE)
- {
- amdlibSetErrMsg("The raw data structure does not "
- "contain data. Check call to amdlibLoadRawData()");
- return amdlibFAILURE;
- }
-
- /* Check frame type */
- if ((rawData->frameType == amdlibDARK_FRAME) ||
- (rawData->frameType == amdlibTEL123_FRAME) ||
- (rawData->frameType == amdlibUNKNOWN_FRAME))
- {
- amdlibSetErrMsg("Invalid frame type %d (see amdlibFRAME_TYPE)",
- rawData->frameType);
- return amdlibFAILURE;
- }
-
- /* Check the raw data only contains 1 row */
- if (rawData->nbRows != 1)
- {
- amdlibSetErrMsg("Wrong number of data rows (%d) for"
- " P2VM computation. Must be 1", rawData->nbRows);
- return amdlibFAILURE;
- }
-
- /* Check if this frame type is already loaded */
- j = rawData->frameType - amdlibTEL1_FRAME;
- if (p2vmData->dataLoaded[j] == amdlibTRUE)
- {
- amdlibSetErrMsg("Frame type %d already loaded"
- "(see amdlibFRAME_TYPE)", rawData->frameType);
- return amdlibFAILURE;
- }
-
- /* Store calibrated data into P2VM data structure */
- if (amdlibRawData2ScienceData(rawData, waveData, &p2vmData->scienceData[j],
- amdlibTRUE, errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- p2vmData->dataLoaded[j] = amdlibTRUE;
- p2vmData->nbFrames = rawData->nbFrames;
-
-#if amdlibDEBUG
- amdlibLogTest("scienceData pour %d ajoutee", j);
- amdlibDisplayScienceData(&p2vmData->scienceData[j]);
-#endif
-
- /* Get DATE keyword used to compute P2VM id */
- for (i=0; i < rawData->insCfg.nbKeywords; i++)
- {
- double obsDate;
- if ( strncmp(rawData->insCfg.keywords[i].name, "MJD-OBS", 7) == 0)
- {
- sscanf(rawData->insCfg.keywords[i].value, "%lf", &obsDate);
- /* Convert MJD to minutes from 01/01/2000 */
- /* Note that MJD is given from 17/11/1858, and 51544 is the number
- * of days between 01/01/2000 and this date.*/
- obsDate = (obsDate-51544.0)*1440;
- p2vmData->p2vmId += obsDate;
- break;
- }
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Free memory allocated memory of P2VM data structure.
- *
- * This function frees previously allocated memory (if any) where data for
- * P2VM has been stored, and resets all the structure fields, including thisPtr
- * pointer.
- *
- * @param p2vmData structure where data for P2VM calibration is stored
- */
-void amdlibReleaseP2vmData(amdlibP2VM_INPUT_DATA *p2vmData)
-{
- int image;
-
- amdlibLogTrace("amdlibReleaseP2vmData()");
-
- for (image = 0; image < amdlibMAX_NB_FRAMES_P2VM; image++)
- {
- amdlibFreeScienceData(&p2vmData->scienceData[image]);
- p2vmData->dataLoaded[image] = amdlibFALSE;
- }
-
- amdlibInitP2vmData(p2vmData);
-
- memset (p2vmData, '\0', sizeof(amdlibP2VM_INPUT_DATA));
-}
-
-/*
- * Local function definition
- */
-/**
- * Initialize P2VM data structure.
- *
- * @warning
- * This function must be called first before using a new 'spectral calibration
- * data' structure.
- *
- * @param p2vmData structure where data for P2VM calibration is stored
- */
-void amdlibInitP2vmData(amdlibP2VM_INPUT_DATA *p2vmData)
-{
- int i;
-
- amdlibLogTrace("amdlibInitP2vmData()");
-
- /* Initialize data structure */
- memset (p2vmData, '\0', sizeof(amdlibP2VM_INPUT_DATA));
- p2vmData->thisPtr = p2vmData;
-
- for (i = 0; i < amdlibMAX_NB_FRAMES_P2VM; i++)
- {
- p2vmData->dataLoaded[i] = amdlibFALSE;
- }
-}
-
-/*___oOo___*/
diff --git a/amber/amdlibPiston.c b/amber/amdlibPiston.c
deleted file mode 100644
index 2ba70a0..0000000
--- a/amber/amdlibPiston.c
+++ /dev/null
@@ -1,1478 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Useful functions related to piston computation.
- */
-
-#define _POSIX_SOURCE 1
-
-/*
- * System Headers
- */
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include "fitsio.h"
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-
-#define amdlibMAX_PISTON2_ITERATIONS 50
-#define amdlibPISTONPRECISION 1E-2
-#define amdlibMAX_SWEEP_SIZE_FOR_PISTON 33
-/*
- * Local function declaration
- */
-double amdlibAbacusErrPhi(double x);
-amdlibCOMPL_STAT amdlibQsortDouble(double *pix_arr, int npix);
-amdlibCOMPL_STAT amdlibQsortDoubleIndexed(double *pix_arr, int *index, int npix);
-static void amdlibFreePiston(amdlibPISTON *piston);
-void amdlibComputePiston2T(int nbWlen,
- amdlibDOUBLE *Wave,
- amdlibCOMPLEX *x,
- amdlibCOMPLEX *s2x,
- amdlibDOUBLE *pistonOPD,
- amdlibDOUBLE *sigma,
- double wlenAvg,
- double wlenDifAvg,
- double R);
-/*
- * Public functions
- */
-/**
- * Release memory allocated to store pistons, and reset the structure members
- * to zero.
- *
- * @param opd pointer to amdlibPISTON structure.
- */
-void amdlibReleasePiston(amdlibPISTON *opd)
-{
- amdlibLogTrace("amdlibReleasePiston()");
-
- amdlibFreePiston(opd);
- memset (opd, '\0', sizeof(amdlibPISTON));
-}
-
-/*
- * Protected functions
- */
-/**
- * Allocate memory for storing pistons.
- *
- * @param piston pointer to amdlibPISTON structure.
- * @param nbFrames number of frames
- * @param nbBases number of baselines
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAllocatePiston(amdlibPISTON *piston,
- const int nbFrames,
- const int nbBases)
-{
- int band;
-
- amdlibLogTrace("amdlibAllocatePiston()");
-
- /* First free previous allocated memory */
- if (piston->thisPtr == piston)
- {
- amdlibFreePiston(piston);
- }
-
- /* Init data structure */
- piston->thisPtr = memset(piston, '\0', sizeof(*piston));
- /* Set array size */
- piston->nbFrames = nbFrames;
- piston->nbBases = nbBases;
- for (band = amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- piston->bandFlag[band] = amdlibFALSE;
- piston->pistonOPDArray[band] = calloc(nbFrames*nbBases, sizeof(amdlibDOUBLE));
- piston->sigmaPistonArray[band] =
- calloc(nbFrames*nbBases, sizeof(amdlibDOUBLE));
- if ((piston->pistonOPDArray[band] == NULL) ||
- (piston->sigmaPistonArray[band] == NULL))
- {
- amdlibFreePiston(piston);
- return amdlibFAILURE;
- }
- }
- piston->pistonOPD = calloc(nbFrames*nbBases, sizeof(amdlibDOUBLE));
- piston->sigmaPiston = calloc(nbFrames*nbBases, sizeof(amdlibDOUBLE));
- if ((piston->pistonOPD == NULL) || (piston->sigmaPiston == NULL))
- {
- amdlibFreePiston(piston);
- return amdlibFAILURE;
- }
-
- /* Return */
- return amdlibSUCCESS;
-}
-
-/**
- * Append amdlibPISTON data structure.
- *
- * @param srcOpd pointer to source data structure
- * @param dstOpd pointer to destination data structure (append to)
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAppendPiston(amdlibPISTON *dstOpd,
- amdlibPISTON *srcOpd,
- amdlibERROR_MSG errMsg)
-{
- int dentry;
- int sentry;
- int band;
-
- amdlibLogTrace("amdlibAppendPiston()");
-
- /* Perform simple check */
- if (dstOpd->nbBases != srcOpd->nbBases)
- {
- amdlibSetErrMsg("Different number of bases");
- return amdlibFAILURE;
- }
-
- /* Reallocate memory to store additional data */
- for (band = amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- dstOpd->pistonOPDArray[band] = realloc(dstOpd->pistonOPDArray[band],
- (dstOpd->nbFrames + srcOpd->nbFrames) *
- srcOpd->nbBases * sizeof(amdlibDOUBLE));
- dstOpd->sigmaPistonArray[band] = realloc(dstOpd->sigmaPistonArray[band],
- (dstOpd->nbFrames + srcOpd->nbFrames) *
- srcOpd->nbBases * sizeof(amdlibDOUBLE));
- if ((dstOpd->pistonOPDArray[band] == NULL) ||
- (dstOpd->sigmaPistonArray[band] == NULL))
- {
- amdlibSetErrMsg("Could not reallocate memory for piston structure");
- return amdlibFAILURE;
- }
- }
- dstOpd->pistonOPD = realloc(dstOpd->pistonOPD,
- (dstOpd->nbFrames + srcOpd->nbFrames) *
- srcOpd->nbBases * sizeof(amdlibDOUBLE));
- dstOpd->sigmaPiston = realloc(dstOpd->sigmaPiston,
- (dstOpd->nbFrames + srcOpd->nbFrames) *
- srcOpd->nbBases * sizeof(amdlibDOUBLE));
- if ((dstOpd->pistonOPD == NULL) || (dstOpd->sigmaPiston == NULL))
- {
- amdlibSetErrMsg("Could not reallocate memory for piston structure");
- return amdlibFAILURE;
- }
-
- /* Append fields allocated dynamically */
- dentry = dstOpd->nbFrames * dstOpd->nbBases;
-
- /* Band Flag sameness insured if check is made beforehand
- * on the sameness of Wlens. No use to update it. */
-
- for (sentry = 0; sentry < srcOpd->nbFrames * srcOpd->nbBases; sentry++)
- {
- for (band=amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- dstOpd->pistonOPDArray[band][dentry] =
- srcOpd->pistonOPDArray[band][sentry];
- dstOpd->sigmaPistonArray[band][dentry] =
- srcOpd->sigmaPistonArray[band][sentry];
- }
- dstOpd->pistonOPD[dentry] = srcOpd->pistonOPD[sentry];
- dstOpd->sigmaPiston[dentry] = srcOpd->sigmaPiston[sentry];
- dentry++;
- }
-
- /* Append fixed size fields */
- dstOpd->nbFrames += srcOpd->nbFrames;
- return amdlibSUCCESS;
-}
-
-
-/**
- * Insert amdlibPISTON data structure.
- *
- * @param srcOpd pointer to source data structure
- * @param dstOpd pointer to destination data structure (insert to)
- * @param insertIndex
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibInsertPiston(amdlibPISTON *dstOpd,
- amdlibPISTON *srcOpd,
- int insertIndex,
- amdlibERROR_MSG errMsg)
-{
- int dentry;
- int sentry;
- int band;
- int dstNbFrames = dstOpd->nbFrames;
- int finalIndex = insertIndex + srcOpd->nbFrames;
-
- amdlibLogTrace("amdlibInsertPiston()");
-
- /* Perform simple check */
- if (insertIndex<0 || insertIndex>=dstOpd->nbFrames)
- {
- amdlibSetErrMsg("Invalid insertion index %d for amdlibInsertVis2",insertIndex);
- return amdlibFAILURE;
- }
- if (dstOpd->nbBases != srcOpd->nbBases)
- {
- amdlibSetErrMsg("Different number of bases");
- return amdlibFAILURE;
- }
- if (dstNbFrames < finalIndex)
- {
- amdlibSetErrMsg("Number of frames (%d) in destination structure"
- "too small to enable insertion of %d frames at position %d",
- dstNbFrames,srcOpd->nbFrames,insertIndex);
- return amdlibFAILURE;
- }
-
- /* Insert src in dst at frame insertIndex */
- dentry = insertIndex * dstOpd->nbBases;
-
- for (band=amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- /* Band Flag sameness insured if check is made beforehand
- * on the sameness of Wlens. Update it since it it void at start. */
- dstOpd->bandFlag[band]=srcOpd->bandFlag[band];
- }
-
- for (sentry = 0; sentry < srcOpd->nbFrames * srcOpd->nbBases; sentry++)
- {
- for (band=amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- dstOpd->pistonOPDArray[band][dentry] =
- srcOpd->pistonOPDArray[band][sentry];
- dstOpd->sigmaPistonArray[band][dentry] =
- srcOpd->sigmaPistonArray[band][sentry];
- }
- dstOpd->pistonOPD[dentry] = srcOpd->pistonOPD[sentry];
- dstOpd->sigmaPiston[dentry] = srcOpd->sigmaPiston[sentry];
- dentry++;
- }
-
- return amdlibSUCCESS;
-}
-
-
-/**);
- * Merge amdlibPISTON data structure.
- *
- * @param opd1 pointer on merged piston structure.
- * @param opd2 pointer on piston structure to merge.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibMergePiston(amdlibPISTON *opd1,
- amdlibPISTON *opd2,
- amdlibERROR_MSG errMsg)
-{
- int band;
-
- amdlibLogTrace("amdlibMergePiston()");
-
- memcpy(opd1->pistonOPD, opd2->pistonOPD,
- opd2->nbFrames * opd2->nbBases * sizeof(amdlibDOUBLE));
- memcpy(opd1->sigmaPiston, opd2->sigmaPiston,
- opd2->nbFrames * opd2->nbBases * sizeof(amdlibDOUBLE));
- for (band=amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- if (opd2->bandFlag[band] == amdlibTRUE)
- {
- if (opd1->bandFlag[band] == amdlibTRUE)
- {
- amdlibSetErrMsg("Same information in pistons to merge");
- return amdlibFAILURE;
- }
- opd1->bandFlag[band] = amdlibTRUE;
- memcpy(opd1->pistonOPDArray[band], opd2->pistonOPDArray[band],
- opd1->nbFrames * opd1->nbBases * sizeof(amdlibDOUBLE));
- memcpy(opd1->sigmaPistonArray[band], opd2->sigmaPistonArray[band],
- opd1->nbFrames * opd1->nbBases * sizeof(amdlibDOUBLE));
- return amdlibSUCCESS;
- }
- }
-
- amdlibSetErrMsg("Problem whith opd to merge: doesn't contain value");
- return amdlibFAILURE;
-}
-
-/**
- * Split amdlibPISTON input data structure into 3 structures, 1 per spectral
- * band. Each new structure only contains information relative to its associated
- * spectral band .
- *
- * @param srcOpd pointer on piston structure to split.
- * @param dstOpd array of splitted piston structures.
- * @param nbWlen array containing the number of wavelengths per spectral band.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibSplitPiston(amdlibPISTON *srcOpd,
- amdlibPISTON *dstOpd,
- int *nbWlen,
- amdlibERROR_MSG errMsg)
-{
- int band, i;
-
- amdlibLogTrace("amdlibSplitPiston()");
-
- for (band=amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- if (nbWlen[band] == 0)
- {
- dstOpd[band].thisPtr = NULL;
- }
- else
- {
- /* Allocate memory for dstOpd */
- if (amdlibAllocatePiston(&dstOpd[band], srcOpd->nbFrames,
- srcOpd->nbBases) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for new piston "
- "structure");
- return amdlibFAILURE;
- }
-
- for (i=amdlibJ_BAND; i <= amdlibK_BAND; i++)
- {
- if (i == band)
- {
- dstOpd[band].bandFlag[band] = amdlibTRUE;
- }
- else
- {
- dstOpd[band].bandFlag[i] = amdlibFALSE;
- }
- }
-
- /* Copy fields allocated dynamically */
- memcpy (dstOpd[band].pistonOPDArray[band],
- srcOpd->pistonOPDArray[band],
- srcOpd->nbFrames * srcOpd->nbBases * sizeof(amdlibDOUBLE));
- memcpy (dstOpd[band].sigmaPistonArray[band],
- srcOpd->sigmaPistonArray[band],
- srcOpd->nbFrames * srcOpd->nbBases * sizeof(amdlibDOUBLE));
-
- memcpy (dstOpd[band].pistonOPD, srcOpd->pistonOPD,
- srcOpd->nbFrames * srcOpd->nbBases * sizeof(amdlibDOUBLE));
- memcpy (dstOpd[band].sigmaPiston, srcOpd->sigmaPiston,
- srcOpd->nbFrames * srcOpd->nbBases * sizeof(amdlibDOUBLE));
- }
- }
-
- return amdlibSUCCESS;
-}
-
-/** Useful macro to free all dynamically allocated structures */
-#define amdlibMeanPiston_FREEALL() \
- amdlibFree2DArrayDoubleWrapping(instantOpdPistonPtr); \
- amdlibFree2DArrayDoubleWrapping(instantOpdSigmaPtr); \
- amdlibFree2DArrayDoubleWrapping(opdPistonPtr); \
- amdlibFree2DArrayDoubleWrapping(opdSigmaPtr);
-/**
- * Compute mean piston.
- *
- * @param instantOpd pointer to amdlibPISTON input data structure (bin of
- * intantaneous opds).
- * @param band current treated band.
- * @param iBin index where to store result in the output (binned) structure.
- * @param selectedFrames structure containing information relative to frame
- * selection. By default, all frames are selected.
- * @param opd pointer to amdlibPISTON output data structure (binned).
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibMeanPiston(amdlibPISTON *instantOpd,
- amdlibBAND band,
- int iBin,
- amdlibSELECTION *selectedFrames,
- amdlibPISTON *opd)
-{
- int iFrame; /* usually loop on number of frames */
- int nbFrames = instantOpd->nbFrames;
- int iBase; /*usually loop on nbBases*/
- int nbBases = instantOpd->nbBases;
- int nbGoodFrames = 0;
- static amdlibDOUBLE pistonOPD, sigma2;
- amdlibDOUBLE **instantOpdPistonPtr = NULL;
- amdlibDOUBLE **opdPistonPtr = NULL;
- amdlibDOUBLE **instantOpdSigmaPtr = NULL;
- amdlibDOUBLE **opdSigmaPtr = NULL;
- static amdlibERROR_MSG errMsg;
- double weight;
-
- amdlibLogTrace("amdlibMeanPiston()");
-
- if (instantOpd->bandFlag[band] == amdlibFALSE)
- {
- amdlibLogError("Piston for band '%d' not ever computed", band);
- amdlibMeanPiston_FREEALL();
- return amdlibFAILURE;
- }
-
- opd->bandFlag[band] = instantOpd->bandFlag[band];
-
- instantOpdPistonPtr =
- amdlibWrap2DArrayDouble(instantOpd->pistonOPDArray[band],
- instantOpd->nbBases,
- instantOpd->nbFrames, errMsg);
- if (instantOpdPistonPtr == NULL)
- {
- amdlibLogError("amdlibWrap2DArrayDouble() failed !");
- amdlibLogErrorDetail(errMsg);
- amdlibMeanPiston_FREEALL();
- return amdlibFAILURE;
- }
- instantOpdSigmaPtr =
- amdlibWrap2DArrayDouble(instantOpd->sigmaPistonArray[band],
- instantOpd->nbBases,
- instantOpd->nbFrames, errMsg);
- if (instantOpdSigmaPtr == NULL)
- {
- amdlibLogError("amdlibWrap2DArrayDouble() failed !");
- amdlibLogErrorDetail(errMsg);
- amdlibMeanPiston_FREEALL();
- return amdlibFAILURE;
- }
- opdPistonPtr = amdlibWrap2DArrayDouble(opd->pistonOPDArray[band],
- opd->nbBases,
- opd->nbFrames, errMsg);
- if (opdPistonPtr == NULL)
- {
- amdlibLogError("amdlibWrap2DArrayDouble() failed !");
- amdlibLogErrorDetail(errMsg);
- amdlibMeanPiston_FREEALL();
- return amdlibFAILURE;
- }
- opdSigmaPtr = amdlibWrap2DArrayDouble(opd->sigmaPistonArray[band],
- opd->nbBases,
- opd->nbFrames, errMsg);
- if (opdSigmaPtr == NULL)
- {
- amdlibLogError("amdlibWrap2DArrayDouble() failed !");
- amdlibLogErrorDetail(errMsg);
- amdlibMeanPiston_FREEALL();
- return amdlibFAILURE;
- }
-
- if (nbFrames > 1)
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- if (selectedFrames->band[band].nbSelectedFrames[iBase] != 0)
- {
- /* compute mean piston */
- pistonOPD = 0.0;
- weight = 0;
- for (iFrame = 0, nbGoodFrames = 0; iFrame < nbFrames; iFrame++)
- {
- if ((selectedFrames->band[band].isSelectedPt[iBase][iFrame] == amdlibTRUE)&&!amdlibCompareDouble(instantOpdPistonPtr[iFrame][iBase],amdlibBLANKING_VALUE))
- {
- weight += 1/amdlibPow2(instantOpdSigmaPtr[iFrame][iBase]);
- pistonOPD += instantOpdPistonPtr[iFrame][iBase] / amdlibPow2(instantOpdSigmaPtr[iFrame][iBase]);
- nbGoodFrames++;
- }
- }
- if (nbGoodFrames != 0)
- {
- pistonOPD /= weight;
- sigma2 = (1.0/weight);
- opdPistonPtr[iBin][iBase] = pistonOPD ;
- opdSigmaPtr[iBin][iBase] = sqrt(sigma2);
- }
- else
- {
- opdPistonPtr[iBin][iBase] = amdlibBLANKING_VALUE;
- opdSigmaPtr[iBin][iBase] = amdlibBLANKING_VALUE;
- }
- }
- else
- {
- opdPistonPtr[iBin][iBase] = amdlibBLANKING_VALUE;
- opdSigmaPtr[iBin][iBase] = amdlibBLANKING_VALUE;
- }
- }
- }
- else /* Do nothing more than copy, only one frame !.*/
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- if (selectedFrames->band[band].nbSelectedFrames[iBase] != 0)
- {
- opdPistonPtr[iBin][iBase] = instantOpdPistonPtr[0][iBase];
- opdSigmaPtr[iBin][iBase] = instantOpdSigmaPtr[0][iBase];
- }
- else
- {
- opdPistonPtr[iBin][iBase] = amdlibBLANKING_VALUE;
- opdSigmaPtr[iBin][iBase] = amdlibBLANKING_VALUE;
- }
- }
- }
-
- memcpy(opd->pistonOPD, opd->pistonOPDArray[band],
- opd->nbBases * opd->nbFrames * sizeof(amdlibDOUBLE));
- memcpy(opd->sigmaPiston, opd->sigmaPistonArray[band],
- opd->nbBases * opd->nbFrames * sizeof(amdlibDOUBLE));
- amdlibMeanPiston_FREEALL();
- return amdlibSUCCESS;
-}
-#undef amdlibMeanPiston_FREEALL
-
-/** Useful macro to free all dynamically allocated structures */
-#define amdlibClosePiston_FREEALL() \
- amdlibFree2DArrayDoubleWrapping(instantOpdPistonPtr); \
- amdlibFree2DArrayDoubleWrapping(instantOpdSigmaPtr);
-
-/**
- * Enforces piston closure if useful (sigma > precision).
- *
- * @param instantOpd pointer to amdlibPISTON input data structure (bin of
- * intantaneous opds).
- * @param band current treated band.
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibClosePiston(amdlibPISTON *instantOpd,
- double precision,
- amdlibBAND band)
-{
- int iFrame;
- int nbFrames = instantOpd->nbFrames;
- int iBase;
- int nbBases = instantOpd->nbBases;
- amdlibDOUBLE **instantOpdPistonPtr = NULL;
- amdlibDOUBLE **instantOpdSigmaPtr = NULL;
- static amdlibERROR_MSG errMsg;
- double s[amdlibNBASELINE],p[amdlibNBASELINE];
- int idx[amdlibNBASELINE];
-
- amdlibLogTrace("amdlibClosePiston()");
- if (instantOpd->bandFlag[band] == amdlibFALSE)
- {
- amdlibLogError("Piston for band '%d' not ever computed", band);
- return amdlibFAILURE;
- }
-
- if (amdlibGetUserPref(amdlibMAX_PISTON_ERROR).set==amdlibTRUE)
- precision=amdlibGetUserPref(amdlibMAX_PISTON_ERROR).value;
-
- amdlibLogInfoDetail("Pistons Closure...");
- if (nbBases==3)
- {
- instantOpdPistonPtr =
- amdlibWrap2DArrayDouble(instantOpd->pistonOPDArray[band],
- instantOpd->nbBases,
- instantOpd->nbFrames, errMsg);
- if (instantOpdPistonPtr == NULL)
- {
- amdlibLogError("amdlibWrap2DArrayDouble() failed !");
- amdlibLogErrorDetail(errMsg);
- amdlibClosePiston_FREEALL();
- return amdlibFAILURE;
- }
- instantOpdSigmaPtr =
- amdlibWrap2DArrayDouble(instantOpd->sigmaPistonArray[band],
- instantOpd->nbBases,
- instantOpd->nbFrames, errMsg);
- if (instantOpdSigmaPtr == NULL)
- {
- amdlibLogError("amdlibWrap2DArrayDouble() failed !");
- amdlibLogErrorDetail(errMsg);
- amdlibClosePiston_FREEALL();
- return amdlibFAILURE;
- }
- for (iFrame = 0; iFrame < nbFrames; iFrame++)
- {
- /* truth table */
- p[0]=instantOpdPistonPtr[iFrame][2]-instantOpdPistonPtr[iFrame][1];
- p[1]=instantOpdPistonPtr[iFrame][2]-instantOpdPistonPtr[iFrame][0];
- p[2]=instantOpdPistonPtr[iFrame][0]+instantOpdPistonPtr[iFrame][1];
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- s[iBase]=instantOpdSigmaPtr[iFrame][iBase];
- idx[iBase]=iBase;
- }
- amdlibQsortDoubleIndexed(s, idx, nbBases);
- /* avoid blanking */
- if (!(s[0]<=amdlibBLANKING_VALUE)) /*which is a huge neg value, so in 0*/
- {
- /* Do it if it is really significant */
- if ((sqrt(s[0]*s[0]+s[1]*s[1])<2*s[2])&&(sqrt(s[0]*s[0]+s[1]*s[1]))<precision)
- {
- instantOpdPistonPtr[iFrame][idx[2]]=p[idx[2]];
- instantOpdSigmaPtr[iFrame][idx[2]]=sqrt(s[0]*s[0]+s[1]*s[1]);
- }
- }
- else /* try to fill blank values */
- {
- instantOpdPistonPtr[iFrame][idx[0]]=p[idx[0]];
- if (!amdlibCompareDouble(s[1],amdlibBLANKING_VALUE)&&!amdlibCompareDouble(s[2],amdlibBLANKING_VALUE))
- instantOpdSigmaPtr[iFrame][idx[0]]=sqrt(s[2]*s[2]+s[1]*s[1]);
- }
- }
- }
- amdlibClosePiston_FREEALL();
- return amdlibSUCCESS;
-}
-#undef amdlibClosePiston_FREEALL
-
-/** Useful macro to free all dynamically allocated structures */
-#define amdlibTagPiston_FREEALL() \
- amdlibFree2DArrayDoubleWrapping(instantOpdPistonPtr); \
- amdlibFree2DArrayDoubleWrapping(instantOpdSigmaPtr);
-
-/**
- * Blanks silly piston values (sigma > threshold).
- *
- * @param instantOpd pointer to amdlibPISTON input data structure (bin of
- * intantaneous opds).
- * @param band current treated band.
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibTagPiston(amdlibPISTON *instantOpd,
- double threshold,
- double errThreshold,
- amdlibBAND band)
-{
- int iFrame;
- int nbFrames = instantOpd->nbFrames;
- int iBase;
- int nbBases = instantOpd->nbBases;
- amdlibDOUBLE **instantOpdPistonPtr = NULL;
- amdlibDOUBLE **instantOpdSigmaPtr = NULL;
- static amdlibERROR_MSG errMsg;
- int nbBlank;
-
- amdlibLogTrace("amdlibTagPiston()");
- if (instantOpd->bandFlag[band] == amdlibFALSE)
- {
- amdlibLogError("Piston for band '%d' not ever computed", band);
- return amdlibFAILURE;
- }
-
- instantOpdPistonPtr =
- amdlibWrap2DArrayDouble(instantOpd->pistonOPDArray[band],
- instantOpd->nbBases,
- instantOpd->nbFrames, errMsg);
- if (instantOpdPistonPtr == NULL)
- {
- amdlibLogError("amdlibWrap2DArrayDouble() failed !");
- amdlibLogErrorDetail(errMsg);
- amdlibTagPiston_FREEALL();
- return amdlibFAILURE;
- }
- instantOpdSigmaPtr =
- amdlibWrap2DArrayDouble(instantOpd->sigmaPistonArray[band],
- instantOpd->nbBases,
- instantOpd->nbFrames, errMsg);
- if (instantOpdSigmaPtr == NULL)
- {
- amdlibLogError("amdlibWrap2DArrayDouble() failed !");
- amdlibLogErrorDetail(errMsg);
- amdlibTagPiston_FREEALL();
- return amdlibFAILURE;
- }
- amdlibLogInfoDetail("Pistons Cleanup...");
- /* blank all pistons with sigma > errThreshold
- * or abs(piston) > threshold*/
- nbBlank=0;
- if (!amdlibCompareDouble(errThreshold,amdlibBLANKING_VALUE))
- {
- for (iFrame = 0; iFrame < nbFrames; iFrame++)
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- if (instantOpdSigmaPtr[iFrame][iBase] >= errThreshold)
- {
- instantOpdSigmaPtr[iFrame][iBase] = amdlibBLANKING_VALUE;
- instantOpdPistonPtr[iFrame][iBase] = amdlibBLANKING_VALUE;
- nbBlank++;
- }
- }
- }
- }
- if (!amdlibCompareDouble(threshold,amdlibBLANKING_VALUE))
- {
- for (iFrame = 0; iFrame < nbFrames; iFrame++)
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- if (!!amdlibCompareDouble(instantOpdSigmaPtr[iFrame][iBase],amdlibBLANKING_VALUE))
- {
- if ((fabs(instantOpdPistonPtr[iFrame][iBase])>=threshold))
- {
- instantOpdSigmaPtr[iFrame][iBase] = amdlibBLANKING_VALUE;
- instantOpdPistonPtr[iFrame][iBase] = amdlibBLANKING_VALUE;
- nbBlank++;
- }
- }
- }
- }
- }
- amdlibLogInfoDetail("Tagged %d pistons as bad, according to filter instructions"
- "(%5.1f %% of total).",nbBlank,
- (float)(100.0*nbBlank/(nbFrames*nbBases)));
-
- amdlibTagPiston_FREEALL();
- return amdlibSUCCESS;
-}
-#undef amdlibTagPiston_FREEALL
-
-/** Useful macro to free all dynamically allocated structures */
-#define amdlibBinPiston_FREEALL() \
- amdlibFree2DArrayDoubleWrapping(instantOpdPistonPtr); \
- amdlibFree2DArrayDoubleWrapping(instantOpdSigmaPtr); \
- amdlibFree2DArrayDoubleWrapping(opdPistonPtr); \
- amdlibFree2DArrayDoubleWrapping(opdSigmaPtr);
-/**
- * Compute Bin piston.
- *
- * @param instantOpd pointer to amdlibPISTON input data structure (bin of
- * intantaneous opds).
- * @param band current treated band.
- * @param iBin index where to store result in the output (binned) structure.
- * @param selectedFrames structure containing information relative to frame
- * selection. By default, all frames are selected.
- * @param opd pointer to amdlibPISTON output data structure (binned).
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibBinPiston(amdlibPISTON *instantOpd,
- amdlibBAND band,
- int firstFrame,
- int nbFrames,
- int iBin,
- amdlibPISTON *opd)
-{
- int iFrame; /* usually loop on number of frames */
- int iBase; /*usually loop on nbBases*/
- int nbBases = instantOpd->nbBases;
- int nbGoodFrames = 0;
- static amdlibDOUBLE pistonOPD, sigma2;
- amdlibDOUBLE **instantOpdPistonPtr = NULL;
- amdlibDOUBLE **opdPistonPtr = NULL;
- amdlibDOUBLE **instantOpdSigmaPtr = NULL;
- amdlibDOUBLE **opdSigmaPtr = NULL;
- static amdlibERROR_MSG errMsg;
- double weight;
-
- amdlibLogTrace("amdlibBinPiston()");
-
- if (instantOpd->bandFlag[band] == amdlibFALSE)
- {
- amdlibLogError("Piston for band '%d' not ever computed", band);
- amdlibBinPiston_FREEALL();
- return amdlibFAILURE;
- }
-
- opd->bandFlag[band] = instantOpd->bandFlag[band];
-
- instantOpdPistonPtr =
- amdlibWrap2DArrayDouble(instantOpd->pistonOPDArray[band],
- instantOpd->nbBases,
- instantOpd->nbFrames, errMsg);
- if (instantOpdPistonPtr == NULL)
- {
- amdlibLogError("amdlibWrap2DArrayDouble() failed !");
- amdlibLogErrorDetail(errMsg);
- amdlibBinPiston_FREEALL();
- return amdlibFAILURE;
- }
- instantOpdSigmaPtr =
- amdlibWrap2DArrayDouble(instantOpd->sigmaPistonArray[band],
- instantOpd->nbBases,
- instantOpd->nbFrames, errMsg);
- if (instantOpdSigmaPtr == NULL)
- {
- amdlibLogError("amdlibWrap2DArrayDouble() failed !");
- amdlibLogErrorDetail(errMsg);
- amdlibBinPiston_FREEALL();
- return amdlibFAILURE;
- }
- opdPistonPtr = amdlibWrap2DArrayDouble(opd->pistonOPDArray[band],
- opd->nbBases,
- opd->nbFrames, errMsg);
- if (opdPistonPtr == NULL)
- {
- amdlibLogError("amdlibWrap2DArrayDouble() failed !");
- amdlibLogErrorDetail(errMsg);
- amdlibBinPiston_FREEALL();
- return amdlibFAILURE;
- }
- opdSigmaPtr = amdlibWrap2DArrayDouble(opd->sigmaPistonArray[band],
- opd->nbBases,
- opd->nbFrames, errMsg);
- if (opdSigmaPtr == NULL)
- {
- amdlibLogError("amdlibWrap2DArrayDouble() failed !");
- amdlibLogErrorDetail(errMsg);
- amdlibBinPiston_FREEALL();
- return amdlibFAILURE;
- }
-
- if (nbFrames > 1)
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- /* compute Binned piston */
- pistonOPD = 0.0;
- weight = 0;
- for (iFrame = firstFrame, nbGoodFrames = 0;
- iFrame < firstFrame+nbFrames; iFrame++)
- {
- if (!amdlibCompareDouble(instantOpdPistonPtr[iFrame][iBase],amdlibBLANKING_VALUE))
- {
- weight += 1/amdlibPow2(instantOpdSigmaPtr[iFrame][iBase]);
- pistonOPD += instantOpdPistonPtr[iFrame][iBase] / amdlibPow2(instantOpdSigmaPtr[iFrame][iBase]);
- nbGoodFrames++;
- }
- }
- if (nbGoodFrames != 0)
- {
- pistonOPD /= weight;
- sigma2 = (1.0/weight);
- opdPistonPtr[iBin][iBase] = pistonOPD ;
- opdSigmaPtr[iBin][iBase] = sqrt(sigma2);
- }
- else
- {
- opdPistonPtr[iBin][iBase] = amdlibBLANKING_VALUE;
- opdSigmaPtr[iBin][iBase] = amdlibBLANKING_VALUE;
- }
-
- }
- }
- else /* Do nothing more than copy, only one frame !.*/
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- opdPistonPtr[iBin][iBase] = instantOpdPistonPtr[firstFrame][iBase];
- opdSigmaPtr[iBin][iBase] = instantOpdSigmaPtr[firstFrame][iBase];
- }
- }
- amdlibBinPiston_FREEALL();
- return amdlibSUCCESS;
-}
-#undef amdlibBinPiston_FREEALL
-
-
-/** Useful macro to free all dynamically allocated structures */
-#define amdlibComputePiston_FREEALL() amdlibFree2DArrayWrapping((void **)tablePtr);\
-free(C);free(S2C);free(Lambda);
-
-/**
- * Compute piston.
- *
- * This function computes the piston_OPD for each frame and each baseline
- * starting from the interspectra. Computes relevant sequence of data, and
- * passes them to amdlibComputePiston2T according to the number of baselines.
- *
- * @param instantCorrFlux instantaneous correlated flux.
- * @param band current treated band.
- * @param wave wavelength data structure used.
- * @param instantOpd resulting computed piston.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibComputePiston(amdlibVIS *instantCorrFlux,
- /* instantCorrFlux because it is a subset
- * of the orginal vis */
- amdlibBAND band,
- amdlibWAVELENGTH *wave,
- amdlibPISTON *instantOpd,
- amdlibERROR_MSG errMsg)
-{
- int iFrame; /* usually loop on number of frames */
- int nbFrames = instantCorrFlux->nbFrames;
- int iBase;
- int nbBases = instantCorrFlux->nbBases;
- int lVis, okVis;
- int nbLVis = wave->nbWlen;
- int nbTel = 2;
- amdlibVIS_TABLE_ENTRY **tablePtr = NULL;
-
- amdlibCOMPLEX *C=NULL,*S2C=NULL;
- amdlibDOUBLE *Lambda=NULL;
-
- double wlenDifAvg, wlenAvg, R;
-
- /* Contrary to previous use, wlenAvg is wlenMax, and wlenDifAvg
- * is wlenDifmin. This to cover every case related to resolution
- * change within the band.*/
-
- amdlibLogTrace("amdlibComputePiston()");
-
- wlenAvg=wave->wlen[0];
- wlenDifAvg=fabs(wave->bandwidth[0]);
-
- for (lVis = 1; lVis < nbLVis; lVis++)
- {
- wlenAvg = amdlibMax(wlenAvg, wave->wlen[lVis]);
- wlenDifAvg = amdlibMin(wlenDifAvg, fabs(wave->bandwidth[lVis]));
- }
-
- R = wlenAvg / wlenDifAvg; /* R computed at max wavelength, but
- * overstimated at the smallest wavelength diff
- * useful for correct exploration of piston
- * possibilities */
- R = R/2 ; /* True resolution if 2 pixels by spectral element - best case */
-
- /* Wrap instantCorrFlux->table structure to easy the reading of the code*/
- tablePtr =
- (amdlibVIS_TABLE_ENTRY **)amdlibWrap2DArray(instantCorrFlux->table,
- nbBases, nbFrames,
- sizeof(amdlibVIS_TABLE_ENTRY),
- errMsg);
- if (tablePtr == NULL)
- {
- amdlibComputePiston_FREEALL();
- return amdlibFAILURE;
- }
-
- C = calloc(nbLVis, sizeof(amdlibCOMPLEX));
- S2C = calloc(nbLVis, sizeof(amdlibCOMPLEX));
- Lambda = calloc(nbLVis, sizeof(amdlibDOUBLE));
- if(nbBases == 3)
- {
- nbTel = 3;
- }
- for (iFrame=0; iFrame < nbFrames; iFrame++)
- {
- iBase=0;
- for (lVis=0, okVis=0; lVis<nbLVis; lVis++)
- {
- if (tablePtr[iFrame][iBase].flag[lVis]==amdlibFALSE)
- {
- C[okVis].re=tablePtr[iFrame][iBase].vis[lVis].re;
- C[okVis].im=tablePtr[iFrame][iBase].vis[lVis].im;
- S2C[okVis].re=tablePtr[iFrame][iBase].sigma2Vis[lVis].re;
- S2C[okVis].im=tablePtr[iFrame][iBase].sigma2Vis[lVis].im;
- Lambda[okVis]=wave->wlen[lVis];
- okVis++;
- }
- }
- if (okVis>2)
- {
- amdlibComputePiston2T(okVis, Lambda, C, S2C,
- &instantOpd->pistonOPDArray[band][nbBases*iFrame+iBase],
- &instantOpd->sigmaPistonArray[band][nbBases*iFrame+iBase], wlenAvg, wlenDifAvg, R);
- }
- else
- {
- instantOpd->pistonOPDArray[band][nbBases*iFrame+iBase]=amdlibBLANKING_VALUE;
- instantOpd->sigmaPistonArray[band][nbBases*iFrame+iBase]=amdlibBLANKING_VALUE;
- }
- if (nbTel==3)
- {
- iBase=1;
- for (lVis=0, okVis=0; lVis<nbLVis; lVis++)
- {
- if (tablePtr[iFrame][iBase].flag[lVis]==amdlibFALSE)
- {
- C[okVis].re=tablePtr[iFrame][iBase].vis[lVis].re;
- C[okVis].im=tablePtr[iFrame][iBase].vis[lVis].im;
- S2C[okVis].re=tablePtr[iFrame][iBase].sigma2Vis[lVis].re;
- S2C[okVis].im=tablePtr[iFrame][iBase].sigma2Vis[lVis].im;
- Lambda[okVis]=wave->wlen[lVis];
- okVis++;
- }
- }
- if (okVis>2)
- {
- amdlibComputePiston2T(okVis, Lambda, C, S2C,
- &instantOpd->pistonOPDArray[band][nbBases*iFrame+iBase],
- &instantOpd->sigmaPistonArray[band][nbBases*iFrame+iBase], wlenAvg, wlenDifAvg, R);
- }
- else
- {
- instantOpd->pistonOPDArray[band][nbBases*iFrame+iBase]=amdlibBLANKING_VALUE;
- instantOpd->sigmaPistonArray[band][nbBases*iFrame+iBase]=amdlibBLANKING_VALUE;
- }
- iBase=2;
- for (lVis=0, okVis=0; lVis<nbLVis; lVis++)
- {
- if (tablePtr[iFrame][iBase].flag[lVis]==amdlibFALSE)
- {
- C[okVis].re=tablePtr[iFrame][iBase].vis[lVis].re;
- C[okVis].im=tablePtr[iFrame][iBase].vis[lVis].im;
- S2C[okVis].re=tablePtr[iFrame][iBase].sigma2Vis[lVis].re;
- S2C[okVis].im=tablePtr[iFrame][iBase].sigma2Vis[lVis].im;
- Lambda[okVis]=wave->wlen[lVis];
- okVis++;
- }
- }
- if (okVis>2)
- {
- amdlibComputePiston2T(okVis, Lambda, C, S2C,
- &instantOpd->pistonOPDArray[band][nbBases*iFrame+iBase],
- &instantOpd->sigmaPistonArray[band][nbBases*iFrame+iBase], wlenAvg, wlenDifAvg, R);
- }
- else
- {
- instantOpd->pistonOPDArray[band][nbBases*iFrame+iBase]=amdlibBLANKING_VALUE;
- instantOpd->sigmaPistonArray[band][nbBases*iFrame+iBase]=amdlibBLANKING_VALUE;
- }
- }
- } /* end loop iFrame */
-
- instantOpd->bandFlag[band] = amdlibTRUE;
- memcpy(instantOpd->pistonOPD, instantOpd->pistonOPDArray[band],
- instantOpd->nbFrames * instantOpd->nbBases * sizeof(amdlibDOUBLE));
- memcpy(instantOpd->sigmaPiston, instantOpd->sigmaPistonArray[band],
- instantOpd->nbFrames * instantOpd->nbBases * sizeof(amdlibDOUBLE));
- amdlibComputePiston_FREEALL();
- return amdlibSUCCESS;
-}
-#undef amdlibComputePiston_FREEALL
-
-#define amdlibComputePiston2T_FREEALL() free(waveNr); free(testPist); \
- free(cVisC); free(cVisCN); free(cVisC0); free(cVisCN0); free(cVisC1);\
- free(cVisCN1); free(cVisC2); free(cVisCN2); free(chi2);
-
-/**
- * Compute piston, iterative phasor method.
- */
-void amdlibComputePiston2T(int nbLVis,
- amdlibDOUBLE *wlen,
- amdlibCOMPLEX *cpxVisTable,
- amdlibCOMPLEX *s2cpxVisTable,
- amdlibDOUBLE *pistonOPD,
- amdlibDOUBLE *sigma,
- double wlenAvg,
- double wlenDifAvg,
- double R
- )
-{
- int lVis;
- int doOnce=1;
- int i, iMin=0, N, nbTest, iTest;
- double *waveNr, *testPist, *chi2;
- amdlibCOMPLEX *cVisC, *cVisCN, *cVisC0, *cVisCN0,*cVisC1, *cVisCN1,
- *cVisC2, *cVisCN2;
- amdlibCOMPLEX phasor, avgVis, rmsVis, conjAvgVis;
-
- double x,range,finesse;
- double opd0, opd1, opd2, Dopd, chi20, chi21, chi22;
- double r;
- double coefGrow = 1.5, coefShrink = 2.;
-
- amdlibLogTrace("amdlibComputePiston2T()");
-
- waveNr = calloc(nbLVis, sizeof(*waveNr));
- cVisC = calloc(nbLVis, sizeof(*cVisC));
- cVisCN = calloc(nbLVis, sizeof(*cVisCN));
- cVisC0 = calloc(nbLVis, sizeof(*cVisC0));
- cVisCN0 = calloc(nbLVis, sizeof(*cVisCN0));
- cVisC1 = calloc(nbLVis, sizeof(*cVisC1));
- cVisCN1 = calloc(nbLVis, sizeof(*cVisCN1));
- cVisC2 = calloc(nbLVis, sizeof(*cVisC2));
- cVisCN2 = calloc(nbLVis, sizeof(*cVisCN2));
-
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- waveNr[lVis] = 2 * M_PI / wlen[lVis];
- }
-
- /* Explore a large range, but limit the number of points to something
- * sensible: */
- if (R<70) /*LR = 35*/
- {
- nbTest = 4*(int)(R)+1;
- }
- else /* Avoid aliasing by looking to the central part */
- {
- R /= 2; /* 1 mm at MR */
- nbTest = amdlibMin(amdlibMAX_SWEEP_SIZE_FOR_PISTON,4*(int)(R)+1);
- }
-
- chi2 = calloc(nbTest, sizeof(*chi2));
- testPist = calloc(nbTest, sizeof(*testPist));
-
- opd0=0.0;
-
- range = 1.2 * R * wlenAvg;
- finesse = range / (nbTest-1);
-
- while ((finesse>wlenAvg)||(doOnce==1))
- {
- doOnce=0;
- for (iTest = 0; iTest < nbTest; iTest++)
- {
-
- testPist[iTest] = (-range/2) + opd0 + iTest * range / (nbTest-1);
- }
-
- for (iTest = 0; iTest < nbTest; iTest++)
- {
- for (i = 0; i < nbLVis; i++)
- {
- x = waveNr[i] * testPist[iTest];
- phasor.re = cos(x);
- phasor.im = -sin(x);
- amdlibCpxMul(cpxVisTable[i], phasor, cVisC[i]);
- }
- conjAvgVis.re = 0.0;
- conjAvgVis.im = 0.0;
- for (i = 0; i < nbLVis; i++)
- {
- conjAvgVis.re += cVisC[i].re;
- conjAvgVis.im -= cVisC[i].im;
- }
- conjAvgVis.re /= nbLVis ;
- conjAvgVis.im /= nbLVis ;
- for (i = 0; i < nbLVis; i++)
- {
- amdlibCpxMul(cVisC[i], conjAvgVis, cVisCN[i]);
- }
- /* rms cVisCN */
- avgVis.re = 0.0;
- avgVis.im = 0.0;
- for (i = 0; i < nbLVis; i++)
- {
- avgVis.re += cVisCN[i].re;
- avgVis.im += cVisCN[i].im;
- }
- avgVis.re /= nbLVis ;
- avgVis.im /= nbLVis ;
- rmsVis.re = 0.0;
- rmsVis.im = 0.0;
- for (i = 0; i < nbLVis; i++)
- {
- rmsVis.re += amdlibPow2(cVisCN[i].re-avgVis.re);
- rmsVis.im += amdlibPow2(cVisCN[i].im-avgVis.im);
- }
- rmsVis.re /= nbLVis ;
- rmsVis.im /= nbLVis ;
- rmsVis.re = sqrt(rmsVis.re);
- rmsVis.im = sqrt(rmsVis.im);
- chi2[iTest] = (rmsVis.re * rmsVis.im) / (avgVis.re*avgVis.re+avgVis.im*avgVis.im);
- }
-
- iMin = amdlibFindIndexOfMinimum(chi2, nbTest);
- opd0 = testPist[iMin];
-
- range /= 2 ;
- finesse = range / (nbTest-1) ;
- }
- /*use opd0 as random generator seed -- piston is notoriously random */
- srand((unsigned int)(opd0*1E12));
- r = (double)rand() / (double)RAND_MAX;
- Dopd=wlenDifAvg;
- for (N = 0; N < amdlibMAX_PISTON2_ITERATIONS; N++)
- {
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- x = waveNr[lVis] * opd0;
- phasor.re = cos(x);
- phasor.im = -sin(x);
- amdlibCpxMul(cpxVisTable[lVis], phasor, cVisC0[lVis]);
- }
- conjAvgVis.re = 0.0;
- conjAvgVis.im = 0.0;
- for (i = 0; i < nbLVis; i++)
- {
- conjAvgVis.re += cVisC0[i].re;
- conjAvgVis.im -= cVisC0[i].im;
- }
- conjAvgVis.re /= nbLVis ;
- conjAvgVis.im /= nbLVis ;
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- amdlibCpxMul(cVisC0[lVis], conjAvgVis, cVisCN0[lVis]);
- }
- avgVis.re = 0.0;
- avgVis.im = 0.0;
- for (i = 0; i < nbLVis; i++)
- {
- avgVis.re += cVisCN0[i].re;
- avgVis.im += cVisCN0[i].im;
- }
- avgVis.re /= nbLVis ;
- avgVis.im /= nbLVis ;
- rmsVis.re = 0.0;
- rmsVis.im = 0.0;
- for (i = 0; i < nbLVis; i++)
- {
- rmsVis.re += amdlibPow2(cVisCN0[i].re - avgVis.re);
- rmsVis.im += amdlibPow2(cVisCN0[i].im - avgVis.im);
- }
- rmsVis.re /= nbLVis ;
- rmsVis.im /= nbLVis ;
- rmsVis.re = sqrt(rmsVis.re);
- rmsVis.im = sqrt(rmsVis.im);
- chi20 = rmsVis.re * rmsVis.im / (avgVis.re*avgVis.re+avgVis.im*avgVis.im);
-
- opd1 = opd0 + Dopd;
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- x = waveNr[lVis] * opd1;
- phasor.re = cos(x);
- phasor.im = -sin(x);
- amdlibCpxMul(cpxVisTable[lVis], phasor, cVisC1[lVis]);
- }
- conjAvgVis.re = 0.0;
- conjAvgVis.im = 0.0;
- for (i = 0; i < nbLVis; i++)
- {
- conjAvgVis.re += cVisC1[i].re;
- conjAvgVis.im -= cVisC1[i].im;
- }
- conjAvgVis.re /= nbLVis ;
- conjAvgVis.im /= nbLVis ;
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- amdlibCpxMul(cVisC1[lVis], conjAvgVis, cVisCN1[lVis]);
- }
- avgVis.re = 0.0;
- avgVis.im = 0.0;
- for (i = 0; i < nbLVis; i++)
- {
- avgVis.re += cVisCN1[i].re;
- avgVis.im += cVisCN1[i].im;
- }
- avgVis.re /= nbLVis ;
- avgVis.im /= nbLVis ;
- rmsVis.re = 0.0;
- rmsVis.im = 0.0;
- for (i = 0; i < nbLVis; i++)
- {
- rmsVis.re += amdlibPow2(cVisCN1[i].re - avgVis.re);
- rmsVis.im += amdlibPow2(cVisCN1[i].im - avgVis.im);
- }
- rmsVis.re /= nbLVis ;
- rmsVis.im /= nbLVis ;
- rmsVis.re = sqrt(rmsVis.re);
- rmsVis.im = sqrt(rmsVis.im);
- chi21 = rmsVis.re * rmsVis.im / (avgVis.re*avgVis.re+avgVis.im*avgVis.im);
-
- opd2 = opd0 - Dopd;
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- x = waveNr[lVis] * opd2;
- phasor.re = cos(x);
- phasor.im = -sin(x);
- amdlibCpxMul(cpxVisTable[lVis], phasor, cVisC2[lVis]);
- }
- conjAvgVis.re = 0.0;
- conjAvgVis.im = 0.0;
- for (i = 0; i < nbLVis; i++)
- {
- conjAvgVis.re += cVisC2[i].re;
- conjAvgVis.im -= cVisC2[i].im;
- }
- conjAvgVis.re /= nbLVis ;
- conjAvgVis.im /= nbLVis ;
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- amdlibCpxMul(cVisC2[lVis], conjAvgVis, cVisCN2[lVis]);
- }
- avgVis.re = 0.0;
- avgVis.im = 0.0;
- for (i = 0; i < nbLVis; i++)
- {
- avgVis.re += cVisCN2[i].re;
- avgVis.im += cVisCN2[i].im;
- }
- avgVis.re /= nbLVis ;
- avgVis.im /= nbLVis ;
- rmsVis.re = 0.0;
- rmsVis.im = 0.0;
- for (i = 0; i < nbLVis; i++)
- {
- rmsVis.re += amdlibPow2(cVisCN2[i].re - avgVis.re);
- rmsVis.im += amdlibPow2(cVisCN2[i].im - avgVis.im);
- }
- rmsVis.re /= nbLVis ;
- rmsVis.im /= nbLVis ;
- rmsVis.re = sqrt(rmsVis.re);
- rmsVis.im = sqrt(rmsVis.im);
- chi22 = rmsVis.re * rmsVis.im / (avgVis.re*avgVis.re+avgVis.im*avgVis.im);
-
- if ((chi21 >= chi20) && (chi20 > chi22))
- {
- opd0 = opd0 - Dopd / coefShrink;
- Dopd = Dopd * coefGrow;
- }
- else if ((chi21 <= chi20) && (chi20 < chi22))
- {
- opd0 = opd0 + Dopd / coefShrink;
- Dopd = Dopd * coefGrow;
- }
- else if ((chi21 > chi20) && (chi20 < chi22))
- {
- Dopd = Dopd / coefShrink;
- }
- else
- {
- r = (double)rand() / (double)RAND_MAX;
- if (Dopd == 0)
- {
- Dopd = (r - 0.5) * wlenDifAvg;
- }
- if (r > 0.5)
- {
- opd0 -= Dopd / coefShrink;
- }
- else
- {
- opd0 += Dopd / coefShrink;
- }
- }
- if (amdlibPow2(Dopd /wlenDifAvg ) < amdlibPow2(amdlibPISTONPRECISION))
- {
- break;
- }
-
- }
-
- if (opd0>R*wlenAvg)
- {
- *pistonOPD = amdlibBLANKING_VALUE;
- *sigma = amdlibBLANKING_VALUE;
- amdlibComputePiston2T_FREEALL();
- return;
- }
- else
- {
- *pistonOPD = opd0;
- }
- /* Heuristic: chi20 above is not a true chi2 since there is no use of
- * the observed variance.( Using the variance gives silly results in chi2).
- * transform the chi2 as an idicator of the error on the phase (in
- * radians), call AbacusErrPhi to amplify the really wrong fits. */
- *sigma=amdlibAbacusErrPhi(2*M_PI*chi20/R)*R*wlenAvg/2/M_PI;
- amdlibComputePiston2T_FREEALL();
-
- return;
-}
-
-/**
- * Display piston structure.
- *
- * @param opd pointer to amdlibPISTON structure.
- */
-void amdlibDisplayPiston(amdlibPISTON *opd)
-{
- int nbFrames, nbBases;
- int iBand, iFrame, iBase, iCell;
- amdlibBOOLEAN bandFlag;
- amdlibDOUBLE bandPistonOPD;
- amdlibDOUBLE bandSigmaPiston;
-
- amdlibLogTrace("amdlibDisplayPiston()");
-
- /* Display number of frames */
- nbFrames = opd->nbFrames;
- printf("nbFrames = %d\n", nbFrames);
-
- /* Display number of base */
- nbBases = opd->nbBases;
- printf("nbBases = %d\n", nbBases);
-
- /* Display arrays[amdlibNB_BAND] */
- for (iBand = 0; iBand < amdlibNB_BANDS; iBand++)
- {
- /* bandFlag */
- bandFlag = opd->bandFlag[iBand];
- printf("bandFlag[%d] = %d\n", iBand, bandFlag);
- }
- /* Display different arrays[nbBand][nbFrames][nbBases] */
- for (iBand = 0; iBand < amdlibNB_BANDS; iBand++)
- {
- for (iFrame = 0; iFrame < nbFrames; iFrame++)
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- /* Set cell[iFrame][iBase] */
- iCell = iFrame * nbBases + iBase;
- printf("---> band[%d] - cell frame/base[%d][%d]\n",iBand,
- iFrame, iBase);
-
- /* pistonOPDArray */
- bandPistonOPD = opd->pistonOPDArray[iBand][iCell];
- printf("pistonOPDArray[%d][%d][%d] = %f - ", iBand, iFrame,
- iBase, bandPistonOPD);
-
- /* sigmaPistonArray */
- bandSigmaPiston = opd->sigmaPistonArray[iBand][iCell];
- printf("sigmaPistonArray[%d][%d][%d] = %f\n", iBand, iFrame,
- iBase, bandSigmaPiston);
- }
- }
- }
-}
-
-
-/**
- * Free memory allocated for pistons.
- *
- * @param piston pointer to amdlibPISTON structure.
- */
-void amdlibFreePiston(amdlibPISTON *piston)
-{
- int band;
-
- amdlibLogTrace("amdlibFreePiston()");
-
- /* Check thisPtr and do nothing if unitialized*/
- if (piston->thisPtr != piston)
- {
- return;
- }
-
- for (band=amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- if (piston->pistonOPDArray[band] != NULL)
- {
- free(piston->pistonOPDArray[band]);
- }
- piston->pistonOPDArray[band] = NULL;
- if (piston->sigmaPistonArray[band] != NULL)
- {
- free(piston->sigmaPistonArray[band]);
- }
- piston->sigmaPistonArray[band] = NULL;
- }
-
- if (piston->pistonOPD != NULL)
- {
- free(piston->pistonOPD);
- }
- piston->pistonOPD = NULL;
- if (piston->sigmaPiston != NULL)
- {
- free(piston->sigmaPiston);
- }
- piston->sigmaPiston = NULL;
-
- piston->thisPtr = NULL;
-}
-
-/*___oOo___*/
diff --git a/amber/amdlibProtected.h b/amber/amdlibProtected.h
deleted file mode 100644
index d68deab..0000000
--- a/amber/amdlibProtected.h
+++ /dev/null
@@ -1,875 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-
-#ifndef amdlibProtected_H
-#define amdlibProtected_H
-/**
- * @file
- * This file contains protected functions and structures of the AMBER data
- * reduction software; ie which can be only used inside library itself.
- */
-
-/* The following piece of code alternates the linkage type to C for all
- * functions declared within the braces, which is necessary to use the
- * functions in C++-code.
- */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Include the generated file which define amdlibVERSION using svn revision or AMDLIB_VERSION env var :
- #define amdlibVERSION "SVN_YYYYMMDD_$SVNVERSIONCODE"
-*/
-#include "amdlibVersion.h"
-
-/** System functions which are not defined on all platform */
-long int lround(double x);
-#ifndef isnan
-int isnan (double value);
-#endif
-int getopt (int argc, char * const argv[],
- const char * optstring);
-
-/** Macro to compute square; more efficient than pow() function */
-#define amdlibPow2(a) ((a)*(a))
-
-/** Constant for program debug */
-#if defined(DEBUG)
-#define amdlibDEBUG 1
-#endif
-
-/** Macro to trace global information */
-#define amdlibInfo(format, arg...) printf(format, ##arg)
-
-/** Useful max macro */
-#define amdlibMax(A,B) ((A)>(B)?(A):(B))
-/** Useful min macro */
-#define amdlibMin(A,B) ((A)<(B)?(A):(B))
-
-/** Macro for conditional memory freeing */
-#define amdlibFree(ptr) \
- if (ptr != NULL) \
- { \
- free(ptr); \
- ptr=NULL; \
- }
-/** Macro to Divide two complex values */
-#define amdlibCpxDiv(p,q,r) \
- r.re = p.re * q.re / (q.re*q.re + q.im*q.im) + \
- p.im * q.im / (q.re*q.re + q.im*q.im); \
- r.im = p.im * q.re / (q.re*q.re + q.im*q.im) - \
- p.re * q.im / (q.re*q.re + q.im*q.im);
-/** Macro to Multiply two complex values */
-#define amdlibCpxMul(p,q,r) r.re = p.re*q.re - p.im*q.im; \
- r.im = p.re*q.im + p.im*q.re;
-
-/** Values used for bad pixels in bad pixel map */
-#define amdlibBAD_PIXEL_FLAG 0
-/** Values used for good pixels in bad pixel map */
-#define amdlibGOOD_PIXEL_FLAG 1
-/** When a pixel is marked as bad, its value is set to the following
- * value when generating calibrated images.
- * Using a NAN will show the influence of any bad pixel in the process */
-/* #define amdlibBAD_PIXEL_VALUE sqrt(-1.0) */
-#define amdlibBAD_PIXEL_VALUE 0.0
-
-/** Threshold for detector saturation detection */
-#define amdlibDETECTOR_SATURATION 8000.0
-
-/** conversion nanometers to meters */
-#define amdlibNM_TO_M 1e-9
-
-/** Blanking value used in amdlib at various places
- ** WARNING: MUST BE A HUGE NEGATIVE VALUE to permit use in
- ** weighted means as in w = 1.0 / amdlibPow2(amdlibBLANKING_VALUE) */
-#define amdlibBLANKING_VALUE -1.0e10
-
-/** Precision for floating point comparison */
-#define amdlibPRECISION 1.0e-8
-
-#ifndef M_PI
-/** pi */
-#define M_PI 3.14159265358979323846
-#endif
-/** 2 pi */
-#ifndef M_2PI
-#define M_2PI 2*M_PI
-#endif
-
-/** Usefull macro to handle error when reading/writing IO-FITS file */
-#define amdlibGetFitsError(msg) \
- fits_get_errstatus(status, (char*)fitsioMsg); \
- sprintf(errMsg, "%s: %s - %s", __FILE_LINE__, msg, fitsioMsg); \
- status = 0;
-#define amdlibReturnFitsError(msg) \
- fits_get_errstatus(status, (char*)fitsioMsg); \
- sprintf(errMsg, "%s: %s - %s", __FILE_LINE__, msg, fitsioMsg); \
- status = 0; \
- return amdlibFAILURE;
-
-/** Usefull macro to set error message including file name and line number */
-#define amdlibSetErrMsg(format, arg...) \
- sprintf(errMsg, "%s: " format, __FILE_LINE__, ##arg);
-
-/**
- * Logging level
- */
-typedef enum
-{
- amdlibLOG_ERROR = -1, /**< Error messages */
- amdlibLOG_QUIET, /**< No echo */
- amdlibLOG_WARNING, /**< Abnormal events for application */
- amdlibLOG_INFO, /**< Major events (e.g when command is received).*/
- amdlibLOG_TEST, /**< Software test activities */
- amdlibLOG_TRACE /**< Use to trace subroutine calls */
-} amdlibLOG_LEVEL;
-
-/**
- * Configuration parameters for logging service
- */
-typedef struct
-{
- amdlibBOOLEAN enabled; /**< Flag indicating whether log is enabled
- or not */
- amdlibLOG_LEVEL level; /**< Lowest level of logged message */
- amdlibBOOLEAN printDate; /**< Flag indicating whether date is
- printed out or not */
- amdlibBOOLEAN printFileLine; /**< Flag indicating whether file/line
- information is printed out or not */
-} amdlibLOG_CONFIG;
-
-/* Time stamp */
-void amdlibGetTimeStamp(char timeStamp[32], unsigned int precision);
-
-/* Log handling */
-void amdlibLogSet(amdlibBOOLEAN enabled, amdlibLOG_LEVEL level,
- amdlibBOOLEAN printDateFileLine);
-amdlibBOOLEAN amdlibLogIsEnabled(void);
-amdlibLOG_LEVEL amdlibLogGetLevel(void);
-void amdlibLogPrint(amdlibLOG_LEVEL level, amdlibBOOLEAN isDetail, const char *fileLine,
- const char *format, ...);
-
-/**
- * Macro to get file name and line number
- */
-#ifndef DOXYGEN /* Code fragment ignored by Doxygen */
-#ifndef __FILE_LINE__
-#define amdlibIToStr(a) #a
-#define amdlibIToStr2(a) amdlibIToStr(a)
-#define __FILE_LINE__ __FILE__ ":" amdlibIToStr2(__LINE__)
-#endif /*!__FILE_LINE__*/
-#endif /*!DOXYGEN*/
-
-/**
- * The following convenient macros are provided for logging information. They
- * automaticaly add log level and file/line information parameters.
- *
- * Log errors. The logging level is set to amdlibLOG_ERROR.
- *
- * @sa amdlibLogPrint
- */
-#define amdlibLogError(format, arg...) \
- amdlibLogPrint(amdlibLOG_ERROR, amdlibFALSE, __FILE_LINE__, format, ##arg)
-#define amdlibLogErrorDetail(format, arg...) \
- amdlibLogPrint(amdlibLOG_ERROR, amdlibTRUE, __FILE_LINE__, format, ##arg)
-/**
- * Log information about abnormal events for application. The logging level is
- * set to amdlibLOG_WARNING.
- *
- * @sa amdlibLogPrint
- */
-#define amdlibLogWarning(format, arg...) \
- amdlibLogPrint(amdlibLOG_WARNING, amdlibFALSE, __FILE_LINE__, format, ##arg)
-#define amdlibLogWarningDetail(format, arg...) \
- amdlibLogPrint(amdlibLOG_WARNING, amdlibTRUE, __FILE_LINE__, format, ##arg)
-/**
- * Log information about major events. For example, when command is received.
- * The logging level is fixed to amdlibLOG_INFO.
- *
- * @sa amdlibLogPrint
- */
-#define amdlibLogInfo(format, arg...) \
- amdlibLogPrint(amdlibLOG_INFO, amdlibFALSE, __FILE_LINE__, format, ##arg)
-#define amdlibLogInfoDetail(format, arg...) \
- amdlibLogPrint(amdlibLOG_INFO, amdlibTRUE, __FILE_LINE__, format, ##arg)
-/**
- * Log relevant information used for the software test activities. The
- * logging level is fixed to amdlibLOG_TEST.
- *
- * @sa amdlibLogPrint
- */
-#define amdlibLogTest(format, arg...) \
- amdlibLogPrint(amdlibLOG_TEST, amdlibFALSE, __FILE_LINE__, format, ##arg)
-#define amdlibLogTestDetail(format, arg...) \
- amdlibLogPrint(amdlibLOG_TEST, amdlibTRUE, __FILE_LINE__, format, ##arg)
-/**
- * Log subroutine calls. The logging level is fixed to amdlibLOG_TRACE.
- *
- * @sa amdlibLogPrint
- */
-#define amdlibLogTrace(format, arg...) \
- amdlibLogPrint(amdlibLOG_TRACE, amdlibFALSE, __FILE_LINE__, format, ##arg)
-
-/* Error handling */
-#define amdlibERR_ALLOC_MEM "Could not allocate memory for"
-#define amdlibERR_NB_PARAM "Invalid number of parameters for"
-
-/**
- * Values not passed by normal selection Mechanism. Change in amdlibMisc
- * if number of arguments in below list is > 24.
- * Also, reflect change in Yorick/amdlibWrapper.i
- */
-typedef enum
-{
- amdlibBEAUTIFY_PISTON,
- amdlibCHISQUARE_LIMIT,
- amdlibMAX_PISTON_ERROR,
- amdlibSHIFT_WLENTABLE,
- amdlibMIN_PHOTOMETRY,
- amdlibCORRECT_OPD0,
- amdlibLINEARIZE_P2VM_PHASE,
- amdlibNORMALIZE_P2VM,
- amdlibNO_FUDGE,
- amdlibNO_BIAS,
- amdlibDROP,
- amdlibNORMALIZE_SPECTRUM,
- amdlibBOXCARSMOOTH_P2VM_PHASE,
- amdlibGAUSSSMOOTH_P2VM_PHASE,
- amdlibAUTO_BADPIXEL,
- amdlibMAX_PISTON_EXCURSION,
- amdlibGLOBAL_PHOTOMETRY,
- amdlibUSE_GAIN,
- amdlibZAP_JHK_DISCONTINUTIES,
- amdlibAUTO_SHIFT_JHK
-} amdlibUSER_PREFERENCES;
-
-/**
- * The corresponding table of values
- */
-
-typedef struct
-{
- amdlibBOOLEAN set; /* yes : was wet and is thus not default */
- amdlibDOUBLE value;
-} amdlibUSERPREF_VALUES;
-/* and the functions associated */
-amdlibUSERPREF_VALUES amdlibGetUserPref(int code);
-void amdlibSetUserPref(int code, amdlibDOUBLE value);
-void amdlibUnsetUserPref(int code);
-
-/* Miscellaneous useful functions */
-const char * amdlibGetProgramName(char * argv0);
-
-/* Function prototypes */
-unsigned char **amdlibAlloc2DArrayUnsignedChar(const int firstDim,
- const int secondDim,
- amdlibERROR_MSG errMsg);
-double **amdlibAlloc2DArrayDouble(const int firstDim,
- const int secondDim,
- amdlibERROR_MSG errMsg);
-double ***amdlibAlloc3DArrayDouble(const int firstDim,
- const int secondDim,
- const int thirdDim,
- amdlibERROR_MSG errMsg);
-float **amdlibAlloc2DArrayFloat(const int firstDim,
- const int secondDim,
- amdlibERROR_MSG errMsg);
-float ***amdlibAlloc3DArrayFloat(const int firstDim,
- const int secondDim,
- const int thirdDim,
- amdlibERROR_MSG errMsg);
-amdlibCOMPLEX **amdlibAlloc2DArrayComplex(const int firstDim,
- const int secondDim,
- amdlibERROR_MSG errMsg);
-amdlibCOMPLEX ***amdlibAlloc3DArrayComplex(const int firstDim,
- const int secondDim,
- const int thirdDim,
- amdlibERROR_MSG errMsg);
-void **amdlibWrap2DArray(void * array,
- const int firstDim,
- const int secondDim,
- const int elemSize,
- amdlibERROR_MSG errMsg);
-void ***amdlibWrap3DArray(void * array,
- const int firstDim,
- const int secondDim,
- const int thirdDim,
- const int elemSize,
- amdlibERROR_MSG errMsg);
-void ****amdlibWrap4DArray(void * array,
- const int firstDim,
- const int secondDim,
- const int thirdDim,
- const int fourthDim,
- const int elemSize,
- amdlibERROR_MSG errMsg);
-float **amdlibWrap2DArrayFloat(float * initialArray,
- const int firstDim,
- const int secondDim,
- amdlibERROR_MSG errMsg);
-float ***amdlibWrap3DArrayFloat(float * initialArray,
- const int firstDim,
- const int secondDim,
- const int thirdDim,
- amdlibERROR_MSG errMsg);
-double **amdlibWrap2DArrayDouble(double * array,
- const int firstDim,
- const int secondDim,
- amdlibERROR_MSG errMsg);
-double ***amdlibWrap3DArrayDouble(double * initialArray,
- const int firstDim,
- const int secondDim,
- const int thirdDim,
- amdlibERROR_MSG errMsg);
-double ****amdlibWrap4DArrayDouble(double * initialArray,
- const int firstDim,
- const int secondDim,
- const int thirdDim,
- const int fourthDim,
- amdlibERROR_MSG errMsg);
-unsigned char **amdlibWrap2DArrayUnsignedChar(unsigned char * initialArray,
- const int firstDim,
- const int secondDim,
- amdlibERROR_MSG errMsg);
-void amdlibFree2DArrayUnsignedChar(unsigned char **arrayToFree);
-void amdlibFree2DArrayDouble(double **arrayToFree);
-void amdlibFree3DArrayDouble(double ***arrayToFree);
-void amdlibFree2DArrayFloat(float **arrayToFree);
-void amdlibFree3DArrayFloat(float ***arrayToFree);
-void amdlibFree2DArrayComplex(amdlibCOMPLEX **arrayToFree);
-void amdlibFree3DArrayComplex(amdlibCOMPLEX ***arrayToFree);
-void amdlibFree2DArrayWrapping(void **wrappingToFree);
-void amdlibFree3DArrayWrapping(void ***wrappingToFree);
-void amdlibFree2DArrayFloatWrapping(float **wrappingToFree);
-void amdlibFree3DArrayFloatWrapping(float ***wrappingToFree);
-void amdlibFree2DArrayDoubleWrapping(double **wrappingToFree);
-void amdlibFree3DArrayDoubleWrapping(double ***wrappingToFree);
-void amdlibFree4DArrayDoubleWrapping(double ****wrappingToFree);
-void amdlibFree2DArrayUnsignedCharWrapping(unsigned char **wrappingToFree);
-
-/* Useful functions */
-void amdlibStripBlanks(char *str);
-void amdlibStripQuotes(char *str);
-char *amdlibMJD2ISODate(double mjd);
-int amdlibCompareDouble(double x, double y);
-
-/* Instrument configuration keywords */
-amdlibCOMPL_STAT amdlibAddInsCfgKeyword(amdlibINS_CFG *insCfg,
- amdlibKEYW_LINE keywLine,
- amdlibERROR_MSG errMsg);
-void amdlibRemoveInsCfgKeyword(amdlibINS_CFG *insCfg,
- amdlibKEYW_LINE keyword);
-amdlibCOMPL_STAT amdlibSetInsCfgKeyword(amdlibINS_CFG *insCfg,
- char *keywName,
- char *keywVal,
- char *keywCmt,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibGetInsCfgKeyword(amdlibINS_CFG *insCfg,
- char *keywName,
- char keywValue[amdlibKEYW_VAL_LEN+1],
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibClearInsCfg(amdlibINS_CFG *insCfg);
-
-/* Raw data */
-void amdlibInitRawData(amdlibRAW_DATA *rawData);
-amdlibCOMPL_STAT amdlibDuplicateRawData(amdlibRAW_DATA *dstRawData,
- amdlibRAW_DATA *srcRawData,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibReadWaveData(fitsfile *filePtr,
- amdlibWAVEDATA *waveData,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibReadImagingDetectorHdr
- (fitsfile *filePtr,
- amdlibIMAGING_DETECTOR *imagingDetector,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibReadImagingDataHdr
- (fitsfile *filePtr,
- amdlibIMAGING_DATA *imagingData,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibReadArrayGeometry (fitsfile *filePtr,
- amdlibOI_ARRAY *arrayGeometry,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibAllocateRegions(amdlibREGION **regions,
- int nbRegions);
-void amdlibFreeRegions(amdlibREGION **regions, int nbRegions );
-
-amdlibCOMPL_STAT amdlibReadRegionInfo (fitsfile *filePtr,
- amdlibREGION **regions,
- int nbRegions,
- int nbTel,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibReadRegionData (fitsfile *filePtr,
- amdlibREGION *regions,
- int nbRegions,
- int firstFrame,
- int nbFrames,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibWriteRegionData (fitsfile *filePtr,
- amdlibREGION *regions,
- int nbRegions,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibStoreRawData(const char *filename,
- amdlibRAW_DATA *rawData,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibCopyRawDataFile(const char *srcFilename,
- const char *dstFilename,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibSaveRawDataToFits(const char *filename,
- amdlibRAW_DATA *rawData,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibSumAndPackData(amdlibRAW_DATA *rawData,
- amdlibBOOLEAN sumX,
- amdlibBOOLEAN sumY,
- amdlibBOOLEAN sumZ,
- int channel,
- amdlibDOUBLE **result,
- amdlibDOUBLE **sigma2Result,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibComputeBandwidth(amdlibWAVEDATA *waveData);
-
-/* Bad pixels */
-amdlibBAD_PIXEL_MAP *amdlibGetBadPixelMap(void);
-amdlibDOUBLE **amdlibGetBadPixelMapRegion(int startPixelX,
- int startPixelY,
- int nbPixelX,
- int nbPixelY,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibUpdateBadPixelMap(int startPixelX,
- int startPixelY,
- int nbPixelX,
- int nbPixelY,
- amdlibDOUBLE **mask,
- amdlibERROR_MSG errMsg);
-/* Flat field */
-amdlibFLAT_FIELD_MAP *amdlibGetFlatFieldMap(void);
-amdlibDOUBLE **amdlibGetFlatFieldMapRegion(int startPixelX,
- int startPixelY,
- int nbPixelX,
- int nbPixelY,
- amdlibERROR_MSG errMsg);
-
-
-/* Science data */
-void amdlibFreeScienceData(amdlibSCIENCE_DATA *scienceData);
-
-/* Spectral calibration */
-amdlibCOMPL_STAT amdlibShift(/* INPUT */
- int nbPix,
- amdlibDOUBLE *tab_in,
- double shift,
- /* OUTPUT */
- amdlibDOUBLE *tab_out,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibComputeShift(/* INPUT */
- int nbPix,
- amdlibDOUBLE *tab1,
- amdlibDOUBLE *tab2,
- /* OUTPUT */
- double *shift,
- double *sigma2_shift,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibGetRefLowJHKSpectrumForCal
- (int bandState[amdlibNB_BANDS],
- amdlibDOUBLE refSpec[amdlibNB_SPECTRAL_CHANNELS]);
-amdlibCOMPL_STAT amdlibGetRefLowJHKSpectralDispersion
- (amdlibDOUBLE specTable[amdlibNB_SPECTRAL_CHANNELS]);
-
-/* Matrix utilities */
-amdlibDOUBLE amdlibMedian9(amdlibDOUBLE *data);
-double amdlibQuickSelectDble(double* arr, int n);
-float amdlibQuickSelectSngl(float* arr, int n);
-
-amdlibCOMPL_STAT amdlibInvertMatrix(double *matrix,
- int dim);
-void amdlibTransposeMatrix(double *matrix,
- double *tmatrix,
- int nx,
- int ny);
-amdlibCOMPL_STAT amdlibProductMatrix(double *matrix1,
- double *matrix2,
- double *matprod,
- int dim1,
- int dim2,
- int dim3);
-void amdlibComputeMatrixCov(double *x,
- double *y,
- int lambda,
- int nbWlen,
- int nbFrames,
- int nbBase,
- double *cov_xy);
-double amdlibComputeCov(double *x,
- double *y,
- int nbFrames);
-double amdlibAvgTable(int nbPix,
- double *table,
- double *sigma2);
-double amdlibRmsTable(int nbPix,
- double *table,
- double *sigma2);
-double amdlibAvgValues(int nbPix,
- double *table);
-double amdlibRmsValues(int nbPix,
- double *table);
-double amdlibSignedSqrt(double a);
-amdlibCOMPL_STAT amdlibCorrect3DVisTableFromAchromaticPiston(
- amdlibCOMPLEX ***cpxVisTable,
- amdlibCOMPLEX ***cNopTable,
- int nbFrames,
- int nbBases,
- int nbLVis,
- amdlibDOUBLE *wlen,
- amdlibDOUBLE **pst,
- amdlibERROR_MSG errMsg);
-int amdlibFindIndexOfMinimum(double *data, int N);
-double amdlibArrayDoubleMinimum(double *data, int N);
-int amdlibFindIndexOfMaximum(double *data, int N);
-double amdlibArrayDoubleMaximum(double *data, int N);
-double amdlibArrayDoubleSum(double *data, int N);
-/* Spectra */
-amdlibCOMPL_STAT amdlibAddSpectrum(amdlibSPECTRUM *dstSpectrum,
- amdlibSPECTRUM *srcSpectrum,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibWriteAmberSpectrum(fitsfile *filePtr,
- amdlibWAVELENGTH *wave,
- amdlibSPECTRUM *spc,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibReadAmberSpectrum(fitsfile *filePtr,
- int nbTels,
- amdlibSPECTRUM *spc,
- amdlibERROR_MSG errMsg);
-
-/* Visibilities */
-amdlibCOMPL_STAT amdlibAppendVis(amdlibVIS *dstVis,
- amdlibVIS *srcVis,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibInsertVis(amdlibVIS *dstVis,
- amdlibVIS *srcVis,
- int insertIndex,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibMergeVis(amdlibVIS *vis1,
- amdlibVIS *vis2,
- amdlibBOOLEAN isInverted,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibCopyVisFrom(amdlibVIS *dstVis,
- amdlibVIS *srcVis,
- int index,
- int nbOfElem,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibSplitVis(amdlibVIS *srcVis,
- amdlibVIS *dstVis,
- int *idxFirstWlen,
- int *nbWlen,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibAppendVis2 (amdlibVIS2 *dstVis2,
- amdlibVIS2 *srcVis2,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibInsertVis2 (amdlibVIS2 *dstVis2,
- amdlibVIS2 *srcVis2,
- int insertIndex,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibMergeVis2(amdlibVIS2 *vis1,
- amdlibVIS2 *vis2,
- amdlibBOOLEAN isInverted,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibCopyVis2From(amdlibVIS2 *dstVis2,
- amdlibVIS2 *srcVis2,
- int index,
- int nbOfElem,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibSplitVis2(amdlibVIS2 *srcVis2,
- amdlibVIS2 *dstVis2,
- int *idxFirstWlen,
- int *nbWlen,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibAppendVis3(amdlibVIS3 *dstVis3,
- amdlibVIS3 *srcVis3,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibInsertVis3(amdlibVIS3 *dstVis3,
- amdlibVIS3 *srcVis3,
- int insertIndex,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibMergeVis3(amdlibVIS3 *vis1,
- amdlibVIS3 *vis2,
- amdlibBOOLEAN isInverted,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibCopyVis3From(amdlibVIS3 *dstVis3,
- amdlibVIS3 *srcVis3,
- int index,
- int nbOfElem,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibSplitVis3(amdlibVIS3 *srcVis3,
- amdlibVIS3 *dstVis3,
- int *idxFirstWlen,
- int *nbWlen,
- amdlibERROR_MSG errMsg);
-
-amdlibBOOLEAN amdlibCompareWavelengths(amdlibWAVELENGTH *wave1,
- amdlibWAVELENGTH *wave2,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibMergeWavelengths(amdlibWAVELENGTH *wave1,
- amdlibWAVELENGTH *wave2,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibSplitWavelength(amdlibWAVELENGTH *srcWave,
- amdlibWAVELENGTH *dstWave,
- int *idxFirstWlen,
- int *nbWlen,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibAppendPhotometry(amdlibPHOTOMETRY *dstPhotometry,
- amdlibPHOTOMETRY *srcPhotometry,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibInsertPhotometry(amdlibPHOTOMETRY *dstPhotometry,
- amdlibPHOTOMETRY *srcPhotometry,
- int insertIndex,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibMergePhotometry(amdlibPHOTOMETRY *phot1,
- amdlibPHOTOMETRY *phot2,
- amdlibBOOLEAN isInverted,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibCopyPhotFrom(amdlibPHOTOMETRY *dstPhot,
- amdlibPHOTOMETRY *srcPhot,
- int index,
- int nbOfElem,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibSplitPhot(amdlibPHOTOMETRY *srcPhot,
- amdlibPHOTOMETRY *dstPhot,
- int *idxFirstWlen,
- int *nbWlen,
- amdlibERROR_MSG errMsg);
-
-
-amdlibCOMPL_STAT amdlibSelectFrames(amdlibVIS *vis,
- amdlibPHOTOMETRY *phot,
- amdlibPISTON *opd,
- amdlibFRAME_SELECTION frameSelectionType,
- double frameSelectionRatio,
- amdlibSELECTION *selectedFrames,
- amdlibBAND band,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibAllocateSelection(amdlibSELECTION *selection,
- int nbFrames,
- int nbBases,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibSetSelection(amdlibSELECTION *selection,
- amdlibBAND band,
- amdlibBOOLEAN isSelected);
-amdlibCOMPL_STAT amdlibUpdateSelection(amdlibSELECTION *selection);
-
-/* Pistons */
-amdlibCOMPL_STAT amdlibAppendPiston(amdlibPISTON *dstOpd,
- amdlibPISTON *srcOpd,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibInsertPiston(amdlibPISTON *dstOpd,
- amdlibPISTON *srcOpd,
- int insertIndex,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibMergePiston(amdlibPISTON *opd1,
- amdlibPISTON *opd2,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibComputePiston(amdlibVIS *instantCorrFlux,
- amdlibBAND band,
- amdlibWAVELENGTH *wave,
- amdlibPISTON *instantOpd,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibBinPiston(amdlibPISTON *instantOpd,
- amdlibBAND band,
- int firstFrame,
- int nbFrames,
- int iBin,
- amdlibPISTON *opd);
-amdlibCOMPL_STAT amdlibMeanPiston(amdlibPISTON *instantOpd,
- amdlibBAND band,
- int iBin,
- amdlibSELECTION *selectedFrames,
- amdlibPISTON *opd);
-amdlibCOMPL_STAT amdlibSplitPiston(amdlibPISTON *srcOpd,
- amdlibPISTON *dstOpd,
- int *nbWlen,
- amdlibERROR_MSG errMsg);
-
-/* Closure phases */
-amdlibCOMPL_STAT amdlibComputeClosurePhases(/* Input */
- amdlibVIS *instantCorrFlux,
- int iBin,
- amdlibBAND band,
- amdlibSELECTION *selectedFrames,
- amdlibERROR_TYPE errorType,
- /* Output */
- amdlibVIS3 *vis3,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibBinClosurePhases(/* Input */
- amdlibVIS *instantCorrFlux,
- int firstFrame,
- int nbFrames,
- int iBin,
- amdlibBAND band,
- amdlibERROR_TYPE errorType,
- /* Output */
- amdlibVIS3 *vis3,
- amdlibERROR_MSG errMsg);
-void amdlibAverageClosurePhases(amdlibVIS3 *vis3);
-
-
-/* Instrument configuration */
-amdlibCOMPL_STAT amdlibCheckInsConfig(/* Input */
- amdlibSCIENCE_DATA *data,
- amdlibP2VM_MATRIX *mv2p,
- amdlibBOOLEAN noCheckP2vmId,
- /* Output */
- amdlibERROR_MSG errMsg);
-/* OI-FITS */
-amdlibCOMPL_STAT amdlibFillInVisTableHeader(/* Input */
- amdlibSCIENCE_DATA *data,
- /* Output */
- amdlibVIS *vis,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibFillInVis2TableHeader(/* Input */
- amdlibSCIENCE_DATA *data,
- /* Output */
- amdlibVIS2 *vis2,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibFillInVis3TableHeader(/* Input */
- amdlibSCIENCE_DATA *data,
- /* Output */
- amdlibVIS3 *vis3,
- amdlibERROR_MSG errMsg);
-
-/* High level functions */
-amdlibCOMPL_STAT amdlibGenerateCalImage(const char *badPixelFile,
- const char *flatFieldFile,
- const char *darkFile,
- const char *inputFile,
- const char *outputFile);
-amdlibCOMPL_STAT amdlibBtbl2Fits(const char *inputFile,
- const char *outputFile);
-
-amdlibCOMPL_STAT amdlibComputeP2vm2T(const char *badPixelFile,
- const char *flatFieldFile,
- const char *darkFile,
- const char *inputFile1,
- const char *inputFile2,
- const char *inputFile3,
- const char *inputFile4,
- const char *p2vmFile,
- amdlibDOUBLE *newSpectralOffsets,
- const amdlibBOOLEAN verbose);
-
-amdlibCOMPL_STAT amdlibComputeP2vm3T(const char *badPixelFile,
- const char *flatFieldFile,
- const char *darkFile,
- const char *inputFile1,
- const char *inputFile2,
- const char *inputFile3,
- const char *inputFile4,
- const char *inputFile5,
- const char *inputFile6,
- const char *inputFile7,
- const char *inputFile8,
- const char *inputFile9,
- const char *p2vmFile,
- amdlibDOUBLE *newSpectralOffsets,
- const amdlibBOOLEAN verbose);
-amdlibCOMPL_STAT amdlibComputeSpectralCalibration2T(const char *badPixelFile,
- const char *flatFieldFile,
- const char *darkFile,
- const char *inputFile1,
- const char *inputFile2,
- amdlibDOUBLE spectralOffsets[]);
-amdlibCOMPL_STAT amdlibComputeSpectralCalibration3T(const char *badPixelFile,
- const char *flatFieldFile,
- const char *darkFile,
- const char *inputFile1,
- const char *inputFile2,
- const char *inputFile3,
- amdlibDOUBLE spectralOffsets[]);
-amdlibCOMPL_STAT amdlibComputeOiData(const char *badPixelFile,
- const char *flatFieldFile,
- const char *p2vmFile,
- const char *darkFile,
- const char *inputFile,
- const char *outputFile,
- const int nbBinning,
- const amdlibERROR_TYPE errorType,
- const amdlibPISTON_ALGORITHM pistonType,
- const amdlibBOOLEAN noCheckP2vmId,
- amdlibBOOLEAN mergeOutputFiles,
- const amdlibFRAME_SELECTION selectionType,
- const double selectionRatio,
- const amdlibBAND bands);
-amdlibCOMPL_STAT amdlibPerformSelection(const char *inputFile,
- const char *inputSelFileName,
- const char *outputFile,
- const char *outputSelFileName,
- const amdlibFRAME_SELECTION selectionType,
- const double selectionRatio,
- const amdlibBOOLEAN useSelFile,
- const amdlibBOOLEAN saveSelFile,
- const amdlibBOOLEAN averageData);
-amdlibCOMPL_STAT amdlibMergeP2vmFromFiles(const int nbFiles,
- const char **p2vmFile,
- const char *outputFile);
-amdlibCOMPL_STAT amdlibAppendOiFitsFiles(const int nbFiles,
- const char **oiFitsFile,
- const char *outputFile);
-
-amdlibCOMPL_STAT amdlibMergeOiStructures(amdlibWAVELENGTH *wave,
- amdlibWAVELENGTH *imdWave,
- amdlibPHOTOMETRY *photometry,
- amdlibPHOTOMETRY *imdPhot,
- amdlibVIS *vis,
- amdlibVIS *imdVis,
- amdlibVIS2 *vis2,
- amdlibVIS2 *imdVis2,
- amdlibVIS3 *vis3,
- amdlibVIS3 *imdVis3,
- amdlibPISTON *opd,
- amdlibPISTON *imdOpd,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibSplitOiStructures(amdlibWAVELENGTH *wave,
- amdlibWAVELENGTH *imdWave,
- amdlibPHOTOMETRY *phot,
- amdlibPHOTOMETRY *imdPhot,
- amdlibVIS *vis,
- amdlibVIS *imdVis,
- amdlibVIS2 *vis2,
- amdlibVIS2 *imdVis2,
- amdlibVIS3 *vis3,
- amdlibVIS3 *imdVis3,
- amdlibPISTON *opd,
- amdlibPISTON *imdOpd,
- amdlibERROR_MSG errMsg);
-
-void amdlibDisplayP2vm(amdlibP2VM_MATRIX *p2vm);
-
-void amdlibDisplayScienceData(amdlibSCIENCE_DATA *scienceData);
-
-void amdlibDisplayWavelength(amdlibWAVELENGTH *wavelength);
-
-void amdlibDisplayPhotometry(amdlibPHOTOMETRY *photometry);
-
-void amdlibDisplayVis(amdlibVIS *vis);
-
-void amdlibDisplayVis2(amdlibVIS2 *vis2);
-
-void amdlibDisplayVis3(amdlibVIS3 *vis3);
-
-void amdlibDisplayPiston(amdlibPISTON *opd);
-
-void amdlibGaussSmooth(int n, double *y, double w);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*!amdlibProtected_H*/
diff --git a/amber/amdlibRawData.c b/amber/amdlibRawData.c
deleted file mode 100644
index 34561f3..0000000
--- a/amber/amdlibRawData.c
+++ /dev/null
@@ -1,2295 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Functions to handle raw data.
- *
- * The raw data is the data produced by the instrument during an exposure. This
- * data is stored as binary tables in a FIT file.
- */
-#define _POSIX_SOURCE 1
-#define amdlibREMANENCE 0.00
-
-/*
- * System Headers
- */
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include "fitsio.h"
-#include <time.h>
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/* List of keywords corresponding to instrument configuration */
-static char *amdlibRequiredInsCfgKeywList[] =
-{
- "HIERARCH ESO INS GRAT1 NAME",
- "HIERARCH ESO INS GRAT1 ORDER",
- "HIERARCH ESO INS GRAT1 WLEN",
- "HIERARCH ESO INS GRIS1 NAME",
- "HIERARCH ESO INS GRIS2 NAME",
- "HIERARCH ESO INS OPTI2 NAME",
- "HIERARCH ESO INS OPTI5 NAME",
- "HIERARCH ESO INS OPTI6 NAME",
- "HIERARCH ESO INS OPTI7 NAME",
- NULL
-};
-
-/*
- * Local functions
- */
-static amdlibCOMPL_STAT amdlibReadTimeTag (fitsfile *filePtr,
- amdlibRAW_DATA *rawData,
- int firstFrame,
- int nbFrames,
- amdlibERROR_MSG errMsg);
-static amdlibCOMPL_STAT amdlibWriteTimeTag (fitsfile *filePtr,
- amdlibRAW_DATA *rawData,
- amdlibERROR_MSG errMsg);
-static void amdlibFreeRawData(amdlibRAW_DATA *rawData);
-static amdlibFRAME_TYPE amdlibFrameTypeStr2Id(char *frameTypeStr);
-static amdlibCOMPL_STAT amdlibCheckDataCompatibility(
- amdlibDARK_DATA *dark,
- amdlibRAW_DATA *rawData,
- amdlibERROR_MSG errMsg);
-static amdlibCOMPL_STAT amdlibDiscardNullFrames(amdlibRAW_DATA *rawData,
- amdlibERROR_MSG errMsg);
-static amdlibCOMPL_STAT amdlibSubstractDark(amdlibDARK_DATA *dark,
- amdlibRAW_DATA *rawData,
- amdlibERROR_MSG errMsg);
-static amdlibCOMPL_STAT amdlibCalibrateImage(amdlibRAW_DATA *rawData,
- int iFrame,
- amdlibERROR_MSG errMsg);
-static amdlibCOMPL_STAT amdlibSubstractRemanence(amdlibRAW_DATA *rawData,
- amdlibERROR_MSG errMsg);
-/*
- * Public functions
- */
-/**
- * Load all frames from raw data file.
- *
- * This function loads the raw data file and updates all the raw data structures
- * accordingly. This concerns information related to:
- * \li the instrument configuration
- * \li the spectral channel data
- * \li the imaging detector
- * \li the imaging data
- * \li the region data
- * \li the variance data
- *
- * @param filename name of the FITS file containing raw data.
- * @param rawData structure where loaded information will be stored
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibLoadRawData(const char *filename,
- amdlibRAW_DATA *rawData,
- amdlibERROR_MSG errMsg)
-{
- amdlibLogTrace("amdlibLoadRawData()");
-
- return (amdlibLoadRawFrames(filename, rawData, amdlibFIRST_FRAME,
- amdlibALL_FRAMES, errMsg));
-}
-
-/**
- *
- * This function loads, as amdlibLoadRawData() function does, the raw data file,
- * but it does not allocated memory to store region data and, of course, does
- * not them. This function is usefull to get information such the number of
- * frames, the number of region or the frame type without loading all the file.
- *
- * @param filename name of the FITS file containing raw data.
- * @param rawData structure where raw data header information will be stored
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibLoadRawDataHdr(const char *filename,
- amdlibRAW_DATA *rawData,
- amdlibERROR_MSG errMsg)
-{
- struct stat statBuf;
- char fitsioMsg[256];
- fitsfile *filePtr;
- int status = 0;
- char keywName[64];
- int i;
- double dit;
- int keysExist = 0;
- int moreKeys = 0;
- amdlibKEYW_LINE record;
-
- amdlibLogTrace("amdlibLoadRawDataHdr()");
-
- /* If raw data structure is not initailized, do it */
- if (rawData->thisPtr != rawData)
- {
- amdlibInitRawData(rawData);
- }
-
- /* First free previous allocated memory */
- amdlibFreeRawData(rawData);
-
- /* Check the file exists */
- if (stat(filename, &statBuf) != 0)
- {
- amdlibSetErrMsg("File '%.80s' does not exist", filename);
- return amdlibFAILURE;
- }
-
- /* Open FITS file */
- if (fits_open_file(&filePtr, filename, READONLY, &status) != 0)
- {
- amdlibReturnFitsError(filename);
- }
-
- /* True if FITS file only contains detector data; i.e. does not contains
- * ICS sub-system nor wave data binary table*/
- rawData->detDataOnly = amdlibTRUE;
-
- /* Main header : get all keywords */
-
- /* Get the number of keywords in HDU */
- keysExist=0;
- moreKeys=0;
- if (fits_get_hdrspace(filePtr, &keysExist, &moreKeys,
- &status) != 0)
- {
- status = 0;
- }
-
- /* For each keyword */
- amdlibClearInsCfg(&rawData->insCfg);
- for (i = 1; i <= keysExist; i++)
- {
- /* Read keyword line i */
- if (fits_read_record(filePtr, i, record, &status) != 0)
- {
- status = 0;
- }
- else
- {
- /* If it is not a simple comment */
- if (strstr(record, "COMMENT ") == NULL)
- {
- /* Store keyword */
- if (amdlibAddInsCfgKeyword(&rawData->insCfg,
- record, errMsg) == amdlibFAILURE)
- {
- return amdlibFAILURE;
- }
- }
-
- /* If there is at least one instrument keyword, it is assumed that
- * ICS keywords have been merged to FITS header */
- if (strstr(record, "HIERARCH ESO INS") != NULL)
- {
- rawData->detDataOnly = amdlibFALSE;
- }
- }
- }
-
- /* Check the mandatory keywords are defined in header */
- if (rawData->detDataOnly == amdlibFALSE)
- {
- i = 0;
- while (amdlibRequiredInsCfgKeywList[i] != 0)
- {
- amdlibKEYWORD keyword;
- strcpy(keyword.name, amdlibRequiredInsCfgKeywList[i]);
- if (fits_read_key (filePtr, TSTRING, (char*)keyword.name,
- keyword.value, NULL, &status) != 0)
- {
- amdlibGetFitsError(amdlibRequiredInsCfgKeywList[i])
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- i++;
- }
- }
-
- /* Main header : get P2VM id */
- strcpy (keywName, "HIERARCH ESO OCS P2VM ID");
- if (fits_read_key (filePtr, TINT, keywName, &rawData->p2vmId,
- NULL, &status) != 0)
- {
- /* No reference to P2VM */
- rawData->p2vmId = 0;
- status = 0;
- }
-
- /* Main header : get DIT */
- sprintf (keywName, "HIERARCH ESO DET DIT");
- if (fits_read_key (filePtr, TDOUBLE, (char*)keywName,
- &dit, NULL, &status) != 0)
- {
- dit = 0.0;
- status = 0;
- }
- rawData->expTime = dit;
-
- /* Determine the frame type */
- if (rawData->detDataOnly == amdlibFALSE)
- {
- /* Main header : get frame type */
- char frameTypeStr[64];
- strcpy (keywName, "HIERARCH ESO OCS DET FRAM TYPE");
- memset (frameTypeStr, '\0', sizeof(frameTypeStr));
- if (fits_read_key (filePtr, TSTRING, keywName, frameTypeStr,
- NULL, &status) != 0)
- {
- status = 0;
- }
-
- /* If OCS.DET.FRAM.TYPE keyword is specified, use it */
- if (strlen(frameTypeStr) != 0)
- {
- rawData->frameType = amdlibFrameTypeStr2Id(frameTypeStr);
- }
- else
- {
- /* Patch missing SKY type in OCS.DET.FRAM.TYPE. look DPR.TYPE instead */
- strcpy (keywName, "HIERARCH ESO DPR TYPE");
- if (fits_read_key (filePtr, TSTRING, keywName, frameTypeStr,
- NULL, &status) != 0)
- {
- status = 0;
- }
- if (strlen(frameTypeStr) != 0)
- {
- if (strcmp(frameTypeStr, "SKY") == 0)
- {
- rawData->frameType = amdlibSKY_FRAME;
- }
- }
- else
- {
- amdlibSetErrMsg("Obsolete input data - "
- "no frame type specified in '%.80s'", filename);
- rawData->frameType = amdlibUNKNOWN_FRAME;
- }
- }
- }
- else
- {
- rawData->frameType = amdlibUNKNOWN_FRAME;
- }
-
- /* Read 'AMBER wave data' */
- if (rawData->detDataOnly == amdlibFALSE)
- {
- if (amdlibReadWaveData(filePtr,
- &rawData->waveData, errMsg) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
- else
- {
- memset(&rawData->waveData, '\0', sizeof(amdlibWAVEDATA));
- }
-
- /* Read 'imaging detector header' */
- if (amdlibReadImagingDetectorHdr(filePtr, &rawData->imagingDetector,
- errMsg) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- /* Set the number of spectral rows and column according to
- * the number of regions
- */
- rawData->nbRegions = rawData->imagingDetector.nbRegions;
- switch(rawData->nbRegions)
- {
- case 1:
- rawData->nbRows=1;
- rawData->nbCols=1;
- break;
- case 4:
- rawData->nbRows=1;
- rawData->nbCols=4;
- break;
- case 8:
- rawData->nbRows=2;
- rawData->nbCols=4;
- break;
- case 12:
- rawData->nbRows=3;
- rawData->nbCols=4;
- break;
- case 5:
- rawData->nbRows=1;
- rawData->nbCols=5;
- break;
- case 10:
- rawData->nbRows=2;
- rawData->nbCols=5;
- break;
- case 15:
- rawData->nbRows=3;
- rawData->nbCols=5;
- break;
- default:
- fits_close_file(filePtr, &status);
- amdlibSetErrMsg("Inconsistent number of regions '%d' ",
- rawData->nbRegions);
- return amdlibFAILURE;
-
- }
-
- /* Read 'region informations' in imaging detector table */
- if (amdlibReadRegionInfo(filePtr, &rawData->region, rawData->nbRegions,
- rawData->imagingDetector.maxTel,
- errMsg) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- /* Read 'imaging data header' */
- if (amdlibReadImagingDataHdr(filePtr, &rawData->imagingData,
- errMsg) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- /* Set the number of frames */
- rawData->nbFrames = rawData->region[0].dimAxis[2];
-
- /* Data is not yet loaded, and there is not calibrated */
- rawData->dataLoaded = amdlibFALSE;
- rawData->dataCalibrated = amdlibFALSE;
-
- /* Close the FITS file */
- if (fits_close_file(filePtr, &status) != 0)
- {
- amdlibReturnFitsError(filename);
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Load N frames from raw data file.
- *
- * This function loads, as amdlibLoadRawData() function does, the raw data file,
- * but only the requested frames. The amdlibFIRST_FRAME macro can be used to
- * specify the first frame of the files, as well as the amdlibALL_FRAMES macro
- * to specify all remaining frames from the first specified frame to the last
- * one of the file.
- *
- * @param filename name of the FITS file containing raw data.
- * @param rawData structure where loaded information will be stored
- * @param firstFrame index of the first frame to load
- * @param nbFrames number of frames to load
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibLoadRawFrames(const char *filename,
- amdlibRAW_DATA *rawData,
- int firstFrame,
- int nbFrames,
- amdlibERROR_MSG errMsg)
-{
- char fitsioMsg[256];
- fitsfile *filePtr;
- int status = 0;
- int i;
-
- amdlibLogTrace("amdlibLoadRawFrames()");
-
- /* First load header of raw file */
- if (amdlibLoadRawDataHdr(filename, rawData, errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- /* Re-open FITS file */
- if (fits_open_file(&filePtr, filename, READONLY, &status) != 0)
- {
- amdlibReturnFitsError(filename);
- }
-
- /* Check if all frames have to be read */
- if (nbFrames == amdlibALL_FRAMES)
- {
- nbFrames = rawData->nbFrames - firstFrame + 1;
- }
-
- /* Read 'region data' in imaging data table */
- if (amdlibReadRegionData(filePtr, rawData->region,
- rawData->nbRegions,
- firstFrame, nbFrames,
- errMsg) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- /* Set the number of frames */
- rawData->nbFrames = nbFrames;
-
- /* Read 'array geometry' */
- if (amdlibReadArrayGeometry(filePtr, &rawData->arrayGeometry,
- errMsg) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- /* Read 'time data' in imaging data table */
- if (amdlibReadTimeTag(filePtr, rawData,
- firstFrame, nbFrames,
- errMsg) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- /* Data is now loaded, but not yet calibrated */
- rawData->dataLoaded = amdlibTRUE;
- rawData->dataCalibrated = amdlibFALSE;
-
- /* Close the FITS file */
- if (fits_close_file(filePtr, &status) != 0)
- {
- amdlibReturnFitsError(filename);
- }
-
- if (amdlibAllocateRegions(&rawData->variance,
- rawData->nbRegions) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for variance map");
- return amdlibFAILURE;
- }
- /* Copy all region information */
- for (i = 0; i < rawData->nbRegions; i++)
- {
- int regionSize;
- /* Copy region information to variance */
- memcpy(&rawData->variance[i], &rawData->region[i],
- sizeof(amdlibREGION));
- /* Allocate memory for variance */
- regionSize = rawData->region[i].dimAxis[0] *
- rawData->region[i].dimAxis[1] *
- rawData->region[i].dimAxis[2];
- rawData->variance[i].data = calloc(regionSize, sizeof(*(rawData->variance[i].data)));
- if (rawData->variance[i].data == NULL)
- {
- amdlibSetErrMsg("Could not allocate memory for data of variance #%d",
- i);
- return amdlibFAILURE;
- }
- }
-
-
- return amdlibSUCCESS;
-}
-
-/**
- * Release memory allocated to store raw data and reset the structure members to
- * zero.
- *
- * @param rawData structure where raw data is stored
- */
-void amdlibReleaseRawData(amdlibRAW_DATA *rawData)
-{
- amdlibLogTrace("amdlibReleaseRawData()");
-
- amdlibFreeRawData(rawData);
- memset (rawData, '\0', sizeof(amdlibRAW_DATA));
-}
-
-#define amdlibSTART_MASK_COL 5
-/**
- * Calculate and remove the global bias, deduced from the masked pixels.
- * The bias varies with time, and is especially high after a time when the camera
- * is idle. Normally the AMBER camera should be ALWAYS acquiring frames.
- * It can be estimated grossly as the median value of the
- * masked pixels, until a real bias measurement is provided.
- * The bias being due (mostly) to the temperature drift of the on-chip converters,
- * is dependent on the pixels's position.
- *
- * This function should normally not be used, if the bias does not change between the
- * dark and the observation, because the dark's rms is the sum of the dark photon noise
- * plus readout noise. Substracting dark and adding this dark noise to the sigma2 is all
- * we need. However, the bias is changing very rapidly in the first 20 or 50 frames at
- * the time of writing. So perhaps estimating the bias frame by frame
- * and removing does a good job in the case where there are less than, say, 50 frames.
- *
- * @param rawData raw data.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibRemoveGlobalBias(
- amdlibRAW_DATA *rawData,
- amdlibERROR_MSG errMsg)
-{
- amdlibDOUBLE globalBias;
- int iRow, iCol;
- int iFrame;
- int iRegion,darkRegion, darkRegionSize;
- int regionHeight, regionWidth, regionSize;
- int iX, iY;
- int nbGoodPixels;
- amdlibDOUBLE* work;
- double rms;
- amdlibDOUBLE **rawPtr, **variancePtr;
- amdlibDOUBLE **badPixels;
-
- amdlibLogTrace("amdlibRemoveGlobalBias()");
-
- for (iRow = 0; iRow < rawData->nbRows; iRow++)
- {
- /* Take first region of each row corresponding to the shielded area */
- darkRegion = iRow * rawData->nbCols;
- darkRegionSize = rawData->region[darkRegion].dimAxis[0] *
- rawData->region[darkRegion].dimAxis[1];
- /* Take the part of the bad pixel map corresponding to the current
- * region */
- badPixels = amdlibGetBadPixelMapRegion(
- rawData->region[darkRegion].corner[0] - 1,
- rawData->region[darkRegion].corner[1] - 1,
- rawData->region[darkRegion].dimAxis[0],
- rawData->region[darkRegion].dimAxis[1],
- errMsg);
- if (badPixels == NULL)
- {
- return amdlibFAILURE;
- }
-
- for (iFrame = 0; iFrame < rawData->region[darkRegion].dimAxis[2]; iFrame++)
- {
- rawPtr = amdlibWrap2DArrayDouble
- (&rawData->region[darkRegion].data[darkRegionSize*iFrame],
- rawData->region[darkRegion].dimAxis[0],
- rawData->region[darkRegion].dimAxis[1],
- errMsg);
- if (rawPtr == NULL)
- {
- return amdlibFAILURE;
- }
- /*initialise number of good pixels*/
- nbGoodPixels = 0;
- /* allocate the work area */
- work=calloc(darkRegionSize,sizeof(double));
-
- /* copy the valid pixels (not bad, not in the amdlibSTART_MASK_COL first pixels)
- in a work array to evaluate the global bias */
- for (iY = 0; iY < rawData->region[darkRegion].dimAxis[1]; iY++)
- {
- /* Skip the first amdlibSTART_MASK_COL pixels of each line. These
- * pixels are too noisy, and are not significant when computing
- * bias.
- */
- /* skip START_MASK_COL pixels */
- for (iX = amdlibSTART_MASK_COL ;
- iX < rawData->region[darkRegion].dimAxis[0];
- iX++)
- {
- if ((badPixels[iY][iX] == amdlibGOOD_PIXEL_FLAG))
- {
- work[nbGoodPixels++] = rawPtr[iY][iX];
- }
- }
- }
- /* evaluate bias in some fashion... */
-/* globalBias = amdlibQuickSelectDble(work,nbGoodPixels); */
- globalBias = amdlibAvgValues(nbGoodPixels,work);
- /* evaluate grossly detector noise, to be set in the "noise" section, in case
- * there is no dark measurement to get a pixel-by-pixel value. Noise is estimated
- * on the masked area as the bias */
- rms = amdlibRmsValues(nbGoodPixels,work);
- free(work);
- amdlibFree2DArrayDoubleWrapping(rawPtr);
- /* substract this value directly from ALL REGIONS of same Row of Raw data.
- No use to remap bad pixels here */
- for (iCol = 0; iCol < rawData->nbCols; iCol++)
- {
- iRegion = iRow * rawData->nbCols + iCol;
- regionWidth = rawData->region[iRegion].dimAxis[0];
- regionHeight = rawData->region[iRegion].dimAxis[1];
- regionSize = regionWidth * regionHeight;
- rawPtr = amdlibWrap2DArrayDouble(
- &rawData->region[iRegion].data[regionSize*iFrame],
- rawData->region[iRegion].dimAxis[0],
- rawData->region[iRegion].dimAxis[1],
- errMsg);
- if (rawPtr == NULL)
- {
- amdlibFree2DArrayDouble(badPixels);
- return amdlibFAILURE;
- }
- variancePtr = amdlibWrap2DArrayDouble(
- &rawData->variance[iRegion].data[regionSize*iFrame],
- rawData->variance[iRegion].dimAxis[0],
- rawData->variance[iRegion].dimAxis[1],
- errMsg);
- if (variancePtr == NULL)
- {
- amdlibFree2DArrayDouble(badPixels);
- amdlibFree2DArrayDoubleWrapping(rawPtr);
- return amdlibFAILURE;
- }
- for (iY = 0; iY < regionHeight; iY++)
- {
- for (iX = 0; iX < regionWidth; iX++)
- {
- /* remove offset */
- rawPtr[iY][iX] -= globalBias;
- /* store estimated sigma2det in variance */
- variancePtr[iY][iX] = rms*rms;
- }
- }
- amdlibFree2DArrayDoubleWrapping(rawPtr);
- amdlibFree2DArrayDoubleWrapping(variancePtr);
- }
- }
- amdlibFree2DArrayDouble(badPixels);
- }
- return amdlibSUCCESS;
-}
-
-
-/**
- * Calibrate raw data; i.e. compensate for detector effect
- *
- * This function applies cosmetic corrections on raw data produced by the AMBER
- * instrument. This consists for each pixel to :
- * \li discard null frames
- * \li substract the dark (compensation for detector effects),
- * \li divide the result by flat field,
- * \li multiply the result by the gain to get photoelectron counts,
- * \li substract remanence.
- *
- * @param dark to be substracted to raw data
- * @param rawData structure where raw data is stored
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned. */
-amdlibCOMPL_STAT amdlibCalibrateRawData(amdlibDARK_DATA *dark,
- amdlibRAW_DATA *rawData,
- amdlibERROR_MSG errMsg)
-{
- int iFrame;
- int iRow, iCol, iRegion;
-
- amdlibLogTrace("amdlibCalibrateRawData()");
-
- /* Check raw data structure contains data */
- if (rawData->dataLoaded == amdlibFALSE)
- {
- amdlibSetErrMsg("The raw data structure does not "
- "contain data. Check call to amdlibLoadRawData()");
- return amdlibFAILURE;
- }
-
- /* Check raw data has been already calibrated */
- if (rawData->dataCalibrated == amdlibTRUE)
- {
- amdlibSetErrMsg("The data has been already calibrated");
- return amdlibFAILURE;
- }
-
- /* Check compatibity of raw data and dark map */
- if (amdlibCheckDataCompatibility(dark, rawData,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- /* Fix eventual start pix 0 to 1 in region header */
- for (iRow = 0; iRow < rawData->nbRows; iRow++)
- {
- for (iCol = 0; iCol < rawData->nbCols; iCol++)
- {
- iRegion = iRow * rawData->nbCols + iCol;
-
- if (rawData->region[iRegion].corner[0] == 0)
- {
- rawData->region[iRegion].corner[0] = 1;
- }
- if (rawData->region[iRegion].corner[1] == 0)
- {
- rawData->region[iRegion].corner[1] = 1;
- }
- if (rawData->variance[iRegion].corner[0] == 0)
- {
- rawData->variance[iRegion].corner[0] = 1;
- }
- if (rawData->variance[iRegion].corner[1] == 0)
- {
- rawData->variance[iRegion].corner[1] = 1;
- }
- }
- }
-
- /* Check for NULL Frames, discard iFFskip first frames */
- if (amdlibDiscardNullFrames(rawData, errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
-/* pixel bias does not exist yet. Here is where it should be removed: */
-/* /\* Subtract Pixel Bias Map directly on raw data *\/ */
-/* if (amdlibSubtractPixelBias(pixelBias, rawData, errMsg) != amdlibSUCCESS) */
-/* { */
-/* return amdlibFAILURE; */
-/* } */
-
-
- /* Calculate and Remove Global Bias (until we have cold shutter
- * bias maps) Additionnally this writes an estimate of the image
- * variance in the rawdata->variance section, (in ADU^2) which is
- * to be replaced by the more correct value given by the dark when
- * or if a dark is used. */
-
- if (!(amdlibGetUserPref(amdlibNO_BIAS).set==amdlibTRUE))
- {
- if (amdlibRemoveGlobalBias(rawData, errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- }
-
- /* Substract Dark Map . Dark is in ADU, removed before converting to e*/
- if (dark!=NULL)
- {
- if (amdlibSubstractDark(dark, rawData, errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- }
-
- /* For each frame */
- for (iFrame = 0; iFrame < rawData->region[0].dimAxis[2]; iFrame++)
- {
- /* Calculate the calibrated image */
- if (amdlibCalibrateImage(rawData, iFrame, errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- }
-
- /* Substract remanence */
- if (amdlibREMANENCE != 0)
- {
- if (amdlibSubstractRemanence(rawData, errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- }
-
- /* Set 'calibrated' flag to TRUE */
- rawData->dataCalibrated = amdlibTRUE;
-
- return amdlibSUCCESS;
-}
-
-
-/**
- * Check whether detector configurations for both raw data are the same or not.
- *
- * This function returns true if the detector configurations (number of rows and
- * columns, and dimensions of each region) corresponding to the raw data are the
- * same. Otherwise, it returns false.
- *
- * @param rawData1 raw data containing first detector configuration
- * @param rawData2 raw data containing second detector configuration
- *
- * @return
- * true (amdlibTRUE) if configurations are the same, and false (amdlibFALSE)
- * otherwise.
- */
-amdlibBOOLEAN amdlibIsSameDetCfg(amdlibRAW_DATA *rawData1,
- amdlibRAW_DATA *rawData2)
-{
- amdlibBOOLEAN sameDetCfg;
- int iRow, iCol;
- int iRegion;
-
- amdlibLogTrace("amdlibIsSameDetCfg()");
-
- /* If raw data structure is not initailized, return FALSE */
- if (rawData1->thisPtr != rawData1)
- {
- return amdlibFALSE;
- }
- if (rawData2->thisPtr != rawData2)
- {
- return amdlibFALSE;
- }
-
- /* Compare the detector configurations */
- sameDetCfg = amdlibTRUE;
- if ((rawData1->nbRows != rawData2->nbRows) ||
- (rawData1->nbCols != rawData2->nbCols))
- {
- sameDetCfg = amdlibFALSE;
- }
- else
- {
- for (iRow=0; iRow < rawData1->nbRows ; iRow++)
- {
- for (iCol = 0; iCol < rawData1->nbCols; iCol++)
- {
- iRegion = iRow * rawData1->nbCols + iCol;
- if ((rawData1->region[iRegion].corner[0] !=
- rawData2->region[iRegion].corner[0]) ||
- (rawData1->region[iRegion].corner[1] !=
- rawData2->region[iRegion].corner[1]) ||
- (rawData1->region[iRegion].dimAxis[0] !=
- rawData2->region[iRegion].dimAxis[0]) ||
- (rawData1->region[iRegion].dimAxis[1] !=
- rawData2->region[iRegion].dimAxis[1]))
- {
- sameDetCfg = amdlibFALSE;
- }
- }
- }
- }
- return sameDetCfg;
-}
-
-/*
- * Protected functions
- */
-/**
- * Initialize raw data structure.
- *
- * @param rawData pointer to raw data structure
- */
-void amdlibInitRawData(amdlibRAW_DATA *rawData)
-{
- amdlibLogTrace("amdlibInitRawData()");
-
- /* Initialize data structure */
- memset (rawData, '\0', sizeof(amdlibRAW_DATA));
- rawData->thisPtr = rawData;
-}
-
-/**
- * Copy the source file into the destination file. This version
- * permits to copy from a fits to a fits.gz and vice-versa.
- *
- * @param srcFilename name of the source file.
- * @param dstFilename name of the destination file.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibCopyRawDataFile(const char *srcFilename,
- const char *dstFilename,
- amdlibERROR_MSG errMsg)
-{
- char fitsioMsg[256];
- fitsfile *srcPtr,*dstPtr;
- int status = 0;
- char *dst;
- dst=calloc(strlen(dstFilename)+2,sizeof(char));
-
- amdlibLogTrace("amdlibCopyRawDataFile()");
- /* Open FITS file */
- if (fits_open_file(&srcPtr, srcFilename, READONLY, &status) != 0)
- {
- amdlibReturnFitsError(srcFilename);
- }
- /*Prefix dstFilename with a ! to overwrite it*/
- sprintf(dst,"!%s",dstFilename);
- if (fits_create_file(&dstPtr, dst, &status) != 0)
- {
- amdlibReturnFitsError(dstFilename);
- }
-
- if (fits_copy_file(srcPtr, dstPtr, (int)1, (int)1,(int)1, &status) != 0)
- {
- amdlibSetErrMsg("Unable to copy Raw data file");
- return amdlibFAILURE;
- }
- /* Write & Close the FITS files */
- if (fits_close_file(srcPtr, &status) != 0)
- {
- amdlibReturnFitsError(srcFilename);
- }
- if (fits_close_file(dstPtr, &status) != 0)
- {
- amdlibReturnFitsError(dstFilename);
- }
- return amdlibSUCCESS;
-
-}
-
-/**
- * Store/Replace the detector data in the given file.
- *
- * This function stores the detector data contained in the raw data structure
- * into the specified file. The specified file must be an existing raw data
- * file. This function just replaces the detector data contained in the
- * IMAGING_DATA binary table.
- *
- * @warning
- * It does not change or update the information of the different headers, and
- * does not check correctness of these informations compared to the raw data.
- * Therefore, this function has to be only used to store, in the original file
- * or in a copy of the original file, the raw data which has been processed
- * using for example amdlibCalibrateRawData() function.
- *
- * @param filename name of the FITS file containing raw data.
- * @param rawData structure where raw data is stored
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibStoreRawData(const char *filename,
- amdlibRAW_DATA *rawData,
- amdlibERROR_MSG errMsg)
-{
- struct stat statBuf;
- char fitsioMsg[256];
- fitsfile *filePtr;
- int status = 0;
-
- amdlibLogTrace("amdlibStoreRawData()");
-
- /* Check the file exists */
- if (stat(filename, &statBuf) != 0)
- {
- amdlibSetErrMsg("File '%.80s' does not exist", filename);
- return amdlibFAILURE;
- }
-
- /* If raw data structure is not initailized, do it */
- if (rawData->thisPtr != rawData)
- {
- amdlibSetErrMsg("Raw data is not initialized");
- return amdlibFAILURE;
- }
-
- /* Open FITS file */
- if (fits_open_file(&filePtr, filename, READWRITE, &status) != 0)
- {
- amdlibReturnFitsError(filename);
- }
-
- /* Write 'region data' in imaging data table */
- if (amdlibWriteRegionData(filePtr, rawData->region,
- rawData->nbRegions,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- /* Write 'time tag' in imaging data table */
- if (amdlibWriteTimeTag(filePtr, rawData, errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- /* Write the FITS file */
- if (fits_close_file(filePtr, &status) != 0)
- {
- amdlibReturnFitsError(filename);
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Save raw data into a FITS file as 2-dimensional images.
- *
- * This function creates glued images from data of the detector subwindows and
- * stores the resulting images into a normal FITS file.
- *
- * @param filename name of the FITS file where 2D images will be stored.
- * @param rawData structure where raw data is stored
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibSaveRawDataToFits(const char *filename,
- amdlibRAW_DATA *rawData,
- amdlibERROR_MSG errMsg)
-{
- char fitsioMsg[256];
- fitsfile *filePtr;
- int status = 0;
- int i, iRegion;
- int iRow, iCol;
- int regionHeight, regionWidth, regionSize;
- int iY, iX, iFrame;
- amdlibDOUBLE *image=NULL;
-
- int bitpix = FLOAT_IMG;
- long naxis = 3; /* 2-dimensional image */
- long naxes[3] = {0, 0, 0};
-
- amdlibLogTrace("amdlibSaveRawDataToFits()");
-
- /* If raw data structure is not initialized, do it */
- if (rawData->thisPtr != rawData)
- {
- amdlibSetErrMsg("Raw data not initialized");
- return amdlibFAILURE;
- }
-
- /* Check raw data structure contains data */
- if (rawData->dataLoaded == amdlibFALSE)
- {
- amdlibSetErrMsg("The raw data structure does not "
- "contain data. Check call to amdlibLoadRawData()");
- return amdlibFAILURE;
- }
-
- /* Delete old file if it already exists */
- remove(filename);
-
- /* Create FITS file */
- if (fits_create_file(&filePtr, filename, &status) != 0)
- {
- amdlibReturnFitsError(filename);
- }
-
- /* Determine the size of the glued image */
- for (iCol = 0; iCol < rawData->nbCols; iCol++)
- {
- iRegion = iCol;
- naxes[0] += rawData->region[iRegion].dimAxis[0];
- }
- for (iRow = 0; iRow < rawData->nbRows; iRow++)
- {
- iRegion = iRow * rawData->nbCols;
- naxes[1] += rawData->region[iRegion].dimAxis[1];
- }
- naxes[2] = rawData->region[0].dimAxis[2];
-
- /* Allocate memory */
- image = calloc(naxes[0]*naxes[1]*naxes[2],sizeof(amdlibDOUBLE));
- if (image == NULL)
- {
- amdlibSetErrMsg("Could not allocate memory for glued image");
- return amdlibFAILURE;
- }
-
- /* Create glued image */
- i=0;
- for (iFrame = 0; iFrame < rawData->region[0].dimAxis[2]; iFrame++)
- {
- for (iRow = 0; iRow < rawData->nbRows; iRow++)
- {
- iRegion = iRow * rawData->nbCols;
- regionHeight = rawData->region[iRegion].dimAxis[1];
- for (iY = 0; iY < regionHeight; iY++)
- {
- for (iCol = 0; iCol < rawData->nbCols; iCol++)
- {
- iRegion = iRow * rawData->nbCols + iCol;
- regionWidth = rawData->region[iRegion].dimAxis[0];
- regionSize = regionWidth * regionHeight;
- for (iX = 0; iX < regionWidth; iX++)
- {
- image[i++] =
- rawData->region[iRegion].data[iFrame*regionSize +
- iY*regionWidth + iX];
- }
- }
- }
- }
- }
-
- /* Write the required keywords for the primary array image. */
- if (fits_create_img(filePtr, bitpix, naxis, naxes, &status) != 0)
- {
- free(image);
- amdlibGetFitsError(filename);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- /* Copy array containing instrument configuration into file */
- for (i=0; i < rawData->insCfg.nbKeywords; i++)
- {
- amdlibKEYW_LINE keywLine;
- if (strstr(rawData->insCfg.keywords[i].name, "HIERARCH ESO") != NULL)
- {
- sprintf((char*)keywLine, "%s=%s/%s",
- rawData->insCfg.keywords[i].name,
- rawData->insCfg.keywords[i].value,
- rawData->insCfg.keywords[i].comment);
- if (fits_write_record(filePtr, keywLine, &status) != 0)
- {
- amdlibGetFitsError(rawData->insCfg.keywords[i].name);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
- }
-
- /* write the array of unsigned integers to the FITS file */
- if (fits_write_img(filePtr, TDOUBLE, 1, naxes[0]*naxes[1]*naxes[2], image,
- &status) != 0)
- {
- free(image);
- amdlibGetFitsError(filename);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- /* Release previously allocated memory */
- free(image);
-
- /* close file */
- if (fits_close_file(filePtr, &status) != 0)
- {
- amdlibReturnFitsError(filename);
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Duplicate raw data structure.
- *
- * This function allocates memory for destination data structure and copies the
- * data from source into it.
- *
- * @param srcRawData source raw data structure.
- * @param dstRawData destination raw data structure.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibDuplicateRawData(amdlibRAW_DATA *srcRawData,
- amdlibRAW_DATA *dstRawData,
- amdlibERROR_MSG errMsg)
-{
- int i;
-
- amdlibLogTrace("amdlibDuplicateRawData()");
-
- /* Initialize destination data structure */
- if (dstRawData->thisPtr != dstRawData)
- {
- amdlibInitRawData(dstRawData);
- }
-
- /* Copy all raw data information */
- memcpy(dstRawData, srcRawData, sizeof(amdlibRAW_DATA));
-
- /* Allocates memory for regions */
- dstRawData->region = NULL;
- if (amdlibAllocateRegions(&dstRawData->region,
- dstRawData->nbRegions) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for regions");
- return amdlibFAILURE;
- }
- dstRawData->variance = NULL;
- if (amdlibAllocateRegions(&dstRawData->variance,
- dstRawData->nbRegions) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for variance map");
- return amdlibFAILURE;
- }
-
- /* Copy all regions information and data */
- for (i = 0; i < dstRawData->nbRegions; i++)
- {
- int regionSize;
- /* Copy region information */
- memcpy(&dstRawData->region[i], &srcRawData->region[i],
- sizeof(amdlibREGION));
- /* Copy variance information */
- memcpy(&dstRawData->variance[i], &srcRawData->variance[i],
- sizeof(amdlibREGION));
-
- /* Allocate memory for region and variance */
- regionSize = srcRawData->region[i].dimAxis[0] *
- srcRawData->region[i].dimAxis[1] *
- srcRawData->region[i].dimAxis[2];
- dstRawData->region[i].data = calloc(regionSize, sizeof(*(dstRawData->region[i].data)));
- dstRawData->variance[i].data = calloc(regionSize, sizeof(*(dstRawData->variance[i].data)));
- if (dstRawData->region[i].data == NULL)
- {
- amdlibSetErrMsg("Could not allocate memory for data of region #%d",
- i);
- return amdlibFAILURE;
- }
- if (dstRawData->variance[i].data == NULL)
- {
- amdlibSetErrMsg("Could not allocate memory for data of variance #%d",
- i);
- return amdlibFAILURE;
- }
- /* Copy region data */
- memcpy(dstRawData->region[i].data, srcRawData->region[i].data,
- regionSize * sizeof(*(srcRawData->region[i].data)));
- /* Copy variance data */
- memcpy(dstRawData->variance[i].data, srcRawData->variance[i].data,
- regionSize * sizeof(*(srcRawData->variance[i].data)));
- }
-
- /* Copy time tag and computed rms for all frames */
- dstRawData->timeTag = calloc(dstRawData->nbFrames, sizeof(double));
- if (dstRawData->timeTag == NULL)
- {
- amdlibSetErrMsg("Could not allocate memory for time tag");
- return amdlibFAILURE;
- }
- for (i = 0; i < dstRawData->nbFrames; i++)
- {
- dstRawData->timeTag[i] = srcRawData->timeTag[i];
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Sum and pack data of a channel
- *
- * This function sums and packs (i.e. rows are merged together) data for the
- * given channel along X, Y and Z axis, according to the specified sum flag. The
- * result is stored in the array given as parameter. This array contains
- * pointers where each pointer points to the memory where result for frame i
- * has to be stored; i.e. result[i] contains pointer to memory allocated for
- * frame i.
- *
- * @warning
- * The calling function has to allocate memory for the result.
- *
- * @param rawData raw data structure.
- * @param sumX flag indicating whether data has to be summed along X-axis or not
- * @param sumY flag indicating whether data has to be summed along Y-axis or not
- * @param sumZ flag indicating whether data has to be summed along Z-axis or not
- * @param channel channel number; could be amdlibPHOTO1_CHANNEL,
- * amdlibPHOTO2_CHANNEL, amdlibPHOTO3_CHANNEL or amdlibINTERF_CHANNEL
- * @param result array where result will be stored
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibSumAndPackData(amdlibRAW_DATA *rawData,
- amdlibBOOLEAN sumX,
- amdlibBOOLEAN sumY,
- amdlibBOOLEAN sumZ,
- int channel,
- amdlibDOUBLE **result,
- amdlibDOUBLE **sigma2Result,
- amdlibERROR_MSG errMsg)
-{
- int channelIndex;
- int dimX; /* resulting column width, ie number of pixels */
- int dimY; /* resulting column height, ie number of spectral channels */
- int dimZ; /* resulting column depth, ie number of frames */
- int iRow; /* index on rawData rows */
- int iRegion; /* index on regions */
- int currentY;
- int firstYInRow;
- int sX, sY, sZ;
- int iX, iY, iZ;
- amdlibDOUBLE ***rawPtr,***variancePtr; /* wrapping on rawData regions data */
- amdlibDOUBLE **resPtr,**sigma2ResPtr; /* wrapping on each result data frame */
- amdlibDOUBLE **badPixels;
-
- amdlibLogTrace("amdlibSumAndPackData()");
-
- /* Find channel index */
- switch (channel)
- {
- case amdlibPHOTO1_CHANNEL :
- {
- channelIndex = 1;
- break;
- }
- case amdlibPHOTO2_CHANNEL :
- {
- channelIndex = 2;
- break;
- }
- case amdlibPHOTO3_CHANNEL :
- {
- channelIndex = 4;
- break;
- }
- case amdlibINTERF_CHANNEL :
- {
- channelIndex = 3;
- break;
- }
- default :
- {
- amdlibSetErrMsg("Channel reference '%d' does not exist", channel);
- return amdlibFAILURE;
- }
- }
-
- /* Find dimensions according to sumX, sumY and sumZ booleans */
- if (sumX == amdlibTRUE)
- {
- dimX = 1;
- }
- else
- {
- dimX = rawData->region[channelIndex].dimAxis[0];
- }
- if (sumY == amdlibTRUE)
- {
- dimY = 1;
- }
- else
- {
- dimY = 0;
- for (iRow = 0; iRow < rawData->nbRows; iRow ++)
- {
- dimY +=
- rawData->region[iRow*rawData->nbCols + channelIndex].dimAxis[1];
- }
- }
- if (sumZ == amdlibTRUE)
- {
- dimZ = 1;
- }
- else
- {
- dimZ = rawData->region[channelIndex].dimAxis[2];
- }
- /* Reset result array */
- for (iZ = 0; iZ < dimZ; iZ ++)
- {
- if (result[iZ] == NULL)
- {
- amdlibSetErrMsg("Null pointer");
- return amdlibFAILURE;
- }
- else
- {
- memset(result[iZ], '\0', dimX * dimY * sizeof(**result));
- }
- }
- /* Reset sigma2Result array */
- for (iZ = 0; iZ < dimZ; iZ ++)
- {
- if (sigma2Result[iZ] == NULL)
- {
- amdlibSetErrMsg("Null pointer");
- return amdlibFAILURE;
- }
- else
- {
- memset(sigma2Result[iZ], '\0', dimX * dimY * sizeof(**sigma2Result));
- }
- }
-
- /* Loop on rows so as to pack data */
- currentY = 0;
- for (iRow = 0; iRow < rawData->nbRows; iRow ++)
- {
- iRegion = iRow*rawData->nbCols + channelIndex;
- badPixels = amdlibGetBadPixelMapRegion(
- rawData->region[iRegion].corner[0] - 1,
- rawData->region[iRegion].corner[1] - 1,
- rawData->region[iRegion].dimAxis[0],
- rawData->region[iRegion].dimAxis[1],
- errMsg);
- if (badPixels == NULL)
- {
- return amdlibFAILURE;
- }
- rawPtr = amdlibWrap3DArrayDouble(rawData->region[iRegion].data,
- rawData->region[iRegion].dimAxis[0],
- rawData->region[iRegion].dimAxis[1],
- rawData->region[iRegion].dimAxis[2],
- errMsg);
- if (rawPtr == NULL)
- {
- amdlibFree2DArrayDouble(badPixels);
- return amdlibFAILURE;
- }
- variancePtr = amdlibWrap3DArrayDouble(rawData->variance[iRegion].data,
- rawData->variance[iRegion].dimAxis[0],
- rawData->variance[iRegion].dimAxis[1],
- rawData->variance[iRegion].dimAxis[2],
- errMsg);
- if (variancePtr == NULL)
- {
- amdlibFree2DArrayDouble(badPixels);
- amdlibFree3DArrayDoubleWrapping(rawPtr);
- return amdlibFAILURE;
- }
- sX = 0;
- sY = 0;
- sZ = 0;
- firstYInRow = currentY;
- for (iZ = 0; iZ < rawData->region[iRegion].dimAxis[2]; iZ ++)
- {
- if (sumZ == amdlibFALSE)
- {
- sZ = iZ;
- }
- resPtr = amdlibWrap2DArrayDouble(result[sZ], dimX, dimY, errMsg);
- if (resPtr == NULL)
- {
- return amdlibFAILURE;
- }
- sigma2ResPtr = amdlibWrap2DArrayDouble(sigma2Result[sZ], dimX, dimY, errMsg);
- if (sigma2ResPtr == NULL)
- {
- amdlibFree2DArrayDoubleWrapping(resPtr);
- return amdlibFAILURE;
- }
-
- currentY = firstYInRow;
- for (iY = 0; iY < rawData->region[iRegion].dimAxis[1]; iY ++)
- {
- if (sumY == amdlibFALSE)
- {
- sY = currentY;
- }
- for (iX = 0; iX < rawData->region[iRegion].dimAxis[0]; iX ++)
- {
- if (sumX == amdlibFALSE)
- {
- sX = iX;
- }
- if (badPixels[iY][iX] == amdlibGOOD_PIXEL_FLAG)
- {
- resPtr[sY][sX] += rawPtr[iZ][iY][iX];
- sigma2ResPtr[sY][sX] += variancePtr[iZ][iY][iX];
- }
- }
- currentY ++;
- }
- amdlibFree2DArrayDoubleWrapping(resPtr);
- amdlibFree2DArrayDoubleWrapping(sigma2ResPtr);
- }
- amdlibFree2DArrayDouble(badPixels);
- amdlibFree3DArrayDoubleWrapping(rawPtr);
- amdlibFree3DArrayDoubleWrapping(variancePtr);
- }
-
- /* If data has been summed along Z-axis, it means
- * that we do an average of all frames.
- * We have to modify the variance accordingly
- * (retrieve the readout noise) */
- if (sumZ == amdlibTRUE)
- {
- resPtr = amdlibWrap2DArrayDouble(result[0], dimX, dimY, errMsg);
- if (resPtr == NULL)
- {
- return amdlibFAILURE;
- }
- sigma2ResPtr = amdlibWrap2DArrayDouble(sigma2Result[0], dimX, dimY, errMsg);
- if (sigma2ResPtr == NULL)
- {
- amdlibFree2DArrayDoubleWrapping(resPtr);
- return amdlibFAILURE;
- }
- for (iY = 0; iY < dimY; iY++)
- {
- for (iX = 0; iX < dimX; iX ++)
- {
- /* sum of N ron */
- sigma2ResPtr[iY][iX] -= resPtr[iY][iX];
- /* mean ron (=true ron if a dark was used) */
- sigma2ResPtr[iY][iX] /= rawData->region[channelIndex].dimAxis[2];
- /*mean value of pixel*/
- resPtr[iY][iX] /= rawData->region[channelIndex].dimAxis[2];
- /*sigma2 of mean value */
- sigma2ResPtr[iY][iX] =
- (resPtr[iY][iX]+sigma2ResPtr[iY][iX])
- /rawData->region[channelIndex].dimAxis[2];
- }
- }
- amdlibFree2DArrayDoubleWrapping(resPtr);
- amdlibFree2DArrayDoubleWrapping(sigma2ResPtr);
- }
-
- return amdlibSUCCESS;
-}
-
-
-/*
- * Local functions
- */
-/**
- * Get time tags for the list of frames.
- *
- * This function retrieves the time tags from the given FITS file for the
- * specified frames.
- *
- * @param filePtr pointer to the FITS file containing raw data.
- * @param rawData structure where raw data is stored
- * @param firstFrame index of the first frame to load
- * @param nbFrames number of frames to load
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibReadTimeTag (fitsfile *filePtr,
- amdlibRAW_DATA *rawData,
- int firstFrame,
- int nbFrames,
- amdlibERROR_MSG errMsg)
-{
- int status = 0;
- int anynull = 0;
- char fitsioMsg[256];
- int colnum;
-
- amdlibLogTrace("amdlibReadTimeTag()");
-
- /* Reset error message */
- memset(errMsg, '\0', sizeof(amdlibERROR_MSG));
-
- /* Allocate memory to store time tag list */
- rawData->timeTag = calloc(nbFrames, sizeof(*(rawData->timeTag)));
- if (rawData->timeTag == NULL)
- {
- amdlibSetErrMsg("Could not allocate memory for time tag list");
- return amdlibFAILURE;
- }
-
- /* Go to the IMAGING_DATA binary table */
- if (fits_movnam_hdu(filePtr, BINARY_TBL,
- "IMAGING_DATA", 0, &status) != 0)
- {
- amdlibReturnFitsError("IMAGING_DATA");
- }
-
- if(fits_get_colnum (filePtr, CASEINSEN, "TIME", &colnum, &status))
- {
- amdlibReturnFitsError("TIME");
- }
-
- if(fits_read_col (filePtr, TDOUBLE, colnum, firstFrame, 1, nbFrames,
- NULL, rawData->timeTag, &anynull, &status) != 0)
- {
- amdlibReturnFitsError("TIME");
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Set time tags for all frames.
- *
- * This function write the time tags stored in the raw data structure into the
- * FITS file.
- *
- * @param filePtr pointer to the FITS file containing raw data.
- * @param rawData structure where raw data is stored
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibWriteTimeTag (fitsfile *filePtr,
- amdlibRAW_DATA *rawData,
- amdlibERROR_MSG errMsg)
-{
- int status = 0;
- char fitsioMsg[256];
- int colnum;
-
- amdlibLogTrace("amdlibWriteTimeTag()");
-
- /* Reset error message */
- memset(errMsg, '\0', sizeof(amdlibERROR_MSG));
-
- /* Go to the IMAGING_DATA binary table */
- if (fits_movnam_hdu(filePtr, BINARY_TBL, "IMAGING_DATA", 0, &status) != 0)
- {
- amdlibReturnFitsError("IMAGING_DATA");
- }
-
- if(fits_get_colnum (filePtr, CASEINSEN, "TIME", &colnum, &status))
- {
- amdlibReturnFitsError("TIME");
- }
- /* Check data pointer */
- if (rawData->timeTag == NULL)
- {
- amdlibSetErrMsg("The pointer to the time data is invalid");
- return amdlibFAILURE;
- }
-
- /* Write the time data */
- if (fits_write_col(filePtr, TDOUBLE, colnum, 1, 1,
- rawData->nbFrames, rawData->timeTag, &status) != 0)
- {
- amdlibReturnFitsError("TIME");
- }
- return amdlibSUCCESS;
-}
-
-
-
-/**
- * Free memory allocated memory of raw data structure.
- *
- * This function frees previously allocated memory (if any) where raw data has
- * been stored.
- *
- * @param rawData structure where raw data is stored
- */
-void amdlibFreeRawData(amdlibRAW_DATA *rawData)
-{
- amdlibLogTrace("amdlibFreeRawData()");
-
- amdlibFreeRegions(&rawData->region, rawData->nbRegions);
- amdlibFreeRegions(&rawData->variance, rawData->nbRegions);
- amdlibReleaseOiArray(&rawData->arrayGeometry);
- if (rawData->timeTag != NULL)
- {
- free(rawData->timeTag);
- rawData->timeTag = NULL;
- }
-}
-
-/**
- * Convert string frame type to Id.
- *
- * This function converts the string corresponding the the frame as defined by
- * OCS.DET.FRAM.TYPE keyword to the frame type Id as defined by the
- * amdlibFRAME_TYPE enumerate.
- *
- * @param frameTypeStr frame type as string
- *
- * @return
- * Frame type Id.
- */
-amdlibFRAME_TYPE amdlibFrameTypeStr2Id(char *frameTypeStr)
-{
- amdlibLogTrace("amdlibFrameTypeStr2Id()");
-
- if (strcmp(frameTypeStr, "DARK") == 0)
- {
- return amdlibDARK_FRAME;
- }
- if ((strcmp(frameTypeStr, "TEL1") == 0) ||
- (strcmp(frameTypeStr, "TEL1SC") == 0))
- {
- return amdlibTEL1_FRAME;
- }
- if ((strcmp(frameTypeStr, "TEL2") == 0) ||
- (strcmp(frameTypeStr, "TEL2SC") == 0))
- {
- return amdlibTEL2_FRAME;
- }
- if ((strcmp(frameTypeStr, "TEL3") == 0) ||
- (strcmp(frameTypeStr, "TEL3SC") == 0))
- {
- return amdlibTEL3_FRAME;
- }
- if (strcmp(frameTypeStr, "TEL12") == 0)
- {
- return amdlibTEL12_FRAME;
- }
- if (strcmp(frameTypeStr, "TEL12Q") == 0)
- {
- return amdlibTEL12Q_FRAME;
- }
- if (strcmp(frameTypeStr, "TEL23") == 0)
- {
- return amdlibTEL23_FRAME;
- }
- if (strcmp(frameTypeStr, "TEL23Q") == 0)
- {
- return amdlibTEL23Q_FRAME;
- }
- if (strcmp(frameTypeStr, "TEL13") == 0)
- {
- return amdlibTEL13_FRAME;
- }
- if (strcmp(frameTypeStr, "TEL13Q") == 0)
- {
- return amdlibTEL13Q_FRAME;
- }
- if (strcmp(frameTypeStr, "SKY") == 0)
- {
- return amdlibSKY_FRAME;
- }
- return amdlibUNKNOWN_FRAME;
-}
-
-/**
- * Check dark map and data compatibity
- *
- * This function checks if data from the dark map and data from the raw
- * data structure are compatible, i.e. if each field stored in both structures
- * is instanciated twice by the same value.
- *
- * @param dark map.
- * @param rawData raw data.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibCheckDataCompatibility(amdlibDARK_DATA *dark,
- amdlibRAW_DATA *rawData,
- amdlibERROR_MSG errMsg)
-{
- int iRegion;
-
- amdlibLogTrace("amdlibCheckDataCompatibility()");
-
- if (dark != NULL)
- {
- if (dark->nbRegions != rawData->nbRegions)
- {
- amdlibSetErrMsg("The number of regions in raw data (%d) and in "
- "dark data (%d) are incompatible",
- rawData->nbRegions, dark->nbRegions);
- return amdlibFAILURE;
- }
-
- if (dark->expTime != rawData->expTime)
- {
- /* Use a Warning this time */
- amdlibLogWarning("The expTime in raw data (%f) and in dark "
- "data (%f) are incompatible",
- rawData->expTime, dark->expTime);
- }
-
- if (dark->nbRows != rawData->nbRows)
- {
- amdlibSetErrMsg("The number of rows in raw data (%d) and in "
- "dark data (%d) are incompatible",
- rawData->nbRows, dark->nbRows);
- return amdlibFAILURE;
- }
-
- if (dark->nbCols != rawData->nbCols)
- {
- amdlibSetErrMsg("The number of columns in raw data (%d) and in "
- "dark data (%d) are incompatible",
- rawData->nbCols, dark->nbCols);
- return amdlibFAILURE;
- }
-
- /* For each region */
- for (iRegion = 0; iRegion < rawData->nbRegions; iRegion++)
- {
- /* Check the region position */
- if (dark->region[iRegion].corner[0] !=
- rawData->region[iRegion].corner[0])
- {
- amdlibSetErrMsg("The position in X direction of the region %d "
- "in raw data (%d) and in dark data (%d) "
- "are incompatible",
- iRegion, rawData->region[iRegion].corner[0],
- dark->region[iRegion].corner[0]);
- return amdlibFAILURE;
- }
-
- if (dark->region[iRegion].corner[1] !=
- rawData->region[iRegion].corner[1])
- {
- amdlibSetErrMsg("The position in X direction of the region %d "
- "in raw data (%d) and in dark data (%d) "
- "are incompatible",
- iRegion, rawData->region[iRegion].corner[1],
- dark->region[iRegion].corner[1]);
- return amdlibFAILURE;
- }
-
- /* Check the region size */
- if (dark->region[iRegion].dimAxis[0] !=
- rawData->region[iRegion].dimAxis[0])
- {
- amdlibSetErrMsg("The number of pixels in X direction of the "
- "region %d in raw data (%d) and in dark "
- "data (%d are incompatible",
- iRegion, rawData->region[iRegion].dimAxis[0],
- dark->region[iRegion].dimAxis[0]);
- return amdlibFAILURE;
- }
- if (dark->region[iRegion].dimAxis[1] !=
- rawData->region[iRegion].dimAxis[1])
- {
- amdlibSetErrMsg("The number of pixels in X direction of the "
- "region %d in raw data (%d) and in dark "
- "data (%d) are incompatible",
- iRegion, rawData->region[iRegion].dimAxis[1],
- dark->region[iRegion].dimAxis[1]);
- return amdlibFAILURE;
- }
- }
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Delete null frames
- *
- * This function treats the problem of null frames present in the raw data being
- * calibrated. These null frames are not taken into account, they are shifted at
- * the end of the list of frames and ignored.
- *
- * @param rawData raw data.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibDiscardNullFrames(amdlibRAW_DATA *rawData,
- amdlibERROR_MSG errMsg)
-{
- int nbFrames;
- int nbNullFrames=0;
- int iFrame, iFirstFrame;
- int onbFrames;
- int oFrame;
- int iRegion;
- int regionSize;
- int iFFskip=0;
-
-#define amdlibFIRST_FRAME_IF_SKIP 0
-#define amdlibMIN_FRAMES_FOR_DROP 200
-
- amdlibLogTrace("amdlibDiscardNullFrames()");
-
- if (amdlibGetUserPref(amdlibDROP).set==amdlibTRUE)
- iFFskip=amdlibGetUserPref(amdlibDROP).value;
-
-
- nbFrames = rawData->region[0].dimAxis[2];
- iFirstFrame=nbNullFrames=iFFskip;
- for (iFrame = iFirstFrame; iFrame < nbFrames ; iFrame++)
- {
- if (rawData->timeTag[iFrame] == 0.0)
- {
- nbNullFrames++;
- }
- }
-
- /* Compact all avoided frames and update structure header accordingly*/
- if (nbNullFrames!=0)
- {
- /* Report on Null Frame Number. Compute a percentage. Warning issued at 20% */
- if (((double)nbNullFrames-(double)iFirstFrame)/(double)nbFrames>0.2) amdlibLogWarning("more than %.1f%% frames tagged with null DIT removed.",100.0*((double)nbNullFrames-(double)iFirstFrame)/(double)nbFrames);
-
- onbFrames = nbFrames-iFirstFrame;
- /* Copy back each non-null frame values and infos after the last good */
- for (iFrame = iFirstFrame, oFrame = 0; iFrame < nbFrames; iFrame++)
- {
- if (rawData->timeTag[iFrame] == 0.0)
- {
- onbFrames--;
- }
- else
- {
- if (iFrame != oFrame)
- {
- for (iRegion = 0; iRegion < rawData->nbRegions; iRegion++)
- {
- regionSize = rawData->region[iRegion].dimAxis[0] *
- rawData->region[iRegion].dimAxis[1];
- memcpy(
- rawData->region[iRegion].data + oFrame*regionSize,
- rawData->region[iRegion].data + iFrame*regionSize,
- regionSize*sizeof(*(rawData->region[iRegion].data)));
- memcpy(
- rawData->variance[iRegion].data + oFrame*regionSize,
- rawData->variance[iRegion].data + iFrame*regionSize,
- regionSize*sizeof(*(rawData->variance[iRegion].data)));
- }
- rawData->timeTag[oFrame] = rawData->timeTag[iFrame];
- }
- oFrame++;
- }
- }
- if (onbFrames == 0)
- {
- amdlibSetErrMsg("Only Null Frames found !");
- return amdlibFAILURE;
- }
-
- /* Zero end of data */
- for (iFrame = onbFrames; iFrame < nbFrames; iFrame++)
- {
- for (iRegion = 0; iRegion < rawData->nbRegions; iRegion++)
- {
- regionSize = rawData->region[iRegion].dimAxis[0] *
- rawData->region[iRegion].dimAxis[1];
- memset(
- rawData->region[iRegion].data + iFrame*regionSize,
- '\0', regionSize*sizeof(*(rawData->region[iRegion].data)));
- memset(
- rawData->variance[iRegion].data + iFrame*regionSize,
- '\0', regionSize*sizeof(*(rawData->variance[iRegion].data)));
- }
- }
-
- nbFrames = onbFrames;
- /* Update nb frame info where it hurts... */
- rawData->nbFrames = nbFrames;
- for (iRegion = 0; iRegion < rawData->nbRegions; iRegion++)
- {
- rawData->region[iRegion].dimAxis[2] = nbFrames;
- rawData->variance[iRegion].dimAxis[2] = nbFrames;
- }
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Substracts dark
- *
- * This function substracts dark
- * on raw data, and add variance information in the structure.
- *
- * @param dark dark map.
- * @param rawData raw data.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibSubstractDark(amdlibDARK_DATA *dark,
- amdlibRAW_DATA *rawData,
- amdlibERROR_MSG errMsg)
-{
- int iRegion;
- int regionSize;
- int iFrame;
- int iX, iY;
- int startPixelX, startPixelY;
- int regionWidth, regionHeight;
- amdlibDOUBLE **badPixels;
- amdlibDOUBLE ***rawPtr;
- amdlibDOUBLE ***variancePtr;
- amdlibDOUBLE **darkPtr;
- amdlibDOUBLE **sigma2DarkPtr;
-
- amdlibLogTrace("amdlibSubstractDark()");
-
- /* Do not take risks of a bad external call */
- if (dark!=NULL)
- {
-
- for (iRegion = 0; iRegion < rawData->nbRegions; iRegion++)
- {
- startPixelX = rawData->region[iRegion].corner[0] - 1;
- regionWidth = rawData->region[iRegion].dimAxis[0];
- startPixelY = rawData->region[iRegion].corner[1] - 1;
- regionHeight = rawData->region[iRegion].dimAxis[1];
-
- /* Get bad pixels and flat-field for this region */
- badPixels = amdlibGetBadPixelMapRegion(startPixelX, startPixelY,
- regionWidth, regionHeight,
- errMsg);
- regionSize = regionWidth * regionHeight;
- rawPtr =
- amdlibWrap3DArrayDouble(rawData->region[iRegion].data,
- regionWidth,
- regionHeight,
- rawData->region[iRegion].dimAxis[2],
- errMsg);
- variancePtr =
- amdlibWrap3DArrayDouble(rawData->variance[iRegion].data,
- regionWidth,
- regionHeight,
- rawData->variance[iRegion].dimAxis[2],
- errMsg);
- darkPtr =
- amdlibWrap2DArrayDouble(dark->region[iRegion].data,
- regionWidth,
- regionHeight,
- errMsg);
- sigma2DarkPtr =
- amdlibWrap2DArrayDouble(dark->noise[iRegion].data,
- regionWidth,
- regionHeight,
- errMsg);
- if (badPixels == NULL)
- {
- return amdlibFAILURE;
- }
- if (rawPtr == NULL)
- {
- return amdlibFAILURE;
- }
- if (variancePtr == NULL)
- {
- amdlibFree3DArrayDoubleWrapping(rawPtr);
- return amdlibFAILURE;
- }
- if (darkPtr == NULL)
- {
- amdlibFree3DArrayDoubleWrapping(rawPtr);
- amdlibFree3DArrayDoubleWrapping(variancePtr);
- return amdlibFAILURE;
- }
- if (sigma2DarkPtr == NULL)
- {
- amdlibFree3DArrayDoubleWrapping(rawPtr);
- amdlibFree3DArrayDoubleWrapping(variancePtr);
- amdlibFree2DArrayDoubleWrapping(darkPtr);
- return amdlibFAILURE;
- }
-
- for (iFrame = 0; iFrame < rawData->region[iRegion].dimAxis[2];
- iFrame++)
- {
- for (iY = 0; iY < regionHeight ; iY++)
- {
- for (iX = 0; iX < regionWidth; iX++)
- {
- if (badPixels[iY][iX] == amdlibGOOD_PIXEL_FLAG)
- {
- rawPtr[iFrame][iY][iX] -= darkPtr[iY][iX];
- /* When dark is used, use the (better)
- * individual noise given by the darks'
- * noise section. */
- variancePtr[iFrame][iY][iX] = sigma2DarkPtr[iY][iX];
- }
- }
- }
- }
- amdlibFree2DArrayDouble(badPixels);
- amdlibFree3DArrayDoubleWrapping(rawPtr);
- amdlibFree2DArrayDoubleWrapping(darkPtr);
- amdlibFree3DArrayDoubleWrapping(variancePtr);
- amdlibFree2DArrayDoubleWrapping(sigma2DarkPtr);
- }
- }
- else
- {
- amdlibLogWarning("Calling procedure amdlibSubstractDark() with a null dark");
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Calibrate image
- *
- * This function calibrates the specified image.
- *
- * @param rawData raw data.
- * @param iFrame index of the frame
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibCalibrateImage(amdlibRAW_DATA *rawData,
- int iFrame,
- amdlibERROR_MSG errMsg)
-{
- int iRow, iCol;
- int iRegion;
- int iX, iY;
- int startPixelX, startPixelY;
- int regionWidth, regionHeight;
- int regionSize;
- amdlibDOUBLE **badPixels;
- amdlibDOUBLE **flatField;
- amdlibDOUBLE **rawPtr;
- amdlibDOUBLE **variancePtr;
- amdlibDOUBLE ffmValue;
- amdlibDOUBLE gain;
- amdlibDOUBLE lastGoodPixelValue=0.0,lastGoodPixelVariance=0.0;
-
- amdlibLogTrace("amdlibCalibrateImage()");
-
- for (iRow = 0; iRow < rawData->nbRows; iRow++)
- {
- for (iCol = 0; iCol < rawData->nbCols; iCol++)
- {
- iRegion = iRow * rawData->nbCols + iCol;
- gain=rawData->region[iRegion].gain;
- startPixelX = rawData->region[iRegion].corner[0] - 1;
- regionWidth = rawData->region[iRegion].dimAxis[0];
- startPixelY = rawData->region[iRegion].corner[1] - 1;
- regionHeight = rawData->region[iRegion].dimAxis[1];
-
- /* Get bad pixels and flat-field for this region */
- badPixels = amdlibGetBadPixelMapRegion(startPixelX, startPixelY,
- regionWidth, regionHeight,
- errMsg);
- if (badPixels == NULL)
- {
- return amdlibFAILURE;
- }
- /* lastGoodPixelValue tries to be a realistic pixel value to put at
- * a bad pixel location, in case this pixel is used anyway in a
- * further treatment. It is reset to 0 at the beginning of
- * a region (since regions have different fluxes), when
- * lastGoodPixelVariance which must be
- * representative of at least the typical ron is not reset.*/
- lastGoodPixelValue=0.0;
- flatField = amdlibGetFlatFieldMapRegion(startPixelX, startPixelY,
- regionWidth, regionHeight,
- errMsg);
- if (flatField == NULL)
- {
- amdlibFree2DArrayDouble(badPixels);
- return amdlibFAILURE;
- }
- regionSize = regionWidth * regionHeight;
- rawPtr = amdlibWrap2DArrayDouble(
- &rawData->region[iRegion].data[regionSize*iFrame],
- rawData->region[iRegion].dimAxis[0],
- rawData->region[iRegion].dimAxis[1],
- errMsg);
- if (rawPtr == NULL)
- {
- amdlibFree2DArrayDouble(badPixels);
- amdlibFree2DArrayDouble(flatField);
- return amdlibFAILURE;
- }
-
- variancePtr = amdlibWrap2DArrayDouble(
- &rawData->variance[iRegion].data[regionSize*iFrame],
- rawData->variance[iRegion].dimAxis[0],
- rawData->variance[iRegion].dimAxis[1],
- errMsg);
- if (variancePtr == NULL)
- {
- amdlibFree2DArrayDouble(badPixels);
- amdlibFree2DArrayDouble(flatField);
- amdlibFree2DArrayDoubleWrapping(rawPtr);
- return amdlibFAILURE;
- }
- for (iY = 0; iY < regionHeight; iY++)
- {
- for (iX = 0; iX < regionWidth; iX++)
- {
- /* Flat is not corrected in shielded area */
- if (iCol != 0)
- {
- ffmValue = flatField[iY][iX];
- }
- else
- {
- ffmValue = 1.0;
- }
-
- if (badPixels[iY][iX] == amdlibGOOD_PIXEL_FLAG)
- {
- /* test whether 'saturated' flag should be set */
- if (rawPtr[iY][iX] > amdlibDETECTOR_SATURATION)
- {
- rawData->dataIsSaturated = amdlibTRUE;
- }
- /* normalize image by gain and flat. Here we are in ADU, so be careful,
- * the statistics are only for photoelectrons e-.
- */
- rawPtr[iY][iX] *= (gain/ffmValue); /*now: in e-*/
- lastGoodPixelValue=rawPtr[iY][iX];
- /*variance is sigma2det in adu at the moment,
- * convert in e- */
- variancePtr[iY][iX] *= (gain*gain); /*RON^2 in e- */
- /* add image to get variance=pix+sigma2det */
- variancePtr[iY][iX] += rawPtr[iY][iX];
- lastGoodPixelVariance=variancePtr[iY][iX];
- }
- else
- {
- rawPtr[iY][iX] = lastGoodPixelValue;
- variancePtr[iY][iX] = lastGoodPixelVariance;
- }
- }
- }
- amdlibFree2DArrayDouble(badPixels);
- amdlibFree2DArrayDoubleWrapping(rawPtr);
- amdlibFree2DArrayDoubleWrapping(variancePtr);
- amdlibFree2DArrayDouble(flatField);
- }
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Substract remanence
- *
- * This function substracts remanence on all frame. The remanence is computed
- * using amdlibREMANENCE value.
- *
- * @param rawData raw data.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibSubstractRemanence(amdlibRAW_DATA *rawData,
- amdlibERROR_MSG errMsg)
-{
- int iRegion;
- int iFrame;
- int iX, iY;
- amdlibDOUBLE **memoryOfPreviousImage;
- amdlibDOUBLE ***rawPtr;
- amdlibDOUBLE cal;
-
- amdlibLogTrace("amdlibSubstractRemanence()");
- amdlibLogWarningDetail("Substracting a remanence of %f",amdlibREMANENCE);
- for (iRegion = 0; iRegion < rawData->nbRegions; iRegion++)
- {
- /* Allocate Previous Image area */
- memoryOfPreviousImage = amdlibAlloc2DArrayDouble(
- rawData->region[iRegion].dimAxis[0],
- rawData->region[iRegion].dimAxis[1],
- errMsg);
- if (memoryOfPreviousImage == NULL)
- {
- return amdlibFAILURE;
- }
- rawPtr = amdlibWrap3DArrayDouble(rawData->region[iRegion].data,
- rawData->region[iRegion].dimAxis[0],
- rawData->region[iRegion].dimAxis[1],
- rawData->region[iRegion].dimAxis[2],
- errMsg);
- if (rawPtr == NULL)
- {
- amdlibFree2DArrayDouble(memoryOfPreviousImage);
- return amdlibFAILURE;
- }
- for (iFrame = 0; iFrame < rawData->region[iRegion].dimAxis[2]; iFrame++)
- {
- for (iY = 0; iY < rawData->region[iRegion].dimAxis[1]; iY++)
- {
- for (iX = 0; iX < rawData->region[iRegion].dimAxis[0]; iX++)
- {
- cal = rawPtr[iFrame][iY][iX] - amdlibREMANENCE *
- memoryOfPreviousImage[iY][iX];
- memoryOfPreviousImage[iY][iX] = rawPtr[iFrame][iY][iX];
- rawPtr[iFrame][iY][iX] = cal;
- }
- }
- }
- /*Free Previous Image area */
- amdlibFree2DArrayDouble(memoryOfPreviousImage);
- amdlibFree3DArrayDoubleWrapping(rawPtr);
- }
- /* Make Invalid the First frame (remanence unknown and uncompensated) */
- rawData->timeTag[0]=0.0;
- return amdlibSUCCESS;
-}
-/*___oOo___*/
diff --git a/amber/amdlibRefSpectrum.c b/amber/amdlibRefSpectrum.c
deleted file mode 100644
index 61a213b..0000000
--- a/amber/amdlibRefSpectrum.c
+++ /dev/null
@@ -1,623 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Functions and data related to reference spectrums
- */
-#define _POSIX_SOURCE 1
-
-/*
- * System Headers
- */
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "fitsio.h"
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/** Reference spectrum used during spectral calibration in JHK mode */
-static amdlibDOUBLE amdlibRefLowJHKSpectrumForCal[amdlibNB_BANDS]
- [amdlibNB_SPECTRAL_CHANNELS] =
-{
- {
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- -1.5733317E-03, -1.1917216E-04, -2.4046969E-04, -3.7889986E-04,
- 6.2059713E-05, -1.9999340E-04, 5.8205980E-05, -2.0363728E-04,
- -4.6164574E-04, -2.4589113E-04, -3.4312002E-04, -3.7088812E-05,
- -1.6353224E-04, -1.3574962E-04, -3.8079228E-04, -1.5107598E-04,
- -3.4872012E-04, -1.6392210E-04, -2.4976014E-04, -3.6536978E-04,
- -5.5517053E-04, -5.0148449E-04, -1.9429484E-04, -2.6544760E-04,
- -1.7156449E-04, -1.8886488E-04, -5.6292189E-05, -1.9997700E-04,
- 7.2581475E-05, -2.9939055E-04, -5.6139350E-05, -2.0836644E-04,
- -6.0716502E-05, -4.6055833E-05, -1.5051253E-04, -2.4556424E-04,
- -1.2726706E-04, -2.2723108E-04, -5.4420327E-04, -1.2684407E-04,
- 2.6880303E-05, -3.6696310E-04, -8.2507875E-05, -2.0338694E-05,
- -2.2669221E-05, -4.2206218E-05, -2.1947974E-04, -8.2626111E-06,
- 2.1349866E-05, 1.1860599E-05, 1.1273767E-04, -1.6934950E-04,
- -1.3691490E-04, -1.0078188E-04, -1.3362357E-04, 9.3083567E-05,
- -7.7289151E-05, 1.9604150E-04, 1.4479323E-04, 3.1441999E-05,
- -1.3701165E-04, -5.4109598E-05, -2.3203402E-05, 7.9520963E-05,
- -6.0383692E-05, 3.0677154E-04, 3.9564946E-04, 4.7399977E-04,
- 4.2246626E-04, 5.1628664E-04, 1.0089658E-03, 1.8462556E-03,
- 3.2429695E-03, 5.7187993E-03, 9.9434610E-03, 1.8168200E-02,
- 2.6520407E-02, 3.4534790E-02, 4.0805556E-02, 4.1993737E-02,
- 3.7710674E-02, 3.2978259E-02, 2.6563648E-02, 2.2251923E-02,
- 1.8266482E-02, 1.4416827E-02, 1.1306120E-02, 9.2432629E-03,
- 7.3791398E-03, 5.9208712E-03, 4.7005122E-03, 3.7486278E-03,
- 3.0240598E-03, 2.4251442E-03, 2.0461632E-03, 1.4433566E-03,
- 1.4666285E-03, 1.4114964E-03, 8.9475577E-04, 9.1793848E-04,
- 4.3259666E-04, 1.6250259E-04, 8.7615382E-04, 1.2216660E-03,
- 1.5063948E-03, 1.5013033E-03, 1.5255552E-03, 2.0396155E-03,
- 2.9851408E-03, 3.7945861E-03, 6.4278455E-03, 2.8644809E-02, 0.1616497,
- 0.3992507, 0.6968028, 0.9448382, 1.000000, 0.9686517, 0.8569408,
- 0.7245666, 0.5532997, 0.4343372, 0.3502789, 0.3113922, 0.2740446,
- 0.2255701, 0.1892572, 0.1589029, 0.1345442, 0.1198603, 0.1103444,
- 0.1006512, 9.2452481E-02, 8.0810815E-02, 6.4893760E-02, 5.4838181E-02,
- 4.6875302E-02, 4.2893562E-02, 3.5280500E-02, 2.7289165E-02,
- 2.3561576E-02, 1.8196234E-02, 1.5296325E-02, 1.1016913E-02,
- 7.3674852E-03, 4.5456444E-03, 2.8868862E-03, 2.3130141E-03,
- 1.6791791E-03, 1.5317193E-03, 1.1219541E-03, 6.8206375E-04,
- 2.9522783E-04, 3.7549951E-04, 4.4018260E-04, 1.4137267E-04,
- -6.9002199E-05, 4.8500186E-04, 1.6716102E-04, 4.2711166E-04,
- -1.8316349E-04, -1.4083233E-04, -7.7192955E-05, 1.3606899E-04,
- -6.4049396E-05, -1.9944916E-04, -9.3542067E-06, 7.1152044E-06,
- -3.7437025E-05, -1.4291603E-04, -2.1182784E-04, -8.6840344E-05,
- -1.7479001E-04, -1.5819486E-04, 1.2507278E-04, -3.2274160E-04,
- 1.1620150E-04, -1.0168986E-04, -1.6631978E-04, -2.9900760E-04,
- -3.6772175E-04, 1.8673432E-04, -2.0672781E-04, -2.8360140E-04,
- -1.6880875E-04, -2.0055012E-04, -1.5235673E-04, -3.1270509E-04,
- -2.0893691E-04, -2.0063351E-04, -7.5405565E-05, -3.4001633E-04,
- -3.1775850E-04, -4.6963475E-04, -3.2409298E-04, -4.8444880E-04,
- -7.6943790E-05, -2.4349977E-04, -1.6298298E-04, -1.9867347E-04,
- -9.6815034E-05, -6.0978742E-05, -2.3152115E-04, -4.1376648E-04,
- -1.0214599E-04, -2.3671484E-04, -4.1024803E-04, -4.7186823E-04,
- -3.1864044E-04, -2.2276987E-04,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000
- },
- {
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- -3.2107235E-04, 4.6065954E-05, -2.6629881E-05, -3.3467044E-05,
- 8.9580295E-05, 8.0471154E-06, 6.9558599E-05, 5.5100008E-06,
- -3.6889254E-05, -2.7884503E-06, -2.3409413E-05, 4.1059284E-05,
- 1.4703858E-05, 4.7176247E-05, -2.1226660E-05, 2.8148537E-05,
- -5.3379249E-06, 2.1912974E-05, 1.2145220E-05, 1.7560697E-05,
- -6.8327157E-05, -7.1510956E-05, 2.6310821E-05, -1.0590612E-05,
- 3.0954936E-05, 3.6192429E-05, 5.8316382E-05, 1.8092072E-05,
- 8.3686937E-05, -6.8597788E-06, 4.1190928E-05, -1.7080519E-06,
- 4.2815424E-05, 5.4837401E-05, 3.2095457E-05, -3.6181693E-06,
- 1.9064302E-05, 3.6908972E-05, -6.8217278E-06, 6.6461558E-05,
- 8.9907604E-05, -7.9636902E-07, 5.6960063E-05, 8.8787543E-05,
- 9.7431024E-05, 8.2615879E-05, 4.6434820E-05, 1.1947391E-04,
- 1.1519158E-04, 1.2209169E-04, 1.6072670E-04, 7.2348848E-05,
- 8.4019521E-05, 9.7020980E-05, 9.1232891E-05, 1.6010356E-04,
- 1.3070961E-04, 2.0276915E-04, 1.8632189E-04, 1.6831003E-04,
- 1.3107363E-04, 1.7320627E-04, 1.9137950E-04, 2.4298878E-04,
- 2.4831088E-04, 2.9991454E-04, 3.4220479E-04, 3.9178701E-04,
- 3.4825498E-04, 3.9900403E-04, 4.9615139E-04, 6.8857661E-04,
- 1.0667475E-03, 1.7044684E-03, 2.8247845E-03, 4.9565015E-03,
- 7.1704369E-03, 9.2264311E-03, 1.0928052E-02, 1.1268413E-02,
- 1.0194673E-02, 8.9544179E-03, 7.2780224E-03, 6.1696898E-03,
- 5.1716054E-03, 4.1428828E-03, 3.3720408E-03, 2.8573687E-03,
- 2.3929353E-03, 2.0476365E-03, 1.8009425E-03, 1.7151105E-03,
- 1.6545109E-03, 1.7413242E-03, 1.9840098E-03, 2.5006123E-03,
- 4.9075764E-03, 1.1443740E-02, 4.2885099E-02, 0.1590595, 0.3773241,
- 0.6848287, 0.9493395, 0.9993991, 0.9901925, 0.9966571, 0.9658914,
- 0.9519714, 0.9565546, 0.8786293, 0.6565691, 0.4414657, 0.2934012,
- 0.1588407, 4.6538245E-02, 9.9417595E-03, 4.9098604E-03, 4.0283226E-03,
- 3.5565449E-03, 3.0151808E-03, 2.4176822E-03, 1.9686033E-03,
- 1.6071247E-03, 1.4445251E-03, 1.2861951E-03, 9.8408223E-04,
- 9.5293223E-04, 7.0823944E-04, 7.0939364E-04, 7.2391354E-04,
- 7.4606301E-04, 8.0536737E-04, 8.4605248E-04, 8.2957384E-04,
- 6.0513080E-04, 5.0495769E-04, 4.1521873E-04, 4.2553002E-04,
- 3.0449766E-04, 3.3256790E-04, 4.1149688E-04, 3.4257831E-04,
- 2.6376065E-04, 2.1599304E-04, 1.4929264E-04, 9.7798096E-05,
- 2.7557520E-05, 1.2620793E-04, 6.4860862E-05, 2.0903046E-04,
- 1.2498361E-04, 7.4317635E-05, 6.5568129E-05, 5.5496781E-05,
- 1.9443057E-04, 1.2280187E-04, 2.1471251E-05, 1.1653985E-04,
- 4.9323731E-05, 1.4090868E-04, -4.4933342E-05, -5.1999556E-05,
- -3.6965059E-05, 7.7401237E-06, 1.3530042E-05, 7.6197175E-05,
- 5.5949735E-05, 7.7809982E-06, 3.3610926E-05, -2.5578227E-05,
- -8.6103806E-05, -1.4661687E-05, 4.7357644E-06, -1.4705853E-05,
- 3.6229914E-05, -6.5285640E-05, 6.1893115E-05, 3.3841654E-05,
- -3.3995570E-05, -4.7671536E-05, -2.1672018E-05, 1.1741660E-04,
- 2.9699142E-06, -5.4969361E-05, -1.3504388E-05, -3.1720912E-05,
- -3.6630270E-05, -8.0940372E-05, -4.8366455E-05, -4.4623317E-05,
- -1.5982076E-05, -5.5214372E-05, -6.0533832E-05, -1.0294130E-04,
- -2.8299350E-05, -1.1760571E-04, 4.7569083E-05, -1.3445375E-05,
- -2.4321431E-05, -2.2966036E-05, 1.8142573E-05, 3.7843802E-05,
- -2.4572868E-05, -8.3573403E-05, 1.9617289E-06, -3.5863628E-05,
- -8.3349849E-05, -7.4229516E-05, -5.5907414E-05, -1.2578599E-06,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000
- },
- {
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- -1.8819088E-04, 5.9819668E-05, 8.6507462E-06, -6.6798825E-06,
- 7.6418626E-05, 1.4353109E-05, 7.5696786E-05, 3.3591634E-05,
- -6.7604133E-06, 2.6802561E-05, 1.1362484E-05, 5.9970171E-05,
- 1.7587136E-05, 2.9993671E-05, -1.2433133E-05, 3.1958254E-05,
- -6.6475159E-06, 4.2731455E-05, 4.7507143E-05, 3.5380621E-05,
- -1.0903559E-05, 3.6580350E-06, 5.1609048E-05, 2.3900537E-05,
- 5.5289787E-05, 5.3486252E-05, 7.2056086E-05, 3.6787056E-05,
- 1.1365362E-04, 3.6965943E-05, 8.9755224E-05, 2.6356778E-05,
- 9.9356141E-05, 8.3560401E-05, 5.5157536E-05, 4.7795176E-05,
- 9.5084921E-05, 7.8702193E-05, 1.0363780E-04, 1.2406023E-04,
- 1.4933140E-04, 9.9781486E-05, 1.6562626E-04, 1.6341887E-04,
- 1.8230487E-04, 1.6103001E-04, 1.2674548E-04, 1.8666359E-04,
- 2.0404372E-04, 1.9673986E-04, 2.5412437E-04, 1.9286506E-04,
- 1.8800881E-04, 2.1491919E-04, 1.9298230E-04, 2.7765331E-04,
- 2.2783245E-04, 2.9739254E-04, 2.6976803E-04, 2.5972931E-04,
- 2.2048369E-04, 2.4333662E-04, 2.4218063E-04, 2.8689828E-04,
- 2.8396692E-04, 3.1365792E-04, 3.7361615E-04, 4.2970380E-04,
- 4.6273437E-04, 5.5042550E-04, 7.2532392E-04, 1.0579396E-03,
- 1.6997184E-03, 2.9906298E-03, 5.8374978E-03, 1.2872973E-02,
- 2.4903886E-02, 4.6361703E-02, 8.8574313E-02, 0.1519925, 0.2331196,
- 0.3517703, 0.4628852, 0.6124794, 0.7433454, 0.8390652, 0.8752457,
- 0.8936772, 0.8771752, 0.8926103, 0.9316412, 1.000000, 0.9692807,
- 0.9246415, 0.8073642, 0.6588188, 0.5060554, 0.3425836, 0.2012957,
- 8.6962819E-02, 2.4828117E-02, 7.5675827E-03, 4.4814027E-03,
- 2.8946868E-03, 1.9353306E-03, 1.4630328E-03, 1.0858242E-03,
- 8.1516267E-04, 8.1469031E-04, 6.2620227E-04, 5.4824539E-04,
- 3.9630619E-04, 3.1806948E-04, 3.1660625E-04, 2.1157876E-04,
- 1.7404146E-04, 2.0480197E-04, 1.8842172E-04, 2.1997139E-04,
- 1.8177080E-04, 1.8670780E-04, 1.5284002E-04, 1.2944288E-04,
- 1.7148946E-04, 2.7134284E-04, 1.9492944E-04, 2.9092337E-04,
- 1.1056810E-04, 1.6621510E-04, 1.5578514E-04, 1.2368207E-04,
- 1.2733438E-04, 1.1667961E-04, 8.4793151E-05, -1.0376571E-06,
- 1.4398598E-05, -3.7098092E-05, 8.5780157E-05, 2.8646604E-05,
- 1.2183939E-04, 1.8073022E-04, 2.2431283E-04, 2.5531347E-04,
- 3.1356711E-04, 3.4146660E-04, 3.5022173E-04, 3.8858660E-04,
- 7.2828098E-04, 9.5058460E-04, 1.5267507E-03, 2.1246579E-03,
- 2.3551865E-03, 2.2587983E-03, 2.1546897E-03, 1.9030331E-03,
- 1.9702727E-03, 1.8917738E-03, 1.8183842E-03, 1.3188934E-03,
- 1.2057900E-03, 7.4187794E-04, 4.4727765E-04, 2.5479673E-04,
- 1.2539627E-04, 2.3654951E-05, -3.6108362E-05, 4.1196156E-05,
- 3.2947148E-05, 3.2257289E-05, -1.5749540E-05, -7.0530412E-05,
- -1.0350982E-05, -3.3443166E-06, 2.2379063E-06, 6.0468032E-05,
- -3.4003755E-05, 4.8555416E-05, 1.8296641E-05, 1.6044325E-05,
- -4.9977339E-06, -3.2215608E-05, 7.0264658E-05, 5.4403217E-06,
- -5.7883812E-05, 2.2786793E-05, 7.6668102E-06, 1.1829807E-05,
- -4.2542728E-05, -1.6310720E-05, -3.5310026E-05, -1.3429714E-05,
- -5.0266015E-05, -4.6398800E-05, -1.2699865E-04, -2.6550726E-05,
- -1.7353594E-04, 1.9257257E-05, -1.5565725E-05, -1.2637637E-05,
- -9.2405180E-06, 2.1336323E-06, -2.9445862E-06, -1.7829912E-05,
- -7.7434284E-05, 1.4523114E-05, -3.5373068E-05, -5.3970693E-05,
- -4.7709098E-05, -2.1409969E-05, 1.1017060E-05,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
- 0.000000, 0.000000
- }
-};
-
-/** Reference spectral dispersion for JHK mode. */
-/* The first and last values of this table which do not belong to [1000 -
- * 3500] are not significant. They have been added to suppress discontinuity
- * disturbing the FFT used to compute wavelenght table offset. */
-static amdlibDOUBLE amdlibRefLowJHKSpectralDispersion[amdlibNB_SPECTRAL_CHANNELS] =
-{
-/* new law could be */
-/* 8302.704, 8278.158, 8253.612, 8229.099, 8204.520, 8179.974, 8155.428, */
-/* 8130.882, 8106.336, 8081.79, 8057.244, 8032.698, 8008.152, 7983.606, */
-/* 7959.06, 7934.514, 7909.968, 7885.422, 7860.876, 7836.33, 7811.784, */
-/* 7787.238, 7762.692, 7738.146, 7713.60, 7689.054, 7664.508, 7639.962, */
-/* 7615.416, 7590.87, 7566.324, 7541.778, 7517.232, 7492.686, 7468.14, */
-/* 7443.594, 7419.048, 7394.502, 7369.956, 7345.41, 7320.864, 7296.318, */
-/* 7271.772, 7247.226, 7222.68, 7198.134, 7173.588, 7149.042, 7124.496, */
-/* 7099.95, 7075.404, 7050.858, 7026.312, 7001.766, 6977.22, 6952.674, */
-/* 6928.128, 6903.582, 6879.036, 6854.49, 6829.944, 6805.398, 6780.852, */
-/* 6756.306, 6731.76, 6707.214, 6682.668, 6658.122, 6633.576, 6609.03, */
-/* 6584.484, 6559.938, 6535.392, 6510.846, 6486.30, 6461.754, 6437.208, */
-/* 6412.662, 6388.116, 6363.57, 6339.024, 6314.478, 6289.932, 6265.386, */
-/* 6240.84, 6216.294, 6191.748, 6167.202, 6142.656, 6118.11, 6093.564, */
-/* 6069.018, 6044.472, 6019.926, 5995.38, 5970.834, 5946.288, 5921.742, */
-/* 5897.196, 5872.65, 5848.104, 5823.558, 5799.012, 5774.466, 5749.92, */
-/* 5725.374, 5700.828, 5676.282, 5651.736, 5627.19, 5602.644, 5578.098, */
-/* 5553.552, 5529.006, 5504.46, 5479.914, 5455.368, 5430.822, 5406.276, */
-/* 5381.73, 5357.184, 5332.638, 5308.092, 5283.546, 5259.00, 5234.454, */
-/* 5209.908, 5185.362, 5160.816, 5136.27, 5111.724, 5087.178, 5062.632, */
-/* 5038.086, 5013.54, 4988.994, 4964.448, 4939.902, 4915.356, 4890.81, */
-/* 4866.264, 4841.718, 4817.172, 4792.626, 4768.08, 4743.534, 4718.988, */
-/* 4694.442, 4669.896, 4645.35, 4620.804, 4596.258, 4571.712, 4547.166, */
-/* 4522.62, 4498.074, 4473.528, 4448.982, 4424.436, 4399.89, 4375.344, */
-/* 4350.798, 4326.252, 4301.706, 4277.16, 4252.614, 4228.068, 4203.522, */
-/* 4178.976, 4154.43, 4129.884, 4105.338, 4080.792, 4056.246, 4031.70, */
-/* 4007.154, 3982.608, 3958.062, 3933.516, 3908.970, 3884.424, 3859.878, */
-/* 3835.332, 3810.786, 3786.240, 3761.694, 3737.148, 3712.602, 3688.056, */
-/* 3663.510, 3638.964, 3614.418, 3589.872, 3565.326, 3540.780, 3516.234, */
-/* 3491.688, 3467.142, 3442.596, 3418.050, 3393.504, 3368.958, 3344.412, */
-/* 3319.866, 3295.32, 3270.774, 3246.228, 3221.682, 3197.136, 3148.044, */
-/* 3123.498, 3098.952, 3073.797, 3048.053, 3021.742, 2994.886, 2967.508, */
-/* 2939.627, 2911.267, 2882.448, 2853.193, 2823.523, 2793.460, 2763.025, */
-/* 2732.240, 2701.128, 2669.708, 2638.004, 2733.059, 2698.242, 2663.421, */
-/* 2628.599, 2593.778, 2558.957, 2524.136, 2489.315, 2454.494, 2419.673, */
-/* 2384.852, 2350.031, 2315.210, 2280.389, 2245.568, 2210.747, 2175.926, */
-/* 2141.105, 2106.284, 2071.463, 2036.642, 2001.821, 1967.000, 1932.178, */
-/* 1897.357, 1922.179, 1889.707, 1857.235, 1824.763, 1792.291, 1759.819, */
-/* 1727.347, 1694.875, 1662.403, 1629.931, 1597.459, 1564.987, 1532.514, */
-/* 1500.042, 1467.569, 1376.652, 1356.504, 1336.355, 1316.207, 1296.058, */
-/* 1275.910, 1255.761, 1235.613, 1215.464, 1195.316, 1175.167, 1155.019, */
-/* 1134.870, 1114.722, 1094.599, 1074.452, 1054.303, 1034.155, 1014.008, */
-/* 993.8599, 973.7119, 953.5639, 953.046, 952.957, 952.8680, 952.7790, */
-/* 952.690, 951.6010, 951.5120, 951.4230, 945.3340, 937.245, 929.1560, */
-/* 921.0670, 912.9780, 904.8890, 896.800, 888.7110, 880.6220, 872.5330, */
-/* 864.4440, 856.355, 848.2660, 840.1770, 832.0880, 823.9990, 815.910, */
-/* 807.8210, 799.7320, 791.6430, 783.5540, 775.465, 767.3760, 759.2870, */
-/* 751.1980, 743.1090, 735.020, 726.9310, 718.8420, 710.7530, 702.6640, */
-/* 694.575, 686.4860, 678.3970, 670.3080, 662.2190, 654.130, 646.0410, */
-/* 637.9520, 629.8630, 621.7740, 613.685, 605.5960, 597.5070, 589.4180, */
-/* 581.3290, 573.240, 565.1510, 557.0620, 548.9730, 540.8840, 532.795, */
-/* 524.7060, 516.6170, 508.5280, 500.4390, 492.350, 484.2610, 476.1720, */
-/* 468.0830, 459.9940, 451.905, 443.8160, 435.7270, 427.6380, 419.5490, */
-/* 411.460, 403.3710, 395.2820, 387.1930, 379.1040, 371.015, 362.9260, */
-/* 354.8370, 346.7480, 338.6590, 330.570, 322.4810, 314.3920, 306.3030, */
-/* 298.2140, 290.125, 282.0360, 273.9470, 265.8580, 257.7690, 249.680, */
-/* 241.5910, 233.5020, 225.4130, 217.3240, 209.235, 201.1460, 193.0570, */
-/* 184.9680, 176.8790, 168.790, 160.7010, 152.6120, 144.5230, 136.4340, */
-/* 128.345, 120.2560, 112.1670, 104.0780, 95.98900, 87.9000, 79.81100, */
-/* 71.72200, 63.63300, 55.54400, 47.4550, 39.36600, 31.27700, 23.18800, */
-/* 15.09900, 7.01000, -1.07900, -9.16800, -17.2570, -25.3460, -33.435, */
-/* -41.5240, -49.6130, -57.7020, -65.7910, -73.880, -81.9690, -90.0580, */
-/* -98.1470, -106.236, -114.32, -122.414, -130.503, -138.592, -146.681, */
-/* -154.77, -162.859, -170.948, -179.037, -187.126, -195.21, -203.304, */
-/* -211.393, -219.482, -227.571, -235.66, -243.749, -251.838, -259.927, */
-/* -268.016, -276.10, -284.194, -292.283, -300.372, -308.461, -316.55, */
-/* -324.639, -332.728, -340.817, -348.906, -356.99, -365.084, -373.173, */
-/* -381.262, -389.351, -397.44, -405.529, -413.618, -421.707, -429.796, */
-/* -437.88, -445.974, -454.063, -462.152, -470.241, -478.33, -486.419, */
-/* -494.508, -502.597, -510.686, -518.77, -526.864, -534.953, -543.042, */
-/* -551.131, -559.22, -567.309, -575.398, -583.487, -591.576, -599.66, */
-/* -607.754, -615.843, -623.932, -632.021, -640.11, -648.199, -656.288, */
-/* -664.377, -672.466, -680.55, -688.644, -696.733, -704.822, -712.911, */
-/* -721.00, -729.089, -737.178, -745.267, -753.356, -761.44, -769.534, */
-/* -777.623 */
-
- 8302.704, 8278.158, 8253.612, 8229.099, 8204.520,
- 8179.974, 8155.428, 8130.882, 8106.336, 8081.790,
- 8057.244, 8032.698, 8008.152, 7983.606, 7959.060,
- 7934.514, 7909.968, 7885.422, 7860.876, 7836.330,
- 7811.784, 7787.238, 7762.692, 7738.146, 7713.600,
- 7689.054, 7664.508, 7639.962, 7615.416, 7590.870,
- 7566.324, 7541.778, 7517.232, 7492.686, 7468.140,
- 7443.594, 7419.048, 7394.502, 7369.956, 7345.410,
- 7320.864, 7296.318, 7271.772, 7247.226, 7222.680,
- 7198.134, 7173.588, 7149.042, 7124.496, 7099.950,
- 7075.404, 7050.858, 7026.312, 7001.766, 6977.220,
- 6952.674, 6928.128, 6903.582, 6879.036, 6854.490,
- 6829.944, 6805.398, 6780.852, 6756.306, 6731.760,
- 6707.214, 6682.668, 6658.122, 6633.576, 6609.030,
- 6584.484, 6559.938, 6535.392, 6510.846, 6486.300,
- 6461.754, 6437.208, 6412.662, 6388.116, 6363.570,
- 6339.024, 6314.478, 6289.932, 6265.386, 6240.840,
- 6216.294, 6191.748, 6167.202, 6142.656, 6118.110,
- 6093.564, 6069.018, 6044.472, 6019.926, 5995.380,
- 5970.834, 5946.288, 5921.742, 5897.196, 5872.650,
- 5848.104, 5823.558, 5799.012, 5774.466, 5749.920,
- 5725.374, 5700.828, 5676.282, 5651.736, 5627.190,
- 5602.644, 5578.098, 5553.552, 5529.006, 5504.460,
- 5479.914, 5455.368, 5430.822, 5406.276, 5381.730,
- 5357.184, 5332.638, 5308.092, 5283.546, 5259.000,
- 5234.454, 5209.908, 5185.362, 5160.816, 5136.270,
- 5111.724, 5087.178, 5062.632, 5038.086, 5013.540,
- 4988.994, 4964.448, 4939.902, 4915.356, 4890.810,
- 4866.264, 4841.718, 4817.172, 4792.626, 4768.080,
- 4743.534, 4718.988, 4694.442, 4669.896, 4645.350,
- 4620.804, 4596.258, 4571.712, 4547.166, 4522.620,
- 4498.074, 4473.528, 4448.982, 4424.436, 4399.890,
- 4375.344, 4350.798, 4326.252, 4301.706, 4277.160,
- 4252.614, 4228.068, 4203.522, 4178.976, 4154.430,
- 4129.884, 4105.338, 4080.792, 4056.246, 4031.700,
- 4007.154, 3982.608, 3958.062, 3933.516, 3908.970,
- 3884.424, 3859.878, 3835.332, 3810.786, 3786.240,
- 3761.694, 3737.148, 3712.602, 3688.056, 3663.510,
- 3638.964, 3614.418, 3589.872, 3565.326, 3540.780,
- 3516.234, 3491.688, 3467.142, 3442.596, 3418.050,
- 3393.504, 3368.958, 3344.412, 3319.866, 3295.32,
- 3270.774, 3246.228, 3221.682, 3197.136, 3148.044,
- 3123.498, 3098.952, 3073.797, 3048.053, 3021.742,
- 2994.886, 2967.508, 2939.627, 2911.267, 2882.448,
- 2853.193, 2823.523, 2793.460, 2763.025, 2732.240,
- 2701.128, 2669.708, 2638.004, 2606.037, 2573.828,
- 2541.400, 2508.773, 2475.970, 2443.012, 2409.922,
- 2376.719, 2343.427, 2310.067, 2276.661, 2243.229,
- 2209.795, 2176.379, 2143.004, 2109.691, 2076.461,
- 2043.337, 2010.339, 1977.491, 1944.813, 1912.327,
- 1880.054, 1848.017, 1816.237, 1784.736, 1753.535,
- 1722.656, 1692.121, 1661.952, 1632.169, 1602.796,
- 1573.853, 1545.362, 1517.344, 1489.823, 1462.818,
- 1436.353, 1410.448, 1385.125, 1360.406, 1336.313,
- 1312.867, 1290.089, 1268.003, 1246.628, 1225.988,
- 1206.103, 1186.995, 1168.687, 1151.199, 1134.553,
- 1118.772, 1103.876, 1089.887, 1076.828, 1064.719,
- 1053.582, 1043.440, 1034.313, 1026.224, 1018.135,
- 1010.046, 1001.957, 993.8680, 985.7790, 977.6900,
- 969.6010, 961.5120, 953.4230, 945.3340, 937.2450,
- 929.1560, 921.0670, 912.9780, 904.8890, 896.8000,
- 888.7110, 880.6220, 872.5330, 864.4440, 856.3550,
- 848.2660, 840.1770, 832.0880, 823.9990, 815.9100,
- 807.8210, 799.7320, 791.6430, 783.5540, 775.4650,
- 767.3760, 759.2870, 751.1980, 743.1090, 735.0200,
- 726.9310, 718.8420, 710.7530, 702.6640, 694.5750,
- 686.4860, 678.3970, 670.3080, 662.2190, 654.1300,
- 646.0410, 637.9520, 629.8630, 621.7740, 613.6850,
- 605.5960, 597.5070, 589.4180, 581.3290, 573.2400,
- 565.1510, 557.0620, 548.9730, 540.8840, 532.7950,
- 524.7060, 516.6170, 508.5280, 500.4390, 492.3500,
- 484.2610, 476.1720, 468.0830, 459.9940, 451.9050,
- 443.8160, 435.7270, 427.6380, 419.5490, 411.4600,
- 403.3710, 395.2820, 387.1930, 379.1040, 371.0150,
- 362.9260, 354.8370, 346.7480, 338.6590, 330.5700,
- 322.4810, 314.3920, 306.3030, 298.2140, 290.1250,
- 282.0360, 273.9470, 265.8580, 257.7690, 249.6800,
- 241.5910, 233.5020, 225.4130, 217.3240, 209.2350,
- 201.1460, 193.0570, 184.9680, 176.8790, 168.7900,
- 160.7010, 152.6120, 144.5230, 136.4340, 128.3450,
- 120.2560, 112.1670, 104.0780, 95.98900, 87.90000,
- 79.81100, 71.72200, 63.63300, 55.54400, 47.45500,
- 39.36600, 31.27700, 23.18800, 15.09900, 7.010000,
- -1.07900, -9.16800, -17.2570, -25.3460, -33.4350,
- -41.5240, -49.6130, -57.7020, -65.7910, -73.8800,
- -81.9690, -90.0580, -98.1470, -106.236, -114.325,
- -122.414, -130.503, -138.592, -146.681, -154.770,
- -162.859, -170.948, -179.037, -187.126, -195.215,
- -203.304, -211.393, -219.482, -227.571, -235.660,
- -243.749, -251.838, -259.927, -268.016, -276.105,
- -284.194, -292.283, -300.372, -308.461, -316.550,
- -324.639, -332.728, -340.817, -348.906, -356.995,
- -365.084, -373.173, -381.262, -389.351, -397.440,
- -405.529, -413.618, -421.707, -429.796, -437.885,
- -445.974, -454.063, -462.152, -470.241, -478.330,
- -486.419, -494.508, -502.597, -510.686, -518.775,
- -526.864, -534.953, -543.042, -551.131, -559.220,
- -567.309, -575.398, -583.487, -591.576, -599.665,
- -607.754, -615.843, -623.932, -632.021, -640.110,
- -648.199, -656.288, -664.377, -672.466, -680.555,
- -688.644, -696.733, -704.822, -712.911, -721.000,
- -729.089, -737.178, -745.267, -753.356, -761.445,
- -769.534, -777.623
-};
-
-/**
- * Get the reference spectrum for low JHK spectral calibration
- *
- * @param bandState state of the shutters for each band; 0 shutters are closed
- * and 1 shutters are open.
- * @param refSpec array where reference spectrum will be stored.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibGetRefLowJHKSpectrumForCal
- (int bandState[amdlibNB_BANDS],
- amdlibDOUBLE refSpec[amdlibNB_SPECTRAL_CHANNELS])
-{
- int l, band;
- amdlibLogTrace("amdlibGetRefSpectrumForLowJHKCal()");
-
- /* Reset reference spectrum */
- for (l = 0; l < amdlibNB_SPECTRAL_CHANNELS; l++)
- {
- refSpec[l] = 0.0;
- }
-
- /* Set reference spectrum by summing J, H and K spectrum according to status
- * of band shutters */
- for (band = amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- if (bandState[band] == 1)
- {
- for (l = 0; l < amdlibNB_SPECTRAL_CHANNELS; l++)
- {
- refSpec[l] += amdlibRefLowJHKSpectrumForCal[band][l];
- }
- }
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Get the reference spectral dispersion table for low JHK mode
- *
- * @param specTable table where spectral dispersion will be stored.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibGetRefLowJHKSpectralDispersion
- (amdlibDOUBLE specTable[amdlibNB_SPECTRAL_CHANNELS])
-{
- int l;
- amdlibLogTrace("amdlibGetRefJHKSpectralDispersion()");
-
- /* Copy reference spectral dispersion table */
- for (l = 0; l < amdlibNB_SPECTRAL_CHANNELS; l++)
- {
- specTable[l] = amdlibRefLowJHKSpectralDispersion[l];
- }
-
- return amdlibSUCCESS;
-}
-/*___oOo__*/
diff --git a/amber/amdlibRegion.c b/amber/amdlibRegion.c
deleted file mode 100644
index f4dfeea..0000000
--- a/amber/amdlibRegion.c
+++ /dev/null
@@ -1,600 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Functions to handle regions.
- *
- * The amdlibREGION structures are these containing all information describing
- * regions of the detector and coming from either IMAGING_DETECTOR or
- * IMAGING_DATA binary tables.
- */
-
-#define _POSIX_SOURCE 1
-
-/*
- * System Headers
- */
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "fitsio.h"
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/*
- * Protected functions
- */
-/**
- * Allocate memory for storing information of regions.
- *
- * This function allocates memory for storing information (not the corresponding
- * data) of N regions.
- *
- * @param regions array of amdlibREGION structures allocated.
- * @param nbRegions size of the regions array.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAllocateRegions(amdlibREGION **regions,
- int nbRegions)
-{
- amdlibLogTrace("amdlibAllocateRegions()");
-
- /* First free previous allocated memory */
- amdlibFreeRegions(regions, nbRegions);
-
- /* Allocates memory to store region information (not data) */
- *regions = calloc(sizeof(amdlibREGION), nbRegions);
- if (*regions == NULL)
- {
- return amdlibFAILURE;
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Free memory allocated for regions.
- *
- * This function frees memory corresponding to the table of regions, with the
- * associated memory containing the dectector data.
- *
- * @param regions array of amdlibREGION structures to free.
- * @param nbRegions size of the regions array.
- */
-void amdlibFreeRegions(amdlibREGION *regions[], int nbRegions )
-{
- amdlibREGION *regionTab;
-
- amdlibLogTrace("amdlibFreeRegions()");
-
- /* Free allocated memory */
- if (*regions != NULL)
- {
- int i;
- regionTab = *regions;
- for (i = 0; i < nbRegions; i++)
- {
- if (regionTab[i].data != NULL)
- {
- free(regionTab[i].data);
- regionTab[i].data = NULL;
- }
- }
- free(*regions);
- *regions = NULL;
- }
-}
-
-/**
- * Read information and store it into regions.
- *
- * This function reads information about the regions from header of the
- * IMAGING_DETECTOR binary table and store them into the corresponding data
- * structures. This concerns, for each region, to :
- * \li the region number
- * \li the detector number
- * \li the entrance ports
- * \li the correlation type
- * \li the region name
- * \li the corner position
- * \li the gain
- * \li the dimension of the data array
- * \li the reference pixel information
- *
- * @param filePtr name of the FITS file containing raw data.
- * @param regions array of regions to store information.
- * @param nbRegions size of the regions array.
- * @param nbTel number of telescopes used.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibReadRegionInfo(fitsfile *filePtr,
- amdlibREGION **regions,
- int nbRegions,
- int nbTel,
- amdlibERROR_MSG errMsg)
-{
-#define amdlibIMAGING_DETECTOR_NB_COLS 10
- int status = 0;
- int anynull = 0;
- int intValues[256];
- double doubleValues[256];
- char fitsioMsg[256];
- int i, j;
- int nbFrames;
- int colNum[amdlibIMAGING_DETECTOR_NB_COLS];
- char* colName[amdlibIMAGING_DETECTOR_NB_COLS] = {
- "REGION ", "DETECTOR", "PORTS ", "CORRELATION",
- "REGNAME ", "CORNER ", "GAIN ", "NAXIS ",
- "CRVAL ", "CRPIX "};
- /*, "CTYPE ", "CD ", "DMP ", "DMC " */
- amdlibREGION *regionTab;
-
- amdlibLogTrace("amdlibReadRegionInfo()");
-
- /* Reset error message */
- memset(errMsg, '\0', sizeof(amdlibERROR_MSG));
-
- /* Allocates memory for 'region information' */
- if (amdlibAllocateRegions(regions, nbRegions) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for regions");
- return amdlibFAILURE;
- }
- regionTab = *regions;
-
- /* Go to the IMAGING_DETECTOR binary table */
- if (fits_movnam_hdu(filePtr, BINARY_TBL,
- "IMAGING_DETECTOR", 0, &status) != 0)
- {
- amdlibReturnFitsError("IMAGING_DETECTOR");
- }
- /* Retreive the column number */
- for (i=0;i<amdlibIMAGING_DETECTOR_NB_COLS;i++)
- {
- if (fits_get_colnum(filePtr,CASESEN,colName[i],&colNum[i],&status) != 0)
- {
- /* Special treatment for 'NAXIS' column: The name of the column of
- * the first files created by AMBER DCS is 'NAXES' instead of
- * 'NAXIS' */
- if (strncmp(colName[i], "NAXIS", 5) == 0)
- {
- status = 0;
- if (fits_get_colnum(filePtr,CASESEN, "NAXES" ,
- &colNum[i], &status) != 0)
- {
- amdlibReturnFitsError(colName[i]);
- }
- }
- else
- {
- amdlibReturnFitsError(colName[i]);
- }
- }
- }
- /* Get region numbers */
- if (fits_read_col(filePtr, TINT, colNum[0], 1, 1, nbRegions, NULL,
- (void *)intValues, &anynull, &status) != 0)
- {
- amdlibReturnFitsError(colName[0]);
- }
- for(i = 0; i < nbRegions; i++)
- {
- regionTab[i].regionNumber = intValues[i];
- }
-
- /* Get detector number */
- if (fits_read_col(filePtr, TINT, colNum[1], 1, 1, nbRegions, NULL,
- (void *)intValues, &anynull, &status) != 0)
- {
- amdlibReturnFitsError(colName[1]);
- }
- for(i = 0; i < nbRegions; i++)
- {
- regionTab[i].detectorNumber = intValues[i];
- }
-
- /* Get entrance ports */
- if (fits_read_col(filePtr, TINT, colNum[2] , 1, 1, nbTel*nbRegions, NULL,
- (void *)intValues, &anynull, &status) != 0)
- {
- amdlibReturnFitsError(colName[2]);
- }
- for(i = 0; i < nbRegions; i++)
- {
- for (j = 0; j < amdlibNB_TEL; j++)
- {
- regionTab[i].ports[j] = 0;
- }
- for (j = 0; j < nbTel; j++)
- {
- regionTab[i].ports[j] = intValues[nbTel*i + j];
- }
- }
-
- /* Get correlation type */
- if (fits_read_col(filePtr, TINT, colNum[3], 1, 1, nbRegions, NULL,
- (void *)intValues, &anynull, &status) != 0)
- {
- amdlibReturnFitsError(colName[3]);
- }
- for(i = 0; i < nbRegions; i++)
- {
- regionTab[i].correlation = intValues[i];
- }
-
- /* Get region name */
- for(i = 0; i < nbRegions; i++)
- {
- char buffer[4096];
- char *ptr[1];
-
- memset(buffer, '\0', sizeof(buffer));
- ptr[0] = buffer;
- if (fits_read_col(filePtr, TSTRING, colNum[4], (i+1), 1, 1, (char *)"",
- ptr, &anynull, &status) != 0)
- {
- amdlibReturnFitsError(colName[4]);
- }
- strncpy (regionTab[i].regionName,ptr[0], 15);
- }
-
- /* Get corner position */
- if (fits_read_col(filePtr, TINT, colNum[5], 1, 1, 2*nbRegions, NULL,
- (void *)intValues, &anynull, &status) != 0)
- {
- amdlibReturnFitsError(colName[5]);
- }
- for(i = 0; i < nbRegions; i++)
- {
- for (j = 0; j < 2; j++)
- {
- regionTab[i].corner[j] = intValues[2*i + j];
- }
- }
-
- /* Get gain or set gain if overriden by user */
- if (amdlibGetUserPref(amdlibUSE_GAIN).set==amdlibTRUE)
- for(i = 0; i < nbRegions; i++)
- {
- regionTab[i].gain = amdlibGetUserPref(amdlibUSE_GAIN).value;
- }
- else
- {
- if (fits_read_col(filePtr, TDOUBLE, colNum[6], 1, 1, nbRegions, NULL,
- (void *)doubleValues, &anynull, &status) != 0)
- {
- amdlibReturnFitsError(colName[6]);
- }
- for(i = 0; i < nbRegions; i++)
- {
- regionTab[i].gain = doubleValues[i];
- }
- }
-
- /* Get dimension of the data array */
- if (fits_read_col(filePtr, TINT, colNum[7], 1, 1, 2*nbRegions, NULL,
- (void *)intValues, &anynull, &status) != 0)
- {
- amdlibReturnFitsError(colName[7]);
- }
- for(i = 0; i < nbRegions; i++)
- {
- for (j = 0; j < 2; j++)
- {
- regionTab[i].dimAxis[j] = intValues[2*i + j];
- }
- }
-
- /* Get coordinates at the reference pixels */
- if (fits_read_col(filePtr, TDOUBLE, colNum[8], 1, 1, 2*nbRegions, NULL,
- (void *)doubleValues, &anynull, &status) != 0)
- {
- amdlibReturnFitsError(colName[8]);
- }
- for(i = 0; i < nbRegions; i++)
- {
- for (j = 0; j < 2; j++)
- {
- regionTab[i].crVal[j] = doubleValues[2*i + j];
- }
- }
- /* Get the reference pixels */
- if (fits_read_col(filePtr, TDOUBLE, colNum[9], 1, 1, 2*nbRegions, NULL,
- (void *)doubleValues, &anynull, &status) != 0)
- {
- amdlibReturnFitsError(colName[9]);
- }
- for(i = 0; i < nbRegions; i++)
- {
- for (j = 0; j < 2; j++)
- {
- regionTab[i].crPix[j] = doubleValues[2*i + j];
- }
- }
-
- /* Go to the IMAGING_DATA binary table */
- if (fits_movnam_hdu(filePtr, BINARY_TBL,
- "IMAGING_DATA", 0, &status) != 0)
- {
- amdlibReturnFitsError("IMAGING_DATA");
- }
-
- /* Get the number of frames in the table */
- if (fits_read_key(filePtr, TINT, "NAXIS2", &nbFrames,
- NULL, &status) != 0)
- {
- amdlibReturnFitsError("NAXIS2");
- }
- for(i = 0; i < nbRegions; i++)
- {
- regionTab[i].dimAxis[2] = nbFrames;
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Read detector data and store them into regions.
- *
- * This function reads the detector data, in the IMAGING_DATA binary table,
- * for all regions and store them into the corresponding data structures.
-
- * @param filePtr name of the FITS file containing raw data.
- * @param regions array of regions to store information.
- * @param nbRegions size of the regions array.
- * @param firstFrame first frame to read.
- * @param nbFrames number of frames.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibReadRegionData (fitsfile *filePtr,
- amdlibREGION *regions,
- int nbRegions,
- int firstFrame,
- int nbFrames,
- amdlibERROR_MSG errMsg)
-{
- int status = 0;
- int anynull = 0;
- char fitsioMsg[256];
- int i, j;
- int nbFields;
- char fieldName[32];
- char key[16];
-
- amdlibLogTrace("amdlibReadRegionData()");
-
- /* Check first frame index and number of frames to be read */
- if ((firstFrame < 1) || (firstFrame > regions[0].dimAxis[2]))
- {
- amdlibSetErrMsg("Invalid first frame index '%d'"
- " Should be in [1..%d] range", firstFrame,
- regions[0].dimAxis[2]);
- return amdlibFAILURE;
- }
- if ((nbFrames < 0) || (nbFrames > (regions[0].dimAxis[2] - firstFrame + 1)))
- {
- amdlibSetErrMsg("Invalid number of frames to be "
- "read '%d'. Should be in [1..%d] range", nbFrames,
- (regions[0].dimAxis[2] - firstFrame + 1));
- return amdlibFAILURE;
- }
-
- /* Reset error message */
- memset(errMsg, '\0', sizeof(amdlibERROR_MSG));
-
- /* Go to the IMAGING_DATA binary table */
- if (fits_movnam_hdu(filePtr, BINARY_TBL,
- "IMAGING_DATA", 0, &status) != 0)
- {
- amdlibReturnFitsError("IMAGING_DATA");
- }
-
- /* Get the number of fields in the table */
- if (fits_read_key(filePtr, TINT, "TFIELDS", &nbFields,
- NULL, &status) != 0)
- {
- amdlibReturnFitsError("TFIELDS");
- }
-
- /* For each field in the table */
- for(i = 0; i < nbFields; i++)
- {
- /* Get the name of the field */
- sprintf(key, "TTYPE%d", i + 1);
- status = 0;
- if (fits_read_key(filePtr, TSTRING, key, fieldName,
- NULL, &status) != 0)
- {
- amdlibReturnFitsError(key);
- }
-
- /* If this name matches with a region name */
- for (j=0; j < nbRegions; j++)
- {
- if (strcmp(regions[j].regionName, fieldName) == 0)
- {
- int imageSize;
- int nbOfElements;
-
- /* Compute the size of each image */
- imageSize = regions[j].dimAxis[0] * regions[j].dimAxis[1];
-
- /* Compute the number of elements in the data array */
- nbOfElements = imageSize * nbFrames;
-
- /* Allocate memory for data */
- regions[j].data = calloc(sizeof(amdlibDOUBLE), nbOfElements);
- if ( regions[j].data == NULL)
- {
- amdlibSetErrMsg("Could not allocate memory for regions");
- return amdlibFAILURE;
- }
-
- /* Load the corresponding data */
- if (fits_read_col
- (filePtr, TDOUBLE, i+1, firstFrame, 1, nbOfElements, NULL,
- (void *)regions[j].data, &anynull, &status) != 0)
- {
- amdlibReturnFitsError("DATAi");
- }
-
- /* Set again the number of frames. It can differ from the
- * number of frames available in file */
- regions[j].dimAxis[2] = nbFrames;
-
- break;
- }
- }
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Sets regions data in IMAGING_DATA binary table of the specified file.
- *
- * This function simply substitutes the detector data stored in the
- * IMAGING_DATA binary table of the specified file, with the data contained
- * in the region data structure.
- *
- * @warning No check is performed concerning the dimension of data array.
- *
- * @param filePtr name of the FITS file to be modified.
- * @param regions array of regions where information is.
- * @param nbRegions size of the regions array.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibWriteRegionData (fitsfile *filePtr,
- amdlibREGION *regions,
- int nbRegions,
- amdlibERROR_MSG errMsg)
-{
- int status = 0;
- char fitsioMsg[256];
- int i, j;
- int nbFields;
- char fieldName[32];
- char key[16];
- int nbFrames = 0;
- int pCount,tableWidth;
-
- amdlibLogTrace("amdlibWriteRegionData()");
-
- /* Reset error message */
- memset(errMsg, '\0', sizeof(amdlibERROR_MSG));
-
- /* Go to the IMAGING_DATA binary table */
- if (fits_movnam_hdu(filePtr, BINARY_TBL,
- "IMAGING_DATA", 0, &status) != 0)
- {
- amdlibReturnFitsError("IMAGING_DATA");
- }
-
- if (fits_read_key(filePtr, TINT, "TFIELDS", &nbFields,
- NULL, &status) != 0)
- {
- amdlibReturnFitsError("TFIELDS");
- }
-
- /* For each field in the table */
- for(i = 0; i < nbFields; i++)
- {
- /* Get the name of the field */
- sprintf(key, "TTYPE%d", i + 1);
- status = 0;
- if (fits_read_key(filePtr, TSTRING, key, fieldName,
- NULL, &status) != 0)
- {
- amdlibReturnFitsError(key);
- }
-
- /* If this name matches with a region name */
- for (j=0; j < nbRegions; j++)
- {
- if (strcmp(regions[j].regionName, fieldName) == 0)
- {
- int nbOfElements;
-
- /* Compute the number of elements in the data array */
- nbOfElements = regions[j].dimAxis[0] *
- regions[j].dimAxis[1] *
- regions[j].dimAxis[2];
-
- /* Check data pointer */
- if (regions[j].data == NULL)
- {
- amdlibSetErrMsg("The pointer to "
- "the data of region #%d is invalid", j);
- return amdlibFAILURE;
- }
-
- /* Load the corresponding data */
- if (fits_write_col
- (filePtr, TDOUBLE, i+1, 1, 1, nbOfElements,
- (void *)regions[j].data, &status) != 0)
- {
- amdlibReturnFitsError("DATAi");
- }
-
- break;
- }
- }
- }
- /* Update the number of frames in the table, in case NULL frames were
- * supressed */
- /* Get the number of frames in the table */
- if (fits_read_key(filePtr, TINT, "NAXIS2", &nbFrames,
- NULL, &status) != 0)
- {
- amdlibReturnFitsError("NAXIS2");
- }
- if (nbFrames!=regions[0].dimAxis[2])
- {
- amdlibLogWarning("Shortening the output file");
- /* trick to write in place: Update PCOUNT to good value to fill up
- * table until next*/
- if (fits_read_key(filePtr, TINT, "NAXIS1", &tableWidth,
- NULL, &status) != 0)
- {
- amdlibReturnFitsError("NAXIS1");
- }
- if (fits_read_key(filePtr, TINT, "PCOUNT", &pCount,
- NULL, &status) != 0)
- {
- amdlibReturnFitsError("PCOUNT");
- }
- pCount+=(nbFrames-regions[0].dimAxis[2])*tableWidth;
- nbFrames=regions[0].dimAxis[2];
- if (fits_modify_key_lng(filePtr, "NAXIS2", nbFrames, NULL,
- &status) != 0)
- {
- amdlibReturnFitsError("NAXIS2");
- }
- if (fits_modify_key_lng(filePtr, "PCOUNT", pCount, NULL, &status) != 0)
- {
- amdlibReturnFitsError("NAXIS2");
- }
- }
-
- return amdlibSUCCESS;
-}
-
-/*___oOo___*/
diff --git a/amber/amdlibScienceData.c b/amber/amdlibScienceData.c
deleted file mode 100644
index d663ecf..0000000
--- a/amber/amdlibScienceData.c
+++ /dev/null
@@ -1,1490 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Functions to convert raw data to science data
- */
-
-#define _POSIX_SOURCE 1
-
-/*
- * System Headers
- */
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "fitsio.h"
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/* Local functions */
-amdlibCOMPL_STAT amdlibComputeBaselines(amdlibISS_INFO *iss, int nbBases,
- double duration);
-double amdlibSexagToRad(double value, int code);
-static void amdlibInitScienceData(amdlibSCIENCE_DATA *scienceData);
-static amdlibCOMPL_STAT amdlibGetSpecChannels(
- amdlibRAW_DATA *rawData,
- amdlibSCIENCE_DATA *scienceData,
- int globalStartOffset,
- int globalEndOffset,
- amdlibERROR_MSG errMsg);
-static amdlibCOMPL_STAT amdlibGetScienceData(
- amdlibRAW_DATA *rawData,
- amdlibWAVEDATA *waveData,
- amdlibSCIENCE_DATA *scienceData,
- int globalStartOffset,
- int globalEndOffset,
- amdlibBOOLEAN sumData,
- amdlibERROR_MSG errMsg);
-static amdlibCOMPL_STAT amdlibDiscardBadChannelsIntf(
- amdlibDOUBLE *intf,
- amdlibDOUBLE *sigma2Intf,
- int intfWidth,
- int *channelNo,
- int nbChannels);
-static amdlibCOMPL_STAT amdlibDiscardBadChannelsPhoto(
- amdlibDOUBLE *photo,
- amdlibDOUBLE *sigma2Photo,
- int *channelNo,
- int nbChannels);
-static amdlibCOMPL_STAT amdlibDiscardBadChannelsNo(int *channelNo,
- int *nbChannels);
-/*
- * Public functions
- */
-/**
- * Release memory allocated to store science data
- *
- * @param scienceData structure where science data is stored
- */
-void amdlibReleaseScienceData(amdlibSCIENCE_DATA *scienceData)
-{
- amdlibLogTrace("amdlibReleaseScienceData()");
-
- amdlibFreeScienceData(scienceData);
- memset(scienceData, '\0', sizeof(amdlibSCIENCE_DATA));
-}
-
-#define amdlibCODE_RA (int)24
-#define amdlibCODE_DEC (int)180
-/**
- * Convert raw data to science data.
- *
- * This function extracts from raw data the science data taking into account the
- * offsets between photometric channels and interferometric channel. This
- * consists in :
- * \li extracting spectrum of the photometric channels; i.e. sum all
- * pixels along X-axis,
- * \li shifting photometric spectrum of the relative offset given in the
- * waveData structure,
- * \li extracting the interferometric channel,
- * \li removing unusable channels; i.e. channels for which there is missing
- * information either photometric or interferometric data,
- * \li computing flux ratio between photometric channels.
- *
- * @param rawData structure where raw data is stored
- * @param waveData structure containing spectral dispersion table and relative
- * offsets between photometric channels and interferometric channel. If a null
- * pointer is given, the waveData structure from raw data is used.
- * @param scienceData structure where science data is stored
- * @param sumData if true, resulting science data is average of all frames
- * contained in raw data.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibRawData2ScienceData(amdlibRAW_DATA *rawData,
- amdlibWAVEDATA *waveData,
- amdlibSCIENCE_DATA *scienceData,
- amdlibBOOLEAN sumData,
- amdlibERROR_MSG errMsg)
-{
- amdlibDOUBLE downOffset, upOffset;
- int offset, nbPhotoChannels;
- int i;
- int didNotInheritWaveData=0;
- char keyName[amdlibKEYW_NAME_LEN+1];
- char keyVal[amdlibKEYW_NAME_LEN+1];
- int beam, nbTel, nbBases;
- double ra,dec;
- double duration;
- int unableToGetBaseInfo=0;
-
- amdlibLogTrace("amdlibRawData2ScienceData()");
-
- /* If not given, use the wave data of the raw data. */
- if (waveData == NULL)
- {
- waveData = &rawData->waveData;
- didNotInheritWaveData=1;
- }
- /* Check raw data structure contains data */
- if (rawData->dataLoaded == amdlibFALSE)
- {
- amdlibSetErrMsg("The raw data structure does not "
- "contain data. Check call to amdlibLoadRawData()");
- return amdlibFAILURE;
- }
-
- /* Check that raw data did not only contain detector data, but that it also
- * contained ICS status and wave data which are needed to convert raw data
- * to science data */
- if (rawData->detDataOnly == amdlibTRUE && didNotInheritWaveData)
- {
- amdlibSetErrMsg("The raw data file contains "
- "neither ICS header nor wave data binary table");
- return amdlibFAILURE;
- }
-
- /* Check number of columns. The raw data must at least contains 4 columns:
- * interferometric channel and 2 photometric channels */
- if (rawData->nbCols < 4)
- {
- amdlibSetErrMsg("The raw data does not contain interferometric data");
- return amdlibFAILURE;
- }
-
- /* If science data structure is not initialized, do it */
- if (scienceData->thisPtr != scienceData)
- {
- /* Initialise data structure */
- amdlibInitScienceData(scienceData);
- }
- /* Else */
- else
- {
- /* Free allocated memory */
- amdlibFreeScienceData(scienceData);
- }
- /* End if */
-
- /* Determine the number of photometric channels */
- if (rawData->nbCols == 4)
- {
- nbPhotoChannels = 2;
- nbTel = 2;
- nbBases = 1;
- }
- else
- {
- nbPhotoChannels = 3;
- nbTel = 3;
- nbBases = 3;
- }
- /* If spectral calibration has not been done, returns error */
- for (offset = 0; offset < nbPhotoChannels; offset++)
- {
- if (waveData->photoOffset[offset] == amdlibOFFSETY_NOT_CALIBRATED)
- {
- amdlibSetErrMsg("Spectral calibration has not been done for this "
- "raw data");
- return amdlibFAILURE;
- }
- }
-
- /* Determine the first and last spectral channels taking into account the
- * offsets between photometric channels and interferometric channel.
- * Remove spectral channels not having entries in interferometric channel
- * and photometric channels */
- downOffset = 0.0;
- upOffset = 0.0;
- for (offset = 0; offset < nbPhotoChannels; offset++)
- {
- downOffset = amdlibMin(downOffset, waveData->photoOffset[offset]);
- upOffset = amdlibMax(upOffset, waveData->photoOffset[offset]);
- }
- downOffset = floor(downOffset); /* Get the largest integer not greater
- than down offset */
- upOffset = ceil(upOffset); /* Get the smallest integer not less than*/
- amdlibLogTest("Interf to Photo total offset : down = %f - up = %f",
- downOffset, upOffset);
-
- /* Set position and dimension of the columns */
- scienceData->col[amdlibPHOTO1_CHANNEL].startPixel =
- rawData->region[1].corner[0];
- scienceData->col[amdlibPHOTO1_CHANNEL].nbPixels =
- rawData->region[1].dimAxis[0];
- scienceData->col[amdlibPHOTO2_CHANNEL].startPixel =
- rawData->region[2].corner[0];
- scienceData->col[amdlibPHOTO2_CHANNEL].nbPixels =
- rawData->region[2].dimAxis[0];
- if (rawData->nbCols == 5)
- {
- scienceData->col[amdlibPHOTO3_CHANNEL].startPixel =
- rawData->region[4].corner[0];
- scienceData->col[amdlibPHOTO3_CHANNEL].nbPixels =
- rawData->region[4].dimAxis[0];
- }
- scienceData->col[amdlibINTERF_CHANNEL].startPixel =
- rawData->region[3].corner[0];
- scienceData->col[amdlibINTERF_CHANNEL].nbPixels =
- rawData->region[3].dimAxis[0];
-
- /* Store station indexes, coordinates, and other useful info */
- memset(scienceData->issInfo.stationIndex, '\0', amdlibNB_TEL * sizeof(int));
- for (i=0; i < 3; i++)
- {
- memset(scienceData->issInfo.stationCoordinates[i], '\0',
- amdlibNB_TEL *sizeof(double));
- }
- if (amdlibGetInsCfgKeyword(&(rawData->insCfg),"HIERARCH ESO ISS REF RA",
- keyVal, errMsg) == amdlibSUCCESS)
-
- {
- sscanf(keyVal, "%lf", &ra);
- /*Convert Ra to radians (ISS.REF.RA seems to be HHMMSS.SS*/
- scienceData->issInfo.ra=amdlibSexagToRad(ra,amdlibCODE_RA);
- }
- else
- {
- unableToGetBaseInfo=1;
- }
-
- if (amdlibGetInsCfgKeyword(&(rawData->insCfg),"HIERARCH ESO ISS REF DEC" ,
- keyVal, errMsg) == amdlibSUCCESS)
- {
- sscanf(keyVal, "%lf", &dec);
- /*Convert Dec to radians*/
- scienceData->issInfo.dec=amdlibSexagToRad(dec,amdlibCODE_DEC);
- } else
- {
- unableToGetBaseInfo=1;
- }
-
- if (amdlibGetInsCfgKeyword(&(rawData->insCfg),"HIERARCH ESO ISS GEOLAT" ,
- keyVal, errMsg) == amdlibSUCCESS)
- {
- sscanf(keyVal, "%lf", &(scienceData->issInfo.geoLat));
- /*Convert geoLat (degrees) to radians*/
- scienceData->issInfo.geoLat=scienceData->issInfo.geoLat*M_PI/180.0;
- }
- else
- {
- unableToGetBaseInfo=1;
- }
-
- if (amdlibGetInsCfgKeyword(&(rawData->insCfg), "LST ",
- keyVal, errMsg) == amdlibSUCCESS)
- {
- sscanf(keyVal, "%lf", &(scienceData->issInfo.lst));
- /* Lst is in seconds of TIME. convert to Radians */
- scienceData->issInfo.lst=scienceData->issInfo.lst*M_PI/3600.0/12.0;
- }
- else
- {
- unableToGetBaseInfo=1;
- }
-
- for (beam=0; beam < nbTel; beam++)
- {
- sprintf(keyName, "HIERARCH ESO ISS CONF STATION%d", beam+1);
- if (amdlibGetInsCfgKeyword(&(rawData->insCfg), keyName,
- keyVal, errMsg) != amdlibSUCCESS)
- {
-#if 0
- amdlibLogWarning("HIERARCH ESO ISS CONF STATION%d keyword missing",
- beam+1);
- amdlibLogWarningDetail("Impossible to associate beam%d to any tel",
- beam+1);
-#endif
- }
- for (i=0; i < rawData->arrayGeometry.nbStations; i++)
- {
- if (strstr(keyVal,
- rawData->arrayGeometry.element[i].stationName) != 0)
- {
- scienceData->issInfo.stationIndex[beam] =
- rawData->arrayGeometry.element[i].stationIndex;
- break;
- }
- }
- char *axis[3] = { "X", "Y", "Z" };
- for (i=0; i < 3; i++)
- {
- sprintf(keyName, "HIERARCH ESO ISS CONF T%d%1s", beam+1,axis[i]);
- if (amdlibGetInsCfgKeyword(&(rawData->insCfg), keyName,
- keyVal, errMsg) == amdlibSUCCESS)
- {
- sscanf(keyVal, "%lf",
- &(scienceData->issInfo.stationCoordinates[i][beam]));
- }
- else
- {
- unableToGetBaseInfo=1;
- }
- }
- }
-
- /* Compute baseline position at begin and end of the observation
- * and their respective angles. We Shall NOT trust the PBL and PBLA values
- * given by ISS. Instead we update them! */
- memset(scienceData->issInfo.projectedBaseStart, '\0',
- amdlibNBASELINE * sizeof(double));
- memset(scienceData->issInfo.projectedBaseEnd, '\0',
- amdlibNBASELINE * sizeof(double));
- memset(scienceData->issInfo.projectedAngleStart, '\0',
- amdlibNBASELINE * sizeof(double));
- memset(scienceData->issInfo.projectedAngleEnd, '\0',
- amdlibNBASELINE * sizeof(double));
- if (unableToGetBaseInfo == 1)
- {
- /* Print warning, only if it is not a calibration file */
- if (rawData->frameType == amdlibUNKNOWN_FRAME)
- {
- amdlibLogWarning("Unable to retrieve necessary information to "
- "recompute baselines");
- }
- unableToGetBaseInfo=0;
- for (i = 0; i < nbBases; i++)
- {
- int tel1;
- int tel2;
- if (nbBases == 1)
- {
- tel1 = 1;
- tel2 = 2;
- }
- else
- {
- tel1 = amdlibMin((i % nbBases) + 1, ((i+1) % nbBases) + 1);
- tel2 = amdlibMax((i % nbBases) + 1, ((i+1) % nbBases) + 1);
- }
-
- char pos[amdlibKEYW_VAL_LEN+1];
-
- sprintf(keyName, "HIERARCH ESO ISS PBL%d%d START", tel1, tel2);
- if (amdlibGetInsCfgKeyword(&(rawData->insCfg), keyName,
- pos, errMsg) == amdlibSUCCESS)
- {
- sscanf(pos, "%lf",
- &(scienceData->issInfo.projectedBaseStart[i]));
- } else unableToGetBaseInfo=1;
-
- sprintf(keyName, "HIERARCH ESO ISS PBL%d%d END", tel1, tel2);
- if (amdlibGetInsCfgKeyword(&(rawData->insCfg), keyName,
- pos, errMsg) == amdlibSUCCESS)
- {
- sscanf(pos, "%lf", &(scienceData->issInfo.projectedBaseEnd[i]));
- } else unableToGetBaseInfo=1;
-
- sprintf(keyName, "HIERARCH ESO ISS PBLA%d%d START", tel1, tel2);
- if (amdlibGetInsCfgKeyword(&(rawData->insCfg), keyName,
- pos, errMsg) == amdlibSUCCESS)
- {
- sscanf(pos, "%lf",
- &(scienceData->issInfo.projectedAngleStart[i]));
- } else unableToGetBaseInfo=1;
-
- sprintf(keyName, "HIERARCH ESO ISS PBLA%d%d END", tel1, tel2);
- if (amdlibGetInsCfgKeyword(&(rawData->insCfg), keyName,
- pos, errMsg) == amdlibSUCCESS)
- {
- sscanf(pos, "%lf",
- &(scienceData->issInfo.projectedAngleEnd[i]));
- } else unableToGetBaseInfo=1;
- }
- /* Print warning, only if it is not a calibration file */
- if (rawData->frameType == amdlibUNKNOWN_FRAME)
- {
- if (unableToGetBaseInfo)
- {
- amdlibLogWarning("No (u,v) position available !");
- }
- else
- {
- amdlibLogWarning("Using ISS (possibly wrong) baselines values"
- "for (u,v) positions !");
- }
- }
- }
- else /* call compute baselines for start and end of time*/
- {
- /*Estimate total duration. here it is a bit difficult since the total
- * duration is NOT exactly the DIT*NDIT, so I read the time tag of the
- * real data */
- duration=rawData->timeTag[rawData->nbFrames-1]-rawData->timeTag[0];
- /**in days*/
- duration=duration*24.0*3600.0;
- amdlibComputeBaselines(&scienceData->issInfo,nbBases,duration);
- /* Update ESO Keywords with Good Ones */
- for (i = 0; i < nbBases; i++)
- {
- int tel1;
- int tel2;
- if (nbBases == 1)
- {
- tel1 = 1;
- tel2 = 2;
- }
- else
- {
- tel1 = amdlibMin((i % nbBases) + 1, ((i+1) % nbBases) + 1);
- tel2 = amdlibMax((i % nbBases) + 1, ((i+1) % nbBases) + 1);
- }
-
- char pos[amdlibKEYW_VAL_LEN+1];
- char comment[amdlibKEYW_VAL_LEN+1];
- sprintf(keyName, "HIERARCH ESO ISS PBL%d%d START", tel1, tel2);
- sprintf(comment, " Projected baseline T%d T%d start", tel1, tel2);
- sprintf(pos," %lf ",scienceData->issInfo.projectedBaseStart[i]);
- amdlibSetInsCfgKeyword(&(rawData->insCfg), keyName,
- pos, comment, errMsg);
- sprintf(keyName, "HIERARCH ESO ISS PBL%d%d END", tel1, tel2);
- sprintf(comment, " Projected baseline T%d T%d end", tel1, tel2);
- sprintf(pos," %lf ",scienceData->issInfo.projectedBaseEnd[i]);
- amdlibSetInsCfgKeyword(&(rawData->insCfg), keyName,
- pos, comment, errMsg);
- sprintf(keyName, "HIERARCH ESO ISS PBLA%d%d START", tel1, tel2);
- sprintf(comment, " Projected base angle T%d T%d start",
- tel1, tel2);
- sprintf(pos," %lf ",scienceData->issInfo.projectedAngleStart[i]);
- amdlibSetInsCfgKeyword(&(rawData->insCfg), keyName,
- pos, comment, errMsg);
- sprintf(keyName, "HIERARCH ESO ISS PBLA%d%d END", tel1, tel2);
- sprintf(comment, " Projected base angle T%d T%d end", tel1, tel2);
- sprintf(pos," %lf ",scienceData->issInfo.projectedAngleEnd[i]);
- amdlibSetInsCfgKeyword(&(rawData->insCfg), keyName,
- pos, comment, errMsg);
- }
- }
-
- /* Get spectral channels */
- if (amdlibGetSpecChannels(rawData, scienceData, (int)upOffset,
- (int)downOffset, errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- /* Get science data from raw data: extract interferometry data and
- * compute photometry */
- if (amdlibGetScienceData(rawData, waveData, scienceData, (int)upOffset,
- (int)downOffset, sumData, errMsg)!=amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- /* Copy P2VM id */
- scienceData->p2vmId = rawData->p2vmId;
-
- /* Copy instrument configuration (if needed) and set visibility */
- for (i=0; i < rawData->insCfg.nbKeywords; i++)
- {
- if (amdlibSetInsCfgKeyword(&scienceData->insCfg,
- rawData->insCfg.keywords[i].name,
- rawData->insCfg.keywords[i].value,
- rawData->insCfg.keywords[i].comment,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- }
-
- /* Store Photometric Beams spectral shifts */
- char value[amdlibKEYW_VAL_LEN+1];
- memset(value, '\0', (amdlibKEYW_VAL_LEN+1)*sizeof(char));
- sprintf(value, " %f", waveData->photoOffset[0]);
- if (amdlibSetInsCfgKeyword(&scienceData->insCfg,
- "HIERARCH ESO QC P1 OFFSETY",
- value, "", errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- memset(value, '\0', (amdlibKEYW_VAL_LEN+1)*sizeof(char));
- sprintf(value, " %f", waveData->photoOffset[1]);
- if (amdlibSetInsCfgKeyword(&scienceData->insCfg,
- "HIERARCH ESO QC P2 OFFSETY",
- value, "", errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- memset(value, '\0', (amdlibKEYW_VAL_LEN+1)*sizeof(char));
- sprintf(value, " %f", waveData->photoOffset[2]);
- if (amdlibSetInsCfgKeyword(&scienceData->insCfg,
- "HIERARCH ESO QC P3 OFFSETY",
- value, "", errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
-
- return amdlibSUCCESS;
-}
-
-/*
- * Protected functions
- */
-/**
- * Free memory allocated memory for science data structure.
- *
- * This function frees previously allocated memory (if any) where science data
- * has been stored.
- *
- * @param scienceData structure where science data is stored
- */
-void amdlibFreeScienceData(amdlibSCIENCE_DATA *scienceData)
-{
- int frame;
-
- amdlibLogTrace("amdlibFreeScienceData()");
-
- /* If science data structure is not initialized, do it */
- if (scienceData->thisPtr != scienceData)
- {
- /* Initialise data structure */
- amdlibInitScienceData(scienceData);
- }
-
- /* Free science data structure */
- if (scienceData->timeTag != NULL)
- {
- free(scienceData->timeTag);
- }
-
- if (scienceData->channelNo != NULL)
- {
- free(scienceData->channelNo);
- scienceData->channelNo = NULL;
- }
-
- if (scienceData->badPixels != NULL)
- {
- amdlibFree2DArrayUnsignedChar(scienceData->badPixelsPt);
- scienceData->badPixels = NULL;
- }
-
- /* For all defined frames */
- for (frame = 0; frame < scienceData->nbFrames; frame++)
- {
- /* Free arrays containing the data */
- if (scienceData->frame[frame].intf != NULL)
- {
- free(scienceData->frame[frame].intf);
- scienceData->frame[frame].intf = NULL;
- }
- if (scienceData->frame[frame].sigma2Intf != NULL)
- {
- free(scienceData->frame[frame].sigma2Intf);
- scienceData->frame[frame].sigma2Intf = NULL;
- }
- if (scienceData->frame[frame].photo1 != NULL)
- {
- free(scienceData->frame[frame].photo1);
- scienceData->frame[frame].photo1 = NULL;
- }
- if (scienceData->frame[frame].photo2 != NULL)
- {
- free(scienceData->frame[frame].photo2);
- scienceData->frame[frame].photo2 = NULL;
- }
- if (scienceData->frame[frame].photo3 != NULL)
- {
- free(scienceData->frame[frame].photo3);
- scienceData->frame[frame].photo3 = NULL;
- }
-
- if (scienceData->frame[frame].sigma2Photo1 != NULL)
- {
- free(scienceData->frame[frame].sigma2Photo1);
- scienceData->frame[frame].sigma2Photo1 = NULL;
- }
- if (scienceData->frame[frame].sigma2Photo2 != NULL)
- {
- free(scienceData->frame[frame].sigma2Photo2);
- scienceData->frame[frame].sigma2Photo2 = NULL;
- }
- if (scienceData->frame[frame].sigma2Photo3 != NULL)
- {
- free(scienceData->frame[frame].sigma2Photo3);
- scienceData->frame[frame].sigma2Photo3 = NULL;
- }
- }
- if (scienceData->frame != NULL)
- {
- free(scienceData->frame);
- scienceData->frame = NULL;
- }
- /* Reset the number of rows */
- scienceData->nbFrames = 0;
-}
-
-/*
- * Local functions
- */
-/**
- * Initialize science data structure.
- *
- * @param scienceData pointer to science data structure
- */
-void amdlibInitScienceData(amdlibSCIENCE_DATA *scienceData)
-{
- amdlibLogTrace("amdlibInitScienceData()");
-
- /* Initialize data structure */
- memset (scienceData, '\0', sizeof(amdlibSCIENCE_DATA));
- scienceData->thisPtr = scienceData;
-}
-
-/**
- * Get number of the channels contained in the given raw data
- *
- * This function gets the number (i.e index in the spectral dispersion table) of
- * the channels belonging to the given raw dat, taking into account the shifts
- * to be done on the photometric channels.
- *
- * @param rawData structure where raw data is stored
- * @param scienceData structure caontaining table to store the channel numbers
- * @param globalStartOffset the number of channels to be ignored at the
- * beginning of the spectral dispersion table; corresponding to the greatest
- * shifts to carry out on the photometric channels in downwards
- * @param globalEndOffset the number of channels to be ignored at the
- * end of the spectral dispersion table; corresponding to the greatest
- * shifts to carry out on the photometric channels in upwards
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibGetSpecChannels(amdlibRAW_DATA *rawData,
- amdlibSCIENCE_DATA *scienceData,
- int globalStartOffset,
- int globalEndOffset,
- amdlibERROR_MSG errMsg)
-{
- int row;
- int channel;
- int globalNbSpecChannels;
- int startPixel;
- int currentChannel;
- int currentNbSpecChannels;
-
- amdlibLogTrace("amdlibGetSpecChannels()");
-
- /* Set the global number of spectral channels : for each row, sum the
- * spectral channels considered in a column, then substract nbRows times
- * the offset due to the offsets between interferometric channel and the
- * photometric channels */
- globalNbSpecChannels = 0;
- for (row = 0; row < rawData->nbRows; row ++)
- {
- globalNbSpecChannels += rawData->region[row*rawData->nbCols].dimAxis[1];
- }
- scienceData->nbChannels = globalNbSpecChannels;
- /* This dimension, not taking into account the bad spectral channels, is
- * stored. Il will be modified when discarding bad frames (in
- * amdlibGetScienceData): bad spectral channels will be shifted at the end
- * of all our tables */
-
- /* Allocate memory for channelNo */
- scienceData->channelNo = (int *)calloc(globalNbSpecChannels, sizeof(int));
- if (scienceData->channelNo == NULL)
- {
- amdlibSetErrMsg("Could not allocate memory for channelNo table");
- return amdlibFAILURE;
- }
-
- /* Set the number of the channels belonging to the science data. */
- currentChannel = 0;
- for (row = 0; row < rawData->nbRows; row++)
- {
- /* Note: bad channels result of the photometric channels shift.
- * Mark them as bad based upon offsets passed to the routine.
- */
-
- for (channel = 0; channel < (-1*globalEndOffset); channel ++)
- {
- scienceData->channelNo[currentChannel] = -1;
- currentChannel++;
- }
-
- startPixel = (rawData->region[row * rawData->nbCols].corner[1] - 1) +
- (-1*globalEndOffset);
- currentNbSpecChannels = rawData->region[row*rawData->nbCols].dimAxis[1]
- - (globalStartOffset - globalEndOffset) ;
-
- for (channel = 0; channel < currentNbSpecChannels; channel ++)
- {
- scienceData->channelNo[currentChannel] =
- startPixel + channel;
- currentChannel++;
- }
-
- for (channel = 0; channel < globalStartOffset ; channel ++)
- {
- scienceData->channelNo[currentChannel] = -1;
- currentChannel++;
- }
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Extract science data from raw data
- *
- * This function extracts the science data (i.e. spectrum of photometric
- * channels and interferometric data) from the raw data, and shifts the
- * photometric spectrum of the relative offset specified in wave data structure.
- *
- * @param rawData structure where raw data is stored
- * @param waveData structure containing spectral dispersion table and relative
- * offsets between photometric channels and interferometric channel. If a null
- * @param scienceData structure containing table to store the channel numbers
- * @param globalStartOffset the number of channels to be ignored at the
- * beginning of the spectral dispersion table; corresponding to the greatest
- * shifts to carry out on the photometric channels in downwards
- * @param globalEndOffset the number of channels to be ignored at the
- * end of the spectral dispersion table; corresponding to the greatest
- * shifts to carry out on the photometric channels in upwards
- * @param sumData if true, resulting science data is average of all frames
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibGetScienceData(amdlibRAW_DATA *rawData,
- amdlibWAVEDATA *waveData,
- amdlibSCIENCE_DATA *scienceData,
- int globalStartOffset,
- int globalEndOffset,
- amdlibBOOLEAN sumData,
- amdlibERROR_MSG errMsg)
-{
- int nbPhotoChannels;
- int photoChannel;
- int nbRawFrames;
- int channel;
- int f,l,i;
- int iRow;
- amdlibDOUBLE *pPhoto;
- amdlibDOUBLE *pSigma2Photo;
- amdlibDOUBLE *pShiftPhoto;
- amdlibDOUBLE *pShiftSigma2Photo;
- double integratedPhoto;
- double snrPhoto;
- int nbFrames;
- int nbChannels;
- int intfWidth;
- amdlibDOUBLE **intf,**sigma2Intf;
- amdlibDOUBLE **photo;
- amdlibDOUBLE **photo1 = NULL;
- amdlibDOUBLE **photo2 = NULL;
- amdlibDOUBLE **photo3 = NULL;
- amdlibDOUBLE **sigma2Photo;
- amdlibDOUBLE **sigma2Photo1 = NULL;
- amdlibDOUBLE **sigma2Photo2 = NULL;
- amdlibDOUBLE **sigma2Photo3 = NULL;
- double pixelShift;
- amdlibDOUBLE **sigma2IntfPtr;
-
- amdlibLogTrace("amdlibGetScienceData()");
-
- /* Number of frames in raw data */
- nbRawFrames = rawData->region[0].dimAxis[2];
-
- /* Set the number of photometric channels */
- if (rawData->nbCols == 4)
- {
- nbPhotoChannels = 2;
- }
- else
- {
- nbPhotoChannels = 3;
- }
- /* Set number of frames */
- if (sumData == amdlibTRUE)
- {
- scienceData->nbFrames = 1;
- }
- else
- {
- scienceData->nbFrames = nbRawFrames;
- }
- /* Set number of columns */
- scienceData->nbCols = nbPhotoChannels + 1;
- /* Set exposure time */
- scienceData->expTime = rawData->expTime;
-
- /* Allocate memory for Time Tag */
- scienceData->timeTag =
- (double *)calloc(scienceData->nbFrames, sizeof(double));
- if (scienceData->timeTag == NULL)
- {
- amdlibSetErrMsg("Could not allocate memory for time tag");
- return amdlibFAILURE;
- }
-
- /* Copy raw data time tag to science data */
- memcpy(scienceData->timeTag, rawData->timeTag,
- scienceData->nbFrames * sizeof(*(scienceData->timeTag)));
-
- /* Allocate memory for all frames */
- scienceData->frame = calloc(scienceData->nbFrames,
- sizeof(amdlibFRAME_SCIENCE_DATA));
- if (scienceData->frame == NULL)
- {
- amdlibSetErrMsg("Could not allocate memory for frames");
- return amdlibFAILURE;
- }
-
- /* Get dimensions of photometric and interferometric beams */
- intfWidth = rawData->region[3].dimAxis[0];
- nbChannels = 0;
- for (iRow = 0; iRow < rawData->nbRows; iRow ++)
- {
- nbChannels += rawData->region[iRow*rawData->nbCols].dimAxis[1];
- }
- nbFrames = scienceData->nbFrames;
-
- intf = (amdlibDOUBLE **)calloc(nbFrames, sizeof(amdlibDOUBLE *));
- if (intf == NULL)
- {
- amdlibSetErrMsg("Impossible to allocate memory for interferometric "
- "beam");
- amdlibReleaseScienceData(scienceData);
- return amdlibFAILURE;
- }
- for (f = 0; f < nbFrames; f ++)
- {
- intf[f] = (amdlibDOUBLE *)calloc(intfWidth * nbChannels, sizeof(amdlibDOUBLE));
- if (intf[f] == NULL)
- {
- amdlibSetErrMsg("Impossible to allocate memory for interferometric "
- "beam");
- amdlibReleaseScienceData(scienceData);
- return amdlibFAILURE;
- }
- }
- sigma2Intf = (amdlibDOUBLE **)calloc(nbFrames, sizeof(amdlibDOUBLE *));
- if (sigma2Intf == NULL)
- {
- amdlibSetErrMsg("Impossible to allocate memory for noise figures ");
- amdlibReleaseScienceData(scienceData);
- return amdlibFAILURE;
- }
- for (f = 0; f < nbFrames; f ++)
- {
- sigma2Intf[f] = (amdlibDOUBLE *)calloc(intfWidth * nbChannels, sizeof(amdlibDOUBLE));
- if (sigma2Intf[f] == NULL)
- {
- amdlibSetErrMsg("Impossible to allocate memory for noise figures ");
- amdlibReleaseScienceData(scienceData);
- return amdlibFAILURE;
- }
- }
-
- /* Allocate memory for badPixel map */
- scienceData->badPixelsPt = amdlibAlloc2DArrayUnsignedChar(intfWidth, nbChannels, errMsg);
- if (scienceData->badPixelsPt == NULL)
- {
- amdlibSetErrMsg("Could not allocate memory for bad pixel copy");
- return amdlibFAILURE;
- }
- scienceData->badPixels = scienceData->badPixelsPt[0];
-
- /* compute intf and sigma2 in one gesture */
- if (amdlibSumAndPackData(rawData, amdlibFALSE, amdlibFALSE, sumData,
- amdlibINTERF_CHANNEL, intf, sigma2Intf, errMsg) != amdlibSUCCESS)
- {
- amdlibReleaseScienceData(scienceData);
- return amdlibFAILURE;
- }
-
- /* Fill badPixel map Using the fact that sigma2Intf = 0 at bad Pixels */
- sigma2IntfPtr = amdlibWrap2DArrayDouble(sigma2Intf[0],intfWidth , nbChannels , errMsg);
- for (l = 0; l < nbChannels; l++)
- {
- for (i=0; i < intfWidth; i++)
- {
- if (sigma2IntfPtr[l][i] <= 0.0)
- {
- scienceData->badPixelsPt[l][i] = (unsigned char) 0;
- }
- else
- {
- scienceData->badPixelsPt[l][i] = (unsigned char) 1;
- }
- }
- }
- amdlibFree2DArrayDoubleWrapping(sigma2IntfPtr);
- /* For all photometric channels */
- for (photoChannel = 0; photoChannel < nbPhotoChannels; photoChannel++)
- {
- /* Allocate memory for photo and sigma2Photo for all frames */
- photo = (amdlibDOUBLE **)calloc(nbFrames, sizeof(amdlibDOUBLE *));
- sigma2Photo = (amdlibDOUBLE **)calloc(nbFrames, sizeof(amdlibDOUBLE *));
- if (photo == NULL)
- {
- amdlibSetErrMsg("Impossible to allocate memory for photometric "
- "beam %d", photoChannel);
- return amdlibFAILURE;
- }
- if (sigma2Photo == NULL)
- {
- amdlibSetErrMsg("Impossible to allocate memory for photometric "
- "error on beam %d", photoChannel);
- return amdlibFAILURE;
- }
- for (f = 0; f < nbFrames; f ++)
- {
- photo[f] = (amdlibDOUBLE *)calloc(nbChannels, sizeof(amdlibDOUBLE));
- if (photo[f] == NULL)
- {
- amdlibSetErrMsg("Impossible to allocate memory for photometric "
- "beam %d", photoChannel);
- amdlibReleaseScienceData(scienceData);
- return amdlibFAILURE;
- }
- sigma2Photo[f] = (amdlibDOUBLE *)calloc(nbChannels, sizeof(amdlibDOUBLE));
- if (sigma2Photo[f] == NULL)
- {
- amdlibSetErrMsg("Impossible to allocate memory for photometric "
- "error on beam %d", photoChannel);
- amdlibReleaseScienceData(scienceData);
- return amdlibFAILURE;
- }
- }
-
- /* Sum and pack photo and sigma2Photo for all frames */
- if (amdlibSumAndPackData(rawData, amdlibTRUE, amdlibFALSE, sumData,
- photoChannel, photo, sigma2Photo, errMsg) != amdlibSUCCESS)
- {
- amdlibReleaseScienceData(scienceData);
- return amdlibFAILURE;
- }
-
- if (amdlibGetUserPref(amdlibGLOBAL_PHOTOMETRY).set==amdlibTRUE)
- {
- /* Test pour voir si la photometrie canal par canal a un sens... On ajoute tout...
- * et ca marche */
- for (f = 0; f < nbFrames; f ++)
- {
- int sumf=0, sumerrf=0;
- for (l = 0; l < nbChannels; l++)
- {
- sumf+=photo[f][l];
- sumerrf+=sigma2Photo[f][l];
- }
- for (l = 0; l < nbChannels; l++)
- {
- photo[f][l]=sumf;
- sigma2Photo[f][l]=sumf;
- }
- }
- }
-
- switch (photoChannel)
- {
- case amdlibPHOTO1_CHANNEL :
- {
- photo1 = photo;
- sigma2Photo1 = sigma2Photo;
- break;
- }
- case amdlibPHOTO2_CHANNEL :
- {
- photo2 = photo;
- sigma2Photo2 = sigma2Photo;
- break;
- }
- case amdlibPHOTO3_CHANNEL :
- {
- photo3 = photo;
- sigma2Photo3 = sigma2Photo;
- break;
- }
- default :
- {
- amdlibSetErrMsg("Reference to channel '%d' does not exist",
- photoChannel);
- amdlibReleaseScienceData(scienceData);
- return amdlibFAILURE;
- }
- }
- }
-
- /* Discard 'bad' channels in photometric and interferometric data, and then
- * discard 'bad' channels in the channel table. */
- for (f = 0; f < scienceData->nbFrames; f ++)
- {
- scienceData->frame[f].intf = intf[f];
- scienceData->frame[f].sigma2Intf = sigma2Intf[f];
-
- /* Interferometric data */
- if (amdlibDiscardBadChannelsIntf(scienceData->frame[f].intf,
- scienceData->frame[f].sigma2Intf,
- intfWidth,
- scienceData->channelNo,
- scienceData->nbChannels) ==
- amdlibFAILURE)
- {
- return amdlibFAILURE;
- }
-
- /* Photometric data */
- for (photoChannel = 0; photoChannel < nbPhotoChannels; photoChannel++)
- {
- switch (photoChannel)
- {
- case amdlibPHOTO1_CHANNEL :
- {
- pPhoto = photo1[f];
- pSigma2Photo = sigma2Photo1[f];
- break;
- }
- case amdlibPHOTO2_CHANNEL :
- {
- pPhoto = photo2[f];
- pSigma2Photo = sigma2Photo2[f];
- break;
- }
- case amdlibPHOTO3_CHANNEL :
- {
- pPhoto = photo3[f];
- pSigma2Photo = sigma2Photo3[f];
- break;
- }
- default :
- {
- amdlibSetErrMsg("Reference to channel '%d' does not exist",
- photoChannel);
- amdlibReleaseScienceData(scienceData);
- return amdlibFAILURE;
- }
- }
- pShiftPhoto = (amdlibDOUBLE *)calloc(nbChannels, sizeof(amdlibDOUBLE));
- pShiftSigma2Photo = (amdlibDOUBLE *)calloc(nbChannels, sizeof(amdlibDOUBLE));
- pixelShift = -1 * waveData->photoOffset[photoChannel];
- if (amdlibShift(nbChannels, pPhoto, pixelShift,
- pShiftPhoto, errMsg) == amdlibFAILURE)
- {
- return amdlibFAILURE;
- }
- if (amdlibShift(nbChannels, pSigma2Photo, pixelShift,
- pShiftSigma2Photo,
- errMsg) == amdlibFAILURE)
- {
- return amdlibFAILURE;
- }
- if (amdlibDiscardBadChannelsPhoto(pShiftPhoto, pShiftSigma2Photo,
- scienceData->channelNo,
- scienceData->nbChannels) ==
- amdlibFAILURE)
- {
- return amdlibFAILURE;
- }
- switch (photoChannel)
- {
- case 0 :
- {
- scienceData->frame[f].photo1 = pShiftPhoto;
- scienceData->frame[f].sigma2Photo1 = pShiftSigma2Photo;
- break;
- }
- case 1 :
- {
- scienceData->frame[f].photo2 = pShiftPhoto;
- scienceData->frame[f].sigma2Photo2 = pShiftSigma2Photo;
- break;
- }
- default :
- {
- scienceData->frame[f].photo3 = pShiftPhoto;
- scienceData->frame[f].sigma2Photo3 = pShiftSigma2Photo;
- break;
- }
- }
- free(pPhoto);
- free(pSigma2Photo);
- }
- }
-
- /* Channel table */
- if (amdlibDiscardBadChannelsNo(scienceData->channelNo,
- &scienceData->nbChannels) == amdlibFAILURE)
- {
- return amdlibFAILURE;
- }
-
- free(intf);
- free(sigma2Intf);
- free(photo1);
- free(photo2);
- free(photo3);
- free(sigma2Photo1);
- free(sigma2Photo2);
- free(sigma2Photo3);
-
- /* Calculate integratedPhoto and snrPhoto for each photometric beam */
- for (photoChannel = 0; photoChannel < nbPhotoChannels; photoChannel++)
- {
- for (f = 0; f < scienceData->nbFrames; f++)
- {
- switch (photoChannel)
- {
- case 0 :
- {
- pPhoto = scienceData->frame[f].photo1;
- pSigma2Photo = scienceData->frame[f].sigma2Photo1;
- break;
- }
- case 1 :
- {
- pPhoto = scienceData->frame[f].photo2;
- pSigma2Photo = scienceData->frame[f].sigma2Photo2;
- break;
- }
- default :
- {
- pPhoto = scienceData->frame[f].photo3;
- pSigma2Photo = scienceData->frame[f].sigma2Photo3;
- break;
- }
- }
- integratedPhoto = 0.;
- snrPhoto = 0;
- for (channel = 0; channel < scienceData->nbChannels;
- channel++)
- {
- integratedPhoto += pPhoto[channel];
- snrPhoto += pSigma2Photo[channel];
- }
-
- if (snrPhoto < 0.0)
- {
- amdlibLogWarning("Photometric channel %d, frame %d: "
- "%.2f", photoChannel, f, integratedPhoto);
- amdlibLogWarning("Sigma² of photometric channel %d, frame %d is negative "
- "%.2f - set to zero.", photoChannel, f, snrPhoto);
- snrPhoto = 0.0;
- }
- if (snrPhoto != 0.0)
- {
- snrPhoto = integratedPhoto / sqrt(snrPhoto);
- }
- else
- {
- snrPhoto = 0.0;
- }
-
- switch (photoChannel)
- {
- case 0 :
- {
- scienceData->frame[f].integratedPhoto1 = integratedPhoto;
- scienceData->frame[f].snrPhoto1 = snrPhoto;
- break;
- }
- case 1 :
- {
- scienceData->frame[f].integratedPhoto2 = integratedPhoto;
- scienceData->frame[f].snrPhoto2 = snrPhoto;
- break;
- }
- default :
- {
- scienceData->frame[f].integratedPhoto3 = integratedPhoto;
- scienceData->frame[f].snrPhoto3 = snrPhoto;
- break;
- }
- }
- }
- }
-
- /**** Compute flux ratio */
- /* Compute total flux per channel */
- for (f = 0; f < scienceData->nbFrames; f++)
- {
- amdlibDOUBLE fluxPerChannel[amdlibNB_PHOTO_CHANNELS];
- amdlibDOUBLE totalFlux;
- amdlibDOUBLE minFlux;
-
- for (photoChannel = 0; photoChannel < nbPhotoChannels; photoChannel++)
- {
- fluxPerChannel[photoChannel] = 0.0;
- }
- fluxPerChannel[0] += scienceData->frame[f].integratedPhoto1;
- fluxPerChannel[1] += scienceData->frame[f].integratedPhoto2;
- if (nbPhotoChannels == 3)
- {
- fluxPerChannel[2] += scienceData->frame[f].integratedPhoto3;
- }
-
- /* If there is negative flux, shift all flux value to only get positive
- * values */
- minFlux = fluxPerChannel[0];
- for (photoChannel = 1; photoChannel < nbPhotoChannels; photoChannel++)
- {
- if (minFlux > fluxPerChannel[photoChannel])
- {
- minFlux = fluxPerChannel[photoChannel];
- }
- }
- if (minFlux < 0.0)
- {
- for (photoChannel = 0;
- photoChannel < nbPhotoChannels;
- photoChannel++)
- {
- fluxPerChannel[photoChannel] += minFlux;
- }
- }
-
- /* Compute total flux */
- totalFlux = 0.0;
- for (photoChannel = 0; photoChannel < nbPhotoChannels; photoChannel++)
- {
- totalFlux += fluxPerChannel[photoChannel];
- }
-
- /* Compute flux ratio */
- for (photoChannel = 0; photoChannel < nbPhotoChannels; photoChannel++)
- {
- if (totalFlux != 0)
- {
- scienceData->frame[f].fluxRatio[photoChannel] =
- fluxPerChannel[photoChannel] / totalFlux * 100.0;
- }
- else
- {
- scienceData->frame[f].fluxRatio[photoChannel] =
- 100.0 / nbPhotoChannels;
- }
- }
-
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Discard bad channels in interferometric data; shift good channel at the
- * beginning of the table.
- *
- * @param intf array containing interferometric data
- * @param intfWidth width of the interferometric channel
- * @param channelNo array containing the channel number; number of bad channels
- * is -1
- * @param nbChannels number of spectral channels
- *
- * @return
- * always amdlibSUCCESS.
- */
-amdlibCOMPL_STAT amdlibDiscardBadChannelsIntf(amdlibDOUBLE *intf,
- amdlibDOUBLE *sigma2Intf,
- int intfWidth,
- int *channelNo,
- int nbChannels)
-{
- int i1, i2, j, k;
-
- amdlibLogTrace("amdlibDiscardBadChannelsIntf()");
-
- i2 = 0;
- /* Scan all channels */
- for (i1 = 0; i1 < nbChannels; i1++)
- {
- /* If channel is bad */
- if (channelNo[i1] == -1)
- {
- /* Shift other channels */
- for (j = i2; j < nbChannels - 1; j++)
- {
- for (k = 0; k < intfWidth; k++)
- {
- intf[j*intfWidth + k] = intf[(j+1)*intfWidth + k];
- sigma2Intf[j*intfWidth + k] = sigma2Intf[(j+1)*intfWidth + k];
- }
- }
- /* Set the values of the last line to amdlibBLANKING_VALUE */
- for (k = 0; k < intfWidth; k++)
- {
- intf[(nbChannels-1)*intfWidth + k] = amdlibBLANKING_VALUE;
- sigma2Intf[(nbChannels-1)*intfWidth + k] = amdlibBLANKING_VALUE;
- }
- }
- else
- {
- i2++;
- }
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Discard bad channels in photometric data; shift good channels at the
- * beginning of the table.
- *
- * @param photo array containing photometric data
- * @param sigma2Photo array containing noise of photometric data
- * @param channelNo array containing the channel number; number of bad channels
- * is -1
- * @param nbChannels number of spectral channels
- *
- * @return
- * always amdlibSUCCESS.
- */
-amdlibCOMPL_STAT amdlibDiscardBadChannelsPhoto(amdlibDOUBLE *photo,
- amdlibDOUBLE *sigma2Photo,
- int *channelNo,
- int nbChannels)
-{
- int i1, i2, j;
-
- amdlibLogTrace("amdlibDiscardBadChannelsPhoto()");
-
- i1 = 0;
- i2 = 0;
- /* Scan all channels */
- for (i1 = 0; i1 < nbChannels; i1++)
- {
- /* If channel is bad */
- if (channelNo[i1] == -1)
- {
- /* Shift other channels */
- for (j = i2; j < nbChannels - 1; j++)
- {
- photo[j] = photo[j+1];
- sigma2Photo[j] = sigma2Photo[j+1];
- }
- /* Set the values of the last line to amdlibBLANKING_VALUE */
- photo[nbChannels-1] = amdlibBLANKING_VALUE;
- sigma2Photo[nbChannels-1] = amdlibBLANKING_VALUE;
- }
- else
- {
- i2++;
- }
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Discard bad channels in the channel number array; shift good channels at the
- * beginning of the table.
- *
- * @param channelNo array containing the channel number; number of bad channels
- * is -1
- * @param nbChannels number of spectral channels
- *
- * @return
- * always amdlibSUCCESS.
- */
-amdlibCOMPL_STAT amdlibDiscardBadChannelsNo(int *channelNo,
- int *nbChannels)
-{
- int i, j;
- int oldNbChannels;
-
- amdlibLogTrace("amdlibDiscardBadChannelsNo()");
-
- i = 0;
- oldNbChannels = *nbChannels;
- /* Scan all channels */
- while (i < *nbChannels)
- {
- /* If channel is bad */
- if (channelNo[i] == -1)
- {
- /* Shift other channels */
- for (j = i; j < oldNbChannels - 1; j++)
- {
- channelNo[j] = channelNo[j+1];
- }
- /* Set the values of the last channel to -1, and decrease the number
- * of channels */
- channelNo[oldNbChannels-1] = -1;
- (*nbChannels)--;
- }
- else
- {
- i++;
- }
- }
-
- return amdlibSUCCESS;
-
-}
-
-
-void amdlibDisplayScienceData(amdlibSCIENCE_DATA *scienceData)
-{
- int i, j, f;
-
- printf("\n\n---------- results ----------\n");
- printf("scienceData.nbFrames = %d\n", scienceData->nbFrames);
- printf("nbWlen = %d\n",scienceData->nbChannels);
- printf("1er canal ok (<=> startPixel 1ere row) = %d\n",
- scienceData->channelNo[0]);
- printf("val photo1 :\n");
- for (i = 0; i < scienceData->nbChannels; i++)
- {
- printf ("i = %d, %f\n", i, scienceData->frame[0].sigma2Photo1[i]);
- }
-
- printf("val photo2 :\n");
- for (i = 0; i < scienceData->nbChannels; i++)
- {
- printf ("i = %d, %f\n", i, scienceData->frame[0].sigma2Photo2[i]);
- }
-
- if (scienceData->frame[0].photo3 != NULL)
- {
- printf("val photo3 :\n");
- for (i = 0; i < scienceData->nbChannels; i++)
- {
- printf ("i = %d, %f\n", i, scienceData->frame[0].sigma2Photo3[i]);
- }
- }
-
-
-
- printf("integrated photo et snr photo :\n");
- for (f = 0; f < scienceData->nbFrames; f++)
- {
- printf("frame : %d\n", f);
- printf("iP1 = %f, snrP1 = %f\n",
- scienceData->frame[f].integratedPhoto1,
- scienceData->frame[f].snrPhoto1);
- printf("iP2 = %f, snrP2 = %f\n",
- scienceData->frame[f].integratedPhoto2,
- scienceData->frame[f].snrPhoto2);
- printf("iP3 = %f, snrP3 = %f\n",
- scienceData->frame[f].integratedPhoto3,
- scienceData->frame[f].snrPhoto3);
- }
-
- for (f=0; f < scienceData->nbFrames; f++)
- {
- printf ("Frame #%d :\n", f);
- printf ("\n+---------------+---------------+---------------+---------------|\n");
- printf("| | Photo 1 | Photo 2 | Photo 3 |\n");
- printf ("+---------------+---------------+---------------+---------------|\n");
- printf("| Value |");
- printf (" %13.1f |", scienceData->frame[f].integratedPhoto1);
- printf (" %13.1f |", scienceData->frame[f].integratedPhoto2);
- printf (" %13.1f |", scienceData->frame[f].integratedPhoto3);
- printf ("\n+---------------+---------------+---------------+---------------|\n");
- printf("| SNR |");
- printf (" %13.1f |", scienceData->frame[f].snrPhoto1);
- printf (" %13.1f |", scienceData->frame[f].snrPhoto2);
- printf (" %13.1f |", scienceData->frame[f].snrPhoto3);
- printf ("\n+-------+-------+---------------+---------------+---------------|");
- printf("\n| Flux ratio |");
- for (j=0; j < amdlibNB_PHOTO_CHANNELS; j++)
- {
- printf (" %13.1f |", scienceData->frame[f].fluxRatio[j]);
- }
- printf ("\n+---------------+---------------+---------------+---------------|\n");
- printf("\n");
- }
-
-}
-
-/*___oOo___*/
diff --git a/amber/amdlibShift.c b/amber/amdlibShift.c
deleted file mode 100644
index f12ba31..0000000
--- a/amber/amdlibShift.c
+++ /dev/null
@@ -1,475 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Functions related to doubleing array shift.
- */
-#define _POSIX_SOURCE 1
-
-/*
- * Macros definitions
- */
-
-/*
- * System Headers
- */
-#include <string.h>
-#include <math.h>
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-#include <complex.h>
-#include <fftw3.h>
-
-/*
- * Protected function
- */
-/** Useful macro to free all allocated memory */
-#define amdlibShift_FREEALL() free(drc); \
- free(tabInPeriodized); \
- free(fftDirect); \
- free(phasor); \
- free(phasedFft); \
- free(tabDecalPeriodized);
-/**
- * Shift array
- *
- * This function shifts array tabIn by 'shift' (possibly non-integer) number in
- * tabOut, wrapping around values.
- *
- * @param nbElem number of element in arrays
- * @param tabIn input array
- * @param shift shift to perform
- * @param tabOut resulting shifted array
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibShift(/* INPUT */
- int nbElem,
- double *tabIn,
- double shift,
- /* OUTPUT */
- double *tabOut,
- amdlibERROR_MSG errMsg)
-{
- int i;
-
- /* Get the integer part (ip) and fractionnal part (fp)
- * of the offset to apply to tabIn */
- int ipShift = (int)shift;
- double fpShift = shift - ipShift;
-
- /* Get the values of the first and last points to substract
- * the affine part of the signal */
- double m1 = tabIn[0];
- double m2 = tabIn[nbElem - 1];
- double phi;
- double dr;
- fftw_plan p;
-
- /* Arrays */
- double *drc = NULL;
- double *tabInPeriodized = NULL;
- double *fftDirect = NULL;
- double *phasor = NULL;
- double *phasedFft = NULL;
- double *tabDecalPeriodized = NULL;
-
- amdlibLogTrace("amdlibShift()");
-
-#if TEST
- amdlibLogTest("amdlibShift()");
- amdlibLogTest(" Array size = %d", nbElem);
- amdlibLogTest(" Shift = %.3f", shift);
-#endif
-
- /* Check shift value; could not be greater then array size */
- if (abs(ipShift) > nbElem)
- {
- amdlibSetErrMsg("Invalid shift %.3f; greater than array size %d",
- shift, nbElem);
- return amdlibFAILURE;
- }
-
- /* Define work arrays */
-
- drc = calloc(nbElem, sizeof(double));
- if (drc == NULL)
- {
- amdlibShift_FREEALL();
- amdlibSetErrMsg("Could not allocate memory (drc)");
- return amdlibFAILURE;
- }
-
- tabInPeriodized = calloc(nbElem, sizeof(double));
- if (tabInPeriodized == NULL)
- {
- amdlibShift_FREEALL();
- amdlibSetErrMsg("Could not allocate memory (tabInPeriodized)");
- return amdlibFAILURE;
- }
-
- fftDirect = calloc(nbElem, sizeof(double));
- if (fftDirect == NULL)
- {
- amdlibShift_FREEALL();
- amdlibSetErrMsg("Could not allocate memory (fftDirect)");
- return amdlibFAILURE;
- }
-
- phasor = calloc(nbElem, sizeof(double));
- if (phasor == NULL)
- {
- amdlibShift_FREEALL();
- amdlibSetErrMsg("Could not allocate memory (phasor)");
- return amdlibFAILURE;
- }
-
- phasedFft = calloc(nbElem, sizeof(double));
- if (phasedFft == NULL)
- {
- amdlibShift_FREEALL();
- amdlibSetErrMsg("Could not allocate memory (phasedFft)");
- return amdlibFAILURE;
- }
-
- tabDecalPeriodized = calloc(nbElem, sizeof(double));
- if (tabDecalPeriodized == NULL)
- {
- amdlibShift_FREEALL();
- amdlibSetErrMsg("Could not allocate memory (tabDecalPeriodized)");
- return amdlibFAILURE;
- }
-
- /* */
- if (fpShift != 0.0)
- {
- for (i=0;i<nbElem;i++)
- {
- /* The value to substract to the signal before the shift */
- dr = ((m2-m1) / (nbElem - 1)) * i + m1;
-
- /* The value to add again to the periodized signal after the
- * shift */
- drc[i] = dr + ((m2 - m1) / (nbElem - 1)) * -fpShift;
- tabInPeriodized[i] = tabIn[i] - dr;
- }
-
-#if TEST
- amdlibLogTest("drc =[");
- for (i = 0; i < nbElem - 1; i++)
- {
- amdlibLogTest("%f, ", drc[i]);
- }
- amdlibLogTest("%f]", drc[nbElem - 1]);
-
- amdlibLogTest("tabInPeriodized =[");
- for (i = 0; i < nbElem - 1; i++)
- {
- amdlibLogTest("%f, ", tabInPeriodized[i]);
- }
- amdlibLogTest("%f]", tabInPeriodized[nbElem-1]);
-#endif
-
-#if TEST
- amdlibLogTest("phi =[");
-#endif
-
- phi = 0; /*(2. * M_PI * fpShift / nbElem) * 1.0;*/
- phasor[0] = cos(phi); /* DC component */
-
- for (i = 1; i < (nbElem + 1) / 2; i++)
- {
- /* The phasor to apply to the fft of the periodized signal
- * to shift it of fpShift */
- phi = (2. * M_PI * fpShift / nbElem) * (i);
-#if TEST
- amdlibLogTest("%f, ", phi);
-#endif
-
- phasor[i] = cos(phi);
- phasor[nbElem - i] = sin(phi);
- }
- if (nbElem % 2 == 0) /* nbElem is even */
- {
- phi = M_PI * fpShift;
- phasor[nbElem / 2] = cos(phi); /* Nyquist freq. */
- }
-
-#if TEST
- amdlibLogTest("]");
-
- amdlibLogTest("phasor =[");
- for (i = 0; i < nbElem - 1; i++)
- {
- amdlibLogTest("%f, ", phasor[i]);
- }
- amdlibLogTest("%f]", phasor[nbElem - 1]);
-#endif
-
- /* The shift itself */
- p = fftw_plan_r2r_1d(nbElem, tabInPeriodized, fftDirect, FFTW_R2HC, FFTW_ESTIMATE);
- fftw_execute(p);
- fftw_destroy_plan(p);
-
-
- phasedFft[0] = phasor[0] * fftDirect[0];
- for (i = 1; i < (nbElem + 1) / 2; i++)
- {
- /* f(x-x0)<=>F(u)exp(i*2*PI/N*u*x0) */
- /* Real part */
- phasedFft[i] = phasor[i] * fftDirect[i] +
- phasor[nbElem - i] * fftDirect[nbElem - i];
-
- /* Imaginary part */
- phasedFft[nbElem-i] = phasor[i] * fftDirect[nbElem - i] -
- phasor[nbElem - i] * fftDirect[i];
- }
-
-
- if (nbElem % 2 == 0) /* nbElem is even Real part only */
- {
- phasedFft[nbElem / 2] = 2 * phasor[nbElem / 2] *
- fftDirect[nbElem / 2];
- }
-
-
-#if TEST
- amdlibLogTest("fftDirect =[");
- for (i = 0; i < nbElem - 1; i++)
- {
- amdlibLogTest("%f, ", fftDirect[i]);
- }
- amdlibLogTest("%f]", fftDirect[nbElem-1]);
-
- amdlibLogTest("phasedFft =[");
- for (i = 0; i < nbElem - 1; i++)
- {
- amdlibLogTest("%f, ", phasedFft[i]);
- }
- amdlibLogTest("%f]", phasedFft[nbElem-1]);
-#endif
-
- p = fftw_plan_r2r_1d(nbElem, phasedFft, tabDecalPeriodized, FFTW_HC2R, FFTW_ESTIMATE);
- fftw_execute(p);
- fftw_destroy_plan(p);
- for (i = 0; i < nbElem; i++)
- {
- tabIn[i] = (1.0 / nbElem) * tabDecalPeriodized[i] +
- drc[i];
- }
- }
- else if (shift == 0.0)
- {
- memcpy(tabOut, tabIn, (size_t)nbElem * sizeof(double));
- amdlibShift_FREEALL();
- return amdlibSUCCESS;
- }
-
-
- if (ipShift < 0)
- {
- for (i = 0; i < -ipShift; i++)
- {
- tabOut[i + ipShift + nbElem] = tabIn[i];
- }
- for (i = -ipShift; i<nbElem; i++)
- {
- tabOut[i + ipShift] = tabIn[i];
- }
- }
- else
- {
- for (i = 0; i < nbElem; i++)
- {
- tabOut[i] = (i < ipShift) ?
- tabIn[i - ipShift + nbElem]:tabIn[i - ipShift];
- }
- }
-
-
-#if TEST
- amdlibLogTest("tabDecalPeriodized =[");
- for (i = 0; i < nbElem - 1; i++)
- {
- amdlibLogTest("%f, ", tabDecalPeriodized[i]);
- }
- amdlibLogTest("%f]", tabDecalPeriodized[nbElem - 1]);
-
- amdlibLogTest("tabOut =[");
- for (i = 0; i < nbElem - 1; i++)
- {
- amdlibLogTest("%f, ", tabOut[i]);
- }
- amdlibLogTest("%f]", tabOut[nbElem - 1]);
-
- amdlibLogTest("tabIn =[");
- for (i = 0; i < nbElem - 1; i++)
- {
- amdlibLogTest("%f, ", tabIn[i]);
- }
- amdlibLogTest("%f]", tabIn[nbElem - 1]);
- amdlibLogTest("tabOut (entier) =[");
- for (i = 0; i < nbElem - 1; i++)
- {
- amdlibLogTest("%f, ", tabOut[i]);
- }
- amdlibLogTest("%f]", tabOut[nbElem - 1]);
-
- if (fpShift == 0.0)
- {
- amdlibLogTest("tabOut (entier decal) =[");
- for (i = 0; i < nbElem - 1; i++)
- {
- amdlibLogTest("%f, ", tabOut[i]);
- }
- amdlibLogTest("%f]", tabOut[nbElem - 1]);
- }
-#endif
-
- amdlibShift_FREEALL();
-
- return amdlibSUCCESS;
-}
-
-/** Useful macro to free all allocated memory */
-#define amdlibComputeShift_FREEALL() free(fft_tab2); \
- free(fft_tab1); \
- free(interSpectrum); \
- free(convolPadded);
-
-/**
- * Computes shift between to value arrays
- *
- * This function computes the shift (possibly non-integer) between two arrays.
- *
- * @param nbElem number of element in arrays
- * @param tab1 first array
- * @param tab2 second array
- * @param shift computed shift between arrays
- * @param sigma2Shift error on computed shift
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibComputeShift(/* INPUT */
- int nbElem,
- double *tab1,
- double *tab2,
- /* OUTPUT */
- double *shift,
- double *sigma2Shift,
- amdlibERROR_MSG errMsg)
-{
- int i;
- int nPhi = (nbElem + 1) / 2;
-
- /* Interpolated spectrum */
- double *interSpectrum = NULL;
- double *convolPadded = NULL;
- double *fft_tab1 = NULL;
- double *fft_tab2 = NULL ;
- int padFactor;
- int mxx;
- double max;
-
-
- fftw_plan p1;
- fftw_plan p2;
-
- amdlibLogTrace("amdlibComputeShift()");
-
- padFactor = 32;
-
- /* Allocate memory */
- interSpectrum = calloc(nbElem * padFactor, sizeof(double));
- if (interSpectrum == NULL)
- {
- amdlibComputeShift_FREEALL();
- amdlibSetErrMsg("Could not allocate memory (interSpectrum)");
- return amdlibFAILURE;
- }
- convolPadded = calloc(nbElem * padFactor, sizeof(double));
- if (convolPadded == NULL)
- {
- amdlibComputeShift_FREEALL();
- amdlibSetErrMsg("Could not allocate memory (convolPadded)");
- return amdlibFAILURE;
- }
- fft_tab1 = calloc(nbElem, sizeof(double));
- if (fft_tab1 == NULL)
- {
- amdlibComputeShift_FREEALL();
- amdlibSetErrMsg("Could not allocate memory (fft_tab1)");
- return amdlibFAILURE;
- }
- fft_tab2 = calloc(nbElem, sizeof(double));
- if (fft_tab2 == NULL)
- {
- amdlibComputeShift_FREEALL();
- amdlibSetErrMsg("Could not allocate memory (fft_tab2)");
- return amdlibFAILURE;
- }
-
- p1 = fftw_plan_r2r_1d(nbElem, tab1, fft_tab1, FFTW_R2HC, FFTW_ESTIMATE);
- fftw_execute(p1);
- fftw_destroy_plan(p1);
- p1 = fftw_plan_r2r_1d(nbElem,tab2, fft_tab2, FFTW_R2HC, FFTW_ESTIMATE);
- fftw_execute(p1);
- fftw_destroy_plan(p1);
-
- interSpectrum[0] = fft_tab1[0] * fft_tab2[0];
- for (i = 1; i < nPhi; i++)
- {
- interSpectrum[i] =
- fft_tab1[i] * fft_tab2[i] +
- fft_tab1[nbElem - i] * fft_tab2[nbElem - i];
-
- interSpectrum[nbElem * padFactor - i] =
- fft_tab1[nbElem - i] * fft_tab2[i] -
- fft_tab1[i] * fft_tab2[nbElem - i];
- }
- if (nbElem % 2 == 0) /* nbElem is even */
- {
- interSpectrum[nPhi - 1] = fft_tab1[nbElem / 2] * fft_tab2[nbElem / 2] +
- fft_tab1[nbElem / 2] * fft_tab2[nbElem / 2];
- }
-
- p2 = fftw_plan_r2r_1d(nbElem * padFactor, interSpectrum, convolPadded,FFTW_HC2R, FFTW_ESTIMATE);
- fftw_execute(p2);
- fftw_destroy_plan(p2);
-
- mxx = 0;
- max = convolPadded[mxx];
- for (i = 1; i < nbElem * padFactor; i++)
- {
- if(convolPadded[i] > max)
- {
- max = convolPadded[i];
- mxx = i;
- }
- }
-
- if (mxx > nbElem * padFactor / 2)
- {
- mxx = mxx - nbElem * padFactor;
- }
-
- *shift = -1 * (double) mxx / (double) padFactor;
- *sigma2Shift = 1.0 / (double) padFactor;
-
- /* Free memory */
- amdlibComputeShift_FREEALL();
-
- return amdlibSUCCESS;
-}
-
-
diff --git a/amber/amdlibSpectralCalibration.c b/amber/amdlibSpectralCalibration.c
deleted file mode 100644
index daf7705..0000000
--- a/amber/amdlibSpectralCalibration.c
+++ /dev/null
@@ -1,792 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Functions to perform spectral calibration
- */
-
-#define _POSIX_SOURCE 1
-
-/*
- * System Headers
- */
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "fitsio.h"
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/*
- * Public function
- */
-
-/**
- * Perform spectral calibration.
- *
- * This function perform the spectral calibration. This consists in :
- * \li computing the photometric channel shift wrt. interferometric channel
- * \li calibration spectral dispersion table (in low JHK mode only)
- *
- * @param scData data used for spectral calibration.
- * @param scType spectral calibration type (amdlibSC_2T or amdlibSC_3T).
- * @param waveData structure where calibration wave data will be stored
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibPerformSpectralCalibration(amdlibSC_INPUT_DATA *scData,
- amdlibSC_TYPE scType,
- amdlibWAVEDATA *waveData,
- amdlibERROR_MSG errMsg)
-{
- int nbTel;
- int beam;
- int nbChannels;
- amdlibDOUBLE *spectrum,*noise;
- int hasAssociatedP2VMFlux[3]={0,0,0};
- amdlibDOUBLE intfSpec [amdlibNB_SPECTRAL_CHANNELS];
- amdlibDOUBLE photoSpec[amdlibNB_SPECTRAL_CHANNELS];
-
- char keywValue[amdlibKEYW_VAL_LEN+1];
-
- amdlibLogTrace("amdlibPerformSpectralCalibration()");
-
- /* Init the number of telescopes and baselines according to SC type */
- if (scType == amdlibSC_2T)
- {
- nbTel = 2;
- }
- else if (scType == amdlibSC_3T)
- {
- nbTel = 3;
- }
- else
- {
- amdlibSetErrMsg("Invalid type %d (see amdlibSC_TYPE)", (int)scType);
- return amdlibFAILURE;
- }
-
- /* Get instrument configuration */
- memset(keywValue, '\0', (amdlibKEYW_VAL_LEN+1)*sizeof(char));
- if (amdlibGetInsCfgKeyword(&(scData->rawData[0].insCfg),
- "HIERARCH ESO OCS OBS SPECCONF",
- keywValue, errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- /* If instrument configuration is High Resolution, Do not even attempt
- * to compute offsets, hardware currently implement prevents it. Just
- * pretend that the offsets have been calibrated and equal 0*/
- if (strstr(keywValue, "High_") != NULL)
- {
- for (beam = 0; beam < nbTel; beam++)
- {
- waveData->photoOffset[beam] = 0.0;
- amdlibLogInfo("High-resolution data");
- amdlibLogInfoDetail("Photometric channel %d set to offset 0", beam);
- }
- return amdlibSUCCESS;
- }
-
- /* Reset error message */
- memset(errMsg, '\0', sizeof(amdlibERROR_MSG));
-
- /* Check the science data have been stored and calibrated */
- for (beam = 0; beam < nbTel; beam++)
- {
- int frameType;
-
- /* Set frame type (see amdlibFRAME_TYPE) */
- frameType = beam + amdlibTEL1_FRAME;
-
- /* Check the corresponding science data has been loaded */
- if (scData->dataLoaded[beam] == amdlibFALSE)
- {
- amdlibSetErrMsg("Missing data file corresponding to the beam %d "
- "(FRAMETYPE %d, see amdlibFRAME_TYPE)",
- beam, frameType);
- return amdlibFAILURE;
- }
- /* Check if data set also has flux correction table (e.g., from P2VM)*/
- if (scData->dataLoaded[beam+3] == amdlibTRUE)
- {
- hasAssociatedP2VMFlux[beam]=1;
- }
- }
-
- /* Retrieve the number of spectral channels */
- nbChannels = scData->rawData[0].region[0].dimAxis[1];
-
- /* For each telescope (i.e. beam), retrieve correct photometry and compute
- * shift wrt. interferometric channel */
- for (beam = 0; beam < nbTel; beam++)
- {
- double shift, sigma2Shift;
- int l;
-
- /* Allocate memory for spectrum */
- spectrum = (amdlibDOUBLE *)calloc(nbChannels, sizeof(*spectrum));
- if (spectrum == NULL)
- {
- amdlibSetErrMsg("Could not allocate memory for spectrum");
- return amdlibFAILURE;
- }
- noise = (amdlibDOUBLE *)calloc(nbChannels, sizeof(*noise));
- if (spectrum == NULL)
- {
- amdlibSetErrMsg("Could not allocate memory for noise");
- return amdlibFAILURE;
- }
-
- /* Compute spectrum for interferometric beam */
- if (amdlibSumAndPackData(&(scData->rawData[beam]),
- amdlibTRUE, amdlibFALSE, amdlibTRUE,
- 3, &spectrum, &noise, errMsg) != amdlibSUCCESS)
- {
- free(spectrum);
- free(noise);
- return amdlibFAILURE;
- }
-
- /* Store interferometric spectrum into 512-element array for 'fft' */
- memset(intfSpec, '\0', amdlibNB_SPECTRAL_CHANNELS*sizeof(*intfSpec));
- for (l = 0; l < nbChannels; l++)
- {
- intfSpec[l] = spectrum[l];
- }
-
- /* if associated flux calibration frame is present, and we are MR (HR?) correct it*/
- if (hasAssociatedP2VMFlux[beam]==1 && (strstr(keywValue, "Low_JHK ") == NULL))
- {
- if (amdlibSumAndPackData(&(scData->rawData[beam+3]),
- amdlibTRUE, amdlibFALSE, amdlibTRUE,
- 3, &spectrum, &noise, errMsg) != amdlibSUCCESS)
- {
- free(spectrum);
- free(noise);
- return amdlibFAILURE;
- }
- /*normalise intfSpec with this spectrum*/
- for (l = 0; l < nbChannels; l++)
- {
- intfSpec[l] /= spectrum[l];
- }
- }
-
- /* Compute spectrum for photometric beam */
- if (amdlibSumAndPackData(&(scData->rawData[beam]),
- amdlibTRUE, amdlibFALSE, amdlibTRUE,
- beam, &spectrum, &noise, errMsg) != amdlibSUCCESS)
- {
- free(spectrum);
- free(noise);
- return amdlibFAILURE;
- }
-
- /* Store photometric spectrum into 512-element array for 'fft' */
- memset(photoSpec, '\0', amdlibNB_SPECTRAL_CHANNELS*sizeof(*photoSpec));
- for (l = 0; l < nbChannels; l++)
- {
- photoSpec[l] = spectrum[l];
- }
-
- /* if associated flux calibration frame is present, correct it*/
- if (hasAssociatedP2VMFlux[beam]==1 && (strstr(keywValue, "Low_JHK ") == NULL) )
- {
- if (amdlibSumAndPackData(&(scData->rawData[beam+3]),
- amdlibTRUE, amdlibFALSE, amdlibTRUE,
- beam, &spectrum, &noise, errMsg) != amdlibSUCCESS)
- {
- free(spectrum);
- free(noise);
- return amdlibFAILURE;
- }
- /*normalise photoSpec with this spectrum*/
- for (l = 0; l < nbChannels; l++)
- {
- photoSpec[l] /= spectrum[l];
- }
- }
-
- /* Compute shift between the interferometric and photometric channels */
- if (amdlibComputeShift(nbChannels, intfSpec, photoSpec,
- &shift, &sigma2Shift, errMsg) == amdlibFAILURE)
- {
- free(spectrum);
- free(noise);
- return amdlibFAILURE;
- }
-
- /* Check shift value; must be less than 5 pixels */
- if (fabs(shift) > 5.0)
- {
- free(spectrum);
- free(noise);
- amdlibSetErrMsg("Shift (%.2f) between photometric channel #%d "
- "and interferometric channel too high",
- shift, beam + 1);
- return amdlibFAILURE;
- }
-
- /* Store shift */
- waveData->photoOffset[beam] = shift;
- amdlibLogInfoDetail("Photometric channel %d has offset %f (%f)",
- beam, shift, sigma2Shift);
-
- free(noise);
- free(spectrum);
- }
-
-
- /* If it is low JHK mode, calibrate spectral dispersion table using image of
- * the beam 1 */
- if (strstr(keywValue, "Low_JHK ") != NULL)
- {
- int shutterNum;
- int i, l;
- int startPixel;
-
- /* Assuming all bands are open */
- int shutterPos[amdlibNB_BANDS] = {1, 1, 1};
- amdlibINS_CFG *insCfg = &scData->rawData[1].insCfg;
-
- /* Reference spectrum */
- amdlibDOUBLE refSpec[amdlibNB_SPECTRAL_CHANNELS];
- double max;
- double shift, sigma2Shift;
-
- /* Scan all configuration keywords */
- for (i=0; i < insCfg->nbKeywords; i++)
- {
- /* Look for SFK shutters; do not check the specific BSL shutters */
- if ((strstr(insCfg->keywords[i].name,
- "HIERARCH ESO INS SHUT") != NULL) &&
- (strstr(insCfg->keywords[i].name, " ST") != NULL))
- {
-
- /* Get the shutter number; used to know the optical path to
- * which it belongs */
- sscanf(insCfg->keywords[i].name,
- "HIERARCH ESO INS SHUT%d", &shutterNum);
- /* If shutter is closed */
- if (strstr(insCfg->keywords[i].value, "F") != 0)
- {
- /* Set correspondind band to close */
- switch(shutterNum)
- {
- /* Shutters of J band */
- case 10:
- case 11:
- shutterPos[amdlibJ_BAND] = 0;
- break;
- case 12:
- if (nbTel == 3)
- {
- shutterPos[amdlibJ_BAND] = 0;
- }
- break;
- /* Shutters of H band */
- case 7:
- case 8:
- shutterPos[amdlibH_BAND] = 0;
- break;
- case 9:
- if (nbTel == 3)
- {
- shutterPos[amdlibH_BAND] = 0;
- }
- break;
- /* Shutters of K band */
- case 4:
- case 5:
- shutterPos[amdlibK_BAND] = 0;
- break;
- case 6:
- if (nbTel == 3)
- {
- shutterPos[amdlibK_BAND] = 0;
- }
- break;
- }
- }
- }
- }
- /* If all bands are off, return an error */
- if ((shutterPos[amdlibJ_BAND] == 0) &&
- (shutterPos[amdlibH_BAND] == 0) &&
- (shutterPos[amdlibK_BAND] == 0))
- {
- amdlibSetErrMsg("Unable to build JHK reference Spectrum: check "
- "shutter status !");
- return amdlibFAILURE;
- }
-
- /* Get reference spectrum corresponding to the instrument
- * configuration */
- if (amdlibGetRefLowJHKSpectrumForCal(shutterPos, refSpec)
- == amdlibFAILURE)
- {
- return amdlibFAILURE;
- }
-
- /* Allocate memory for spectrum */
- spectrum = (amdlibDOUBLE *)calloc(nbChannels, sizeof(*spectrum));
- noise = (amdlibDOUBLE *)calloc(nbChannels, sizeof(*noise));
-
- /* Compute spectrum for interferometric beam */
- if (amdlibSumAndPackData(&(scData->rawData[0]),
- amdlibTRUE, amdlibFALSE, amdlibTRUE,
- 3, &spectrum, &noise, errMsg) != amdlibSUCCESS)
- {
- free(noise);
- free(spectrum);
- return amdlibFAILURE;
- }
-
- /* Get the start pixel; -1 because this value is on the detector where
- * pixels numbers start at 1 */
- startPixel = scData->rawData[0].region[3].corner[1] - 1;
- /* Store interferometric spectrum into 512-element array for 'fft'
- * taking into account the start pixel. */
- memset(intfSpec, '\0', amdlibNB_SPECTRAL_CHANNELS*sizeof(*intfSpec));
- for (l = 0; l < nbChannels; l++)
- {
- intfSpec[startPixel + l] = spectrum[l];
- }
- free(noise);
- free(spectrum);
-
- /* Since spectra have now different powers, normalize the spectra
- * observed to unity */
- max = intfSpec[0];
- for (l = 0; l < amdlibNB_SPECTRAL_CHANNELS; l++)
- {
- if (intfSpec[l] > max)
- {
- max = intfSpec[l];
- }
- }
- for (l = 0; l < amdlibNB_SPECTRAL_CHANNELS; l++)
- {
- intfSpec[l] /= max;
- }
-
- /* Compute shift */
- if (amdlibComputeShift(amdlibNB_SPECTRAL_CHANNELS, refSpec,
- intfSpec, &shift, &sigma2Shift,
- errMsg) == amdlibFAILURE)
- {
- return amdlibFAILURE;
- }
- amdlibLogInfo("Wavelength table has offset %f (%f)",
- shift, sigma2Shift);
-
- /* Check offset value; must be less than 10 pixels */
- if (fabs(shift) > 10.0)
- {
- //free(noise);
- //free(spectrum);
- amdlibSetErrMsg("Offset (%.2f) of wavelength table too high",
- shift);
- return amdlibFAILURE;
- }
-
- /* Update wavelength and bandwidth by removing data, inserting reference
- * spectrum wavelength at the good location and shifting this by the
- * nint of measured shift value (this to maintain zeroes in all
- * wavelength undefined -- with the non-integer shift method, invalid
- * wavelength would contain noise, not zeroes)
- */
- /* Get reference spectral dispersion table for low JHK mode */
- if (amdlibGetRefLowJHKSpectralDispersion(refSpec) == amdlibFAILURE)
- {
- return amdlibFAILURE;
- }
- /* Shift reference spectral dispersion table of the measured shift */
- if (amdlibShift(amdlibNB_SPECTRAL_CHANNELS, refSpec, shift,
- waveData->wlen, errMsg) == amdlibFAILURE)
- {
- return amdlibFAILURE;
- }
-
- /* Set all wavelengths that do not belong to J, H or K band to 0 */
- l = 0;
- while (l < amdlibNB_SPECTRAL_CHANNELS)
- {
- if (amdlibGetBand(waveData->wlen[l]) == amdlibUNKNOWN_BAND)
- {
- waveData->wlen[l] = 0.;
- l++;
- }
- else
- {
- break;
- }
- }
- i = amdlibNB_SPECTRAL_CHANNELS - 1;
- while (i > l)
- {
- if (amdlibGetBand(waveData->wlen[i]) == amdlibUNKNOWN_BAND)
- {
- waveData->wlen[i] = 0.;
- i--;
- }
- else
- {
- break;
- }
- }
-
- /* Compute bandwidth */
- if (amdlibComputeBandwidth(waveData) == amdlibFAILURE)
- {
- amdlibSetErrMsg("Could not compute bandwidth");
- return amdlibFAILURE;
- }
- }
-
- return amdlibSUCCESS;
-}
-
-static amdlibDARK_DATA dark = {NULL};
-static amdlibRAW_DATA rawData = {NULL};
-static amdlibSC_INPUT_DATA spectralCalibrationData = {NULL};
-static amdlibWAVEDATA calWaveData;
-
-/**
- * Compute spectral calibration for the 2 telescopes configuration.
- *
- * This function computes the spectral calibration for the 2 telescope
- * configuration. The resulting calculated offsets are saved into the file
- * given as parameter. If this file exists, it is overwritten.
- *
- * @param badPixelFile name of file containing bad pixel map
- * @param flatFieldFile name of file containing flat-field map
- * @param darkFile name of file containing data for dark compensation
- * @param inputFile1 name of file containing data on specific shutter
- * configuration useful to perform spectral calibration
- * @param inputFile2 name of file containing data on specific shutter
- * configuration useful to perform spectral calibration
- * @param spectralOffsets amdlibDOUBLE array containing computed calibration offsets.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibComputeSpectralCalibration2T(
- const char *badPixelFile,
- const char *flatFieldFile,
- const char *darkFile,
- const char *inputFile1,
- const char *inputFile2,
- amdlibDOUBLE spectralOffsets[])
-{
- const char *inputFiles[3];
- int i;
- amdlibERROR_MSG errMsg;
-
- amdlibLogTrace("amdlibComputeSpectralCalibration2T()");
-
- /* Init list of input files */
- inputFiles[0] = darkFile;
- inputFiles[1] = inputFile1;
- inputFiles[2] = inputFile2;
-
- /* If a bad pixel file has been specified */
- if ((badPixelFile != NULL) && (strlen(badPixelFile) != 0))
- {
- /* Load it */
- if (amdlibLoadBadPixelMap(badPixelFile, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load bad pixel map '%s'", badPixelFile);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- }
-
- /* Load flat field map */
- if ((flatFieldFile != NULL) && (strlen(flatFieldFile) != 0))
- {
- if(amdlibLoadFlatFieldMap(flatFieldFile, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load flat Field map '%s'", flatFieldFile);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- }
-
- /* For each input files */
- amdlibLogInfo("Loading input files ...");
- for (i = 0; i < 3; i++)
- {
- if ((inputFiles[i] == NULL) || (strlen(inputFiles[i]) == 0))
- {
- amdlibLogError("Invalid name for %dth input file", i+1);
- return amdlibFAILURE;
- }
-
- /* Load raw data */
- amdlibLogInfoDetail("%s", inputFiles[i]);
-
- if (amdlibLoadRawData(inputFiles[i], &rawData, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load raw data from file '%s'",
- inputFiles[i]);
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseRawData(&rawData);
- return amdlibFAILURE;
- }
-
-
- if (rawData.frameType == amdlibUNKNOWN_FRAME)
- {
- amdlibLogError("Invalid frame type '%d'", amdlibUNKNOWN_FRAME);
- amdlibReleaseRawData(&rawData);
- return amdlibFAILURE;
- }
- else if (rawData.frameType == amdlibDARK_FRAME)
- {
- /* Compute pixel dark map */
- if (amdlibGenerateDarkData(&rawData, &dark,
- errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not generate dark map");
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseDarkData(&dark);
- amdlibReleaseRawData(&rawData);
- return amdlibFAILURE;
- }
- }
- else
- {
- /* Equalize raw data */
- if (amdlibCalibrateRawData(&dark, &rawData, errMsg)
- !=amdlibSUCCESS)
- {
- amdlibLogError("Could not calibrate raw data");
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseDarkData(&dark);
- amdlibReleaseRawData(&rawData);
- return amdlibFAILURE;
- }
-
- /* Store calibrated data into Spectral Calibration data structure */
- if (amdlibAddToSpectralCalibrationData(&rawData,
- &spectralCalibrationData,
- errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not store calibrated wave data into "
- "spectral calibration data structure");
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseDarkData(&dark);
- amdlibReleaseRawData(&rawData);
- amdlibReleaseSpectralCalibrationData(&spectralCalibrationData);
- return amdlibFAILURE;
- }
- }
- /* copy first rawData->waveData structure in calWaveData to fill all
- * fields*/
- if (i != 0)
- {
- memcpy(&calWaveData, &rawData.waveData, sizeof(amdlibWAVEDATA));
- }
- amdlibReleaseRawData(&rawData);
- }
- /* End for */
-
- amdlibReleaseDarkData(&dark);
-
- /* Compute Spectral Calibration */
- amdlibLogInfo("Computing spectral calibration ...");
- if (amdlibPerformSpectralCalibration(&spectralCalibrationData, amdlibSC_2T,
- &calWaveData, errMsg) == amdlibFAILURE)
- {
- amdlibLogError("Could not perform spectral calibration");
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseSpectralCalibrationData(&spectralCalibrationData);
- return amdlibFAILURE;
- }
-
- amdlibReleaseSpectralCalibrationData(&spectralCalibrationData);
-
- for (i=0; i < 2; i++)
- {
- spectralOffsets[i] = calWaveData.photoOffset[i];
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Compute spectral calibration for the 3 telescopes configuration.
- *
- * Ditto amdlibComputeSpectralCalibration2T for the 3 telescopes configuration
- *
- * @param badPixelFile name of file containing bad pixel map
- * @param flatFieldFile name of file containing flat-field map
- * @param darkFile name of file containing data for dark estimation
- * @param inputFile1 name of file containing data on specific shutter
- * configuration useful to perform spectral calibration
- * @param inputFile2 name of file containing data on specific shutter
- * configuration useful to perform spectral calibration
- * @param inputFile3 name of file containing data on specific shutter
- * configuration useful to perform spectral calibration
- * @param spectralOffsets amdlibDOUBLE array containing computed calibration offsets.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibComputeSpectralCalibration3T(const char *badPixelFile,
- const char *flatFieldFile,
- const char *darkFile,
- const char *inputFile1,
- const char *inputFile2,
- const char *inputFile3,
- amdlibDOUBLE spectralOffsets[])
-{
- const char *inputFiles[4];
- int i;
- amdlibERROR_MSG errMsg;
-
- amdlibLogTrace("amdlibComputeSpectralCalibration3T()");
-
- /* Init list of input files */
- inputFiles[0] = darkFile;
- inputFiles[1] = inputFile1;
- inputFiles[2] = inputFile2;
- inputFiles[3] = inputFile3;
-
- /* If a bad pixel file has been specified */
- if ((badPixelFile != NULL) && (strlen(badPixelFile) != 0))
- {
- /* Load it */
- if (amdlibLoadBadPixelMap(badPixelFile, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load bad pixel map '%s'", badPixelFile);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- }
-
- /* Load flat field map */
- if ((flatFieldFile != NULL) && (strlen(flatFieldFile) != 0))
- {
- if(amdlibLoadFlatFieldMap(flatFieldFile, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load flat field map '%s'", flatFieldFile);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- }
-
- /* For each input files */
- amdlibLogInfo("Loading input files ...");
- for (i = 0; i < 4; i++)
- {
- if ((inputFiles[i] == NULL) || (strlen(inputFiles[i]) == 0))
- {
- amdlibLogError("Invalid name for %dth input file", i+1);
- return amdlibFAILURE;
- }
-
- /* Load raw data */
- amdlibLogInfoDetail("%s", inputFiles[i]);
-
- if (amdlibLoadRawData(inputFiles[i], &rawData, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load raw data from file '%s'", inputFiles[i]);
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseRawData(&rawData);
- return amdlibFAILURE;
- }
-
- if (rawData.frameType == amdlibUNKNOWN_FRAME)
- {
- amdlibLogError("Invalid frame type '%d'", amdlibUNKNOWN_FRAME);
- amdlibReleaseRawData(&rawData);
- return amdlibFAILURE;
- }
- else if (rawData.frameType == amdlibDARK_FRAME)
- {
- /* Compute dark map */
- if (amdlibGenerateDarkData(&rawData, &dark,
- errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not generate dark map");
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseDarkData(&dark);
- amdlibReleaseRawData(&rawData);
- return amdlibFAILURE;
- }
- }
- else
- {
- /* Equalize raw data */
- if (amdlibCalibrateRawData(&dark, &rawData, errMsg)
- !=amdlibSUCCESS)
- {
- amdlibLogError("Could not calibrate raw data");
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseDarkData(&dark);
- amdlibReleaseRawData(&rawData);
- return amdlibFAILURE;
- }
-
- /* Store calibrated data into Spectral Calibration data structure */
- if (amdlibAddToSpectralCalibrationData(&rawData,
- &spectralCalibrationData,
- errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not store calibrated wave data into "
- "spectral calibration data structure");
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseDarkData(&dark);
- amdlibReleaseRawData(&rawData);
- amdlibReleaseSpectralCalibrationData(&spectralCalibrationData);
- return amdlibFAILURE;
- }
- }
- /* copy first rawData->waveData structure in calWaveData to fill
- * all fields*/
- if (i != 0)
- {
- memcpy(&calWaveData, &rawData.waveData, sizeof(amdlibWAVEDATA));
- }
- amdlibReleaseRawData(&rawData);
- }
- /* End for */
-
- amdlibReleaseDarkData(&dark);
-
- /* Compute Spectral Calibration */
- amdlibLogInfo("Computing spectral calibration ...");
- if (amdlibPerformSpectralCalibration(&spectralCalibrationData, amdlibSC_3T,
- &calWaveData, errMsg) == amdlibFAILURE)
- {
- amdlibLogError("Could not perform spectral calibration");
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseSpectralCalibrationData(&spectralCalibrationData);
- return amdlibFAILURE;
- }
-
- amdlibReleaseSpectralCalibrationData(&spectralCalibrationData);
-
- for (i=0; i < 3; i++)
- {
- spectralOffsets[i] = calWaveData.photoOffset[i];
- }
-
- return amdlibSUCCESS;
-}
-
-/*___oOo__*/
diff --git a/amber/amdlibSpectralCalibrationData.c b/amber/amdlibSpectralCalibrationData.c
deleted file mode 100644
index 9eef645..0000000
--- a/amber/amdlibSpectralCalibrationData.c
+++ /dev/null
@@ -1,216 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Functions to handle data used for spectral calibration.
- */
-
-#define _POSIX_SOURCE 1
-
-/*
- * System Headers
- */
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "fitsio.h"
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/* Local function declaration */
-static void amdlibInitSpectralCalibrationData(amdlibSC_INPUT_DATA *);
-
-/* Public functions */
-/**
- * Add raw data to the input data needed for spectral calibration.
- *
- * This function stores the given raw data, which should be calibrated, into the
- * spectral calibration data structure.
- *
- * @param rawData raw data to be added to spectral calibration data.
- * @param specCalData structure where data for spectral calibration will be
- * stored
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAddToSpectralCalibrationData (
- amdlibRAW_DATA *rawData,
- amdlibSC_INPUT_DATA *specCalData,
- amdlibERROR_MSG errMsg)
-{
- int i;
-
- amdlibLogTrace("amdlibAddToSpectralCalibrationData()");
-
- /* If data structure is not initialized, do it */
- if (specCalData->thisPtr != specCalData)
- {
- /* Initialise data structure */
- amdlibInitSpectralCalibrationData(specCalData);
- }
-
- /* Check raw data structure contains data */
- if (rawData->dataLoaded == amdlibFALSE)
- {
- amdlibSetErrMsg("The raw data structure does not contain data. "
- "Check call to amdlibLoadRawData()");
- return amdlibFAILURE;
- }
-
- /* Check frame type. */
- if ((rawData->frameType != amdlibTEL1_FRAME) &&
- (rawData->frameType != amdlibTEL2_FRAME) &&
- (rawData->frameType != amdlibTEL3_FRAME))
- {
- amdlibSetErrMsg("Invalid frame type %d (see amdlibFRAME_TYPE)",
- rawData->frameType);
- return amdlibFAILURE;
- }
-
- /* Check the raw data only contains 1 row */
- if (rawData->nbRows != 1)
- {
- amdlibSetErrMsg("Wrong number of data rows (%d) for spectral "
- "calibration: must be 1", rawData->nbRows);
- return amdlibFAILURE;
- }
-
- /* Check if this frame type is already loaded */
- i = rawData->frameType - amdlibTEL1_FRAME;
- if (specCalData->dataLoaded[i] == amdlibTRUE)
- {
- amdlibSetErrMsg("Frame type %d already loaded (see amdlibFRAME_TYPE)",
- rawData->frameType);
- return amdlibFAILURE;
- }
-
- if (amdlibDuplicateRawData(rawData, &specCalData->rawData[i],
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- specCalData->dataLoaded[i] = amdlibTRUE;
-
- return amdlibSUCCESS;
-}
-
-amdlibCOMPL_STAT amdlibAddP2VDataToSpectralCalibrationData (
- amdlibRAW_DATA *rawData,
- amdlibSC_INPUT_DATA *specCalData,
- amdlibERROR_MSG errMsg)
-{
- int i;
-
- amdlibLogTrace("amdlibAddP2VDataToSpectralCalibrationData()");
-
- /* If data structure is not initialized, do it */
- if (specCalData->thisPtr != specCalData)
- {
- /* Initialise data structure */
- amdlibInitSpectralCalibrationData(specCalData);
- }
-
- /* Check raw data structure contains data */
- if (rawData->dataLoaded == amdlibFALSE)
- {
- amdlibSetErrMsg("The raw data structure does not contain data. "
- "Check call to amdlibLoadRawData()");
- return amdlibFAILURE;
- }
-
- /* Check frame type. Return immediately if not the good ones */
- if ((rawData->frameType != amdlibTEL1_FRAME) &&
- (rawData->frameType != amdlibTEL2_FRAME) &&
- (rawData->frameType != amdlibTEL3_FRAME))
- {
- return amdlibSUCCESS;
- }
-
- /* Check the raw data only contains 1 row */
- if (rawData->nbRows != 1)
- {
- amdlibSetErrMsg("Wrong number of data rows (%d) for spectral "
- "calibration: must be 1", rawData->nbRows);
- return amdlibFAILURE;
- }
-
- /* Check if this frame type is already loaded at its good place */
- i = rawData->frameType - amdlibTEL1_FRAME + 3;
- if (specCalData->dataLoaded[i] == amdlibTRUE)
- {
- amdlibSetErrMsg("Frame type %d already loaded (see amdlibFRAME_TYPE)",
- rawData->frameType);
- return amdlibFAILURE;
- }
-
- if (amdlibDuplicateRawData(rawData, &specCalData->rawData[i],
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- specCalData->dataLoaded[i] = amdlibTRUE;
-
- return amdlibSUCCESS;
-}
-
-/**
- * Free memory allocated memory of spectral calibration data structure.
- *
- * This function frees previously allocated memory (if any) where data for
- * spectral calibration has been stored, and resets all the structure fields,
- * including thisPtr pointer.
- *
- * @param specCalData structure where raw data is stored
- */
-void amdlibReleaseSpectralCalibrationData(amdlibSC_INPUT_DATA *specCalData)
-{
- int image;
-
- amdlibLogTrace("amdlibReleaseSpectralCalibrationData()");
-
- for (image = 0; image < amdlibMAX_NB_FRAMES_SC; image++)
- {
- amdlibReleaseRawData(&specCalData->rawData[image]);
- specCalData->dataLoaded[image] = amdlibFALSE;
- }
- memset(specCalData, '\0', sizeof(amdlibSC_INPUT_DATA));
-}
-
-/*
- * Local functions
- */
-/**
- * Initialize spectral calibration data structure.
- *
- * @warning
- * This function must be called first before using a new 'spectral calibration
- * data' structure.
- *
- * @param specCalData pointer to spectral calibration data structure
- */
-void amdlibInitSpectralCalibrationData(amdlibSC_INPUT_DATA *specCalData)
-{
- int i;
-
- amdlibLogTrace("amdlibInitSpectralCalibrationData()");
-
- /* Initialize data structure */
- memset (specCalData, '\0', sizeof(amdlibSC_INPUT_DATA));
- specCalData->thisPtr = specCalData;
-
- for (i = 0; i < amdlibMAX_NB_FRAMES_SC; i++)
- {
- specCalData->dataLoaded[i] = amdlibFALSE;
- }
-}
-
-/*___oOo___*/
-
diff --git a/amber/amdlibSpectrum.c b/amber/amdlibSpectrum.c
deleted file mode 100644
index 208e8fb..0000000
--- a/amber/amdlibSpectrum.c
+++ /dev/null
@@ -1,742 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Functions to handle AMBER_SPECTRUM table.
- *
- */
-
-/*
- * System Headers
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include "fitsio.h"
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/*
- * Local function declaration
- */
-static void amdlibFreeSpectrum(amdlibSPECTRUM *spc);
-
-/**
- * Allocate memory for storing spectra.
- *
- * @param spc pointer to amdlibSPECTRUM structure.
- * @param nbTels number of telescopes
- * @param nbWlen number of spectral channels
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAllocateSpectrum(amdlibSPECTRUM *spc,
- const int nbTels,
- const int nbWlen)
-{
- int i;
-
- amdlibLogTrace("amdlibAllocateSpectrum()");
-
- /* First free previous allocated memory */
- if (spc->thisPtr == spc)
- {
- amdlibFreeSpectrum(spc);
- }
-
- /* Init & Update thisPtr */
- spc->thisPtr = memset(spc, '\0', sizeof(*spc));
-
- spc->nbTels = nbTels;
- spc->nbWlen = nbWlen;
-
- for (i=0; i < nbTels; i++)
- {
- spc->spec[i] = calloc(nbWlen, sizeof(double));
- if (spc->spec[i] == NULL)
- {
- amdlibFreeSpectrum(spc);
- return amdlibFAILURE;
- }
- spc->specErr[i] = calloc(nbWlen, sizeof(double));
- if (spc->specErr[i] == NULL)
- {
- amdlibFreeSpectrum(spc);
- return amdlibFAILURE;
- }
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Release memory allocated to store spectra, and reset the structure
- * members to zero.
- *
- * @param spc pointer to amdlibSPECTRUM structure.
- */
-void amdlibReleaseSpectrum(amdlibSPECTRUM *spc)
-{
- amdlibLogTrace("amdlibReleaseSpectrum()");
-
- amdlibFreeSpectrum(spc);
- memset(spc, '\0', sizeof(amdlibSPECTRUM));
-}
-
-/**
- * Get spectra from P2VM.
- *
- * This function gets the spectra form the P2VM which corresponds to the
- * instrument transmission. If wave is given, it just gets the spectrum for
- * the wavelength of this table, otherwise all spectrum is copied.
- *
- * @param p2vm pointer to P2VM structure
- * @param wave pointer to the structure containing the wavelengths for which
- * spectrum has to be get. If NULL, all spectrum values are read.
- * @param spectrum pointer to spectrum structure
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned. */
-amdlibCOMPL_STAT amdlibGetSpectrumFromP2VM(amdlibP2VM_MATRIX *p2vm,
- amdlibWAVELENGTH *wave,
- amdlibSPECTRUM *spectrum,
- amdlibERROR_MSG errMsg)
-{
- int nbTels;
- int nbWlen;
-
- amdlibLogTrace("amdlibGetSpectrumFromP2VM()");
-
- /* Re-allocate spectrum structure */
- nbTels = (p2vm->type == amdlibP2VM_2T) ? 2 : 3;
- if (wave == NULL)
- {
- nbWlen = p2vm->nbChannels;
- }
- else
- {
- nbWlen = wave->nbWlen;
- }
- amdlibReleaseSpectrum(spectrum);
- if (amdlibAllocateSpectrum(spectrum, nbTels, nbWlen) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for spectra");
- return amdlibFAILURE;
- }
-
- /* Copy spectra */
- int l;
- int tel;
- for (l = 0; l < spectrum->nbWlen; l++)
- {
-
- int lP2vm = 0;
- if (wave == NULL)
- {
- lP2vm = l;
- }
- else
- {
- /* Look for wavelength in P2VM */
- while (wave->wlen[l] != p2vm->wlen[lP2vm])
- {
- if (lP2vm == p2vm->nbChannels)
- {
- amdlibSetErrMsg("P2VM does not cover wavelength %.3f",
- wave->wlen[l]);
- return amdlibFAILURE;
- }
- lP2vm++;
- }
- }
-
- for (tel = 0; tel < nbTels; tel++)
- {
- /* P2VM photoemtry is the mean flux of all the frames, then go
- * back to the total flux */
- spectrum->spec[tel][l] = p2vm->photometryPt[0][tel][lP2vm] *
- p2vm->nbFrames;
- /* Neglect detector read-out noise, and prevent against neagtive
- * flux */
- spectrum->specErr[tel][l] = sqrt(fabs(spectrum->spec[tel][l]));
- }
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned. */
-
-amdlibCOMPL_STAT amdlibGetAndNormalizeSpectrumFromScienceData
- (amdlibSCIENCE_DATA *data,
- amdlibP2VM_MATRIX *p2vm,
- amdlibWAVEDATA *waveData,
- amdlibWAVELENGTH *wave,
- amdlibSPECTRUM *spectrum,
- amdlibERROR_MSG errMsg)
-{
- int nbTels;
- int nbWlen;
- int l;
- int tel;
- amdlibDOUBLE fluxMax;
-
- amdlibLogTrace("amdlibGetAndNormalizeSpectrumFromScienceData()");
-
- /* Re-allocate spectrum structure */
- nbTels = (data->nbCols == 3) ? 2 : 3;
- if (wave == NULL)
- {
- nbWlen = data->nbChannels;
- }
- else
- {
- nbWlen = wave->nbWlen;
- }
- if (spectrum->thisPtr == spectrum)
- {
- amdlibFreeSpectrum(spectrum);
- }
-
- if (amdlibAllocateSpectrum(spectrum, nbTels, nbWlen) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for spectra");
- return amdlibFAILURE;
- }
-
- if (p2vm != NULL)
- {
- if(amdlibGetSpectrumFromP2VM(p2vm,wave,spectrum,errMsg)!= amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- /* convert this spectrum as a transmission: */
- for (tel = 0; tel < nbTels; tel++)
- {
- fluxMax=spectrum->spec[tel][0];
- for (l = 1; l < spectrum->nbWlen; l++)
- {
- fluxMax=amdlibMax(fluxMax,spectrum->spec[tel][l]);
- }
- for (l = 0; l < spectrum->nbWlen; l++)
- {
- spectrum->spec[tel][l]/=fluxMax;
- }
- }
- }
- else
- {
- for (tel = 0; tel < nbTels; tel++)
- {
- for (l = 0; l < spectrum->nbWlen; l++)
- {
- spectrum->spec[tel][l]=1.0;
- }
- }
- }
- /* Copy spectra */
- for (l = 0; l < spectrum->nbWlen; l++)
- {
- double spec[amdlibNB_TEL];
- int frame;
- int lData = 0;
- if (wave == NULL)
- {
- lData = l;
- }
- else
- {
- while (wave->wlen[l] != waveData->wlen[data->channelNo[lData]])
- {
- if (lData == data->nbChannels)
- {
- amdlibSetErrMsg("Science data does not contain wavelength "
- "%.3f", wave->wlen[l]);
- return amdlibFAILURE;
- }
- lData++;
- }
- }
-
- /* Compute beam spectra over all frames */
- for (tel = 0; tel < nbTels; tel++)
- {
- spec[tel] = 0.0;
- }
- for (frame = 0; frame < data->nbFrames; frame++)
- {
- spec[0] += data->frame[frame].photo1[lData];
- spec[1] += data->frame[frame].photo2[lData];
- if (nbTels == 3)
- {
- spec[2] += data->frame[frame].photo3[lData];
- }
- }
- /* and copy them after normalisation with transmission */
- for (tel = 0; tel < nbTels; tel++)
- {
- spectrum->spec[tel][l] = spec[tel]/spectrum->spec[tel][l];
- }
- /* Compute beam spectra sigma2 over all frames */
- for (tel = 0; tel < nbTels; tel++)
- {
- spec[tel] = 0.0;
- }
- for (frame = 0; frame < data->nbFrames; frame++)
- {
- spec[0] += data->frame[frame].photo1[lData];
- spec[1] += data->frame[frame].photo2[lData];
- if (nbTels == 3)
- {
- spec[2] += data->frame[frame].photo3[lData];
- }
- }
- /* and copy them */
- for (tel = 0; tel < nbTels; tel++)
- {
- spectrum->specErr[tel][l] = amdlibSignedSqrt(spec[tel]);
- }
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Get spectra from science data.
- *
- * This function gets the spectra form the science data which corresponds to
- * the object spectra. If wave is given, it just gets the spectrum for the
- * wavelengths of this table, otherwise all spectrum is copied.
- *
- * @param data structure containing the science observation (where the fringes
- * are)
- * @param waveData structure containing spectral dispersion table
- * @param wave pointer to the structure containing the wavelengths for which
- * spectrum has to be get. If NULL, all spectrum values are read.
- * @param spectrum pointer to spectrum structure
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned. */
-amdlibCOMPL_STAT amdlibGetSpectrumFromScienceData(amdlibSCIENCE_DATA *data,
- amdlibWAVEDATA *waveData,
- amdlibWAVELENGTH *wave,
- amdlibSPECTRUM *spectrum,
- amdlibERROR_MSG errMsg)
-{
- int nbTels;
- int nbWlen;
-
- amdlibLogTrace("amdlibGetSpectrumFromScienceData()");
-
- /* Re-allocate spectrum structure */
- nbTels = (data->nbCols == 3) ? 2 : 3;
- if (wave == NULL)
- {
- nbWlen = data->nbChannels;
- }
- else
- {
- nbWlen = wave->nbWlen;
- }
- if (spectrum->thisPtr == spectrum)
- {
- amdlibFreeSpectrum(spectrum);
- }
-
- if (amdlibAllocateSpectrum(spectrum, nbTels, nbWlen) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for spectra");
- return amdlibFAILURE;
- }
-
- /* Copy spectra */
- int l;
- for (l = 0; l < spectrum->nbWlen; l++)
- {
- double spec[amdlibNB_TEL];
- int tel;
- int frame;
- int lData = 0;
- if (wave == NULL)
- {
- lData = l;
- }
- else
- {
- while (wave->wlen[l] != waveData->wlen[data->channelNo[lData]])
- {
- if (lData == data->nbChannels)
- {
- amdlibSetErrMsg("Science data does not contain wavelength "
- "%.3f", wave->wlen[l]);
- return amdlibFAILURE;
- }
- lData++;
- }
- }
-
- /* Compute beam spectra over all frames */
- for (tel = 0; tel < nbTels; tel++)
- {
- spec[tel] = 0.0;
- }
- for (frame = 0; frame < data->nbFrames; frame++)
- {
- spec[0] += data->frame[frame].photo1[lData];
- spec[1] += data->frame[frame].photo2[lData];
- if (nbTels == 3)
- {
- spec[2] += data->frame[frame].photo3[lData];
- }
- }
- /* and copy them */
- for (tel = 0; tel < nbTels; tel++)
- {
- spectrum->spec[tel][l] = spec[tel];
- }
- /* Compute beam spectra sigma2 over all frames */
- for (tel = 0; tel < nbTels; tel++)
- {
- spec[tel] = 0.0;
- }
- for (frame = 0; frame < data->nbFrames; frame++)
- {
- spec[0] += data->frame[frame].photo1[lData];
- spec[1] += data->frame[frame].photo2[lData];
- if (nbTels == 3)
- {
- spec[2] += data->frame[frame].photo3[lData];
- }
- }
- /* and copy them */
- for (tel = 0; tel < nbTels; tel++)
- {
- spectrum->specErr[tel][l] = amdlibSignedSqrt(spec[tel]);
- }
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Write AMBER_SPECTRUM table in OI-FITS file.
- *
- * This function writes the AMBER_SPECTRUM binary table in the OI-FITS file
- * given as parameter.
- *
- * @param filePtr pointer on the file to be created.
- * @param wave OI_WAVELENGTH produced.
- * @param spc amdlibSPECTRUM produced.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibWriteAmberSpectrum(fitsfile *filePtr,
- amdlibWAVELENGTH *wave,
- amdlibSPECTRUM *spc,
- amdlibERROR_MSG errMsg)
-{
- int status = 0;
- char fitsioMsg[256];
- const int tfields = 4;
- char *Ttype[] = {"EFF_WAVE", "EFF_BAND", "SPECTRUM", "SPECTRUM_ERROR"};
- char *Tform[] = {"E", "E", "?D", "?D"};
- char *Tunit[] = {"m", "m", "\0", "\0"};
- char *ttype[tfields];
- char *tform[tfields];
- char *tunit[tfields];
-
- char extname[] = "AMBER_SPECTRUM";
- int revision = amdlib_OI_REVISION;
- int i, l;
- char tmp[16];
- double specDouble[amdlibNB_TEL];
- double specErrDouble[amdlibNB_TEL];
- char insName[amdlibKEYW_VAL_LEN+1];
-
- amdlibLogTrace("amdlibWriteAmberSpectrum()");
-
- if (spc->thisPtr != spc)
- {
- amdlibSetErrMsg("Unitialized spc structure");
- return amdlibFAILURE;
- }
-
- /* If initialized but empty, do nothing gracefully */
- if (spc->nbWlen < 1)
- {
- amdlibLogTrace("amdlibWriteAmberSpectrum done");
- return amdlibSUCCESS;
- }
-
- /* Create table structure. Make up Tform: substitute spc->nbTels for '?' */
- for (i = 0; i < tfields; i++)
- {
- ttype[i] = calloc(strlen(Ttype[i]) + 1, sizeof(char));
- strcpy(ttype[i], Ttype[i]);
- tunit[i] = calloc(strlen(Tunit[i]) + 1, sizeof(char));
- strcpy(tunit[i], Tunit[i]);
-
- if (Tform[i][0] == '?')
- {
- sprintf(tmp, "%d%s", spc->nbTels, &Tform[i][1]);
- }
- else
- {
- strcpy(tmp, Tform[i]);
- }
- tform[i] = calloc((strlen(tmp) + 1), sizeof(char));
- strcpy(tform[i], tmp);
- }
-
- if (fits_create_tbl(filePtr, BINARY_TBL, 0, tfields, ttype, tform, tunit,
- extname, &status))
- {
- amdlibReturnFitsError("Creating Binary Table");
- }
-
- for (i = 0; i < tfields; i++)
- {
- free(ttype[i]);
- free(tform[i]);
- free(tunit[i]);
- }
-
- /* Write revision number of the table definition */
- if (fits_write_key (filePtr, TINT, "AMB_REVN", &revision,
- "Revision number of the table definition", &status))
- {
- amdlibReturnFitsError("AMB_REVN");
- }
-
- /* Write spectral setup unique identifier */
- sprintf(insName, "AMBER");
- if (fits_write_key (filePtr, TSTRING, "INSNAME", insName,
- "Instrument name", &status))
- {
- amdlibReturnFitsError("INSNAME");
- }
-
- for (l=0; l < wave->nbWlen; l++)
- {
- amdlibDOUBLE waveInM;
- waveInM = wave->wlen[l] * amdlibNM_TO_M; /* Convert nm to m */
- if (fits_write_col(filePtr, TDOUBLE, 1, l+1, 1, 1, &waveInM, &status))
- {
- amdlibReturnFitsError("EFF_WAVE");
- }
-
- amdlibDOUBLE bandInM;
- bandInM = wave->bandwidth[l] * amdlibNM_TO_M; /* Convert nm to m */
- if (fits_write_col(filePtr, TDOUBLE, 2, l+1, 1, 1, &bandInM, &status))
- {
- amdlibReturnFitsError("EFF_BAND");
- }
-
- for (i=0; i < spc->nbTels; i++)
- {
- specDouble[i] = spc->spec[i][l];
- specErrDouble[i] = spc->specErr[i][l];
- }
- if (fits_write_col(filePtr, TDOUBLE, 3, l+1, 1, spc->nbTels,
- specDouble, &status))
- {
- amdlibReturnFitsError("SPECTRUM");
- }
-
- if (fits_write_col(filePtr, TDOUBLE, 4, l+1, 1, spc->nbTels,
- specErrDouble, &status))
- {
- amdlibReturnFitsError("SPECTRUM_ERROR");
- }
- }
-
- amdlibLogTrace("amdlibWriteAmberSpectrum done");
- return amdlibSUCCESS;
-}
-
-/**
- * Read AMBER_SPECTRUM table in OI-FITS file.
- *
- * This function reads the AMBER_SPECTRUM binary table in the OI-FITS file
- * given as parameter.
- *
- * @param filePtr pointer on the file to be created.
- * @param nbBases input parameter giving the number of telescopes.
- * @param spectrum AMBER_DATA structure where read data will be stored.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibReadAmberSpectrum(fitsfile *filePtr,
- int nbTels,
- amdlibSPECTRUM *spectrum,
- amdlibERROR_MSG errMsg)
-{
- char fitsioMsg[256];
- int status = 0;
- int specCol, specErrCol;
- double specDouble[amdlibNB_TEL];
- double specErrDouble[amdlibNB_TEL];
-
- amdlibLogTrace("amdlibReadAmberSpectrum()");
-
- /* Release previously allocated memory */
- amdlibReleaseSpectrum(spectrum);
-
- /* Check there is a AMBER_SPECTRUM binary table */
- if (fits_movnam_hdu(filePtr, BINARY_TBL, "AMBER_SPECTRUM", 0, &status))
- {
- amdlibReturnFitsError("AMBER_SPECTRUM");
- }
-
- /* Get number of channels */
- long nbWlen;
- if (fits_get_num_rows(filePtr, &nbWlen, &status))
- {
- amdlibReturnFitsError(
- "Getting the number of spectral channels");
- }
-
- /* Allocate data structure and array to read values */
- if (amdlibAllocateSpectrum(spectrum, nbTels, nbWlen) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for spectra");
- return amdlibFAILURE;
- }
-
- /* Get column numbers for spectra and associated error */
- if (fits_get_colnum(filePtr, CASEINSEN, "SPECTRUM", &specCol, &status))
- {
- amdlibReturnFitsError("SPECTRUM");
- }
- if (fits_get_colnum(filePtr, CASEINSEN, "SPECTRUM_ERROR", &specErrCol,
- &status))
- {
- amdlibReturnFitsError("SPECTRUM_ERROR");
- }
-
- /* Read data */
- double nulldouble = 0.0;
- int l, anynull;
- for (l=1; l <= spectrum->nbWlen; l++)
- {
- int tel;
-
- if (fits_read_col(filePtr, TDOUBLE, specCol, l, 1, nbTels,
- &nulldouble, specDouble, &anynull, &status))
- {
- amdlibReturnFitsError("reading spectrum");
- }
- if (fits_read_col(filePtr, TDOUBLE, specErrCol, l, 1, nbTels,
- &nulldouble, specErrDouble, &anynull, &status))
- {
- amdlibReturnFitsError("reading spectrum error");
- }
-
- /* Copy back in structure */
- for (tel = 0; tel < nbTels; tel++)
- {
- spectrum->spec[tel][l-1] = specDouble[tel];
- spectrum->specErr[tel][l-1] = specErrDouble[tel];
- }
- }
-
- return amdlibSUCCESS;
-}
-
-/*
- * Local functions
- */
-/**
- * Free memory allocated for spectrum.
- *
- * @param spc pointer to amdlibSPECTRUM structure.
- */
-void amdlibFreeSpectrum(amdlibSPECTRUM *spc)
-{
- int i;
-
- amdlibLogTrace("amdlibFreeSpectrum()");
-
- /* Check thisPtr and do nothing if uninitialized */
- if (spc->thisPtr != spc)
- {
- return;
- }
-
- /* Spectrum table */
- for (i=0; i < spc->nbTels; i++)
- {
- if (spc->spec[i] != NULL)
- {
- free(spc->spec[i]);
- }
- if (spc->specErr[i] != NULL)
- {
- free(spc->specErr[i]);
- }
- }
- spc->thisPtr = NULL;
-}
-
-/**
- * Add source spectrum to dest spectrum in the data structure.
- *
- * @param srcSpectrum pointer to source data structure
- * @param dstSpectrum pointer to destination data structure (append to)
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAddSpectrum(amdlibSPECTRUM *dstSpectrum,
- amdlibSPECTRUM *srcSpectrum,
- amdlibERROR_MSG errMsg)
-{
- int wlen,tel;
- int nbWlen=dstSpectrum->nbWlen;
- int nbTels=dstSpectrum->nbTels;
- double err;
-
- amdlibLogTrace("amdlibAddSpectrum()");
- /* Perform simple checks */
- if (nbWlen != srcSpectrum->nbWlen)
- {
- amdlibSetErrMsg("Different numbers of "
- "wavelengths (%d and %d) ", srcSpectrum->nbWlen,
- nbWlen);
- return amdlibFAILURE;
- }
- if (nbTels != srcSpectrum->nbTels)
- {
- amdlibSetErrMsg("Different numbers of "
- "Telescopes (%d and %d) ", srcSpectrum->nbTels,
- nbTels);
- return amdlibFAILURE;
- }
-
- for (tel=0; tel<nbTels; tel++)
- {
- for (wlen=0; wlen<nbWlen; wlen++)
- {
- err=amdlibPow2(dstSpectrum->specErr[tel][wlen]+
- srcSpectrum->specErr[tel][wlen]);
- dstSpectrum->specErr[tel][wlen]=amdlibSignedSqrt(err);
- dstSpectrum->spec[tel][wlen]+=srcSpectrum->spec[tel][wlen];
- }
- }
-
- return amdlibSUCCESS;
-}
-
diff --git a/amber/amdlibString.c b/amber/amdlibString.c
deleted file mode 100644
index 751e7a4..0000000
--- a/amber/amdlibString.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Useful functions related to string.
- */
-
-#define _POSIX_SOURCE 1
-
-/*
- * System Headers
- */
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include "fitsio.h"
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/*
- * Protected functions
- */
-
-/**
- * Removes the leading and trailing blanks
- *
- * This function set removes the leading and trailing blanks. The function
- * strips these off using the same character buffer for storing the processed
- * string. The string must be NULL terminated.
- *
- * @param str string to process.
- */
-void amdlibStripBlanks(char *str)
-{
- char *chrPtr;
- char *strPtr;
-
- strPtr = str;
- chrPtr = str;
-
- /* Skip possible blanks */
- while ((*chrPtr != '\0') && (*chrPtr == ' '))
- {
- chrPtr++;
- }
-
- /* Copy until NULL terminator */
- while (*chrPtr != '\0')
- {
- *strPtr = *chrPtr;
- strPtr++;
- chrPtr++;
- }
-
- /* If the string only contains blanks or is of length 0, strPtr still
- * points to the beginning of the string */
- if (strPtr != str)
- {
- strPtr--;
- /* Yank possible trailing blanks
- */
- while (*strPtr == ' ')
- strPtr--;
- strPtr++;
- }
- *strPtr = '\0';
-}
-
-/**
- * Removes the leading and trailing single quotes
- *
- * This function set removes the leading and trailing quotes. The function
- * strips these off using the same character buffer for storing the processed
- * string. The string must be NULL terminated.
- *
- * @param str string to process.
- */
-void amdlibStripQuotes(char *str)
-{
- char *chrPtr;
- char *strPtr;
-
- strPtr = str;
- if ((chrPtr = strchr(str, '\'')) != NULL) /* " */
- {
- /* Skip possible blanks after the quote
- */
- chrPtr++;
- while (*chrPtr == ' ')
- chrPtr++;
- /* Copy until single quote or NULL terminator
- */
- while ((*chrPtr != '\0') && (*chrPtr != '\'')) /* " */
- {
- *strPtr = *chrPtr;
- strPtr++;
- chrPtr++;
- }
- /* If the string only contains blanks or is of length 0, strPtr still
- * points to the beginning of the string
- */
- if (strPtr != str)
- {
- strPtr--;
- /* Yank possible trailing blanks
- */
- while (*strPtr == ' ')
- strPtr--;
- strPtr++;
- }
- *strPtr = '\0';
- }
-}
-
-/*___oOo___*/
diff --git a/amber/amdlibUtils.c b/amber/amdlibUtils.c
deleted file mode 100644
index e00a2e8..0000000
--- a/amber/amdlibUtils.c
+++ /dev/null
@@ -1,3026 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * High-level function for AMBER data reduction processing.
- *
- * This file includes high-level functions which provide interface to AMBER data
- * reduction functions with no internal data structure as input or output
- * paremeters.
- *
- * These functions very often uses :
- * \li a bad pixel map file which contains for each pixel of the detector
- * (512x512 pixels) a flag indicating if pixel is good or not. This file is
- * generated by the detector Maintenance Software (see amdmsServer(1)) through
- * the AMBER Maintenance Templates. If the file name is an empty string all
- * pixels are marked as good.
- *
- * \li a flat field map file which contains for each pixel of the detector
- * (512x512 pixels) a factor which gives the gain of that pixel. This file is
- * generated by the detector Maintenance Software (see amdmsServer(1)) through
- * the AMBER Maintenance Templates. If the file name is an empty string the gain
- * of all pixels is set to 1.
- *
- * \li a dark file which is used to compensate for detector effects. It
- * corresponds to a series of sky images or to a series of images with all
- * shutters closed. The detector subwindow setup and exposure time must be the
- * same than the ones corresponding to the raw data to be calibrated. If the
- * file name is an empty string the dark for each pixel is set to 0.
- */
-
-#define _POSIX_SOURCE 1
-
- /*
- * System Headers
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <string.h>
-#include <libgen.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <time.h>
-
- /*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/*
- * Local function definition
- */
-#define amdlibTYPICAL_RON 10.0
-
-static amdlibDARK_DATA dark = {NULL};
-static amdlibRAW_DATA rawData = {NULL};
-
-#ifndef ESO_CPL_PIPELINE_VARIANT
-static amdlibCOMPL_STAT amdlibAppendKeywordListToP2VM(
- const char *p2vmFile,
- const char *badPixelFile,
- const char *flatFieldFile,
- const char **inputFiles,
- int nbInputFiles,
- amdlibDOUBLE newSpectralOffsets[],
- amdlibBOOLEAN addOffsets,
- amdlibERROR_MSG errMsg);
-static amdlibCOMPL_STAT amdlibAppendKeywordListToOIFITS(
- const char *oifitsFile,
- const char *badPixelFile,
- const char *flatFieldFile,
- const char *darkFile,
- const char *inputFile,
- const int nbBinning,
- const amdlibERROR_TYPE errorType,
- const amdlibPISTON_ALGORITHM pistonType,
- const amdlibBOOLEAN noCheckP2vmId,
- const amdlibBOOLEAN mergeBandsInOutputFile,
- const amdlibFRAME_SELECTION selectionType,
- const double selectionRatio,
- const int nbRecords,
- amdlibERROR_MSG errMsg);
-#endif
-static amdlibCOMPL_STAT amdlibAppendSelectionKeywords(
- const char *oifitsFile,
- const char *selFile,
- const char *inOiFits,
- amdlibINS_CFG *selKewList,
- amdlibBOOLEAN saveInOiFits,
- const amdlibFRAME_SELECTION selectionType,
- const double selectionRatio,
- amdlibERROR_MSG errMsg);
-
-amdlibBOOLEAN amdlibIsBandPresentInData(amdlibSCIENCE_DATA *data,
- amdlibP2VM_MATRIX *p2vm,
- amdlibWAVEDATA *waveData,
- amdlibBAND band);
-/*
- * Public function
- */
-/**
- * Return version of AMBER Data reduction library.
- *
- * @param version string where software version is copied in
- */
-void amdlibGetVersion(char version[32])
-{
- strcpy(version, amdlibVERSION);
-}
-
-/**
- * Print version of AMBER Data reduction library.
- */
-void amdlibPrintVersion()
-{
- char version[32];
-
- amdlibGetVersion(version);
-
- printf(" amdlib %s version\n",version);
-}
-
-/*
- * Protected functions
- */
-/**
- * Calibrate raw image.
- *
- * This function converts raw image into calibrated image, by correcting
- * detector effects, and stores calibrated image in the ouput file (if given) or
- * the input file otherwise.
- *
- * @param badPixelFile name of file containing bad pixel map
- * @param flatFieldFile name of file containing flat-field map
- * @param darkFile name of file containing data for dark estimation
- * @param inputFile name of file containing data to calibrate
- * @param outputFile name of file where calibrated data will be stored
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibGenerateCalImage(const char *badPixelFile,
- const char *flatFieldFile,
- const char *darkFile,
- const char *inputFile,
- const char *outputFile)
-{
- amdlibERROR_MSG errMsg;
-
- amdlibLogTrace("amdlibGenerateCalImage()");
-
- /* If a bad pixel file has been specified */
- if ((badPixelFile != NULL) && (strlen(badPixelFile) != 0))
- {
- /* Load it */
- if (amdlibLoadBadPixelMap(badPixelFile, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load bad pixel map '%s'", badPixelFile);
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseRawData(&rawData);
- amdlibReleaseDarkData(&dark);
- return amdlibFAILURE;
- }
- }
- /* Else */
- else
- {
- /* Set it with all pixels marked as good */
- if (amdlibSetBadPixelMap(amdlibTRUE) != amdlibSUCCESS)
- {
- amdlibLogError("Could not set bad pixel map");
- amdlibReleaseRawData(&rawData);
- amdlibReleaseDarkData(&dark);
- return amdlibFAILURE;
- }
- }
- /* End if */
-
- /* If a flat field file has been specified */
- if ((flatFieldFile != NULL) && (strlen(flatFieldFile) != 0))
- {
- /* Load it */
- if (amdlibLoadFlatFieldMap(flatFieldFile, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load flat field map '%s'", flatFieldFile);
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseRawData(&rawData);
- amdlibReleaseDarkData(&dark);
- return amdlibFAILURE;
- }
- }
- /* Else */
- else
- {
- /* Set it with gain set to 1.0 */
- if (amdlibSetFlatFieldMap(1.0) != amdlibSUCCESS)
- {
- amdlibLogError("Could not set flat field map");
- amdlibReleaseRawData(&rawData);
- amdlibReleaseDarkData(&dark);
- return amdlibFAILURE;
- }
- }
- /* End if */
-
- /* If a dark file has been specified */
- if ((darkFile != NULL) && (strlen(darkFile) != 0))
- {
- /* Load it */
- if (amdlibLoadRawData(darkFile, &rawData, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load raw data from file '%s'", darkFile);
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseRawData(&rawData);
- amdlibReleaseDarkData(&dark);
- return amdlibFAILURE;
- }
-
- /* Compute dark map */
- if (amdlibGenerateDarkData(&rawData, &dark,
- errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not generate dark map");
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseRawData(&rawData);
- amdlibReleaseDarkData(&dark);
- return amdlibFAILURE;
- }
- }
- /* Else */
- else
- {
- /* Load input data file */
- if (amdlibLoadRawData(inputFile, &rawData, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load raw data from file '%s'", inputFile);
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseRawData(&rawData);
- amdlibReleaseDarkData(&dark);
- return amdlibFAILURE;
- }
-
- /* Set dark map to 0.0 */
- if (amdlibSetDarkData(&rawData, &dark,
- 0.0, amdlibTYPICAL_RON, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not set dark map");
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseRawData(&rawData);
- amdlibReleaseDarkData(&dark);
- return amdlibFAILURE;
- }
- }
- /* End if */
-
- /* Load input file */
- if ((inputFile == NULL) || (strlen(inputFile) == 0))
- {
- amdlibLogError("Invalid name for input file");
- amdlibReleaseRawData(&rawData);
- amdlibReleaseDarkData(&dark);
- return amdlibFAILURE;
- }
- if (amdlibLoadRawData(inputFile, &rawData, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load raw data from file '%s'", inputFile);
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseRawData(&rawData);
- amdlibReleaseDarkData(&dark);
- return amdlibFAILURE;
- }
-
- /* Equalize raw data */
- if (amdlibCalibrateRawData(&dark, &rawData, errMsg) !=amdlibSUCCESS)
- {
- amdlibLogError("Could not calibrate raw data");
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseRawData(&rawData);
- amdlibReleaseDarkData(&dark);
- return amdlibFAILURE;
- }
-
- /* If output file has been specified */
- if ((outputFile != NULL) && (strlen(outputFile) != 0))
- {
- /* Copy input file to output file */
- if (amdlibCopyRawDataFile(inputFile,
- outputFile, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not copy '%s' raw data file to '%s' file",
- inputFile, outputFile);
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseRawData(&rawData);
- amdlibReleaseDarkData(&dark);
- return amdlibFAILURE;
- }
-
- /* Store calibrated data in specified output file or in original file */
- if (amdlibStoreRawData(outputFile, &rawData, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not store raw data in file '%s'", outputFile);
- amdlibLogError("(hint: doe not use a compressed output file).");
-
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseRawData(&rawData);
- amdlibReleaseDarkData(&dark);
- return amdlibFAILURE;
- }
- }
- else
- {
- if (amdlibStoreRawData(inputFile, &rawData, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not store raw data in file '%s'", inputFile);
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseRawData(&rawData);
- amdlibReleaseDarkData(&dark);
- return amdlibFAILURE;
- }
- }
-
- amdlibReleaseRawData(&rawData);
- amdlibReleaseDarkData(&dark);
- return amdlibSUCCESS;
-}
-
-/**
- * Convert AMBER data file into FITS file.
- *
- * This function creates FITS files from data files produced by the AMBER
- * instrument which are stored as binary tables. This consists to load the
- * original data file, to create glued images from data of detector regions and
- * save them into FITS file.
- *
- * @param inputFile name of file containing AMBER data
- * @param outputFile name of file where 2D images will be stored
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibBtbl2Fits(const char *inputFile,
- const char *outputFile)
-{
- amdlibERROR_MSG errMsg;
-
- amdlibLogTrace("amdlibBtbl2Fits()");
-
- /* Load input file */
- if ((inputFile == NULL) || (strlen(inputFile) == 0))
- {
- amdlibLogError("Invalid name for input file");
- amdlibReleaseRawData(&rawData);
- return amdlibFAILURE;
- }
- if (amdlibLoadRawData(inputFile, &rawData, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load raw data from file '%s'", inputFile);
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseRawData(&rawData);
- return amdlibFAILURE;
- }
-
- /* Store image into FITS file */
- if ((outputFile == NULL) || (strlen(outputFile) == 0))
- {
- amdlibLogError("Invalid name for output file");
- amdlibReleaseRawData(&rawData);
- return amdlibFAILURE;
- }
- if (amdlibSaveRawDataToFits(outputFile, &rawData, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not save raw data into FITS file '%s'",
- outputFile);
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseRawData(&rawData);
- return amdlibFAILURE;
- }
- amdlibReleaseRawData(&rawData);
- return amdlibSUCCESS;
-}
-
-/**
- * Compute the P2VM (Photometry to Visibility Matrix) for the 2 telescope
- * configuration.
- *
- * This function computes the P2VM (Photometry to Visibility Matrix) for the 2
- * telescope configuration by processing the input data files. The resulting
- * P2VM is saved into the file given as parameter. If this file exists, it is
- * overwritten.
- *
- * @param badPixelFile name of file containing bad pixel map
- * @param flatFieldFile name of file containing flat-field map
- * @param darkFile name of file containing data for dark estimation
- * @param inputFile1 name of the 1st file containing AMBER data
- * @param inputFile2 name of the 2nd file containing AMBER data
- * @param inputFile3 name of the 3rd file containing AMBER data
- * @param inputFile4 name of the 4th file containing AMBER data
- * @param p2vmFile name of file where P2VM will be stored
- * @param newSpectralOffsets offset to be applied on photometric channels
- * @param verbose indicates if information have to be displayed.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibComputeP2vm2T(const char *badPixelFile,
- const char *flatFieldFile,
- const char *darkFile,
- const char *inputFile1,
- const char *inputFile2,
- const char *inputFile3,
- const char *inputFile4,
- const char *p2vmFile,
- amdlibDOUBLE newSpectralOffsets[],
- const amdlibBOOLEAN verbose)
-{
- amdlibBOOLEAN newSpecOffset;
- const char *inputFiles[5];
- int i;
- amdlibERROR_MSG errMsg;
- amdlibP2VM_INPUT_DATA p2vmData = {NULL};
- amdlibP2VM_MATRIX p2vm = {NULL};
- amdlibWAVEDATA waveData;
- amdlibBOOLEAN waveDataLoaded;
-
- amdlibLogTrace("amdlibComputeP2vm2T()");
-
- /* Init list of input files */
- inputFiles[0] = darkFile;
- inputFiles[1] = inputFile1;
- inputFiles[2] = inputFile2;
- inputFiles[3] = inputFile3;
- inputFiles[4] = inputFile4;
-
- /* If a bad pixel file has been specified */
- if ((badPixelFile != NULL) && (strlen(badPixelFile) != 0))
- {
- /* Load it */
- if (amdlibLoadBadPixelMap(badPixelFile, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load bad pixel map '%s'", badPixelFile);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- }
-
- /* Load flat field map */
- if ((flatFieldFile != NULL) && (strlen(flatFieldFile) != 0))
- {
- if(amdlibLoadFlatFieldMap(flatFieldFile, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load flat field map '%s'", flatFieldFile);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- }
-
- /* Check P2VM file name */
- if ((p2vmFile == NULL) || (strlen(p2vmFile) == 0))
- {
- amdlibLogError("Invalid name for P2VM file");
- return amdlibFAILURE;
- }
-
- /* For each input files */
- waveDataLoaded = amdlibFALSE;
- newSpecOffset = amdlibFALSE;
- amdlibLogInfo("Loading input files ...");
- for (i = 0; i < 5; i++)
- {
- if ((inputFiles[i] == NULL) || (strlen(inputFiles[i]) == 0))
- {
- amdlibLogError("Invalid name for %dth input file", i+1);
- return amdlibFAILURE;
- }
-
- /* Load raw data */
- amdlibLogInfoDetail("%s", inputFiles[i]);
-
- if (amdlibLoadRawData(inputFiles[i], &rawData, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load raw data from file '%s'",
- inputFiles[i]);
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseRawData(&rawData);
- return amdlibFAILURE;
- }
-
- if (rawData.frameType == amdlibUNKNOWN_FRAME)
- {
- amdlibLogError("Invalid frame type '%d'", amdlibUNKNOWN_FRAME);
- amdlibReleaseRawData(&rawData);
- return amdlibFAILURE;
- }
- else if (rawData.frameType == amdlibDARK_FRAME)
- {
- /* Compute dark map */
- if (amdlibGenerateDarkData(&rawData, &dark,
- errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not generate dark map");
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseDarkData(&dark);
- amdlibReleaseRawData(&rawData);
- return amdlibFAILURE;
- }
- }
- else
- {
- /* Equalize raw data */
- if (amdlibCalibrateRawData(&dark,
- &rawData, errMsg) !=amdlibSUCCESS)
- {
- amdlibLogError("Could not calibrate raw data");
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseDarkData(&dark);
- amdlibReleaseRawData(&rawData);
- return amdlibFAILURE;
- }
-
- /* Test if some pixels are saturated */
- if (rawData.dataIsSaturated)
- {
- amdlibLogWarning("Saturation present in Data of file %s.",
- inputFiles[i]);
- }
-
- /* Get wave data from the first given file */
- if (waveDataLoaded == amdlibFALSE)
- {
- int p;
-
- if (amdlibGetWaveDataFromRawData(&rawData, &waveData,
- errMsg) == amdlibFAILURE)
- {
- amdlibLogError("Could not get wave data from raw data");
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseDarkData(&dark);
- amdlibReleaseRawData(&rawData);
- amdlibReleaseP2vmData(&p2vmData);
- return amdlibFAILURE;
- }
-
- /* And set new offsets (if given) */
- for (p = 0; p < 3; p++)
- {
- if (newSpectralOffsets[p] != amdlibOFFSETY_NOT_CALIBRATED)
- {
- newSpecOffset = amdlibTRUE;
- waveData.photoOffset[p] = newSpectralOffsets[p];
- }
- }
-
- waveDataLoaded = amdlibTRUE;
- }
-
- /* Store calibrated data into P2VM data structure */
- if (amdlibAddToP2vmData(&rawData, &waveData, &p2vmData,
- errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not add data into P2VM data structure");
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseDarkData(&dark);
- amdlibReleaseRawData(&rawData);
- amdlibReleaseP2vmData(&p2vmData);
- return amdlibFAILURE;
- }
- }
-
- amdlibReleaseRawData(&rawData);
- }
- /* End for */
-
- amdlibReleaseDarkData(&dark);
-
- /* Compute P2VM */
- amdlibLogInfo("Computing P2VM ...");
- if (amdlibComputeP2VM(&p2vmData, amdlibP2VM_2T,
- &waveData, &p2vm, errMsg) == amdlibFAILURE)
- {
- amdlibLogError("Could not compute P2VM");
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseP2vmData(&p2vmData);
- amdlibReleaseP2VM(&p2vm);
- return amdlibFAILURE;
- }
-
- if (verbose == amdlibTRUE)
- {
- amdlibDisplayP2vm(&p2vm);
- }
-
- amdlibReleaseP2vmData(&p2vmData);
-
- amdlibLogInfo("Saving P2VM file ...");
- amdlibLogInfoDetail(p2vmFile);
- if (amdlibSaveP2VM(p2vmFile, &p2vm,
- amdlibP2VM_STD_ACC,
- errMsg) == amdlibFAILURE)
- {
- amdlibLogError("Could not save P2VM");
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseP2VM(&p2vm);
- return amdlibFAILURE;
- }
-
- amdlibReleaseP2VM(&p2vm);
-
-#ifndef ESO_CPL_PIPELINE_VARIANT
- if (amdlibAppendKeywordListToP2VM(p2vmFile, badPixelFile, flatFieldFile,
- inputFiles, 5, newSpectralOffsets,
- newSpecOffset, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not add PRO keywords - %s", errMsg);
- return amdlibFAILURE;
- }
-#endif
-
- return amdlibSUCCESS;
-}
-
-/**
- * Compute the P2VM (Photometry to Visibility Matrix) for the 3 telescope
- * configuration.
- *
- * Ditto amdlibComputeP2vm2T for a 3 telescope configuration.
- *
- * @param badPixelFile name of file containing bad pixel map
- * @param flatFieldFile name of file containing flat-field map
- * @param darkFile name of file containing data for dark estimation
- * @param inputFile1 name of the 1st file containing AMBER data
- * @param inputFile2 name of the 2nd file containing AMBER data
- * @param inputFile3 name of the 3rd file containing AMBER data
- * @param inputFile4 name of the 4th file containing AMBER data
- * @param inputFile5 name of the 5th file containing AMBER data
- * @param inputFile6 name of the 6th file containing AMBER data
- * @param inputFile7 name of the 7th file containing AMBER data
- * @param inputFile8 name of the 8th file containing AMBER data
- * @param inputFile9 name of the 9th file containing AMBER data
- * @param p2vmFile name of file where P2VM will be stored
- * @param newSpectralOffsets offset to be applied on photometric channels
- * @param verbose indicates if information have to be displayed.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibComputeP2vm3T(const char *badPixelFile,
- const char *flatFieldFile,
- const char *darkFile,
- const char *inputFile1,
- const char *inputFile2,
- const char *inputFile3,
- const char *inputFile4,
- const char *inputFile5,
- const char *inputFile6,
- const char *inputFile7,
- const char *inputFile8,
- const char *inputFile9,
- const char *p2vmFile,
- amdlibDOUBLE *newSpectralOffsets,
- const amdlibBOOLEAN verbose)
-{
- amdlibBOOLEAN newSpecOffset;
- const char *inputFiles[10];
- int i;
- amdlibERROR_MSG errMsg;
- amdlibP2VM_INPUT_DATA p2vmData = {NULL};
- amdlibP2VM_MATRIX p2vm = {NULL};
- amdlibWAVEDATA waveData;
- amdlibBOOLEAN waveDataLoaded;
-
- amdlibLogTrace("amdlibComputeP2vm3T()");
-
- /* Init list of input files */
- inputFiles[0] = darkFile;
- inputFiles[1] = inputFile1;
- inputFiles[2] = inputFile2;
- inputFiles[3] = inputFile3;
- inputFiles[4] = inputFile4;
- inputFiles[5] = inputFile5;
- inputFiles[6] = inputFile6;
- inputFiles[7] = inputFile7;
- inputFiles[8] = inputFile8;
- inputFiles[9] = inputFile9;
-
- /* If a bad pixel file has been specified */
- if ((badPixelFile != NULL) && (strlen(badPixelFile) != 0))
- {
- /* Load it */
- if (amdlibLoadBadPixelMap(badPixelFile, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load bad pixel map '%s'", badPixelFile);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- }
-
-
- /* Load flat field map */
- if ((flatFieldFile != NULL) && (strlen(flatFieldFile) != 0))
- {
- if(amdlibLoadFlatFieldMap(flatFieldFile, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load flat field map '%s'", flatFieldFile);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- }
-
- /* Check P2VM file name */
- if ((p2vmFile == NULL) || (strlen(p2vmFile) == 0))
- {
- amdlibLogError("Invalid name for P2VM file");
- return amdlibFAILURE;
- }
-
- /* For each input files */
- waveDataLoaded = amdlibFALSE;
- newSpecOffset = amdlibFALSE;
- amdlibLogInfo("Loading input files ...");
- for (i = 0; i < 10; i++)
- {
- if ((inputFiles[i] == NULL) || (strlen(inputFiles[i]) == 0))
- {
- amdlibLogError("Invalid name for %dth input file", i+1);
- return amdlibFAILURE;
- }
-
- /* Load raw data */
- amdlibLogInfoDetail("%s", inputFiles[i]);
- if (amdlibLoadRawData(inputFiles[i], &rawData, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load raw data from file '%s'",
- inputFiles[i]);
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseRawData(&rawData);
- return amdlibFAILURE;
- }
-
- if (rawData.frameType == amdlibUNKNOWN_FRAME)
- {
- amdlibLogError("Invalid frame type '%d'", amdlibUNKNOWN_FRAME);
- amdlibReleaseRawData(&rawData);
- return amdlibFAILURE;
- }
- else if (rawData.frameType == amdlibDARK_FRAME)
- {
- /* Compute dark map */
- if (amdlibGenerateDarkData(&rawData, &dark,
- errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not generate dark map");
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseDarkData(&dark);
- amdlibReleaseRawData(&rawData);
- return amdlibFAILURE;
- }
- }
- else
- {
- int p;
-
- /* Equalize raw data */
- if (amdlibCalibrateRawData(&dark,
- &rawData, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not calibrate raw data");
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseDarkData(&dark);
- amdlibReleaseRawData(&rawData);
- return amdlibFAILURE;
- }
-
- /* Test if some pixels are saturated */
- if (rawData.dataIsSaturated)
- {
- amdlibLogWarning("Saturation present in Data of file %s.",
- inputFiles[i]);
- }
-
- /* Get wave data from the first given file */
- if (waveDataLoaded == amdlibFALSE)
- {
- if (amdlibGetWaveDataFromRawData(&rawData, &waveData,
- errMsg) == amdlibFAILURE)
- {
- amdlibLogError("Could not get wave data");
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseDarkData(&dark);
- amdlibReleaseRawData(&rawData);
- amdlibReleaseP2vmData(&p2vmData);
- return amdlibFAILURE;
- }
-
- /* And set new offsets (if given) */
- for (p = 0; p < 3; p++)
- {
- if (newSpectralOffsets[p] != amdlibOFFSETY_NOT_CALIBRATED)
- {
- newSpecOffset = amdlibTRUE;
- waveData.photoOffset[p] = newSpectralOffsets[p];
- }
- }
- waveDataLoaded = amdlibTRUE;
- }
-
- /* Store calibrated data into P2VM data structure */
- if (amdlibAddToP2vmData(&rawData, &waveData, &p2vmData,
- errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not add data into P2VM data structure");
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseDarkData(&dark);
- amdlibReleaseRawData(&rawData);
- amdlibReleaseP2vmData(&p2vmData);
- return amdlibFAILURE;
- }
-
- }
- amdlibReleaseRawData(&rawData);
- }
- /* End for */
-
- amdlibReleaseDarkData(&dark);
-
- /* Compute P2VM */
- amdlibLogInfo("Computing P2VM ...");
- if (amdlibComputeP2VM(&p2vmData, amdlibP2VM_3T, &waveData, &p2vm, errMsg)
- == amdlibFAILURE)
- {
- amdlibLogError("Could not compute P2VM");
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseP2vmData(&p2vmData);
- amdlibReleaseP2VM(&p2vm);
- return amdlibFAILURE;
- }
- amdlibReleaseP2vmData(&p2vmData);
-
- if (verbose == amdlibTRUE)
- {
- amdlibDisplayP2vm(&p2vm);
- }
-
- amdlibLogInfo("Saving P2VM file ...");
- amdlibLogInfoDetail(p2vmFile);
- if (amdlibSaveP2VM(p2vmFile, &p2vm,
- amdlibP2VM_STD_ACC,
- errMsg) == amdlibFAILURE)
- {
- amdlibLogError("Could not save P2VM file");
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseP2VM(&p2vm);
- return amdlibFAILURE;
- }
- amdlibReleaseP2VM(&p2vm);
-
-#ifndef ESO_CPL_PIPELINE_VARIANT
- if (amdlibAppendKeywordListToP2VM(p2vmFile, badPixelFile, flatFieldFile,
- inputFiles, 10, newSpectralOffsets,
- newSpecOffset, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not add PRO keywords");
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
-#endif
-
-
- return amdlibSUCCESS;
-}
-/**
- * Compute visibilities.
- *
- * This function extracts the visibilities and piston from the input file, using
- * the given p2vm, and save result into the output file. If the dark/sky file
- * file is not specified (i.e set to ""), it is simply ignored. In the same
- * way, if file name for output is "", it is not created.
- *
- * @param badPixelFile name of file containing bad pixel map
- * @param flatFieldFile name of file containing flat-field map
- * @param p2vmFile name of file containing P2VM
- * @param darkFile name of file containing data for dark estimation (dark or sky)
- * @param inputFile name of the file containing AMBER data
- * @param outputFile name of the resulting file
- * @param nbBinning number of binnings
- * @param errorType indicates wether the noise figures are estimated
- * statistically from the sequence of photometries during the bin
- * (amdlibSTATISTICAL_ERROR) or theoretically by the poisson error on N photons
- * (amdlibTHEORETICAL_ERROR). The latter is forced obviously when the binsize
- * is 1.
- * @param pistonType indicates wether the piston is to be measured by fitting
- * a slope in the phasors amdlibITERATIVE_PHASOR or in the differential phases
- * after dewrapping (amdlibUNWRAPPED_PHASE). UNWRAPPED_PHASE is deprecated,
- * and not used anymore.
- * @param noCheckP2vmId forces amdlib to use without wuestion the passed p2vm,
- * even if its magic number is not OK. Can happen if the P2VM has been
- * observed AFTER the science observations.
- * @param mergeBandsInOutputFile indicates if many files will be produced (a single
- * one if TRUE or as much as there are bands otherwise).
- * @param selectionType name of the chosen selection criteria
- * (amdlibNO_FRAME_SEL if no selection).
- * @param selectionRatio ratio or threshold associated to the selection
- * criteria.
- * @param bands spectral bands to be treated; could be amdlibALL_BANDS to
- * compute visibilities for all bands
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibComputeOiData(const char *badPixelFile,
- const char *flatFieldFile,
- const char *p2vmFile,
- const char *darkFile,
- const char *inputFile,
- const char *outputFile,
- const int nbBinning,
- const amdlibERROR_TYPE errorType,
- const amdlibPISTON_ALGORITHM pistonType,
- const amdlibBOOLEAN noCheckP2vmId,
- amdlibBOOLEAN mergeBandsInOutputFile,
- const amdlibFRAME_SELECTION selectionType,
- const double selectionRatio,
- const amdlibBAND bands)
-{
- amdlibERROR_MSG errMsg;
- amdlibSCIENCE_DATA scienceData = {NULL};
- amdlibP2VM_MATRIX p2vm = {NULL};
- amdlibPHOTOMETRY photometry = {NULL}, imdPhot = {NULL};
- amdlibWAVELENGTH wave = {NULL}, imdWave = {NULL};
- amdlibPISTON opd = {NULL}, imdOpd = {NULL};
- amdlibOI_TARGET target = {NULL};
- amdlibOI_ARRAY array = {NULL};
- amdlibVIS vis = {NULL}, imdVis = {NULL};
- amdlibVIS2 vis2 = {NULL}, imdVis2 = {NULL};
- amdlibVIS3 vis3 = {NULL}, imdVis3 = {NULL};
- amdlibSPECTRUM spectrum = {NULL};
- amdlibSCIENCE_DATA *sciencePtr;
- amdlibWAVEDATA waveData;
- amdlibCPT_VIS_OPTIONS visOptions = {nbBinning, errorType, pistonType,
- noCheckP2vmId, selectionType, selectionRatio};
- char localfile[512];
- int firstBand=amdlibJ_BAND, lastBand=amdlibK_BAND;
- int band;
-
- amdlibLogTrace("amdlibComputeOiData()");
-
- /* Load bad pixel map */
- amdlibLogInfo("Loading bad pixel map ...");
- amdlibLogInfoDetail(badPixelFile);
- if (amdlibLoadBadPixelMap(badPixelFile, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load bad pixel map '%s'", badPixelFile);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
-
- /* Load flat field map */
- amdlibLogInfo("Loading flat-field file ...");
- amdlibLogInfoDetail(flatFieldFile);
- if (amdlibLoadFlatFieldMap(flatFieldFile, errMsg)!=amdlibSUCCESS)
- {
- amdlibLogError("Could not load flat-field map '%s'", flatFieldFile);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
-
- /* Load P2VM */
- amdlibLogInfo("Loading P2VM file ...");
- amdlibLogInfoDetail(p2vmFile);
- if (amdlibLoadP2VM(p2vmFile, &p2vm, errMsg) == amdlibFAILURE)
- {
- amdlibLogError("Could not load P2VM file '%s'", p2vmFile);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
-
- /* Retrieve wavedata */
- if (amdlibGetWaveDataFromP2vm(&p2vm, &waveData, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not get wave data");
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
-
- /* Load dark file */
- if (strlen(darkFile) != 0)
- {
- amdlibLogInfo("Loading sky (or dark) file ...");
- amdlibLogInfoDetail(darkFile);
- if (amdlibLoadRawData(darkFile, &rawData, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load raw data from dark file '%s'",
- darkFile);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- /* Compute dark map */
- if (amdlibGenerateDarkData(&rawData, &dark,
- errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not generate dark map");
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- amdlibReleaseRawData(&rawData);
- }
- else
- {
- amdlibLogWarning("No dark used");
-
- /* Load data file so that the false dark mimics its structure */
- if (amdlibLoadRawData(inputFile, &rawData, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load raw data from file '%s'", inputFile);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- amdlibSetDarkData( &rawData, &dark, 0.0, amdlibTYPICAL_RON , errMsg);
- amdlibReleaseRawData(&rawData);
- }
-
- /* Load data file */
- amdlibLogInfo("Loading data file ...");
- amdlibLogInfoDetail(inputFile);
- if (amdlibLoadRawData(inputFile, &rawData, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load raw data from file '%s'", inputFile);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
-
- /* Equalize raw data */
- if (amdlibCalibrateRawData(&dark, &rawData, errMsg) !=amdlibSUCCESS)
- {
- amdlibLogError("Could not calibrate raw data");
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
-
- /* Retrieve array information from raw data*/
- if (amdlibGetOiArrayFromRawData(&rawData, &array, errMsg) != amdlibSUCCESS)
- {
- amdlibLogWarning("Unable to retrieve OI_ARRAY information from data "
- "file");
- amdlibReleaseOiArray(&array);
- }
-
- /* retrieve target information */
- if (amdlibAllocateOiTarget(&target, 1) != amdlibSUCCESS)
- {
- amdlibLogError("Could not allocate target structure");
- return amdlibFAILURE;
- }
- if (amdlibGetOiTargetFromRawData(&rawData,&target) != amdlibSUCCESS)
- {
- amdlibLogError("Could not retrieve target information from data file");
- return amdlibFAILURE;
- }
-
- /* Produce science data */
- if (amdlibRawData2ScienceData(&rawData, &waveData, &scienceData,
- amdlibFALSE,
- errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not convert raw data to science data");
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
-
- sciencePtr = &scienceData;
- amdlibReleaseRawData(&rawData);
- amdlibReleaseDarkData(&dark);
-
- /* Check band(s) to be processed */
- if (bands != amdlibALL_BANDS)
- {
- firstBand = bands;
- lastBand = bands;
- mergeBandsInOutputFile = amdlibFALSE;
- }
-
- for (band = firstBand; band <= lastBand; band++)
- {
- int nbChannels;
- if (amdlibIsBandPresentInData(sciencePtr, &p2vm, &waveData, band))
- {
- amdlibLogInfoDetail("Processing band %c...",amdlibBandNumToStr(band));
- }
- /* Compute visibilities */
- nbChannels = amdlibComputeVisibilities
- (/* Input */
- sciencePtr, &p2vm, &waveData, band, &visOptions,
- /* Output */
- &imdPhot, &imdVis, &imdVis2, &imdVis3, &imdWave, &imdOpd,
- errMsg);
- if (nbChannels == -1)
- {
- amdlibLogError("Could not compute visibilities for '%c' band",
- amdlibBandNumToStr(band));
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- else if (nbChannels > 0)
- {
- if (mergeBandsInOutputFile == amdlibTRUE)
- {
- if (amdlibMergeOiStructures(&wave, &imdWave,
- &photometry, &imdPhot,
- &vis, &imdVis,
- &vis2, &imdVis2,
- &vis3, &imdVis3,
- &opd, &imdOpd,
- errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not merge OI structures");
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- }
- else
- {
- /* Save OI file */
- if (strlen(outputFile) != 0)
- {
- if (amdlibGetUserPref(amdlibNORMALIZE_SPECTRUM).set==amdlibTRUE)
- {
- /* Get normalized spectrum */
- if (amdlibGetAndNormalizeSpectrumFromScienceData
- (sciencePtr, &p2vm, &waveData, &imdWave,
- &spectrum, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not get normalized spectrum from science "
- "data");
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- }
- else
- {
- if (amdlibGetSpectrumFromScienceData
- (sciencePtr, &waveData, &imdWave,
- &spectrum, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not get spectrum from science "
- "data");
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- }
-
- /* Prepare OI file name */
- strcpy(localfile, outputFile);
- char *p;
- strcpy(localfile, outputFile);
- p = strstr(localfile, ".fits");
- if (p != NULL)
- {
- sprintf(p, "_%c.%s", amdlibBandNumToStr(band), "fits");
- }
- else
- {
- sprintf(localfile, "%s_%c", outputFile,
- amdlibBandNumToStr(band));
- }
- amdlibLogInfo("Saving OI file ...");
- amdlibLogInfoDetail(localfile);
- if (amdlibSaveOiFile(localfile, &sciencePtr->insCfg,
- &array, &target,
- &imdPhot, &imdVis, &imdVis2,
- &imdVis3, &imdWave, &imdOpd, &spectrum,
- errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not save OI file '%s'",
- localfile);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
-#ifndef ESO_CPL_PIPELINE_VARIANT
- if (amdlibAppendKeywordListToOIFITS(
- localfile, badPixelFile, flatFieldFile,
- darkFile, inputFile, nbBinning,
- errorType, pistonType, noCheckP2vmId,
- mergeBandsInOutputFile, selectionType,
- selectionRatio, vis.nbFrames,
- errMsg)!= amdlibSUCCESS)
- {
- amdlibLogError("Could not add PRO keywords to '%s'",
- localfile);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
-#endif
- }
-
- /* Display for test */
- if (amdlibLogGetLevel() >= amdlibLOG_TRACE)
- {
- printf("\nDisplay spectral dispersion structure ...\n");
- amdlibDisplayWavelength(&imdWave);
-
- printf("\nDisplay photometry structure ...\n");
- amdlibDisplayPhotometry(&imdPhot);
-
- printf("\nDisplay visibility structure ...\n");
- amdlibDisplayVis(&imdVis);
-
- printf("\nDisplay squared visibility structure ...\n");
- amdlibDisplayVis2(&imdVis2);
-
- printf("\nDisplay closure phases structure ...\n");
- amdlibDisplayVis3(&imdVis3);
-
- printf("\nDisplay piston structure ...\n");
- amdlibDisplayPiston(&imdOpd);
- }
- }
-
- amdlibReleasePhotometry(&imdPhot);
- amdlibReleaseVis(&imdVis);
- amdlibReleaseVis2(&imdVis2);
- amdlibReleaseVis3(&imdVis3);
- amdlibReleaseWavelength(&imdWave);
- amdlibReleasePiston(&imdOpd);
- }
- }
-
- if (mergeBandsInOutputFile == amdlibTRUE)
- {
- /* Save OI file */
- if (strlen(outputFile) != 0)
- {
- if (amdlibGetUserPref(amdlibNORMALIZE_SPECTRUM).set==amdlibTRUE)
- {
- if (amdlibGetAndNormalizeSpectrumFromScienceData
- (sciencePtr, &p2vm, &waveData, &wave,
- &spectrum, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not get spectrum from science data");
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- }
- else
- {
- if (amdlibGetSpectrumFromScienceData
- (sciencePtr, &waveData, &wave,
- &spectrum, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not get spectrum from science data");
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- }
- amdlibLogInfo ("Saving OI file...");
- amdlibLogInfoDetail (outputFile);
-
- if (amdlibSaveOiFile(outputFile, &sciencePtr->insCfg,
- &array, &target,
- &photometry, &vis, &vis2, &vis3, &wave,
- &opd, &spectrum, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not save OI file '%s'", outputFile);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
-#ifndef ESO_CPL_PIPELINE_VARIANT
- if (amdlibAppendKeywordListToOIFITS(
- outputFile, badPixelFile, flatFieldFile,
- darkFile, inputFile, nbBinning,
- errorType, pistonType, noCheckP2vmId,
- mergeBandsInOutputFile, selectionType,
- selectionRatio, vis.nbFrames,
- errMsg)!= amdlibSUCCESS)
- {
- amdlibLogError("Could not add PRO keywords to '%s'",
- outputFile);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
-#endif
- }
-
- /* Display for test */
- if (amdlibLogGetLevel() >= amdlibLOG_TRACE)
- {
- printf("\nDisplay spectral dispersion structure ...\n");
- amdlibDisplayWavelength(&wave);
-
- printf("\nDisplay photometry structure ...\n");
- amdlibDisplayPhotometry(&photometry);
-
- printf("\nDisplay visibility structure ...\n");
- amdlibDisplayVis(&vis);
-
- printf("\nDisplay squared visibility structure ...\n");
- amdlibDisplayVis2(&vis2);
-
- printf("\nDisplay closure phases structure ...\n");
- amdlibDisplayVis3(&vis3);
-
- printf("\nDisplay piston structure ...\n");
- amdlibDisplayPiston(&opd);
- }
- }
-
- amdlibReleaseScienceData(sciencePtr);
- amdlibReleaseP2VM(&p2vm);
- amdlibReleaseVis(&vis);
- amdlibReleaseVis2(&vis2);
- amdlibReleaseVis3(&vis3);
- amdlibReleaseOiArray(&array);
- amdlibReleaseWavelength(&wave);
- amdlibReleasePiston(&opd);
- amdlibReleasePhotometry(&photometry);
- amdlibReleaseOiTarget(&target);
- amdlibReleaseSpectrum(&spectrum);
-
- return amdlibSUCCESS;
-}
-
-/**
- * Perform a frame selection on input file.
- *
- * This function loads the input file, performs a selection on its frames to
- * keep only good ones using the given criterion and ratio, and/or the
- * selection input file. Then it can, if specified,
- * - average all data according to good frames kept and then save result
- * into the 'outputFile' file.
- * - save selection information into the 'outputSelFileName' file.
- *
- * @param inputFile name of the file containing AMBER data
- * @param inputSelFileName name of the input selection file
- * @param outputFile name of the resulting file
- * @param outputSelFileName name of the output selection file
- * @param selectionType name of the chosen selection criteria
- * (amdlibNO_FRAME_SEL if no selection).
- * @param selectionRatio rato or threshold associated to the selection criteria.
- * @param useSelFile indicates whether input selection file has to be used or
- * not
- * @param saveSelFile indicates whether output selection file has to be saved or
- * not
- * @param averageData indicates whether OI data has to be averaged or not
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibPerformSelection(const char *inputFile,
- const char *inputSelFileName,
- const char *outputFile,
- const char *outputSelFileName,
- const amdlibFRAME_SELECTION selectionType,
- const double selectionRatio,
- const amdlibBOOLEAN useSelFile,
- const amdlibBOOLEAN saveSelFile,
- const amdlibBOOLEAN averageData)
-{
- amdlibERROR_MSG errMsg;
- static amdlibPHOTOMETRY photometry = {NULL}, dstPhot = {NULL};
- static amdlibPHOTOMETRY imdPhot[amdlibNB_BANDS];
- static amdlibWAVELENGTH wave = {NULL}, dstWave = {NULL};
- static amdlibWAVELENGTH imdWave[amdlibNB_BANDS];
- static amdlibPISTON opd = {NULL}, dstOpd = {NULL};
- static amdlibPISTON imdOpd[amdlibNB_BANDS];
- static amdlibOI_TARGET target = {NULL};
- static amdlibOI_ARRAY array = {NULL};
- static amdlibVIS vis = {NULL}, dstVis = {NULL};
- static amdlibVIS imdVis[amdlibNB_BANDS];
- static amdlibVIS2 vis2 = {NULL}, dstVis2 = {NULL};
- static amdlibVIS2 imdVis2[amdlibNB_BANDS];
- static amdlibVIS3 vis3 = {NULL}, dstVis3 = {NULL};
- static amdlibVIS3 imdVis3[amdlibNB_BANDS];
- static amdlibINS_CFG insCfg;
- static amdlibINS_CFG selKewList;
- static amdlibSELECTION selectedFrames;
- static amdlibSPECTRUM spectrum = {NULL};
- int band, base, i;
- int nbSelectedFrames[3];
- int totalNbSelectedFrames;
- int noVis3=0;
-
- amdlibLogTrace("amdlibPerformSelection()");
-
- /* Load input OI-FITS file */
- amdlibLogInfo("Loading OI-FITS file...");
- amdlibLogInfoDetail(inputFile);
- if (amdlibLoadOiFile(inputFile, &insCfg, &array, &target, &photometry,
- &vis, &vis2, &vis3, &wave, &opd, &spectrum,
- errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load OI-FITS file '%s'", inputFile);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
-
- if (useSelFile == amdlibTRUE)
- {
- if (amdlibReadSelectionFile(inputSelFileName, &selKewList,
- &selectedFrames, errMsg) == amdlibFAILURE)
- {
- amdlibLogError("Could not read selection file or extract selection "
- "information");
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- }
- else
- {
- if (amdlibAllocateSelection(&selectedFrames, vis.nbFrames,
- vis.nbBases, errMsg) == amdlibFAILURE)
- {
- amdlibLogError("Could not allocate frame selection structure");
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- }
-
- if (amdlibSplitOiStructures(&wave, imdWave, &photometry, imdPhot,
- &vis, imdVis, &vis2, imdVis2, &vis3, imdVis3,
- &opd, imdOpd, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not split OI data into structures");
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
-
- totalNbSelectedFrames = 0;
- for (band = amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- nbSelectedFrames[band] = 0;
-
- /* If required, perform frame selection */
- if (imdOpd[band].thisPtr == NULL)
- {
- amdlibLogInfo("No channel for band %c: no selection for that "
- "band", amdlibBandNumToStr(band));
- if (saveSelFile == amdlibTRUE)
- {
- /* Indicate all frames are not selected for that band */
- amdlibSetSelection(&selectedFrames, band, amdlibFALSE);
- }
- }
- else
- {
- /* Select 'good' frames depending on selection criterion. If no
- * criterion is specified, this function does nothing. */
- if (amdlibSelectFrames(&vis, &photometry, &opd, selectionType,
- selectionRatio, &selectedFrames,
- band, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not select good frames");
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
-
- /* Determine if there are frames selected in at least one
- * baseline */
- for (base = 0; base < vis.nbBases; base++)
- {
- nbSelectedFrames[band] +=
- selectedFrames.band[band].nbSelectedFrames[base];
- }
- if (nbSelectedFrames[band] != 0)
- {
- if (averageData == amdlibTRUE)
- {
- /* Average visibilities, photometries and pistons on good
- * frames */
- if (amdlibAverageVisibilities(&imdPhot[band], &imdVis[band],
- &imdVis2[band],
- &imdVis3[band],
- &imdOpd[band], band,
- &imdWave[band],
- &selectedFrames,
- errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not average data after frame "
- "selection for band %c",
- amdlibBandNumToStr(band));
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- }
- for (base = 0; base < vis.nbBases; base++)
- {
-
- if (selectedFrames.band[band].nbSelectedFrames[base] == 0)
- {
- /* No frames are selected for that base, so flag them */
- for (i=0; i < imdVis[band].nbFrames; i++)
- {
- memset(imdVis[band].table[i*vis.nbBases+base].flag,
- amdlibTRUE,
- imdVis[band].nbWlen * sizeof(amdlibBOOLEAN));
- memset(imdVis2[band].table[i*vis.nbBases+base].flag,
- amdlibTRUE,
- imdVis2[band].nbWlen *sizeof(amdlibBOOLEAN));
- }
- }
- else /* take note that there is a base with some unflagged values */
- {
- noVis3 += 1;
- }
-
- }
- /* flag vis3 if all bases are null (perhaps already done elsehere!)*/
- if ((&(imdVis3[band]) != NULL) && (noVis3 == 0))
- {
- for (i=0;
- i < imdVis3[band].nbClosures * imdVis3[band].nbFrames;
- i++)
- {
- memset(imdVis3[band].table[i].flag, amdlibTRUE,
- imdVis3[band].nbWlen * sizeof(amdlibBOOLEAN));
- }
- }
-
- if (amdlibMergeOiStructures(&dstWave, &imdWave[band],
- &dstPhot, &imdPhot[band],
- &dstVis, &imdVis[band],
- &dstVis2, &imdVis2[band],
- &dstVis3, &imdVis3[band],
- &dstOpd, &imdOpd[band],
- errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not merge OI structures");
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- }
- else
- {
- amdlibLogWarning("No frames selected for band %c",
- amdlibBandNumToStr(band));
- }
- }
- totalNbSelectedFrames += nbSelectedFrames[band];
- }
-
- if (totalNbSelectedFrames == 0)
- {
- amdlibLogError("No frames selected at all for given criteria");
- return amdlibFAILURE;
- }
-
- amdlibLogInfo("Number of selected frames :");
- for (band = amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- amdlibVIS_TABLE_ENTRY **visTablePtr = NULL;
- int base;
- /* Wrap vis table */
- visTablePtr =
- (amdlibVIS_TABLE_ENTRY **)amdlibWrap2DArray(vis.table,
- vis.nbBases, vis.nbFrames,
- sizeof(amdlibVIS_TABLE_ENTRY),
- errMsg);
- for (base = 0; base < vis.nbBases; base++)
- {
- if (visTablePtr[0][base].bandFlag[band] == amdlibTRUE)
- {
- amdlibLogInfoDetail("Band %c, base %d = %d frames",
- amdlibBandNumToStr(band), base,
- selectedFrames.band[band].nbSelectedFrames[base]);
- }
- }
- if (visTablePtr[0][0].bandFlag[band] == amdlibTRUE)
- {
- if (selectedFrames.nbBases == 3)
- {
- amdlibLogInfoDetail("%d frames for phase closure",
- selectedFrames.band[band].nbFramesOkForClosure);
- }
- }
- amdlibFree2DArrayWrapping((void **)visTablePtr);
- }
-
- if (saveSelFile == amdlibTRUE)
- {
- amdlibLogInfo("Saving selection file ...");
- amdlibLogInfoDetail(outputSelFileName);
- if (amdlibWriteSelectionFile(outputSelFileName,
- &selectedFrames, errMsg) == amdlibFAILURE)
- {
- amdlibLogError("Could not write selection file");
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- if (amdlibAppendSelectionKeywords(outputFile, outputSelFileName,
- inputFile, &selKewList, amdlibFALSE,
- selectionType, selectionRatio,
- errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not add PRO keywords");
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- }
-
- if (averageData == amdlibTRUE)
- {
- char dprCatg[256];
- char proCatg[256];
- if (amdlibGetInsCfgKeyword(&insCfg, "HIERARCH ESO DPR CATG",
- dprCatg, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not get DPR CATG keywords");
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- amdlibStripQuotes(dprCatg);
- sprintf(proCatg, " '%s_%s' ", dprCatg, "AVERAGED");
- if (amdlibSetInsCfgKeyword(&insCfg, "HIERARCH ESO PRO CATG",
- proCatg, "Category of product frames",
- errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not set PRO CATG keywords");
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
-
- amdlibLogInfo("Saving OI-FITS file ...");
- amdlibLogInfoDetail(outputFile);
-
- if (amdlibSaveOiFile(outputFile, &insCfg, &array, &target, &dstPhot,
- &dstVis, &dstVis2, &dstVis3, &dstWave, &dstOpd,
- &spectrum, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not save OI-FITS file '%s'", outputFile);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
-
- if (amdlibAppendSelectionKeywords(outputFile, outputSelFileName,
- inputFile, &selKewList, amdlibTRUE,
- selectionType,
- selectionRatio,
- errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not add PRO keywords");
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- }
-
- /* Release all data structures */
- for (band=amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- amdlibReleaseWavelength(&imdWave[band]);
- amdlibReleasePiston(&imdOpd[band]);
- amdlibReleaseVis(&imdVis[band]);
- amdlibReleaseVis2(&imdVis2[band]);
- amdlibReleaseVis3(&imdVis3[band]);
- amdlibReleasePhotometry(&imdPhot[band]);
- }
- amdlibReleaseSelection(&selectedFrames);
- amdlibReleasePhotometry(&photometry);
- amdlibReleasePhotometry(&dstPhot);
- amdlibReleaseWavelength(&wave);
- amdlibReleaseWavelength(&dstWave);
- amdlibReleasePiston(&opd);
- amdlibReleasePiston(&dstOpd);
- amdlibReleaseVis(&vis);
- amdlibReleaseVis(&dstVis);
- amdlibReleaseVis2(&vis2);
- amdlibReleaseVis2(&dstVis2);
- amdlibReleaseVis3(&vis3);
- amdlibReleaseVis3(&dstVis3);
- amdlibReleaseOiArray(&array);
- amdlibReleaseOiTarget(&target);
- amdlibReleaseSpectrum(&spectrum);
-
- return amdlibSUCCESS;
-}
-
-/**
- * Merge p2vms
- *
- * Not yet implemented
- *
- * @param nbFiles number of P2VM to merge
- * @param p2vmFile list of names of files containing P2VM
- * @param outputFile name of file containing resulting P2VM
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibMergeP2vmFromFiles(const int nbFiles,
- const char **p2vmFile,
- const char *outputFile)
-{
-
- static amdlibP2VM_MATRIX p2vm1;
- static amdlibP2VM_MATRIX p2vm2;
- static amdlibP2VM_MATRIX p2vmRes;
- amdlibERROR_MSG errMsg;
- int i;
-
- amdlibLogTrace("amdlibMergeP2vmFromFiles()");
-
- if (nbFiles < 2)
- {
- amdlibLogError("P2VM merge needs at least 2 input files");
- return amdlibFAILURE;
- }
-
- if (amdlibLoadP2VM(p2vmFile[0], &p2vmRes, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load P2VM file '%s'", p2vmFile[0]);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- for (i = 1; i < nbFiles; i++)
- {
- if (amdlibDuplicateP2VM(&p2vmRes, &p2vm1, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not duplicate P2VM");
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseP2VM(&p2vm2);
- amdlibReleaseP2VM(&p2vmRes);
- return amdlibFAILURE;
- }
- amdlibReleaseP2VM(&p2vmRes);
- if (amdlibLoadP2VM(p2vmFile[i], &p2vm2, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load P2VM file '%s'", p2vmFile[i]);
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseP2VM(&p2vm1);
- amdlibReleaseP2VM(&p2vmRes);
- return amdlibFAILURE;
- }
- if (amdlibMergeP2VM(&p2vm1, &p2vm2, &p2vmRes, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not merge P2VM");
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseP2VM(&p2vm1);
- amdlibReleaseP2VM(&p2vm2);
- amdlibReleaseP2VM(&p2vmRes);
- return amdlibFAILURE;
- }
- }
-
- if (amdlibSaveP2VM(outputFile, &p2vmRes, amdlibP2VM_STD_ACC,
- errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not save P2VM");
- amdlibLogErrorDetail(errMsg);
- amdlibReleaseP2VM(&p2vm1);
- amdlibReleaseP2VM(&p2vm2);
- amdlibReleaseP2VM(&p2vmRes);
- return amdlibFAILURE;
- }
-
- amdlibReleaseP2VM(&p2vm1);
- amdlibReleaseP2VM(&p2vm2);
- amdlibReleaseP2VM(&p2vmRes);
- return amdlibSUCCESS;
-}
-
-/**
- * Append Oi-Fits Files into a single one
- *
- * @param nbFiles number of OI-FITS files to append
- * @param oiFitsFile list of names of OI-FITS files to be append
- * @param outputFile name of resulting file
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAppendOiFitsFiles(const int nbFiles,
- const char **oiFitsFile,
- const char *outputFile)
-{
- amdlibPHOTOMETRY srcPhot = {NULL};
- amdlibPHOTOMETRY refPhot = {NULL};
- amdlibPHOTOMETRY dstPhot = {NULL};
- amdlibWAVELENGTH srcWave = {NULL};
- amdlibWAVELENGTH refWave = {NULL};
- amdlibPISTON srcPst = {NULL};
- amdlibPISTON refPst = {NULL};
- amdlibPISTON dstPst = {NULL};
- amdlibOI_TARGET srcTarget = {NULL};
- amdlibOI_TARGET refTarget = {NULL};
- amdlibOI_ARRAY srcArray = {NULL};
- amdlibOI_ARRAY refArray = {NULL};
- amdlibVIS srcVis = {NULL};
- amdlibVIS refVis = {NULL};
- amdlibVIS dstVis = {NULL};
- amdlibVIS2 srcVis2 = {NULL};
- amdlibVIS2 refVis2 = {NULL};
- amdlibVIS2 dstVis2 = {NULL};
- amdlibVIS3 srcVis3 = {NULL};
- amdlibVIS3 refVis3 = {NULL};
- amdlibVIS3 dstVis3 = {NULL};
- amdlibINS_CFG insCfg;
- amdlibINS_CFG srcCfg;
- amdlibSPECTRUM srcSpectrum = {NULL};
- amdlibSPECTRUM refSpectrum = {NULL};
- amdlibSPECTRUM dstSpectrum = {NULL};
- amdlibERROR_MSG errMsg;
- int iFile=0;
- int insertIndex=0;
- int nbFrames = 0;
- int nbBases = 0;
- int nbWlen = 0;
- int nbTels = 0;
- int finalNbFrames = 0;
- char arrayName[16];
- int hasAmberData = 0;
- int hasSpectrum = 0;
- int hasVis3 = 0;
- char keywLine[amdlibKEYW_NAME_LEN+1];
- char fullFileName[1024];
- char keywValue[amdlibKEYW_VAL_LEN+1];
- char *keyValBis;
-
- amdlibLogTrace("amdlibAppendOiFitsFiles()");
-
- if (nbFiles < 2)
- {
- amdlibLogError("OI-FITS file concatenation needs at least 2 input "
- "files");
- return amdlibFAILURE;
- }
-
- /* Load first file */
- amdlibClearInsCfg(&insCfg);
- if (amdlibLoadOiFile(oiFitsFile[0], &insCfg, &refArray, &refTarget,
- &refPhot, &refVis, &refVis2, &refVis3, &refWave,
- &refPst, &refSpectrum, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load OI-FITS file '%s'", oiFitsFile[0]);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- /* Remove invalid keywords in Header*/
- amdlibRemoveInsCfgKeyword(&insCfg,"HIERARCH ESO PRO REC1");
- amdlibRemoveInsCfgKeyword(&insCfg,"HIERARCH ESO PRO DATANCOM");
- amdlibRemoveInsCfgKeyword(&insCfg,"HIERARCH ESO QC");
- amdlibRemoveInsCfgKeyword(&insCfg,"HIERARCH ESO OCS DRS");
- amdlibRemoveInsCfgKeyword(&insCfg,"DATASUM");
- amdlibRemoveInsCfgKeyword(&insCfg,"CHECKSUM");
-
- if (refPst.nbFrames != 0)
- {
- hasAmberData = 1;
- }
-
- nbFrames = finalNbFrames = refVis2.nbFrames;
- nbBases = refVis2.nbBases;
- nbWlen = refVis2.nbWlen;
- nbTels = refSpectrum.nbTels;
- strcpy(arrayName, refArray.arrayName);
-
- /* Loop on files and count the final size (or error!) */
- for (iFile = 1; iFile < nbFiles; iFile++)
- {
- /* Load file */
- if (amdlibLoadOiFile(oiFitsFile[iFile], NULL, &srcArray, &srcTarget,
- &srcPhot, &srcVis, &srcVis2, &srcVis3, &srcWave,
- &srcPst, &srcSpectrum, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load OI-FITS file '%s'", oiFitsFile[iFile]);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- /* Perform simple checks */
- if (strcmp(arrayName, srcArray.arrayName) != 0)
- {
- amdlibLogError("Different ARRNAME in file '%s' (%s) and in "
- "previous file(s) (%s)",
- oiFitsFile[iFile], srcArray.arrayName, arrayName );
- return amdlibFAILURE;
- }
- if (nbBases != srcVis2.nbBases)
- {
- amdlibLogError("Different number of bases (%d vs. %d)"
- "in file '%s' and in previous file(s)",
- nbBases, srcVis2.nbBases, oiFitsFile[iFile]);
- return amdlibFAILURE;
- }
- if (nbWlen != srcVis2.nbWlen)
- {
- amdlibLogError("Different number of Wavelength (%d vs. %d)"
- "in file '%s' and in previous file(s)",
- nbWlen, srcVis2.nbWlen, oiFitsFile[iFile]);
- return amdlibFAILURE;
- }
-
- /* Check amdlibWAVELENGTH structures are identical */
- if (amdlibCompareWavelengths(&srcWave, &refWave, errMsg) != amdlibTRUE)
- {
- amdlibLogError("Could not append files with different wavelength "
- "data structures ('%s' and '%s')",
- oiFitsFile[0], oiFitsFile[iFile]);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
-
- if ((hasAmberData==0)&&(srcPst.nbFrames != 0))
- {
- amdlibLogError("Could not append files with different AmberData "
- "structures ('%s' and '%s')",
- oiFitsFile[0], oiFitsFile[iFile]);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
-
- /* All OK: count these frames also */
- finalNbFrames+=srcVis2.nbFrames;
-
- amdlibReleaseOiArray(&srcArray);
- amdlibReleaseOiTarget(&srcTarget);
- amdlibReleaseVis(&srcVis);
- amdlibReleaseVis2(&srcVis2);
- amdlibReleaseVis3(&srcVis3);
- amdlibReleaseWavelength(&srcWave);
- amdlibReleasePiston(&srcPst);
- amdlibReleasePhotometry(&srcPhot);
- amdlibReleaseSpectrum(&srcSpectrum);
- }
-
- sprintf(keywLine,"HIERARCH ESO DRS DATANCOM = %d / Nb of Combined Files",nbFiles);
- amdlibAddInsCfgKeyword(&insCfg,keywLine,errMsg);
-
- /* Allocate the dst structures. */
- if (nbTels>0)
- {
- if (amdlibAllocateSpectrum(&dstSpectrum,nbTels,nbWlen) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for spectrum");
- return amdlibFAILURE;
- }
- hasSpectrum=1;
- }
- else
- {
- amdlibLogWarning("Output File will not have Spectrum Table");
- }
- /* Allocate memory for phot */
- if (amdlibAllocatePhotometry(&dstPhot, finalNbFrames, nbBases,
- nbWlen) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for photometry");
- return amdlibFAILURE;
- }
- /* Allocate memory for vis */
- if (amdlibAllocateVis(&dstVis, finalNbFrames, nbBases,
- nbWlen) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for vis");
- return amdlibFAILURE;
- }
- /* Allocate memory for vis2 */
- if (amdlibAllocateVis2(&dstVis2, finalNbFrames, nbBases,
- nbWlen) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for vis2");
- return amdlibFAILURE;
- }
- /* Allocate memory for vis3 if necessary */
- if (nbBases > 1)
- {
- if (amdlibAllocateVis3(&dstVis3, finalNbFrames, refVis3.nbClosures,
- nbWlen) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for vis3");
- return amdlibFAILURE;
- }
- hasVis3 = 1;
- }
- if (hasAmberData == 1)
- {
- /* Allocate memory for piston */
- if (amdlibAllocatePiston(&dstPst, finalNbFrames,
- nbBases) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for opd");
- return amdlibFAILURE;
- }
- }
- /* Loop on files and insert at end of final structure */
- for (iFile = 0, insertIndex=0 ; iFile < nbFiles; iFile++)
- {
- /* reload file */
- if (amdlibLoadOiFile(oiFitsFile[iFile], &srcCfg, &srcArray, &srcTarget,
- &srcPhot, &srcVis, &srcVis2, &srcVis3, &srcWave,
- &srcPst, &srcSpectrum, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not reload OI-FITS file '%s'", oiFitsFile[iFile]);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
-
- /* add spectrum to ref Spectrum*/
- if (srcSpectrum.nbTels != 0 && (hasSpectrum == 1))
- {
- if (amdlibAddSpectrum(&dstSpectrum, &srcSpectrum, errMsg)!= amdlibSUCCESS)
- {
- amdlibLogError("Could not add spectrum from file '%s'", oiFitsFile[iFile]);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- }
- /* Insert photometry (if any) */
- if ((srcPhot.nbFrames != 0) && (hasAmberData == 1))
- {
- if (amdlibInsertPhotometry(&dstPhot,
- &srcPhot, insertIndex, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not append photometry from file '%s'",
- oiFitsFile[iFile]);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- }
-
- /* Insert vis */
- if (amdlibInsertVis(&dstVis, &srcVis, insertIndex, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not insert vis from file '%s'",
- oiFitsFile[iFile]);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- /* Insert vis2 */
- if (amdlibInsertVis2(&dstVis2, &srcVis2, insertIndex, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not insert vis2 from file '%s'",
- oiFitsFile[iFile]);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- /* Insert vis3 */
- if (hasVis3 == 1)
- {
- if (amdlibInsertVis3(&dstVis3, &srcVis3, insertIndex, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not insert vis3 from file '%s'",
- oiFitsFile[iFile]);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- }
- /* Insert piston */
- if (hasAmberData == 1)
- {
- if (amdlibInsertPiston(&dstPst, &srcPst, insertIndex, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not insert piston from file '%s'",
- oiFitsFile[iFile]);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
- }
-
- insertIndex += srcVis2.nbFrames;
-
- amdlibReleaseOiArray(&srcArray);
- amdlibReleaseOiTarget(&srcTarget);
- amdlibReleaseVis(&srcVis);
- amdlibReleaseVis2(&srcVis2);
- amdlibReleaseVis3(&srcVis3);
- amdlibReleaseWavelength(&srcWave);
- amdlibReleasePiston(&srcPst);
- amdlibReleasePhotometry(&srcPhot);
- amdlibReleaseSpectrum(&srcSpectrum);
-
- /*Add relevant Keyword(s)*/
- strncpy(fullFileName,oiFitsFile[iFile],1024);
- keyValBis = basename(fullFileName);
- sprintf(keywLine,"HIERARCH ESO DRS PROV%2.2d = \'%.50s\'",iFile,keyValBis);
- amdlibAddInsCfgKeyword(&insCfg,keywLine,errMsg);
- /* If last file, update PBL* END with the ones of the last one */
- if (iFile==(nbFiles-1))
- {
- switch(nbBases)
- {
- case 3 :
- {
- amdlibRemoveInsCfgKeyword(&insCfg,"HIERARCH ESO ISS PBLA13 END");
- amdlibRemoveInsCfgKeyword(&insCfg,"HIERARCH ESO ISS PBLA23 END");
- amdlibRemoveInsCfgKeyword(&insCfg,"HIERARCH ESO ISS PBL13 END");
- amdlibRemoveInsCfgKeyword(&insCfg,"HIERARCH ESO ISS PBL23 END");
- }
- default :
- {
- amdlibRemoveInsCfgKeyword(&insCfg,"HIERARCH ESO ISS PBLA12 END");
- amdlibRemoveInsCfgKeyword(&insCfg,"HIERARCH ESO ISS PBL12 END");
- }
- }
- amdlibGetInsCfgKeyword(&srcCfg,"HIERARCH ESO ISS PBL12 END",keywValue,errMsg);
- sprintf(keywLine,"HIERARCH ESO ISS PBL12 END = %s / New End Value",keywValue);
- amdlibAddInsCfgKeyword(&insCfg,keywLine,errMsg);
- amdlibGetInsCfgKeyword(&srcCfg,"HIERARCH ESO ISS PBLA12 END",keywValue,errMsg);
- sprintf(keywLine,"HIERARCH ESO ISS PBLA12 END = %s / New End Value",keywValue);
- amdlibAddInsCfgKeyword(&insCfg,keywLine,errMsg);
- if (nbBases==3)
- {
- amdlibGetInsCfgKeyword(&srcCfg,"HIERARCH ESO ISS PBL23 END",keywValue,errMsg);
- sprintf(keywLine,"HIERARCH ESO ISS PBL23 END = %s / New End Value",keywValue);
- amdlibAddInsCfgKeyword(&insCfg,keywLine,errMsg);
- amdlibGetInsCfgKeyword(&srcCfg,"HIERARCH ESO ISS PBLA23 END",keywValue,errMsg);
- sprintf(keywLine,"HIERARCH ESO ISS PBLA23 END = %s / New End Value",keywValue);
- amdlibAddInsCfgKeyword(&insCfg,keywLine,errMsg);
- amdlibGetInsCfgKeyword(&srcCfg,"HIERARCH ESO ISS PBL13 END",keywValue,errMsg);
- sprintf(keywLine,"HIERARCH ESO ISS PBL13 END = %s / New End Value",keywValue);
- amdlibAddInsCfgKeyword(&insCfg,keywLine,errMsg);
- amdlibGetInsCfgKeyword(&srcCfg,"HIERARCH ESO ISS PBLA13 END",keywValue,errMsg);
- sprintf(keywLine,"HIERARCH ESO ISS PBLA13 END = %s / New End Value",keywValue);
- amdlibAddInsCfgKeyword(&insCfg,keywLine,errMsg);
- }
- }
- amdlibClearInsCfg(&srcCfg);
- }
- /* Save output file */
- if(amdlibSaveOiFile(outputFile, &insCfg, &refArray, &refTarget,
- &dstPhot, &dstVis, &dstVis2,
- (hasVis3==1)?&dstVis3:NULL, &refWave,
- (hasAmberData==1)?&dstPst:NULL,
- (hasSpectrum==1)?&dstSpectrum:NULL,
- errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not save OI-FITS file '%s'", outputFile);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
-
- amdlibReleaseVis(&dstVis);
- amdlibReleaseVis2(&dstVis2);
- amdlibReleaseVis3(&dstVis3);
- amdlibReleasePiston(&dstPst);
- amdlibReleasePhotometry(&dstPhot);
- amdlibReleaseSpectrum(&dstSpectrum);
-
- amdlibReleaseOiArray(&refArray);
- amdlibReleaseOiTarget(&refTarget);
- amdlibReleaseVis(&refVis);
- amdlibReleaseVis2(&refVis2);
- amdlibReleaseVis3(&refVis3);
- amdlibReleaseWavelength(&refWave);
- amdlibReleasePiston(&refPst);
- amdlibReleasePhotometry(&refPhot);
- amdlibReleaseSpectrum(&refSpectrum);
-
- return amdlibSUCCESS;
-}
-/*
- * Local functions
- */
-
-#ifndef ESO_CPL_PIPELINE_VARIANT
-/**
- * Add PRO keywords for P2VM
- *
- * @param p2vmFile name of file containing P2VM
- * @param badPixelFile name of file containing bad pixel map
- * @param flatFieldFile name of file containing flat-field map
- * @param inputFiles names of the files containing AMBER data
- * @param nbInputFiles number of files containing AMBER data
- * @param newSpectralOffsets offset to be applied on photometric channels
- * @param addOffsets true iif new spectral offsets are considered.
- * @param errMsg error description message returned if function fails
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAppendKeywordListToP2VM(const char *p2vmFile,
- const char *badPixelFile,
- const char *flatFieldFile,
- const char **inputFiles,
- int nbInputFiles,
- amdlibDOUBLE newSpectralOffsets[],
- amdlibBOOLEAN addOffsets,
- amdlibERROR_MSG errMsg)
-{
- char keyName[36];
- char keyVal[256], *keyValBis;
- char fullFileName[1024];
- int i;
- fitsfile *filePtr;
- int status = 0;
- char fitsioMsg[256];
- int nbTel;
- int nbRaws;
-
- amdlibLogTrace("amdlibAppendKeywordListToFile()");
-
- if(fits_open_file(&filePtr, p2vmFile, READWRITE, &status))
- {
- amdlibReturnFitsError(p2vmFile);
- }
-
- if (fits_movabs_hdu(filePtr, 1, 0, &status) != 0)
- {
- amdlibGetFitsError("main header");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- if (fits_write_key(filePtr, TSTRING, "HIERARCH ESO PRO DID", "AMBER",
- "Data dictionnary for PRO", &status) != 0)
- {
- amdlibGetFitsError("PRO DID");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- if (fits_write_key(filePtr, TSTRING, "HIERARCH ESO PRO CATG",
- "P2VM_REDUCED",
- "Category of product frames", &status) != 0)
- {
- amdlibGetFitsError("PRO CATG");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- if (fits_write_key(filePtr, TSTRING, "HIERARCH ESO PRO TYPE", "REDUCED",
- "Product type", &status) != 0)
- {
- amdlibGetFitsError("PRO TYPE");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- if (fits_write_key(filePtr, TSTRING, "HIERARCH ESO PRO REC1 ID",
- "amdlibComputeP2vm",
- "Program identifier", &status) != 0)
- {
- amdlibGetFitsError("PRO REC1 ID");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- /* Add information relative to bad pixel file */
- strcpy(keyVal, badPixelFile);
- strcpy(fullFileName, badPixelFile);
- keyValBis = basename(fullFileName);
- sprintf(keyVal, "%.40s", keyValBis);
- if (fits_write_key(filePtr, TSTRING, "HIERARCH ESO PRO REC1 RAW1 NAME",
- keyVal, "File name of raw frame", &status) != 0)
- {
- amdlibGetFitsError("PRO REC1 RAW1 NAME");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- if (fits_write_key(filePtr, TSTRING, "HIERARCH ESO PRO REC1 RAW1 CATG",
- "AMBER_BADPIX",
- "Category of raw frame", &status) != 0)
- {
- amdlibGetFitsError("PRO REC1 RAW1 CATG");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- /* Add information relative to flat field file */
- strcpy(fullFileName, flatFieldFile);
- keyValBis = basename(fullFileName);
- sprintf(keyVal, "%.40s", keyValBis);
- if (fits_write_key(filePtr, TSTRING, "HIERARCH ESO PRO REC1 RAW2 NAME",
- keyVal, "File name of raw frame", &status) != 0)
- {
- amdlibGetFitsError("PRO REC1 RAW2 NAME");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- if (fits_write_key(filePtr, TSTRING, "HIERARCH ESO PRO REC1 RAW2 CATG",
- "AMBER_FLATFIELD",
- "Category of raw frame", &status) != 0)
- {
- amdlibGetFitsError("PRO REC1 RAW2 CATG");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- if (nbInputFiles == 5)
- {
- nbTel = 2;
- }
- else if (nbInputFiles == 10)
- {
- nbTel = 3;
- }
- else
- {
- amdlibSetErrMsg("Invalid parameter nbInputFiles (%d) should be 5 or 10",
- nbInputFiles);
- return amdlibFAILURE;
- }
- for (i = 0; i < nbInputFiles; i++)
- {
- /* Add information relative to input files name (PRO keywords) */
- sprintf(keyName, "HIERARCH ESO PRO REC1 RAW%d NAME", i+3);
- strcpy(fullFileName, inputFiles[i]);
- keyValBis = basename(fullFileName);
- sprintf(keyVal, "%.40s", keyValBis);
- if (fits_write_key(filePtr, TSTRING, keyName, keyVal,
- "File name of raw frame", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- sprintf(keyName, "HIERARCH ESO PRO REC1 RAW%d CATG", i+3);
- if (fits_write_key(filePtr, TSTRING, keyName, "AMBER_2P2V",
- "Category of raw frame", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
-
- nbRaws = i+2;
- if (fits_write_key(filePtr, TINT, "HIERARCH ESO PRO DATANCOM", &nbRaws,
- "Number of combined frames", &status) != 0)
- {
- amdlibGetFitsError("PRO DATANCOM");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- if (addOffsets == amdlibTRUE)
- {
- if (fits_write_key(filePtr, TSTRING,
- "HIERARCH ESO PRO REC1 PARAM1 NAME", "-s",
- "", &status) != 0)
- {
- amdlibGetFitsError("PRO REC1 PARAM1 NAME");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- if (nbTel == 2)
- {
- sprintf(keyVal, "%f,%f", newSpectralOffsets[0],
- newSpectralOffsets[1]);
-
- }
- else
- {
- sprintf(keyVal, "%f,%f,%f", newSpectralOffsets[0],
- newSpectralOffsets[1], newSpectralOffsets[2]);
- }
- if (fits_write_key(filePtr, TSTRING,
- "HIERARCH ESO PRO REC1 PARAM1 VALUE", keyVal,
- "", &status) != 0)
- {
- amdlibGetFitsError("PRO REC1 PARAM1 VALUE");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
-
- /* Close FITS file */
- if (fits_close_file(filePtr, &status))
- {
- amdlibReturnFitsError(p2vmFile);
- }
-
-
- return amdlibSUCCESS;
-}
-
-/**
- * Add PRO keywords in insCfg structure for OI-FITS result file
- *
- * @param oifitsFile name of the OI-FITS result file.
- * @param badPixelFile name of file containing bad pixel map
- * @param flatFieldFile name of file containing flat-field map
- * @param darkFile name of file containing dark (if any)
- * @param inputFile name of the input science file
- * @param nbBinning number of binnings
- * @param errorType indicates wether the noise figures are estimated
- * statistically from the sequence of photometries during the bin
- * (amdlibSTATISTICAL_ERROR) or theoretically by the poisson error on N photons
- * (amdlibTHEORETICAL_ERROR). The latter is forced obviously when the binsize
- * is 1.
- * @param pistonType indicates wether the piston is to be measured by fitting
- * a slope in the phasors amdlibITERATIVE_PHASOR or in the differential phases
- * after dewrapping (amdlibUNWRAPPED_PHASE).
- * @param noCheckP2vmId forces amdlib to use without wuestion the passed p2vm,
- * even if its magic number is not OK. Can happen if the P2VM has been
- * observed AFTER the science observations.
- * @param mergeBandsInOutputFile indicates if many files will be produced (a single
- * one if TRUE or as much as there are bands otherwise).
- * @param selectionType name of the chosen selection criteria
- * (amdlibNO_FRAME_SEL if no selection).
- * @param selectionRatio rato or threshold associated to the selection criteria.
- * @param errMsg error description message returned if function fails
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAppendKeywordListToOIFITS(
- const char *oifitsFile,
- const char *badPixelFile,
- const char *flatFieldFile,
- const char *darkFile,
- const char *inputFile,
- const int nbBinning,
- const amdlibERROR_TYPE errorType,
- const amdlibPISTON_ALGORITHM pistonType,
- const amdlibBOOLEAN noCheckP2vmId,
- const amdlibBOOLEAN mergeBandsInOutputFile,
- const amdlibFRAME_SELECTION selectionType,
- const double selectionRatio,
- const int nbRecords,
- amdlibERROR_MSG errMsg)
-{
- fitsfile *filePtr;
- int status = 0;
- char fitsioMsg[256];
- char fullFileName[1024];
- char keyName[36];
- char keyVal[256], *keyValBis;
- char comment[amdlibKEYW_CMT_LEN+1];
- int index;
- char dprCatg[256];
- char proCatg[256];
-
- if(fits_open_file(&filePtr, oifitsFile, READWRITE, &status))
- {
- amdlibReturnFitsError(oifitsFile);
- }
-
- if (fits_movabs_hdu(filePtr, 1, 0, &status) != 0)
- {
- amdlibGetFitsError("main header");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- if (fits_write_key(filePtr, TSTRING, "HIERARCH ESO PRO DID", "AMBER",
- "Data dictionnary for PRO", &status) != 0)
- {
- amdlibGetFitsError("PRO DID");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- /* Get DPR categrory (SCIENCE or CALIB) */
- if (fits_read_key(filePtr, TSTRING, "HIERARCH ESO DPR CATG", dprCatg,
- comment, &status))
- {
- status = 0;
- strcpy(dprCatg , "SCIENCE");
- }
-
- /* If there is only one records, assume it is averaged OI data */
- if (nbRecords != 1)
- {
- sprintf(proCatg, "%s_%s", dprCatg, "REDUCED");
- }
- else
- {
- sprintf(proCatg, "%s_%s", dprCatg, "AVERAGED");
- }
-
- if (fits_write_key(filePtr, TSTRING, "HIERARCH ESO PRO CATG",
- proCatg, "Category of product frames", &status) != 0)
- {
- amdlibGetFitsError("PRO CATG");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- if (fits_write_key(filePtr, TSTRING, "HIERARCH ESO PRO TYPE", "REDUCED",
- "Product type", &status) != 0)
- {
- amdlibGetFitsError("PRO TYPE");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- if (fits_write_key(filePtr, TSTRING, "HIERARCH ESO PRO REC1 ID",
- "amdlibComputeOiData",
- "Program identifier", &status) != 0)
- {
- amdlibGetFitsError("PRO REC1 ID");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- /* Add information relative to bad pixel file */
- strcpy(fullFileName, badPixelFile);
- keyValBis = basename(fullFileName);
- sprintf(keyVal, "%.40s", keyValBis);
- if (fits_write_key(filePtr, TSTRING, "HIERARCH ESO PRO REC1 RAW1 NAME",
- keyVal, "File name of raw frame", &status) != 0)
- {
- amdlibGetFitsError("PRO REC1 RAW1 NAME");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- if (fits_write_key(filePtr, TSTRING, "HIERARCH ESO PRO REC1 RAW1 CATG",
- "AMBER_BADPIX",
- "Category of raw frame", &status) != 0)
- {
- amdlibGetFitsError("PRO REC1 RAW1 CATG");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- /* Add information relative to flat field file */
- strcpy(fullFileName, flatFieldFile);
- keyValBis = basename(fullFileName);
- sprintf(keyVal, "%.40s", keyValBis);
- if (fits_write_key(filePtr, TSTRING, "HIERARCH ESO PRO REC1 RAW2 NAME",
- keyVal, "File name of raw frame", &status) != 0)
- {
- amdlibGetFitsError("PRO REC1 RAW2 NAME");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- if (fits_write_key(filePtr, TSTRING, "HIERARCH ESO PRO REC1 RAW2 CATG",
- "AMBER_FLATFIELD",
- "Category of raw frame", &status) != 0)
- {
- amdlibGetFitsError("PRO REC1 RAW2 CATG");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- index = 2;
- /* Add information relative to dark file (if any) (PRO keywords) */
- if (strlen(darkFile) != 0)
- {
- index += 1;
- sprintf(keyName, "HIERARCH ESO PRO REC1 RAW%d NAME", index);
- strcpy(fullFileName, darkFile);
- keyValBis = basename(fullFileName);
- sprintf(keyVal, "%.40s", keyValBis);
- if (fits_write_key(filePtr, TSTRING, keyName, keyVal,
- "File name of raw frame", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- sprintf(keyName, "HIERARCH ESO PRO REC1 RAW%d CATG", index);
- if (fits_write_key(filePtr, TSTRING, keyName, "AMBER_DARK",
- "Category of raw frame", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
-
-
- /* Add information relative to input science file (PRO keywords) */
- index += 1;
- sprintf(keyName, "HIERARCH ESO PRO REC1 RAW%d NAME", index);
- strcpy(fullFileName, inputFile);
- keyValBis = basename(fullFileName);
- sprintf(keyVal, "%.40s", keyValBis);
- if (fits_write_key(filePtr, TSTRING, keyName, keyVal,
- "File name of raw frame", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- sprintf(keyName, "HIERARCH ESO PRO REC1 RAW%d CATG", index);
- if (fits_write_key(filePtr, TSTRING, keyName, "AMBER_SCIENCE",
- "Category of raw frame", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- if (fits_write_key(filePtr, TINT, "HIERARCH ESO PRO DATANCOM", &index,
- "Number of combined frames", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- /* Add information relative to parameters */
- index = 1;
- sprintf(keyName, "HIERARCH ESO PRO REC1 PARAM%d NAME", index);
- if (fits_write_key(filePtr, TSTRING, keyName, "-e",
- "Parameter name", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- sprintf(keyName, "HIERARCH ESO PRO REC1 PARAM%d VALUE", index);
- if (errorType == amdlibSTATISTICAL_ERROR)
- {
- strcpy(keyVal, "STATISTIC");
- }
- else if (errorType == amdlibTHEORETICAL_ERROR)
- {
- strcpy(keyVal, "THEORETIC");
- }
- if (fits_write_key(filePtr, TSTRING, keyName, keyVal,
- "Parameter value", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- index ++;
-
- sprintf(keyName, "HIERARCH ESO PRO REC1 PARAM%d NAME", index);
- if (fits_write_key(filePtr, TSTRING, keyName, "-p",
- "Parameter name", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- sprintf(keyName, "HIERARCH ESO PRO REC1 PARAM%d VALUE", index);
- if (pistonType == amdlibITERATIVE_PHASOR)
- {
- strcpy(keyVal, "PHASOR");
- }
- else if (pistonType == amdlibUNWRAPPED_PHASE)
- {
- strcpy(keyVal, "PHASE");
- }
- if (fits_write_key(filePtr, TSTRING, keyName, keyVal,
- "Parameter value", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- index ++;
-
- sprintf(keyName, "HIERARCH ESO PRO REC1 PARAM%d NAME", index);
- if (mergeBandsInOutputFile == amdlibFALSE)
- {
- if (fits_write_key(filePtr, TSTRING, keyName, "-s",
- "Parameter name", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- sprintf(keyName, "HIERARCH ESO PRO REC1 PARAM%d VALUE", index);
- if (fits_write_key(filePtr, TSTRING, keyName, "",
- "Parameter value", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- index ++;
- }
-
- if (noCheckP2vmId == amdlibTRUE)
- {
- sprintf(keyName, "HIERARCH ESO PRO REC1 PARAM%d NAME", index);
- if (fits_write_key(filePtr, TSTRING, keyName, "-f",
- "Parameter name", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- sprintf(keyName, "HIERARCH ESO PRO REC1 PARAM%d VALUE", index);
- if (fits_write_key(filePtr, TSTRING, keyName, "",
- "Parameter value", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- index ++;
- }
-
- if (nbBinning != 999999)
- {
- int binning;
- sprintf(keyName, "HIERARCH ESO PRO REC1 PARAM%d NAME", index);
- if (fits_write_key(filePtr, TSTRING, keyName, "-b",
- "Parameter name", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- sprintf(keyName, "HIERARCH ESO PRO REC1 PARAM%d VALUE", index);
- binning = nbBinning;
- if (fits_write_key(filePtr, TINT, keyName, &binning,
- "Parameter value", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- index ++;
- }
-
- if (selectionType != amdlibNO_FRAME_SEL)
- {
- amdlibDOUBLE ratio;
- sprintf(keyName, "HIERARCH ESO PRO REC1 PARAM%d NAME", index);
- if (fits_write_key(filePtr, TSTRING, keyName, "-c",
- "Parameter name", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- sprintf(keyName, "HIERARCH ESO PRO REC1 PARAM%d VALUE", index);
- if (selectionType == amdlibFLUX_SEL_PCG)
- {
- strcpy(keyVal, "FLUX_PCG");
- }
- else if (selectionType == amdlibFLUX_SEL_THR)
- {
- strcpy(keyVal, "FLUX_THR");
- }
- else if (selectionType == amdlibFRG_CONTRAST_SEL_PCG)
- {
- strcpy(keyVal, "FRG_PCG");
- }
- else if (selectionType == amdlibFRG_CONTRAST_SEL_THR)
- {
- strcpy(keyVal, "FRG_THR");
- }
- else if (selectionType == amdlibOPD_SEL_PCG)
- {
- strcpy(keyVal, "OPD_PCG");
- }
- else if (selectionType == amdlibOPD_SEL_THR)
- {
- strcpy(keyVal, "OPD_THR");
- }
- if (fits_write_key(filePtr, TSTRING, keyName, keyVal,
- "Parameter value", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- index ++;
-
- sprintf(keyName, "HIERARCH ESO PRO REC1 PARAM%d NAME", index);
- if (fits_write_key(filePtr, TSTRING, keyName, "-r",
- "Parameter name", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- sprintf(keyName, "HIERARCH ESO PRO REC1 PARAM%d VALUE", index);
- ratio = selectionRatio;
- if (fits_write_key(filePtr, TDOUBLE, keyName, &ratio,
- "Parameter value", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- index ++;
- }
-
- /* Close FITS file */
- if (fits_close_file(filePtr, &status))
- {
- amdlibReturnFitsError(oifitsFile);
- }
-
- return amdlibSUCCESS;
-}
-#endif
-
-/**
- * Add PRO keywords in insCfg structure for OI-FITS result file after having
- * performed a frame selection.
- *
- * @param oifitsFile name of the OI-FITS result file.
- * @param selFile name of the selection file.
- * @param inOiFits name of OI-FITS file from which a selection is performed.
- * @param selKeywList list of keywords contained in an input selection file was
- * given.
- * @param saveInOiFits true if OI-FITS file is saved.
- * @param selectionType name of the chosen selection criteria
- * (amdlibNO_FRAME_SEL if no selection).
- * @param selectionRatio rato or threshold associated to the selection criteria.
- * @param errMsg error description message returned if function fails
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAppendSelectionKeywords(
- const char *oifitsFile,
- const char *selFile,
- const char *inOiFits,
- amdlibINS_CFG *selKeywList,
- amdlibBOOLEAN saveInOiFits,
- const amdlibFRAME_SELECTION selectionType,
- const double selectionRatio,
- amdlibERROR_MSG errMsg)
-{
- fitsfile *filePtr;
- int status = 0;
- char fitsioMsg[256];
- char keyName[36];
- char fullFileName[1024];
- char name[36], suffix[36];
- char keyVal[80], *keyValBis;
- char keyCmt[amdlibKEYW_CMT_LEN+1];
- int index;
- int ind1, ind2, i;
- int recNb;
- amdlibDOUBLE ratio;
- amdlibKEYW_LINE keywLine;
-
- recNb = 0;
- if (saveInOiFits == amdlibTRUE)
- {
- if (fits_open_file(&filePtr, oifitsFile, READWRITE, &status))
- {
- amdlibReturnFitsError(oifitsFile);
- }
- /* Search for recipe number */
- index = 0;
- while (recNb == 0)
- {
- index ++;
- sprintf(keyName, "HIERARCH ESO PRO REC%d ID", index);
- if (fits_read_key(filePtr, TSTRING, keyName, keyVal, keyCmt,
- &status) != 0)
- {
- recNb = index;
- status = 0;
- }
- }
- }
- else
- {
- if (fits_open_file(&filePtr, selFile, READWRITE, &status))
- {
- amdlibReturnFitsError(oifitsFile);
- }
- recNb = 1;
- }
-
- /* Move to primary header */
- if (fits_movabs_hdu(filePtr, 1, 0, &status) != 0)
- {
- amdlibGetFitsError("main header");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- /* Append keywords stored in selKeywList (if any) */
- if (selKeywList->nbKeywords != 0)
- {
- if (saveInOiFits == amdlibFALSE)
- {
- for (i = 0; i < selKeywList->nbKeywords; i++)
- {
- if (strstr(selKeywList->keywords[i].name, "DATE ") == NULL)
- {
- if ((strstr(selKeywList->keywords[i].name,
- "HIERARCH ESO PRO REC") != NULL) &&
- (strstr(selKeywList->keywords[i].name, "ID") != NULL))
- {
- recNb++;
- }
- sprintf((char*)keywLine, "%s=%s/%s",
- selKeywList->keywords[i].name,
- selKeywList->keywords[i].value,
- selKeywList->keywords[i].comment);
- if (fits_write_record(filePtr, keywLine, &status) != 0)
- {
- fits_close_file(filePtr, &status);
- amdlibSetErrMsg("Could not complete main header");
- return amdlibFAILURE;
- }
- }
- }
- }
- else
- {
- ind2 = 0;
- for (i = 0; i < selKeywList->nbKeywords; i++)
- {
- strcpy(name, selKeywList->keywords[i].name);
- if (strstr(name, "HIERARCH") != NULL)
- {
- if (sscanf(name, "HIERARCH ESO PRO REC%d %[^^]", &ind1,
- suffix) != 0)
- {
- if ((ind2 != 0) && (ind1 != ind2))
- {
- recNb++;
- ind2 = ind1;
- }
- else
- {
- ind2 = ind1;
- }
- sprintf(keyName, "HIERARCH ESO PRO REC%d %s", recNb,
- suffix);
- amdlibStripQuotes(selKeywList->keywords[i].value);
-
- if (fits_write_key(filePtr, TSTRING, keyName,
- selKeywList->keywords[i].value,
- selKeywList->keywords[i].comment,
- &status) != 0)
- {
- fits_close_file(filePtr, &status);
- amdlibSetErrMsg("Could not complete main header");
- return amdlibFAILURE;
- }
- }
- }
- }
- recNb++;
- }
- }
-
-
- /* Add information on the recipe itself */
- sprintf(keyName, "HIERARCH ESO PRO REC%d ID", recNb);
- if (fits_write_key(filePtr, TSTRING, keyName,
- "amdlibPerformFrameSelection",
- "Program identifier", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- /* Add information relative to parameters */
- if (saveInOiFits == amdlibFALSE)
- {
- sprintf(keyName, "HIERARCH ESO PRO REC%d RAW1 NAME", recNb);
- strcpy(fullFileName, inOiFits);
- keyValBis = basename(fullFileName);
- sprintf(keyVal, "%.40s", keyValBis);
- if (fits_write_key(filePtr, TSTRING, keyName, keyVal,
- "File name of raw frame", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- sprintf(keyName, "HIERARCH ESO PRO REC%d RAW1 CATG", recNb);
- if (fits_write_key(filePtr, TSTRING, keyName, "SCIENCE_REDUCED",
- "Category of raw frame", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
- sprintf(keyName, "HIERARCH ESO PRO REC%d PARAM1 NAME", recNb);
- if (fits_write_key(filePtr, TSTRING, keyName, "-c",
- "Parameter name", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- sprintf(keyName, "HIERARCH ESO PRO REC%d PARAM1 VALUE", recNb);
- if (selectionType == amdlibFLUX_SEL_PCG)
- {
- strcpy(keyVal, "FLUX_PCG");
- }
- else if (selectionType == amdlibFLUX_SEL_THR)
- {
- strcpy(keyVal, "FLUX_THR");
- }
- else if (selectionType == amdlibFRG_CONTRAST_SEL_PCG)
- {
- strcpy(keyVal, "FRG_PCG");
- }
- else if (selectionType == amdlibFRG_CONTRAST_SEL_THR)
- {
- strcpy(keyVal, "FRG_THR");
- }
- else if (selectionType == amdlibOPD_SEL_PCG)
- {
- strcpy(keyVal, "OPD_PCG");
- }
- else if (selectionType == amdlibOPD_SEL_THR)
- {
- strcpy(keyVal, "OPD_THR");
- }
- if (fits_write_key(filePtr, TSTRING, keyName, keyVal,
- "Parameter value", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- sprintf(keyName, "HIERARCH ESO PRO REC%d PARAM2 NAME", recNb);
- if (fits_write_key(filePtr, TSTRING, keyName, "-r",
- "Parameter name", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- sprintf(keyName, "HIERARCH ESO PRO REC%d PARAM2 VALUE", recNb);
- ratio = selectionRatio;
- if (fits_write_key(filePtr, TDOUBLE, keyName, &ratio,
- "Parameter value", &status) != 0)
- {
- amdlibGetFitsError(keyName);
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- /* Close FITS file */
- if (fits_close_file(filePtr, &status))
- {
- amdlibReturnFitsError(oifitsFile);
- }
-
- return amdlibSUCCESS;
-}
-
-
-/*___oOo___*/
diff --git a/amber/amdlibVersion.h b/amber/amdlibVersion.h
deleted file mode 100644
index 8ecc1d1..0000000
--- a/amber/amdlibVersion.h
+++ /dev/null
@@ -1 +0,0 @@
-#define amdlibVERSION "3.0.3"
diff --git a/amber/amdlibVisibilities.c b/amber/amdlibVisibilities.c
deleted file mode 100644
index a29e055..0000000
--- a/amber/amdlibVisibilities.c
+++ /dev/null
@@ -1,6929 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Functions to compute the instantaneous correlated fluxes, pistons,
- * photometries and fringe quality estimator, and to derive bin-averaged
- * values of normalised visibilities, debiassed squared visibilities,
- * triple products. Additionally contains routines to estimate noise-averaged
- * values of these multidimensional values.
- */
-
-#define _POSIX_SOURCE 1
-
-/*
- * System Headers
- */
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include "fitsio.h"
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/** the DATE part of an ISO 8601 Date+Time format*/
-#define amdlibDATE_LENGTH 10
-/** The limit for the chi square rejection */
-#define amdlibFILTER_CHISQUARE_LIMIT 0
-/** List of instrument configuration keywords which influence the P2VM */
-static char *amdlibP2vmInsCfgKeywList[] = {
- "HIERARCH ESO INS OPTI2 NAME",
- "HIERARCH ESO INS GRIS1 NAME",
- "HIERARCH ESO INS GRIS2 NAME",
- "HIERARCH ESO INS GRAT1 NAME",
- "HIERARCH ESO INS GRAT1 ORDER",
- "HIERARCH ESO INS GRAT1 WLEN",
- NULL};
-
-/* Local functions */
-amdlibCOMPL_STAT amdlibComputeUVCoords(amdlibSCIENCE_DATA *data,
- int nbBases,
- amdlibDOUBLE **uCoord,
- amdlibDOUBLE **vCoord);
-
-amdlibCOMPL_STAT amdlibTagPiston(amdlibPISTON *instantOpd,
- double threshold,
- double errThreshold,
- amdlibBAND band);
-amdlibCOMPL_STAT amdlibClosePiston(amdlibPISTON *instantOpd,
- double threshold,
- amdlibBAND band);
-
-double amdlibAbacusErrPhi(double x);
-
-void amdlibFilterByChiSquare(amdlibVIS *instantCorrFlux, double **chisq, double range);
-
-static amdlibCOMPL_STAT amdlibComputeChiSquare(/* Input */
- amdlibVIS *instantCorrFlux,
- double *p2v,
- unsigned char *badp2v,
- double *mk,
- double *sigma2_mk,
- int iFrame,
- int nbLVis,
- int nbPix,
- int nbBases,
- /* Output */
- double **chisq,
- amdlibERROR_MSG errMsg);
-
-static amdlibCOMPL_STAT amdlibCrossP2vmAndData(/* Input */
- amdlibP2VM_MATRIX *p2vm,
- amdlibSCIENCE_DATA *data,
- amdlibWAVEDATA *waveData,
- double *fudge,
- int iFrame,
- int *channelNo,
- int nbChannels,
- /* Output */
- amdlibWAVELENGTH *wave,
- double *p2vCkDk,
- unsigned char *badPixelFlags,
- double *mk,
- double *sigma2_mk,
- double *cova_mk,
- double *ikMean,
- double *sigma2_ikMean,
- amdlibERROR_MSG errMsg);
-
-static amdlibCOMPL_STAT amdlibGetInstantPhotometry(/* Input */
- amdlibP2VM_MATRIX *p2vm,
- amdlibSCIENCE_DATA *data,
- double *fudge,
- int *channelNo,
- int nbChannels,
- /* Output */
- amdlibPHOTOMETRY *photometry,
- amdlibERROR_MSG errMsg);
-
-static amdlibCOMPL_STAT amdlibCrossGeneralizedP2vmAndData(/* Input */
- amdlibP2VM_MATRIX *p2vm,
- amdlibSCIENCE_DATA *data,
- int *channelNo,
- int nbChannels,
- /* Output */
- double *gp2vCkDk,
- unsigned char *badPixelFlags,
- double *ikMean,
- double *sigma2_ikMean,
- amdlibERROR_MSG errMsg);
-
-static amdlibCOMPL_STAT amdlibInvertGeneralizedP2v(/* Input */
- double *gp2v,
- unsigned char *badp2v,
- double *sigma2_ikMean,
- int nbLVis,
- int nbPix,
- int nbBases,
- /* Output */
- double *gv2p,
- amdlibERROR_MSG errMsg);
-static amdlibCOMPL_STAT amdlibInvertP2v(/* Input */
- double *p2v,
- unsigned char *badp2v,
- double *cova_mk,
- int nbLVis,
- int nbPix,
- int nbBases,
- /* Output */
- double *v2p,
- amdlibERROR_MSG errMsg);
-
-static amdlibCOMPL_STAT amdlibComputeCorrFlux(/* Input */
- double *v2p,
- double *mk,
- double *sigma2_mk,
- int nbFrames,
- int nbLVis,
- int nbPix,
- int nbBases,
- /* Output */
- amdlibVIS *instantCorrFlux,
- amdlibERROR_MSG errMsg);
-static amdlibCOMPL_STAT amdlibComputeFudgeFactor(/* Input */
- double *gv2p,
- double *ikMean,
- int nbLVis,
- int nbPix,
- int nbBases,
- /* Output */
- double *fudge,
- amdlibERROR_MSG errMsg);
-static amdlibCOMPL_STAT amdlibMeanCpxVis(
- amdlibVIS *instantCorrFlux,
- amdlibPHOTOMETRY *photometry,
- int firstFrame,
- int nbFrames,
- int iBin,
- amdlibVIS *meanVis);
-
-static amdlibCOMPL_STAT amdlibSumPhotometry(
- amdlibPHOTOMETRY *instantPhotometry,
- int firstFrame,
- int nbFrames,
- int iBin,
- amdlibPHOTOMETRY *sumPhotometry);
-
-static void amdlibComputeFringeCriterion(/* Input */
- amdlibVIS *instantCorrFlux,
- int iBin,
- amdlibBAND band,
- amdlibSELECTION *selection,
- /* Output */
- amdlibVIS *vis);
-static void amdlibBinFringeCriterion(/* Input */
- amdlibVIS *instantCorrFlux,
- int firstFrame,
- int nbFrames,
- int iBin,
- amdlibBAND band,
- /* Output */
- amdlibVIS *vis);
-
-static void amdlibAverageVis2(amdlibVIS2 *vis2);
-
-static amdlibCOMPL_STAT amdlibComputeSqVis(/* Input */
- amdlibVIS *instantCorrFlux,
- amdlibPHOTOMETRY *photometry,
- int iBin,
- amdlibBAND band,
- amdlibSELECTION *selection,
- amdlibERROR_TYPE errorType,
- /* Output */
- amdlibVIS2 *vis2,
- amdlibERROR_MSG errMsg);
-
-static amdlibCOMPL_STAT amdlibBinSqVis(/* Input */
- amdlibVIS *instantCorrFlux,
- amdlibPHOTOMETRY *photometry,
- int firstFrame,
- int nbFrames,
- int iBin,
- amdlibBAND band,
- amdlibERROR_TYPE errorType,
- /* Output */
- amdlibVIS2 *vis2,
- amdlibERROR_MSG errMsg);
-
-static amdlibCOMPL_STAT amdlibComputeDiffVis(/* Input */
- amdlibVIS *instantCorrFlux,
- amdlibWAVELENGTH *wave,
- amdlibPISTON *instantOpd,
- int iBin,
- amdlibBAND band,
- amdlibSELECTION *selection,
- /* Output */
- amdlibVIS *vis,
- amdlibERROR_MSG errMsg);
-static amdlibCOMPL_STAT amdlibBinDiffVis(/* Input */
- amdlibVIS *instantCorrFlux,
- amdlibWAVELENGTH *wave,
- amdlibPISTON *instantOpd,
- int firstFrame,
- int nbFrames,
- int iBin,
- amdlibBAND band,
- /* Output */
- amdlibVIS *vis,
- amdlibERROR_MSG errMsg);
-
-static amdlibCOMPL_STAT amdlibAverageVis(/* Input */
- amdlibVIS *instantCorrFlux,
- int iBin,
- amdlibBAND band,
- amdlibSELECTION *selection,
- /* Output */
- amdlibVIS *vis,
- amdlibERROR_MSG errMsg);
-
-static amdlibCOMPL_STAT amdlibGetThreshold(double *array,
- int arraySize,
- double percentage,
- double *threshold,
- amdlibERROR_MSG errMsg);
-
-static amdlibCOMPL_STAT
-amdlibCorrectFromPistonExtenuation(amdlibVIS *instantCorrFlux,
- amdlibPISTON *instantOpd,
- amdlibWAVELENGTH *wave,
- amdlibBAND band,
- double R,
- amdlibERROR_MSG errMsg);
-/*
- * Public functions
- */
-/**
- * @warning obsolete method. Please use amdlibComputeVisibilities.
- *
- * @param data structure containing the science observation (where the fringes
- * are)
- * @param p2vm structure where P2VM is stored
- * @param waveData the wavelength definition structure
- * @param band the spectral band to select in the observations
- * @param binning the number of consecutives frames in the science observation
- * that will be used to measure a single point of visibilties in output.
- * the total time span of the frames in a bin should be of the order of
- * the coherence time of the atmosphere, unless the observation has
- * benefitted of a fringe tracker device. At Paranal coherence time are
- * rarely more than a few Millisecond.
- * @param errorType indicates wether the noise figures are estimated
- * statistically from the sequence of photometries during the bin
- * (amdlibSTATISTICAL_ERROR) or theoretically by the poisson error on N photons
- * (amdlibTHEORETICAL_ERROR). The latter is forced obviously when the binsize
- * is 1.
- * @param pistonType indicates whether the piston is to be measured by fitting
- * a slope in the phasors amdlibITERATIVE_PHASOR or in the differential phases
- * after dewrapping (amdlibUNWRAPPED_PHASE). The latter is deprecated and
- * is not maintained anymore.
- * @param noCheckP2vmId forces amdlib to use without question the passed p2vm,
- * even if its magic number is not OK. Can happen if the P2VM has been
- * observed AFTER the science observations.
- * @param photometry output structure containing the (binned) photometry
- * results.
- * @param vis structure containing the (binned) raw visibilities.
- * @param vis2 structure containing the (binned) squared visibilities.
- * @param vis3 structure containing the (binned) triple products.
- * @param wave structure containing the wavelengths corresponding to the other
- * output structures.
- * @param opd structure containing the (binned) piston measurements.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * the number of valid wavelengths for input band on successful completion.
- * Otherwise -1 is returned.
- */
-int amdlibExtractVisibilities(/* Input */
- amdlibSCIENCE_DATA *data,
- amdlibP2VM_MATRIX *p2vm,
- amdlibWAVEDATA *waveData,
- amdlibBAND band,
- int binning,
- amdlibERROR_TYPE errorType,
- amdlibPISTON_ALGORITHM pistonType,
- amdlibBOOLEAN noCheckP2vmId,
- /* Output */
- amdlibPHOTOMETRY *photometry,
- amdlibVIS *vis,
- amdlibVIS2 *vis2,
- amdlibVIS3 *vis3,
- amdlibWAVELENGTH *wave,
- amdlibPISTON *opd,
- amdlibERROR_MSG errMsg)
-{
- amdlibCPT_VIS_OPTIONS visOpt = {binning, errorType, pistonType,
- noCheckP2vmId, amdlibNO_FRAME_SEL, 1};
-
- amdlibLogTrace("amdlibExtractVisibilities()");
-
- amdlibLogWarning("amdlibExtractVisibilities is obsolete. Please use "
- "amdlibComputeVisibilities");
-
- return (amdlibComputeVisibilities(data, p2vm, waveData, band, &visOpt,
- photometry, vis, vis2, vis3, wave,
- opd, errMsg));
-}
-
-
-/**
- * main entry point, gathers all strutures in input and output,
- * merely calls amdlibComputeVisibilitiesFor()
- *
- * @param data structure containing the science observation (where the fringes
- * are)
- * @param p2vm structure where P2VM is stored
- * @param waveData the wavelength definition structure
- * @param band the spectral band to select in the observations
- * @param visOptions information necessary for visibilities computation
- * (binning, noise and piston computation, requirement about p2vm use and frame
- * selection).
- * @param photometry output structure containing the (binned) photometry
- * results.
- * @param vis structure containing the (binned) raw visibilities.
- * @param vis2 structure containing the (binned) squared visibilities.
- * @param vis3 structure containing the (binned) triple products.
- * @param wave structure containing the wavelengths corresponding to the other
- * output structures.
- * @param opd structure containing the (binned) piston measurements.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * the number of valid wavelengths for input band on successful completion.
- * Otherwise -1 is returned.
- */
-int amdlibComputeVisibilities(/* Input */
- amdlibSCIENCE_DATA *data,
- amdlibP2VM_MATRIX *p2vm,
- amdlibWAVEDATA *waveData,
- amdlibBAND band,
- amdlibCPT_VIS_OPTIONS *visOptions,
- /* Output */
- amdlibPHOTOMETRY *photometry,
- amdlibVIS *vis,
- amdlibVIS2 *vis2,
- amdlibVIS3 *vis3,
- amdlibWAVELENGTH *wave,
- amdlibPISTON *opd,
- amdlibERROR_MSG errMsg)
-{
- int nbChannelsInBand = 0;
- int channelNoForBand[amdlibNB_SPECTRAL_CHANNELS];
- amdlibSELECTION selectedFrames;
- int i, base;
- amdlibBOOLEAN noVis3 = amdlibFALSE;
-
- amdlibLogTrace("amdlibComputeVisibilities()");
-
- if ((visOptions->binSize != 1) &&
- (visOptions->frameSelectionType != amdlibNO_FRAME_SEL))
- {
- amdlibLogError("Binning AND frame selection are not compatible");
- return 0;
- }
-
- /* Search for the number of valid (considering p2vm flags) spectral channels
- * for specified band */
- if (amdlibGetChannelsInBand(p2vm, data, waveData, band,
- &nbChannelsInBand,
- channelNoForBand) != amdlibSUCCESS)
- {
- return -1;
- }
-
- if (nbChannelsInBand == 0)
- {
- return 0;
- }
-
- /* Compute visibilities for these valid spectral channels. */
- if (amdlibComputeVisibilitiesFor(data, p2vm, waveData,
- channelNoForBand, nbChannelsInBand,
- visOptions->binSize,
- visOptions->errorType,
- visOptions->pistonType,
- visOptions->noCheckP2vmId,
- photometry, vis, vis2, vis3,
- wave, opd, errMsg) != amdlibSUCCESS)
- {
- return -1;
- }
-
- /* If required, perform frame selection */
- if (visOptions->frameSelectionType != amdlibNO_FRAME_SEL)
- {
- amdlibLogInfo("Performing Selection...");
- if (amdlibAllocateSelection(&selectedFrames, vis->nbFrames,
- vis->nbBases, errMsg) != amdlibSUCCESS)
- {
- return -1;
- }
-
- /* Select 'good' frames depending on selection criterion */
- if (amdlibSelectFrames(vis, photometry, opd,
- visOptions->frameSelectionType,
- visOptions->frameSelectionRatio,
- &selectedFrames,
- band, errMsg) != amdlibSUCCESS)
- {
- return -1;
- }
-
- /* Average visibilities, photometries and pistons on good frames */
- if (amdlibAverageVisibilities(photometry,
- vis, vis2, vis3,
- opd, band, wave,
- &selectedFrames, errMsg) != amdlibSUCCESS)
- {
- return -1;
- }
-
- for (base = 0; base < vis->nbBases; base++)
- {
- if (selectedFrames.band[band].nbSelectedFrames[base] == 0)
- {
- /* No frames are selected for that base, so flag them */
- for (i=0; i < vis->nbFrames; i++)
- {
- memset(vis->table[i*vis->nbBases+base].flag,
- amdlibTRUE,
- vis->nbWlen * sizeof(amdlibBOOLEAN));
- memset(vis2->table[i*vis2->nbBases+base].flag,
- amdlibTRUE,
- vis2->nbWlen * sizeof(amdlibBOOLEAN));
- }
- noVis3 = amdlibTRUE;
- }
- }
- if ((vis3 != NULL) && (noVis3 == amdlibTRUE))
- {
- for (i=0; i < vis3->nbClosures * vis3->nbFrames; i++)
- {
- memset(vis3->table[i].flag, amdlibTRUE,
- vis3->nbWlen * sizeof(amdlibBOOLEAN));
- }
- }
-
- amdlibReleaseSelection(&selectedFrames);
- }
-
- return nbChannelsInBand;
-}
-
-/**
- * Select frames according to frame selection criterion chosen.
- *
- * @param vis input visibility structure.
- * @param phot input photometry structure.
- * @param opd input piston structure.
- * @param frameSelectionType frame criterion to apply.
- * @param frameSelectionRatio percentage of good frames to keep or, directly,
- * threshold corresponding to the chosen criterion.
- * @param selectedFrames output structure containing a description of selected
- * frames.
- * @param band the current spectral band treated.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibSelectFrames(amdlibVIS *vis,
- amdlibPHOTOMETRY *phot,
- amdlibPISTON *opd,
- amdlibFRAME_SELECTION frameSelectionType,
- double frameSelectionRatio,
- amdlibSELECTION *selectedFrames,
- amdlibBAND band,
- amdlibERROR_MSG errMsg)
-{
- int iFrame, iBase, iWlen, index, index2;
- amdlibVIS_TABLE_ENTRY **visTablePtr = NULL;
- amdlibPHOTOMETRY_TABLE_ENTRY **photTablePtr = NULL;
- amdlibDOUBLE **opdTablePtr = NULL;
-
- double *tmpArray[amdlibNBASELINE];
- double threshold[amdlibNBASELINE];
- amdlibBOOLEAN select[amdlibNBASELINE] = {amdlibTRUE, amdlibTRUE, amdlibTRUE};
-
- amdlibLogTrace("amdlibSelectFrames()");
-
- if ((frameSelectionType == amdlibFRG_CONTRAST_SEL_PCG) ||
- (frameSelectionType == amdlibFRG_CONTRAST_SEL_THR))
- {
- /* Wrap vis table */
- visTablePtr =
- (amdlibVIS_TABLE_ENTRY **)amdlibWrap2DArray(vis->table,
- vis->nbBases, vis->nbFrames,
- sizeof(amdlibVIS_TABLE_ENTRY),
- errMsg);
- if (visTablePtr == NULL)
- {
- return amdlibFAILURE;
- }
- /* Allocate memory for temporary arrays */
- for (iBase = 0; iBase < vis->nbBases; iBase++)
- {
- tmpArray[iBase] = calloc(selectedFrames->band[band].nbSelectedFrames[iBase],
- sizeof(double));
- if (tmpArray[iBase] == NULL)
- {
- amdlibSetErrMsg("Could not allocate memory for temporary buffer");
- return amdlibFAILURE;
- }
- }
-
- /* Loop on frames, copy fringe contrast snr in a temporary array for
- * each baseline ... */
- for (iBase = 0; iBase < vis->nbBases; iBase++)
- {
- index = 0;
- for (iFrame = 0; iFrame < vis->nbFrames; iFrame++)
- {
- if (selectedFrames->band[band].isSelectedPt[iBase][iFrame] == amdlibTRUE)
- {
- tmpArray[iBase][index] =
- visTablePtr[iFrame][iBase].frgContrastSnrArray[band];
- index++;
- }
- }
- }
-
- /* Set threshold */
- if (frameSelectionType == amdlibFRG_CONTRAST_SEL_THR)
- {
- for (iBase = 0; iBase < vis->nbBases; iBase++)
- {
- threshold[iBase] = frameSelectionRatio;
- }
- }
- else
- {
- /* Get threshold associated to the frameSelectionRatio
- * by sorting the temporary array */
- for (iBase = 0; iBase < vis->nbBases; iBase++)
- {
- if (amdlibGetThreshold(tmpArray[iBase],
- selectedFrames->band[band].nbSelectedFrames[iBase],
- frameSelectionRatio,
- &threshold[iBase],
- errMsg) != amdlibSUCCESS)
- {
- amdlibLogWarning("Could not get threshold associated to "
- "the frameSelectionRatio");
- amdlibLogWarningDetail(errMsg);
- amdlibLogWarning("Could not perform frame selection on "
- "baseline %d in band %c",
- iBase+1, amdlibBandNumToStr(band));
- select[iBase] = amdlibFALSE;
- }
- }
- }
- /* Loop on frames and stamp the bad ones (criterion lower than
- * threshold) */
- for (iBase = 0; iBase < vis->nbBases; iBase++)
- {
- if (select[iBase] == amdlibTRUE)
- {
- index = 0;
- for (iFrame = 0; iFrame < vis->nbFrames; iFrame++)
- {
- if (selectedFrames->band[band].isSelectedPt[iBase][iFrame] == amdlibTRUE)
- {
- if (tmpArray[iBase][index] < threshold[iBase])
- {
- selectedFrames->band[band].isSelectedPt[iBase][iFrame] = amdlibFALSE;
- selectedFrames->band[band].nbSelectedFrames[iBase]--;
- }
- index++;
- }
- }
- }
- /* In the case no selection was possible, set all frames to false */
- else
- {
- for (iFrame = 0; iFrame < vis->nbFrames; iFrame++)
- {
- selectedFrames->band[band].isSelectedPt[iBase][iFrame] = amdlibFALSE;
- }
- selectedFrames->band[band].nbSelectedFrames[iBase] = 0;
- }
- }
- for (iBase = 0; iBase < vis->nbBases; iBase++)
- {
- free(tmpArray[iBase]);
- }
- amdlibFree2DArrayWrapping((void **)visTablePtr);
- }
- else if ((frameSelectionType == amdlibFLUX_SEL_PCG) ||
- (frameSelectionType == amdlibFLUX_SEL_THR))
- {
- /* Wrap phot table */
- photTablePtr =
- (amdlibPHOTOMETRY_TABLE_ENTRY **)amdlibWrap2DArray(phot->table,
- phot->nbBases, phot->nbFrames,
- sizeof(amdlibPHOTOMETRY_TABLE_ENTRY),
- errMsg);
- if (photTablePtr == NULL)
- {
- return amdlibFAILURE;
- }
- /* Allocate memory for temporary arrays */
- for (iBase = 0; iBase < phot->nbBases; iBase++)
- {
- tmpArray[iBase] = calloc(selectedFrames->band[band].nbSelectedFrames[iBase],
- sizeof(double));
- if (tmpArray[iBase] == NULL)
- {
- amdlibSetErrMsg("Could not allocate memory for temporary buffer");
- return amdlibFAILURE;
- }
- }
-
- /* Loop on frames, insert flux criterion in the temporary array
- * for each baseline. Flux criterion is here
- * sqrt(Pi*Pj)/signedsqrt(fluxPi+fluxPj+npix*RON^2)
- * (summed over spectrum = all lambdas)
- */
-
- for (iBase = 0; iBase < phot->nbBases; iBase++)
- {
- index = 0;
- for (iFrame = 0; iFrame < phot->nbFrames; iFrame++)
- {
- if (selectedFrames->band[band].isSelectedPt[iBase][iFrame] == amdlibTRUE)
- {
- index2=0;
- for (iWlen = 0; iWlen < phot->nbWlen; iWlen++)
- {
- if (!amdlibCompareDouble(
- photTablePtr[iFrame][iBase].sigma2FluxSumPiPj[iWlen],
- amdlibBLANKING_VALUE))
- {
- tmpArray[iBase][index] +=
- amdlibSignedSqrt(photTablePtr[iFrame][iBase].PiMultPj[iWlen])
- / amdlibSignedSqrt(photTablePtr[iFrame][iBase].sigma2FluxSumPiPj[iWlen]);
- index2++;
- }
- }
- if (index2>0)
- {
- tmpArray[iBase][index] /= sqrt(index2);
- }
- else
- {
- tmpArray[iBase][index] = amdlibBLANKING_VALUE; /*negative: dont count*/
- }
- index++;
- }
- }
- }
-
-
- if (frameSelectionType == amdlibFLUX_SEL_THR)
- {
- for (iBase = 0; iBase < phot->nbBases; iBase++)
- {
- threshold[iBase] = frameSelectionRatio;
- }
- }
- else
- {
- /* Sort these temporary arrays and get associated thresholds */
- for (iBase = 0; iBase < phot->nbBases; iBase++)
- {
- if (amdlibGetThreshold(tmpArray[iBase],
- selectedFrames->band[band].nbSelectedFrames[iBase],
- frameSelectionRatio,
- &threshold[iBase],
- errMsg) != amdlibSUCCESS)
- {
- amdlibLogWarning("Could not get threshold associated to "
- "the frameSelectionRatio");
- amdlibLogWarningDetail(errMsg);
- amdlibLogWarning("Could not perform frame selection on "
- "baseline %d in band %c",
- iBase+1, amdlibBandNumToStr(band));
- select[iBase] = amdlibFALSE;
- }
- }
- }
- /* Loop on frames and stamp the bad ones ( criterion lower than
- * threshold) */
- for (iBase = 0; iBase < phot->nbBases; iBase++)
- {
- if (select[iBase] == amdlibTRUE)
- {
- index = 0;
- for (iFrame = 0; iFrame < phot->nbFrames; iFrame++)
- {
- if (selectedFrames->band[band].isSelectedPt[iBase][iFrame] == amdlibTRUE)
- {
- if (tmpArray[iBase][index] < threshold[iBase])
- {
- selectedFrames->band[band].isSelectedPt[iBase][iFrame] = amdlibFALSE;
- selectedFrames->band[band].nbSelectedFrames[iBase]--;
- }
- index++;
- }
- }
- }
- /* In the case no selection was possible, set all frames to false */
- else
- {
- for (iFrame = 0; iFrame < phot->nbFrames; iFrame++)
- {
- selectedFrames->band[band].isSelectedPt[iBase][iFrame] = amdlibFALSE;
- }
- selectedFrames->band[band].nbSelectedFrames[iBase] = 0;
- }
- }
- for (iBase = 0; iBase < phot->nbBases; iBase++)
- {
- free(tmpArray[iBase]);
- }
- amdlibFree2DArrayWrapping((void **)photTablePtr);
- }
- /* PISTONS: HERE WE SELECT PISTONS SMALLER THAN THR, NOT GREATER!
- ** Actually the selection on pistons should not be done this way.
- ** However, to keep on the same algorithm, we make the largest pistons
- ** the smallest "criterium value" using -1*fabs(piston)
- ** and we select the same as for the other criteria, i.e., greater than the criterium.
- ** It is thus necessary to apply -1*fabs(piston) to the absolute threshold also.*/
- else if ((frameSelectionType == amdlibOPD_SEL_PCG) ||
- (frameSelectionType == amdlibOPD_SEL_THR))
- {
- /* Wrap opd table */
- opdTablePtr = amdlibWrap2DArrayDouble(opd->pistonOPDArray[band],
- opd->nbBases,
- opd->nbFrames, errMsg);
- if (opdTablePtr == NULL)
- {
- return amdlibFAILURE;
- }
- /* Filter Blanks eventually */
-
- for (iBase = 0; iBase < opd->nbBases; iBase++)
- {
- for (iFrame = 0; iFrame < opd->nbFrames; iFrame++)
- {
- if (amdlibCompareDouble(opdTablePtr[iFrame][iBase],amdlibBLANKING_VALUE))
- {
- selectedFrames->band[band].isSelectedPt[iBase][iFrame] = amdlibFALSE;
- selectedFrames->band[band].nbSelectedFrames[iBase]--;
- }
- }
- }
-
- /* Allocate memory for temporary arrays */
- for (iBase = 0; iBase < opd->nbBases; iBase++)
- {
- tmpArray[iBase] =
- calloc(selectedFrames->band[band].nbSelectedFrames[iBase],
- sizeof(double));
- if (tmpArray[iBase] == NULL)
- {
- amdlibSetErrMsg("Could not allocate memory for temporary buffer");
- return amdlibFAILURE;
- }
- }
-
- /* Loop on frames, copy ABSOLUTE VALUE of piston in a temporary array for each baseline */
- for (iBase = 0; iBase < opd->nbBases; iBase++)
- {
- index = 0;
- for (iFrame = 0; iFrame < opd->nbFrames; iFrame++)
- {
- if (selectedFrames->band[band].isSelectedPt[iBase][iFrame] == amdlibTRUE )
- {
- tmpArray[iBase][index] = -1*fabs(opdTablePtr[iFrame][iBase]);
- index++;
- }
- }
- }
-
- /* Threshold case */
- if (frameSelectionType == amdlibOPD_SEL_THR)
- {
- for (iBase = 0; iBase < opd->nbBases; iBase++)
- {
- threshold[iBase] = -1*fabs(frameSelectionRatio);
- }
- }
- else
- {
- /* Sort these temporary arrays and get associated thresholds */
- for (iBase = 0; iBase < opd->nbBases; iBase++)
- {
- if (amdlibGetThreshold(tmpArray[iBase],
- selectedFrames->band[band].nbSelectedFrames[iBase],
- frameSelectionRatio,
- &threshold[iBase],
- errMsg) != amdlibSUCCESS)
- {
- amdlibLogWarning("Could not get threshold associated to "
- "the frameSelectionRatio");
- amdlibLogWarningDetail(errMsg);
- amdlibLogWarning("Could not perform frame selection "
- "on baseline %d in band %c",
- iBase+1, amdlibBandNumToStr(band));
- select[iBase] = amdlibFALSE;
- }
- }
- }
-
- /* Loop on frames and stamp the bad ones (criterion lower than
- * threshold) */
- for (iBase = 0; iBase < opd->nbBases; iBase++)
- {
- if (select[iBase] == amdlibTRUE)
- {
- index = 0;
- for (iFrame = 0; iFrame < opd->nbFrames; iFrame++)
- {
- if (selectedFrames->band[band].isSelectedPt[iBase][iFrame] == amdlibTRUE)
- {
- if (tmpArray[iBase][index] < threshold[iBase])
- {
- selectedFrames->band[band].isSelectedPt[iBase][iFrame] = amdlibFALSE;
- selectedFrames->band[band].nbSelectedFrames[iBase]--;
- }
- index++;
- }
- }
- }
- /* In the case no selection was possible, set all frames to false */
- else
- {
- for (iFrame = 0; iFrame < opd->nbFrames; iFrame++)
- {
- selectedFrames->band[band].isSelectedPt[iBase][iFrame] = amdlibFALSE;
- }
- selectedFrames->band[band].nbSelectedFrames[iBase] = 0;
- }
- }
- for (iBase = 0; iBase < opd->nbBases; iBase++)
- {
- free(tmpArray[iBase]);
- }
- amdlibFree2DArrayWrapping((void **)photTablePtr);
- }
- else if (frameSelectionType == amdlibNO_FRAME_SEL)
- {
- return amdlibSUCCESS;
- }
- else
- {
- amdlibSetErrMsg("Invalid frame selection type '%d'",
- frameSelectionType);
- return amdlibFAILURE;
- }
-
- /* Update frame selection */
- amdlibUpdateSelection(selectedFrames);
-
- return amdlibSUCCESS;
-}
-
-/**
- * Computes the selection threshold, ie the minimal possible value for frame
- * selection criterion so as to a frame should be selected.
- *
- * @param array input data
- * @param arraySize size of array.
- * @param frameSelectionRatio percentage of good frames to keep.
- * @param threshold output threshold.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibGetThreshold(double *array,
- int arraySize,
- double frameSelectionRatio,
- double *threshold,
- amdlibERROR_MSG errMsg)
-{
- int i, j;
- double val;
- int index;
- amdlibBOOLEAN isSorted;
- double * phantomArray;
-
- amdlibLogTrace("amdlibGetThreshold()");
- /*here we are in PCG, so frameSelectionRatio must be >0.0 and <1.0*/
- frameSelectionRatio=amdlibMin(frameSelectionRatio,1.0);
- frameSelectionRatio=amdlibMax(frameSelectionRatio,0.0);
-
- phantomArray = calloc(arraySize, sizeof(double));
- memcpy(phantomArray, array, arraySize*sizeof(double));
- /* Protected Bubble sort, leaves array invariant! */
- isSorted = amdlibFALSE;
- i = 0;
- while ((i < arraySize) && (isSorted == amdlibFALSE))
- {
- /* Assume array is already sorted */
- isSorted = amdlibTRUE;
- for (j = 1; j < arraySize - i; j++)
- {
- if (phantomArray[j] < phantomArray[j-1])
- {
- /* Invert both values */
- val = phantomArray[j-1];
- phantomArray[j-1] = phantomArray[j];
- phantomArray[j] = val;
-
- /* phantomArray is not sorted yet */
- isSorted = amdlibFALSE;
- }
- }
- i++;
- }
-
- /* Find threshold */
- index = floor((1.0-frameSelectionRatio)*arraySize);
- *threshold = phantomArray[index];
- free(phantomArray);
-
-
- if (isnan(*threshold))
- {
- amdlibSetErrMsg("Impossible to determine threshold; probably "
- "due to poor data quality");
- return amdlibFAILURE;
- }
-
- return amdlibSUCCESS;
-}
-
-
-/** Useful macro to free amdlibAverageVisibilities structures */
-#define amdlibAverageVisibilities_FREEALL() \
- amdlibFree2DArrayWrapping((void **)photTabPtr); \
- amdlibFree2DArrayWrapping((void **)visTabPtr); \
- amdlibFree2DArrayWrapping((void **)vis2TabPtr); \
- amdlibFree2DArrayWrapping((void **)vis3TabPtr); \
- amdlibFree3DArrayDouble(tmpphot); \
- amdlibFree3DArrayDouble(s2phot);
-/**
- * Average data for selected frames in each output data structure for
- * visibilities computation.
- *
- * @param phot input/output photometry structure.
- * @param vis input/output OI_VIS structure.
- * @param vis2 input/output OI_VIS2 structure.
- * @param vis3 input/output OI_VIS3 structure.
- * @param opd input/output piston structure.
- * @param band the current spectral band treated.
- * @param wave structure containing the wavelengths.
- * @param selectedFrames structure containing information about selected frames.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAverageVisibilities(amdlibPHOTOMETRY *phot,
- amdlibVIS *vis,
- amdlibVIS2 *vis2,
- amdlibVIS3 *vis3,
- amdlibPISTON *opd,
- amdlibBAND band,
- amdlibWAVELENGTH *wave,
- amdlibSELECTION *selectedFrames,
- amdlibERROR_MSG errMsg)
-{
- amdlibPHOTOMETRY_TABLE_ENTRY **photTabPtr = NULL;
- amdlibVIS_TABLE_ENTRY **visTabPtr = NULL;
- amdlibVIS2_TABLE_ENTRY **vis2TabPtr = NULL;
- amdlibVIS3_TABLE_ENTRY **vis3TabPtr = NULL;
- int nbFrames = vis->nbFrames;
- int nbBases = vis->nbBases;
- int nbWlen = vis->nbWlen;
- int i, j, k;
- int totalNbSel;
-
- /* Intermediate structures */
- amdlibPHOTOMETRY imdPhot = {NULL};
- amdlibVIS imdVis = {NULL};
- amdlibVIS2 imdVis2 = {NULL};
- amdlibVIS3 imdVis3 = {NULL};
- amdlibPISTON imdOpd = {NULL};
-
- double ***tmpphot = NULL, ***s2phot = NULL;
- double P1P2, P1MoreP2, P1DiviP2, P1, P2, sigma2P1MoreP2, sigma2P1DiviP2,
- sigma2_P1, sigma2_P2;
-
- amdlibLogTrace("amdlibAverageVisibilities()");
-
- /* Allocate intermediate structures which will contain mean values*/
- if (amdlibAllocatePhotometry(&imdPhot, 1, phot->nbBases,
- phot->nbWlen) != amdlibSUCCESS)
- {
- amdlibAverageVisibilities_FREEALL();
- amdlibSetErrMsg("Could not allocate memory for intermediate structures");
- return amdlibFAILURE;
- }
- if (amdlibAllocateVis(&imdVis, 1, vis->nbBases,
- vis->nbWlen) != amdlibSUCCESS)
- {
- amdlibAverageVisibilities_FREEALL();
- amdlibReleasePhotometry(&imdPhot);
- amdlibSetErrMsg("Could not allocate memory for intermediate structures");
- return amdlibFAILURE;
- }
- if (amdlibAllocateVis2(&imdVis2, 1, vis2->nbBases,
- vis2->nbWlen) != amdlibSUCCESS)
- {
- amdlibAverageVisibilities_FREEALL();
- amdlibReleasePhotometry(&imdPhot);
- amdlibReleaseVis(&imdVis);
- amdlibSetErrMsg("Could not allocate memory for intermediate structures");
- return amdlibFAILURE;
- }
-
- if (nbBases > 1)
- {
- if (amdlibAllocateVis3(&imdVis3, 1, vis3->nbClosures,
- vis3->nbWlen) != amdlibSUCCESS)
- {
- amdlibAverageVisibilities_FREEALL();
- amdlibReleasePhotometry(&imdPhot);
- amdlibReleaseVis(&imdVis);
- amdlibReleaseVis2(&imdVis2);
- amdlibSetErrMsg("Could not allocate memory for intermediate structures");
- return amdlibFAILURE;
- }
- }
- if (amdlibAllocatePiston(&imdOpd, 1, opd->nbBases) != amdlibSUCCESS)
- {
- amdlibAverageVisibilities_FREEALL();
- amdlibReleasePhotometry(&imdPhot);
- amdlibReleaseVis(&imdVis);
- amdlibReleaseVis2(&imdVis2);
- amdlibReleaseVis3(&imdVis3);
- amdlibSetErrMsg("Could not allocate memory for intermediate structures");
- return amdlibFAILURE;
- }
-
- /* Allocate memory */
- tmpphot = amdlibAlloc3DArrayDouble(2, nbWlen, nbBases, errMsg);
- if (tmpphot == NULL)
- {
- amdlibAverageVisibilities_FREEALL();
- return amdlibFAILURE;
- }
- s2phot = amdlibAlloc3DArrayDouble(2, nbWlen, nbBases, errMsg);
- if (s2phot == NULL)
- {
- amdlibAverageVisibilities_FREEALL();
- return amdlibFAILURE;
- }
-
- /* Wrap on structures to average */
- photTabPtr = (amdlibPHOTOMETRY_TABLE_ENTRY **)
- amdlibWrap2DArray(phot->table, nbBases, nbFrames,
- sizeof(*(phot->table)), errMsg);
- if (photTabPtr == NULL)
- {
- amdlibAverageVisibilities_FREEALL();
- return amdlibFAILURE;
- }
- visTabPtr = (amdlibVIS_TABLE_ENTRY **)
- amdlibWrap2DArray(vis->table, nbBases, nbFrames,
- sizeof(*(vis->table)), errMsg);
- if (visTabPtr == NULL)
- {
- amdlibAverageVisibilities_FREEALL();
- return amdlibFAILURE;
- }
- vis2TabPtr = (amdlibVIS2_TABLE_ENTRY **)
- amdlibWrap2DArray(vis2->table, nbBases, nbFrames,
- sizeof(*(vis2->table)), errMsg);
- if (vis2TabPtr == NULL)
- {
- amdlibAverageVisibilities_FREEALL();
- return amdlibFAILURE;
- }
- if (nbBases > 1)
- {
- vis3TabPtr = (amdlibVIS3_TABLE_ENTRY **)
- amdlibWrap2DArray(vis3->table, vis3->nbClosures, nbFrames,
- sizeof(*(vis3->table)), errMsg);
- if (vis3TabPtr == NULL)
- {
- amdlibAverageVisibilities_FREEALL();
- return amdlibFAILURE;
- }
- }
-
- /* Check there is at least one frame selected */
- totalNbSel = 0;
- for (j=0; j < nbBases; j++)
- {
- totalNbSel += selectedFrames->band[band].nbSelectedFrames[j];
- }
-
- if (totalNbSel != 0)
- {
- /* Sum all values that have to be simply averaged */
- for (j = 0; j < nbBases; j++)
- {
- selectedFrames->band[band].firstSelectedFrame[j] = -1;
- }
-
- for (j = 0; j < nbBases; j++)
- {
- if (selectedFrames->band[band].nbSelectedFrames[j] == 0)
- {
- continue;
- }
- for (i = 0; i < nbFrames; i++)
- {
- if (selectedFrames->band[band].isSelectedPt[j][i] == amdlibTRUE)
- {
- imdVis.table[j].expTime += visTabPtr[i][j].expTime;
- imdVis2.table[j].expTime += vis2TabPtr[i][j].expTime;
- /*FIXME: if all phots are BLANK , unpredictable result!*/
- for (k = 0; k < nbWlen; k++)
- {
- if (!amdlibCompareDouble(
- photTabPtr[i][j].sigma2FluxSumPiPj[k],
- amdlibBLANKING_VALUE))
- {
- P1MoreP2 = photTabPtr[i][j].fluxSumPiPj[k];
-
- sigma2P1MoreP2 = photTabPtr[i][j].sigma2FluxSumPiPj[k];
-
- P1DiviP2 = photTabPtr[i][j].fluxRatPiPj[k];
-
- sigma2P1DiviP2 = photTabPtr[i][j].sigma2FluxRatPiPj[k];
-
- P2 = P1MoreP2 / (1.0 + P1DiviP2);
-
- sigma2_P2 = sigma2P1MoreP2 / (1.0 + sigma2P1DiviP2);
-
- P1 = P1MoreP2*P1DiviP2/(1.0+P1DiviP2);
-
- sigma2_P1 = sigma2P1MoreP2 * sigma2P1DiviP2 /
- (1.0 + sigma2P1DiviP2);
-
- tmpphot[j][k][0] += P1;
- s2phot[j][k][0] += sigma2_P1;
- tmpphot[j][k][1] += P2;
- s2phot[j][k][1] += sigma2_P2;
-
- imdPhot.table[j].PiMultPj[k] +=
- photTabPtr[i][j].PiMultPj[k];
- }
- }
-
- if (selectedFrames->band[band].firstSelectedFrame[j] == -1)
- {
- selectedFrames->band[band].firstSelectedFrame[j] = i;
- }
- }
- }
- }
-
- for (j = 0; j < nbBases; j++)
- {
- if (selectedFrames->band[band].nbSelectedFrames[j] == 0)
- {
- for (k = 0; k < nbWlen; k++)
- {
- imdPhot.table[j].fluxSumPiPj[k] = amdlibBLANKING_VALUE;
-
- imdPhot.table[j].sigma2FluxSumPiPj[k] = amdlibBLANKING_VALUE;
-
- imdPhot.table[j].fluxRatPiPj[k] = amdlibBLANKING_VALUE;
-
- imdPhot.table[j].sigma2FluxRatPiPj[k] = amdlibBLANKING_VALUE;
- }
- }
- else
- {
- for (k = 0; k < nbWlen; k++)
- {
- imdPhot.table[j].fluxSumPiPj[k] = tmpphot[j][k][0] +
- tmpphot[j][k][1];
-
- imdPhot.table[j].sigma2FluxSumPiPj[k] = s2phot[j][k][0] +
- s2phot[j][k][1];
-
- imdPhot.table[j].fluxRatPiPj[k] = tmpphot[j][k][0] /
- tmpphot[j][k][1];
-
- imdPhot.table[j].sigma2FluxRatPiPj[k] = s2phot[j][k][0] /
- s2phot[j][k][1];
- }
- }
- }
-
- /* Update complex vis (VISDATA) section accordingly. */
- amdlibAverageVis(vis, 0, band, selectedFrames, &imdVis, errMsg);
-
- /* In order to recompute vis2, reconvert visdata (normalized) in
- * coherent fluxes :*/
- for (i = 0; i < nbFrames; i++)
- {
- for (j = 0; j < nbBases; j++)
- {
- for (k = 0; k < nbWlen; k++)
- {
- if (visTabPtr[i][j].flag[k]!=amdlibTRUE)
- {
- P1P2 = photTabPtr[i][j].PiMultPj[k];
- if (!amdlibCompareDouble(P1P2, amdlibBLANKING_VALUE))
- {
- visTabPtr[i][j].vis[k].re *= (2*amdlibSignedSqrt(P1P2));
- visTabPtr[i][j].vis[k].im *= (2*amdlibSignedSqrt(P1P2));
- visTabPtr[i][j].sigma2Vis[k].re *= (4 * P1P2);
- visTabPtr[i][j].sigma2Vis[k].im *= (4 * P1P2);
- }
- else
- { /* Should keep vis BLANK, but vis is already tagged */
- amdlibLogWarning("Wrongly Unflagged Vis -- please report!");
- visTabPtr[i][j].flag[k]=amdlibTRUE;
- }
- }
- }
- }
- }
-
- /* Compute vis (diffvis) on selected frames exclusively. */
- amdlibComputeDiffVis(/* INPUT */
- vis, wave, opd, 0, band,
- selectedFrames,
- /* OUTPUT */
- &imdVis, errMsg);
-
-
- /* Compute fringe criteria on selected frames exclusively. */
- amdlibComputeFringeCriterion(vis, 0, band, selectedFrames, &imdVis); /*protected against flagged V */
-
- /* Re-Compute vis2 on selected frames exclusively */
- amdlibComputeSqVis(vis, phot, 0, band, selectedFrames,
- (amdlibERROR_TYPE)amdlibSTATISTICAL_ERROR,
- &imdVis2, errMsg); /*protected against flagged V and blanked phots.*/
- /* update average values in header */
- amdlibAverageVis2(&imdVis2);
-
- /* Compute piston on selected frames exclusively */
- if (amdlibMeanPiston(opd, band, 0, selectedFrames,
- &imdOpd) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not mean piston");
- return amdlibFAILURE;
- }
-
- /* Build vis3 data structure */
- if (nbBases > 1)
- {
- if (selectedFrames->band[band].nbFramesOkForClosure != 0)
- {
- /* Build vis3 values again */
- if (amdlibComputeClosurePhases(vis, 0, band, selectedFrames,
- (amdlibERROR_TYPE)amdlibSTATISTICAL_ERROR,
- &imdVis3,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- amdlibAverageClosurePhases(&imdVis3);
-
- /* Fill VIS3 data structure */
- i = selectedFrames->band[band].frameOkForClosure[0];
- for (i = 0; i < selectedFrames->band[band].nbFramesOkForClosure; i++)
- {
- j = selectedFrames->band[band].frameOkForClosure[i];
- imdVis3.table[0].expTime += vis3TabPtr[j][0].expTime;
- }
- }
- }
-
- }
- else
- {
- amdlibLogWarning("No frames selected for band %c",
- amdlibBandNumToStr(band));
- }
-
- /* Compute UV coords */
- for (j=0; j < nbBases; j++)
- {
- /* UV coordinates treatment */
- imdVis.table[j].uCoord = (visTabPtr[0][j].uCoord +
- visTabPtr[nbFrames-1][j].uCoord) / 2;
- imdVis.table[j].vCoord = (visTabPtr[0][j].vCoord +
- visTabPtr[nbFrames-1][j].vCoord) / 2;
- imdVis2.table[j].uCoord = (vis2TabPtr[0][j].uCoord +
- vis2TabPtr[nbFrames-1][j].uCoord) / 2;
- imdVis2.table[j].vCoord = (vis2TabPtr[0][j].vCoord +
- vis2TabPtr[nbFrames-1][j].vCoord) / 2;
-
- /* Time / date treatment */
- imdVis.table[j].time = (visTabPtr[0][j].time +
- visTabPtr[nbFrames-1][j].time) / 2;
- imdVis2.table[j].time = (vis2TabPtr[0][j].time +
- vis2TabPtr[nbFrames-1][j].time) / 2;
- imdVis.table[j].dateObsMJD = (visTabPtr[0][j].dateObsMJD +
- visTabPtr[nbFrames-1][j].dateObsMJD) / 2;
- imdVis2.table[j].dateObsMJD = (vis2TabPtr[0][j].dateObsMJD +
- vis2TabPtr[nbFrames-1][j].dateObsMJD)/2;
-
- /* target identifier and station indexes treatment */
- imdVis.table[j].targetId = visTabPtr[0][j].targetId;
- imdVis.table[j].stationIndex[0] = visTabPtr[0][j].stationIndex[0];
- imdVis.table[j].stationIndex[1] = visTabPtr[0][j].stationIndex[1];
-
- imdVis2.table[j].targetId = vis2TabPtr[0][j].targetId;
- imdVis2.table[j].stationIndex[0] = vis2TabPtr[0][j].stationIndex[0];
- imdVis2.table[j].stationIndex[1] = vis2TabPtr[0][j].stationIndex[1];
- }
- if (nbBases > 1)
- {
- imdVis3.table[0].targetId = vis3TabPtr[0][0].targetId;
- imdVis3.table[0].time = (vis3TabPtr[0][0].time +
- vis3TabPtr[nbFrames-1][0].time) / 2;
- imdVis3.table[0].dateObsMJD = (vis3TabPtr[0][0].dateObsMJD +
- vis3TabPtr[nbFrames-1][0].dateObsMJD)/2;
- imdVis3.table[0].stationIndex[0] = vis3TabPtr[0][0].stationIndex[0];
- imdVis3.table[0].stationIndex[1] = vis3TabPtr[0][0].stationIndex[1];
- imdVis3.table[0].stationIndex[2] = vis3TabPtr[0][0].stationIndex[2];
-
- imdVis3.table[0].u1Coord = (vis3TabPtr[0][0].u1Coord +
- vis3TabPtr[nbFrames-1][0].u1Coord) / 2;
- imdVis3.table[0].v1Coord = (vis3TabPtr[0][0].v1Coord +
- vis3TabPtr[nbFrames-1][0].v1Coord) / 2;
- imdVis3.table[0].u2Coord = (vis3TabPtr[0][0].u2Coord +
- vis3TabPtr[nbFrames-1][0].u2Coord) / 2;
- imdVis3.table[0].v2Coord = (vis3TabPtr[0][0].v2Coord +
- vis3TabPtr[nbFrames-1][0].v2Coord) / 2;
- }
-
- /* Free all wrappings */
- amdlibAverageVisibilities_FREEALL();
-
- /* Update all data structures: set computed mean values */
- free(phot->table[0].fluxSumPiPj);
- free(phot->table[0].sigma2FluxSumPiPj);
- free(phot->table[0].fluxRatPiPj);
- free(phot->table[0].sigma2FluxRatPiPj);
- free(phot->table[0].PiMultPj);
- free(phot->table);
- phot->nbFrames = 1;
- phot->table = imdPhot.table;
-
- free(vis->table[0].vis);
- free(vis->table[0].sigma2Vis);
- free(vis->table[0].visCovRI);
- free(vis->table[0].diffVisAmp);
- free(vis->table[0].diffVisAmpErr);
- free(vis->table[0].diffVisPhi);
- free(vis->table[0].diffVisPhiErr);
- free(vis->table[0].flag);
- free(vis->table);
- vis->nbFrames = 1;
- vis->table = imdVis.table;
-
- free(vis2->table[0].vis2);
- free(vis2->table[0].vis2Error);
- free(vis2->table[0].flag);
- free(vis2->table);
- vis2->nbFrames = 1;
- vis2->table = imdVis2.table;
- vis2->vis12 = imdVis2.vis12;
- vis2->vis23 = imdVis2.vis23;
- vis2->vis31 = imdVis2.vis31;
- vis2->sigmaVis12 = imdVis2.sigmaVis12;
- vis2->sigmaVis23 = imdVis2.sigmaVis23;
- vis2->sigmaVis31 = imdVis2.sigmaVis31;
-
- if (nbBases > 1)
- {
- free(vis3->table[0].vis3Amplitude);
- free(vis3->table[0].vis3AmplitudeError);
- free(vis3->table[0].vis3Phi);
- free(vis3->table[0].vis3PhiError);
- free(vis3->table[0].flag);
- free(vis3->table);
- vis3->nbFrames = 1;
- vis3->averageClosure = imdVis3.averageClosure;
- vis3->averageClosureError = imdVis3.averageClosureError;
- vis3->table = imdVis3.table;
- }
-
- opd->nbFrames = 1;
- for (i = amdlibJ_BAND; i <= amdlibK_BAND; i++)
- {
- if (opd->pistonOPDArray[i] != NULL)
- {
- free(opd->pistonOPDArray[i]);
- }
- if (opd->sigmaPistonArray[i] != NULL)
- {
- free(opd->sigmaPistonArray[i]);
- }
- opd->pistonOPDArray[i] = imdOpd.pistonOPDArray[i];
- opd->sigmaPistonArray[i] = imdOpd.sigmaPistonArray[i];
- }
- free(opd->pistonOPD);
- free(opd->sigmaPiston);
- opd->pistonOPD = imdOpd.pistonOPD;
- opd->sigmaPiston = imdOpd.sigmaPiston;
-
- return amdlibSUCCESS;
-}
-#undef amdlibAverageVisibilities_FREEALL
-
-/** Useful macro to free amdlibComputeVisibilitiesFor structures */
-#define amdlibComputeVisibilitiesFor_FREEALL() \
- free(p2v); free(mk); free(sigma2_mk); free(cova_mk); \
- free(v2p); free(fudge); \
- amdlibFree2DArrayDouble(chisq); \
- free(gp2v); free(ikMean); free(sigma2_ikMean); \
- free(gv2p); free(badp2v); \
- amdlibReleasePhotometry(&instantPhotometry); \
- amdlibReleaseVis(&instantCorrFlux); \
- amdlibReleasePiston(&instantOpd);
-/**
- * sub-entry point, gathers all strutures in input and output,
- * calls the other functions in sequence
- *
- * @param data structure containing the science observation (where the fringes * are)
- * @param p2vm structure where P2VM is stored
- * @param waveData the wavelength definition structure
- * @param channelNo first channel included in computation
- * @param nbChannels number of channels total used in computation
- * @param binning the number of consecutives frames in the science observation
- * that will be used to measure a single point of visibilties in output.
- * the total time span of the frames in a bin should be of the order of
- * the coherence time of the atmosphere, unless the observation has
- * benefitted of a fringe tracker device. At Paranal coherence time are
- * rarely more than a few Millisecond.
- * @param errorType indicates wether the noise figures are estimated
- * statistically from the sequence of photometries during the bin
- * (amdlibSTATISTICAL_ERROR) or theoretically by the poisson error on N photons
- * (amdlibTHEORETICAL_ERROR). The latter is forced obviously when the binsize
- * is 1.
- * @param pistonType indicates wether the piston is to be measured by fitting
- * a slope in the phasors amdlibITERATIVE_PHASOR or in the differential phases
- * after dewrapping (amdlibUNWRAPPED_PHASE). The latter is deprecated and
- * is not mainained anymore.
- * @param noCheckP2vmId forces amdlib to use without question the passed p2vm,
- * even if its magic number is not OK. Can happen if the P2VM has been
- * observed AFTER the science observations.
- * @param photometry output structure containing the (binned) photometry
- * results.
- * @param vis structure containing the (binned) raw visibilities.
- * @param vis2 structure containing the (binned) squared visibilities.
- * @param vis3 structure containing the (binned) triple products.
- * @param wave structure containing the wavelengths corresponding to the other
- * output structures.
- * @param opd structure containing the (binned) piston measurements.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned. */
-amdlibCOMPL_STAT
-amdlibComputeVisibilitiesFor(/* Input */
- amdlibSCIENCE_DATA *data,
- amdlibP2VM_MATRIX *p2vm,
- amdlibWAVEDATA *waveData,
- int *channelNo,
- int nbChannels,
- int binning,
- amdlibERROR_TYPE errorType,
- amdlibPISTON_ALGORITHM pistonType,
- amdlibBOOLEAN noCheckP2vmId,
- /* Output */
- amdlibPHOTOMETRY *photometry,
- amdlibVIS *vis,
- amdlibVIS2 *vis2,
- amdlibVIS3 *vis3,
- amdlibWAVELENGTH *wave,
- amdlibPISTON *opd,
- amdlibERROR_MSG errMsg)
-{
-
- int nbPix = data->col[amdlibINTERF_CHANNEL].nbPixels;
- int nbTel = data->nbCols - 1; /* Number of telescopes used in data*/
- int iFrame;
- int nbFrames = data->nbFrames;
- int nbBases = nbTel * (nbTel - 1) / 2; /* Number of baselines in data*/
- int nbClos = nbTel * (nbTel - 1) * (nbTel - 2) / 6; /* Number of closures */
- int iBin; /* Index of the current binning */
- int firstFrame; /* Number of visibilities stored in OI_VIS */
- int nbBins; /* Number of binnings */
- double *p2v; /* local copy of (eventual 2T subset of) current p2vm */
- double *gp2v; /* local copy of (eventual 2T subset of) current p2vm */
- unsigned char *badp2v; /* local copy of current p2vm Bad Pixels */
- double *gv2p; /* the direct pixel to visibility matrix */
- double *v2p; /* the direct pixel to visibility matrix */
- double *mk;
- double *sigma2_mk,*cova_mk;
- double *ikMean;
- double *sigma2_ikMean;
- double *fudge;
- double **chisq;
- static amdlibVIS instantCorrFlux;
- static amdlibPHOTOMETRY instantPhotometry;
- static amdlibPISTON instantOpd;
- amdlibBAND band;
- double chi2Limit;
- double spectralResolution=1E12;
- double pistonErrThreshold=amdlibBLANKING_VALUE;
- double pistonThreshold=amdlibBLANKING_VALUE;
-
- amdlibLogTrace("amdlibComputeVisibilitiesFor()");
-
- if(binning > nbFrames)
- {
- binning = nbFrames;
- nbBins = 1;
- }
- else
- {
- nbBins = data->nbFrames / binning;
- }
-
- if (binning == 1)
- {
- errorType = amdlibTHEORETICAL_ERROR;
- }
-#if amdlibDEBUG
- amdlibLogTrace("amdlibComputeVisibilitiesFor() - first data : ");
- amdlibLogTrace("nbPix = %d", nbPix);
- amdlibLogTrace("nbTel = %d", nbTel);
- amdlibLogTrace("nbFrames = %d", nbFrames);
- amdlibLogTrace("nbBases = %d", nbBases);
- amdlibLogTrace("nbClos = %d", nbClos);
- amdlibLogTrace("nbBins = %d", nbBins);
- amdlibLogTrace("nbChannels = %d", nbChannels);
- amdlibLogTrace("details: ");
- int i;
- for (i = 0; i < nbChannels; i++)
- {
- amdlibLogTrace("channelNo[%d] = %d, wlen = %f", i, channelNo[i],
- waveData->wlen[channelNo[i]]);
- }
-#endif
-
- if(amdlibCheckInsConfig(data, p2vm, noCheckP2vmId,
- errMsg) == amdlibFAILURE)
- {
- return amdlibFAILURE;
- }
-
- /* Allocate all the structures used by amdlibComputeVisibilitiesFor */
- /* Allocate Wavelength Structure */
- if (amdlibAllocateWavelength(wave, nbChannels, errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- /* Allocate memory for photometry */
- if (amdlibAllocatePhotometry(photometry, nbBins, nbBases,
- nbChannels) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for PHOTOMETRY");
- return amdlibFAILURE;
- }
- /* Allocate memory for vis */
- if (amdlibAllocateVis(vis, nbBins, nbBases, nbChannels) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for VIS");
- return amdlibFAILURE;
- }
- /* Allocate memory vis2 */
- if (amdlibAllocateVis2(vis2, nbBins, nbBases, nbChannels) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for VIS2");
- return amdlibFAILURE;
- }
- if (nbTel == 3)
- {
- /* Allocate VIS3 structure */
- if (amdlibAllocateVis3(vis3, nbBins, nbClos,
- nbChannels) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for VIS3");
- return amdlibFAILURE;
- }
- }
- /* Allocate Piston Structure */
- if (amdlibAllocatePiston(opd, nbBins, nbBases) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for Piston structure");
- return amdlibFAILURE;
- }
-
- /* Allocate p2v matrix and associated matrixes */
- /* local copy of (eventual 2T subset of) current
- * p2vm dim(nbPix,2*nbBases)
- */
- p2v = calloc(2*nbBases*nbPix*nbChannels, sizeof(double));
- gp2v = calloc((2*nbBases+1)*nbPix*nbChannels, sizeof(double));
- /* local copy of (eventual 2T subset of)
- * current p2vm Bad Pixels
- */
- badp2v = calloc(nbChannels*nbPix, sizeof(char));
- mk = calloc(nbChannels*nbPix, sizeof(double));
- sigma2_mk = calloc(nbChannels*nbPix, sizeof(double));
- cova_mk = calloc(nbChannels*nbPix*nbPix, sizeof(double));
- ikMean = calloc(nbChannels*nbPix, sizeof(double));
- sigma2_ikMean = calloc(nbChannels*nbPix, sizeof(double));
- /* the direct visibility to pixel matrix */
- v2p = calloc(nbPix*2*nbBases*nbChannels, sizeof(double));
- gv2p = calloc(nbPix*(2*nbBases+1)*nbChannels, sizeof(double));
- /* The fudge factor vector */
- fudge = calloc(nbChannels, sizeof(double));
- /* The chi-square vector */
- chisq = amdlibAlloc2DArrayDouble(nbChannels, nbFrames, errMsg);
- if (chisq == NULL)
- {
- amdlibComputeVisibilitiesFor_FREEALL();
- return amdlibFAILURE;
- }
-
- /* Allocate memory for the instantaneous photometry
- * used for all the computations */
- if (amdlibAllocatePhotometry(&instantPhotometry,
- nbFrames, nbBases, nbChannels) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for instantPhotometry");
- amdlibComputeVisibilitiesFor_FREEALL();
- return amdlibFAILURE;
- }
-
- /* Allocate memory for the instantaneous visibility
- * used for all the computations */
- if (amdlibAllocateVis(&instantCorrFlux,
- nbFrames, nbBases, nbChannels) !=
- amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for instantCorrFlux");
- amdlibComputeVisibilitiesFor_FREEALL();
- return amdlibFAILURE;
- }
- /* Allocate memory for the instantaneous piston time series*/
- if (amdlibAllocatePiston(&instantOpd, nbFrames, nbBases) !=
- amdlibSUCCESS)
- {
- amdlibSetErrMsg("Could not allocate memory for instantOpd");
- amdlibComputeVisibilitiesFor_FREEALL();
- return amdlibFAILURE;
- }
-
- /* Linearize problem by retrieving the correct fudge factor
- * of the vks based on the whole measurement i.e.,
- * the long integration limit. */
- if (amdlibCrossGeneralizedP2vmAndData(/* Input */
- p2vm, data, channelNo, nbChannels,
- /* Output */
- gp2v, badp2v,
- ikMean, sigma2_ikMean,
- errMsg)!= amdlibSUCCESS)
- {
- amdlibComputeVisibilitiesFor_FREEALL();
- return amdlibFAILURE;
- }
-
- if (amdlibInvertGeneralizedP2v(/* Input */
- gp2v, badp2v, sigma2_ikMean,
- nbChannels, nbPix, nbBases,
- /* Output */
- gv2p, errMsg)!= amdlibSUCCESS)
- {
- amdlibComputeVisibilitiesFor_FREEALL();
- return amdlibFAILURE;
- }
-
- if (amdlibComputeFudgeFactor(/* Input */
- gv2p, ikMean,
- nbChannels, nbPix, nbBases,
- /* Output */
- fudge,
- errMsg)!= amdlibSUCCESS)
- {
- amdlibComputeVisibilitiesFor_FREEALL();
- return amdlibFAILURE;
- }
-
- /* Retrieve All Photometries in one shot */
- if (amdlibGetInstantPhotometry(/* Input */
- p2vm, data, fudge,
- channelNo, nbChannels,
- /* Output */
- &instantPhotometry,
- errMsg) != amdlibSUCCESS)
- {
- amdlibComputeVisibilitiesFor_FREEALL();
- return amdlibFAILURE;
- }
- amdlibLogInfoDetail("Computing Raw Correlated Fluxes...");
- /*Compute raw correlated fluxes for each frame. Binning will occur
- * afterwards. */
- for(iFrame=0; iFrame < nbFrames; iFrame++)
- {
- /* Get the right data, using the P2VM and data rows informations */
- if (amdlibCrossP2vmAndData(/* Input */
- p2vm, data, waveData, fudge,
- iFrame, channelNo, nbChannels,
- /* Output */
- wave,
- p2v, badp2v,
- mk, sigma2_mk, cova_mk,
- ikMean, sigma2_ikMean,
- errMsg) != amdlibSUCCESS)
- {
- amdlibComputeVisibilitiesFor_FREEALL();
- return amdlibFAILURE;
- }
-
- /* Invert the P2VM, using a generalized inverse */
- if (amdlibInvertP2v(/* Input */
- p2v, badp2v, cova_mk,
- nbChannels, nbPix, nbBases,
- /* Output */
- v2p, errMsg) != amdlibSUCCESS)
- {
- amdlibComputeVisibilitiesFor_FREEALL();
- return amdlibFAILURE;
- }
-
- /* Compute correlated flux, used after to compute visibilities */
- if (amdlibComputeCorrFlux(/* Input */
- v2p, mk, sigma2_mk,
- iFrame, nbChannels, nbPix, nbBases,
- /* Output */
- &instantCorrFlux, errMsg) != amdlibSUCCESS)
- {
- amdlibComputeVisibilitiesFor_FREEALL();
- return amdlibFAILURE;
- }
-
- if (amdlibComputeChiSquare(/* Input */
- &instantCorrFlux, p2v, badp2v,
- mk, sigma2_mk,
- iFrame, nbChannels, nbPix, nbBases,
- /* Output */
- chisq,
- errMsg) != amdlibSUCCESS)
- {
- amdlibComputeVisibilitiesFor_FREEALL();
- return amdlibFAILURE;
- }
- }
- /* Achromatic piston computation for all frames. benefits even from 'bad'
- * correlated fluxes */
- band = amdlibGetBand(wave->wlen[0]);
-
- amdlibLogInfoDetail("Computing Pistons...");
- if (amdlibComputePiston(&instantCorrFlux, band, wave,
- &instantOpd, errMsg) != amdlibSUCCESS)
- {
- amdlibComputeVisibilitiesFor_FREEALL();
- return amdlibFAILURE;
- }
- /* Chi-Square filtering of very strange visibilities -
- * 0 means 3 sigma around mean,
- * -1 means none
- * a positive value is a limit */
- chi2Limit=amdlibFILTER_CHISQUARE_LIMIT;
- if (amdlibGetUserPref(amdlibCHISQUARE_LIMIT).set==amdlibTRUE)
- chi2Limit=amdlibGetUserPref(amdlibCHISQUARE_LIMIT).value;
- amdlibFilterByChiSquare(&instantCorrFlux,chisq,chi2Limit);
-
- /* update thresholds for piston */
- if (amdlibGetUserPref(amdlibMAX_PISTON_ERROR).set==amdlibTRUE)
- pistonErrThreshold=amdlibGetUserPref(amdlibMAX_PISTON_ERROR).value;
- if (amdlibGetUserPref(amdlibMAX_PISTON_EXCURSION).set==amdlibTRUE)
- pistonThreshold=amdlibGetUserPref(amdlibMAX_PISTON_EXCURSION).value;
-
- /* Improve Piston using piston closure (if requested) */
- if (amdlibGetUserPref(amdlibBEAUTIFY_PISTON).set==amdlibTRUE)
- {
- amdlibClosePiston(&instantOpd,pistonErrThreshold,band);
- }
-
- /* Tag bad pistons eventually */
- if (!amdlibCompareDouble(pistonErrThreshold,amdlibBLANKING_VALUE) ||
- !amdlibCompareDouble(pistonThreshold,amdlibBLANKING_VALUE)) amdlibTagPiston(&instantOpd,pistonThreshold,pistonErrThreshold,band);
-
- /* Correct from piston extenuation if requested */
- if (amdlibGetUserPref(amdlibCORRECT_OPD0).set==amdlibTRUE)
- {
- spectralResolution=amdlibGetUserPref(amdlibCORRECT_OPD0).value;
- if (amdlibCorrectFromPistonExtenuation(&instantCorrFlux, &instantOpd, wave, band, spectralResolution, errMsg)!= amdlibSUCCESS)
- {
- amdlibComputeVisibilitiesFor_FREEALL();
- return amdlibFAILURE;
- }
- }
-
- if (binning>1) amdlibLogInfoDetail("Binning...");
- /* Binning */
- for(iBin=0; iBin < nbBins; iBin++)
- {
- /* The first frame to read in the data */
- firstFrame = iBin * binning;
- /* amdlibLogTrace("binning = %d", binning); */
-
- if (amdlibBinPiston(/* Input */
- &instantOpd, band, firstFrame, binning,
- iBin,
- /* Output */
- opd) != amdlibSUCCESS)
- {
- amdlibComputeVisibilitiesFor_FREEALL();
- return amdlibFAILURE;
- }
-
-
- /* Fringe criterion (SNR) computation */
- amdlibBinFringeCriterion(/* Input */
- &instantCorrFlux, firstFrame, binning,
- iBin, band,
- /* Output */
- vis);
-
- /* complex visibilities average */
- if (amdlibMeanCpxVis(/* Input */
- &instantCorrFlux,
- &instantPhotometry,
- firstFrame, binning,
- iBin,
- /* Output */
- vis) != amdlibSUCCESS)
- {
- amdlibComputeVisibilitiesFor_FREEALL();
- return amdlibFAILURE;
- }
-
- /* squared visibilities estimation */
- if (amdlibBinSqVis(/* Input */
- &instantCorrFlux, &instantPhotometry,
- firstFrame, binning,
- iBin, band, errorType,
- /* Output */
- vis2, errMsg) != amdlibSUCCESS)
- {
- amdlibComputeVisibilitiesFor_FREEALL();
- return amdlibFAILURE;
- }
-
- /* flux computation */
- if (amdlibSumPhotometry(/* Input */
- &instantPhotometry,
- firstFrame, binning,
- iBin,
- /* Output */
- photometry) != amdlibSUCCESS)
- {
- amdlibComputeVisibilitiesFor_FREEALL();
- return amdlibFAILURE;
- }
-
-
- /* Compute Closure phases. */
- if (nbTel == 3)
- {
- if (amdlibBinClosurePhases(/* Input */
- &instantCorrFlux, firstFrame,
- binning, iBin, band,
- errorType,
- /* Output */
- vis3, errMsg) != amdlibSUCCESS)
- {
- amdlibComputeVisibilitiesFor_FREEALL();
- return amdlibFAILURE;
- }
- } /*End if (nbTel == 3) */
-
- /* Compute diffvis */
- if (amdlibBinDiffVis(/* Input */
- &instantCorrFlux, wave, &instantOpd,
- firstFrame, binning, iBin, band,
- /* Output */
- vis, errMsg)!= amdlibSUCCESS)
- {
- amdlibComputeVisibilitiesFor_FREEALL();
- return amdlibFAILURE;
- }
- }
-
- /* Finalize table headers */
- amdlibFillInVisTableHeader(data, vis, errMsg);
- amdlibFillInVis2TableHeader(data, vis2, errMsg);
- if (nbTel == 3)
- {
- amdlibFillInVis3TableHeader(data, vis3, errMsg);
- }
-
- amdlibReleasePhotometry(&instantPhotometry);
- amdlibReleaseVis(&instantCorrFlux);
- amdlibReleasePiston(&instantOpd);
- /* Compute global averaged values of squared visibilities and CPs */
- amdlibAverageVis2(vis2);
- amdlibAverageClosurePhases(vis3);
-
- amdlibComputeVisibilitiesFor_FREEALL();
-
- return amdlibSUCCESS;
-}
-#undef amdlibComputeVisibilitiesFor_FREEALL
-
-/*
- * Local functions definitions
- */
-/**
- * Check instrument configuration and coherence of the files used in the data
- * reduction.
- *
- * @param data structure containing the science observation (where the fringes
- * are)
- * @param p2vm structure where P2VM is stored
- * @param noCheckP2vmId forces amdlib to use without question the passed p2vm,
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned. */
-amdlibCOMPL_STAT amdlibCheckInsConfig(/* Input */
- amdlibSCIENCE_DATA *data,
- amdlibP2VM_MATRIX *p2vm,
- amdlibBOOLEAN noCheckP2vmId,
- /* Output */
- amdlibERROR_MSG errMsg)
-{
-
- int nbTelInp2v = amdlibNB_TEL;
- /* Number of Telescopes Used in the p2vm calibration file*/
- int nbTel = data->nbCols - 1;
- /* Number of Telescopes Used in the Science data*/
-
- amdlibLogTrace("amdlibCheckInsConfig()");
-
- if (noCheckP2vmId == amdlibFALSE)
- {
- /* Check data reference to P2VM id */
- if (data->p2vmId == -1)
- {
- amdlibSetErrMsg("No P2VM available for this data");
- return amdlibFAILURE;
- }
- /* Check P2VM Ids */
- if ((p2vm->id != 0) && (data->p2vmId != 0) &&
- (p2vm->id != data->p2vmId))
- {
- amdlibSetErrMsg("PV2M id '%d' referenced in data does not match "
- "with PV2M id '%d'", data->p2vmId, p2vm->id);
- return amdlibFAILURE;
- }
- }
-
- /* If P2VM id was not written in header */
- if ((p2vm->id == 0) || (data->p2vmId == 0))
- {
- /* Check instrument configuration */
- int keywIdx = 0;
- int dataKeywIdx;
- int p2vmKeywIdx;
- while (amdlibP2vmInsCfgKeywList[keywIdx] != NULL)
- {
- /* Found keyword in data instrument cfg */
- dataKeywIdx = 0;
- while ((strlen(data->insCfg.keywords[dataKeywIdx].name) != 0) &&
- (strncmp(data->insCfg.keywords[dataKeywIdx].name,
- amdlibP2vmInsCfgKeywList[keywIdx],
- strlen(amdlibP2vmInsCfgKeywList[keywIdx])) != 0))
- {
- dataKeywIdx++;
- }
-
- /* Found keyword in P2VM instrument cfg */
- p2vmKeywIdx = 0;
- while ((strlen(p2vm->insCfg.keywords[p2vmKeywIdx].name) != 0) &&
- (strncmp(p2vm->insCfg.keywords[p2vmKeywIdx].name,
- amdlibP2vmInsCfgKeywList[keywIdx],
- strlen(amdlibP2vmInsCfgKeywList[keywIdx])) != 0))
- {
- p2vmKeywIdx++;
- }
-
-
- /* Check keyword values (if found) */
- if ((strlen(data->insCfg.keywords[dataKeywIdx].name) != 0) &&
- (strlen(p2vm->insCfg.keywords[p2vmKeywIdx].name) != 0))
- {
- if (strcmp(data->insCfg.keywords[dataKeywIdx].value,
- p2vm->insCfg.keywords[p2vmKeywIdx].value) != 0)
- {
- amdlibStripBlanks(data->insCfg.keywords[dataKeywIdx].value);
- amdlibStripBlanks(p2vm->insCfg.keywords[p2vmKeywIdx].value);
-
- amdlibSetErrMsg("Value of keyword'%s' differs for P2VM "
- "'%s' and data '%s'",
- amdlibP2vmInsCfgKeywList[keywIdx],
- p2vm->insCfg.keywords[p2vmKeywIdx].value,
- data->insCfg.keywords[dataKeywIdx].value);
- return amdlibFAILURE;
- }
- }
-
- /* Check next keyword */
- keywIdx++;
- }
- }
-
- /* Init the number of telescopes and baselines according to P2VM type */
- if (p2vm->type == amdlibP2VM_2T)
- {
- nbTelInp2v = 2;
- }
- else if (p2vm->type == amdlibP2VM_3T)
- {
- nbTelInp2v = 3;
- }
- else
- {
- amdlibSetErrMsg("Invalid P2VM type %d (see amdlibP2VM_TYPE)",
- (int)p2vm->type);
- return amdlibFAILURE;
- }
- /* Should Check the number of telescopes and baselines according to
- * what the Science data claims
- */
- nbTel = data->nbCols - 1;
- if (nbTel > nbTelInp2v)
- {
- amdlibSetErrMsg("P2VM is %dT and Data %dT, aborting.",
- nbTelInp2v, nbTel);
- return amdlibFAILURE;
- }
- /*
- * Make a few checks on the adequation between p2vm and science data
- */
- if (p2vm->nx != data->col[amdlibINTERF_CHANNEL].nbPixels)
- {
- amdlibSetErrMsg("Incompatible P2VM and data interf channel width "
- "(%d vs. %d)", p2vm->nx,
- data->col[amdlibINTERF_CHANNEL].nbPixels);
- return amdlibFAILURE;
- }
-
- if (data->nbChannels <= 0)
- {
- amdlibSetErrMsg("Invalid nbWlen (%d) information in data.",
- data->nbChannels);
- return amdlibFAILURE;
- }
- /* I do not understand the following test. Corrected to accept (at least)
- * simulated data from amdsim whose 1st valid spectral channel is 0
- * . GD */
- if(data->channelNo[0] < 0)
- {
- amdlibSetErrMsg("Invalid startPixel (%d) information in data.",
- data->channelNo[0]);
- return amdlibFAILURE;
- }
- return amdlibSUCCESS;
-
-}
-
-/**
- * Useful macro to free memory allocted in amdlibCrossGeneralizedP2vmAndData function
- */
-#define amdlibCrossGeneralizedP2vmAndData_FREEALL() \
- amdlibFree2DArrayDouble(vk); \
- amdlibFree3DArrayDoubleWrapping(gp2vCkDkPtr); \
- amdlibFree2DArrayDoubleWrapping(ikMeanPtr); \
- amdlibFree2DArrayDoubleWrapping(sigma2_ikMeanPtr); \
- amdlibFree2DArrayUnsignedCharWrapping(badPixelFlagsPtr);
-/**
- * Extracts in the (large) input structures the relevant subset of values
- * needed, computes the ikMean (long exposure equivalent) and photometries.
- *
- * @param p2vm pointer to P2VM.
- * @param data pointer to science data.
- * @param waveData the wavelength definition structure
- * @param firstFrame first frame in science data to handle.
- * @param nbFrames number of frames in science data to handle.
- * @param channelNo indexes of valid spectral channels to treat.
- * @param nbChannels number of valid spectral channels to treat.
- * @param wave structure containing the wavelengths corresponding to the other
- * @param photometry output structure containing the (binned) photometry
- * results.
- * @param gp2vCkDk ck and dk and 'a' values of generalised P2VM.
- * @param badPixelFlags pointer to the bad pixel map
- * @param ikMean the mean value of the successive interferograms
- * @param sigma2_ikMean the associated variances of the ikMeans
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned. */
-amdlibCOMPL_STAT amdlibCrossGeneralizedP2vmAndData(/* Input */
- amdlibP2VM_MATRIX *p2vm,
- amdlibSCIENCE_DATA *data,
- int *channelNo,
- int nbChannels,
- /* Output */
- double *gp2vCkDk,
- unsigned char *badPixelFlags,
- double *ikMean,
- double *sigma2_ikMean,
- amdlibERROR_MSG errMsg)
-{
-
- /* loop indexes and associated limits */
- /* Index on pixels */
- int iPix;
- int nbPix = data->col[amdlibINTERF_CHANNEL].nbPixels;
-
- /* Index on telescopse */
- int iTel;
- int nbTel = data->nbCols - 1;
-
- /* Index on baselines */
- int iBase;
- int nbBases = nbTel * (nbTel - 1) / 2;
-
- /* Various Indexes on frames */
- int iFrame;
- int allFrames=data->nbFrames;
-
- /* Index on spectral channel in P2VM */
- int iP2vmChannel;
-
- /* Index on spectral channel in scienData */
- int iDataChannel;
-
- /* Index on spectral channel */
- int channel;
-
- /* Array to store Vk */
- double **vk = NULL;
- double ***gp2vCkDkPtr = NULL;
- double **ikMeanPtr = NULL;
- double **sigma2_ikMeanPtr = NULL;
- unsigned char **badPixelFlagsPtr = NULL;
-
- amdlibLogTrace("amdlibCrossGeneralizedP2vmAndData()");
-
- /* Allocate memory */
- vk = amdlibAlloc2DArrayDouble(nbPix, nbTel, errMsg);
- if (vk == NULL)
- {
- amdlibCrossGeneralizedP2vmAndData_FREEALL();
- return amdlibFAILURE;
- }
-
- /* And wrap already allocated array */
- gp2vCkDkPtr = amdlibWrap3DArrayDouble(gp2vCkDk, 2 * nbBases + 1, nbPix,
- nbChannels, errMsg);
- if (gp2vCkDkPtr == NULL)
- {
- amdlibCrossGeneralizedP2vmAndData_FREEALL();
- return amdlibFAILURE;
- }
- ikMeanPtr = amdlibWrap2DArrayDouble(ikMean, nbPix, nbChannels, errMsg);
- if (ikMeanPtr == NULL)
- {
- amdlibCrossGeneralizedP2vmAndData_FREEALL();
- return amdlibFAILURE;
- }
- sigma2_ikMeanPtr = amdlibWrap2DArrayDouble(sigma2_ikMean, nbPix, nbChannels,
- errMsg);
- if (sigma2_ikMeanPtr == NULL)
- {
- amdlibCrossGeneralizedP2vmAndData_FREEALL();
- return amdlibFAILURE;
- }
- badPixelFlagsPtr = amdlibWrap2DArrayUnsignedChar(badPixelFlags, nbPix,
- nbChannels, errMsg);
- if (badPixelFlagsPtr == NULL)
- {
- amdlibCrossGeneralizedP2vmAndData_FREEALL();
- return amdlibFAILURE;
- }
-
- for (channel = 0; channel < nbChannels; channel++)
- {
- /* Check this channel is valid in P2VM, and get entry in P2VM
- * corresponding to channel */
- if (amdlibIsValidChannel(p2vm, channelNo[channel],
- &iP2vmChannel) == amdlibFALSE)
- {
- amdlibSetErrMsg("Channel '%d' is not in P2VM or it is not valid",
- channelNo[channel]);
- return amdlibFAILURE;
- }
-
- /* Check this channel belongs to science data */
- iDataChannel = 0;
- while ((data->channelNo[iDataChannel] != channelNo[channel]) &&
- (iDataChannel < data->nbChannels))
- {
- iDataChannel++;
- }
- if (iDataChannel == data->nbChannels)
- {
- amdlibSetErrMsg("Channel '%d' does not belong to science data",
- channelNo[channel]);
- return amdlibFAILURE;
- }
-
-#if amdlibDEBUG
- amdlibLogTrace("channelNo=%d, iDataChannel=%d, iP2vmChannel=%d, "
- "wlen=%f",
- channelNo[channel], iDataChannel, iP2vmChannel,
- p2vm->wlen[iP2vmChannel]);
-#endif
-
- /* first pass: retrieve initial vks */
- for (iTel = 0; iTel < nbTel; iTel++)
- {
- for (iPix = 0; iPix < nbPix; iPix++)
- {
- vk[iTel][iPix] = p2vm->vkPt[iTel][iP2vmChannel][iPix];
- }
- }
-
- /* Fill the generalised p2vm:
- * Extract cks, dks for all pixel of spectral channel from P2VM and
- * store into gp2v */
- for (iBase = 0; iBase < (2 * nbBases); iBase++)
- {
- for (iPix = 0; iPix < nbPix; iPix++)
- {
- gp2vCkDkPtr[channel][iPix][iBase] =
- p2vm->matrixPt[iP2vmChannel][iPix][iBase];
- }
- }
- /* compute p1*v1k+p2*v2k+p3*v3k, where Pi(lambda)
- * is averaged over ALL frames, and store in
- * the generalized p2vm */
- for (iTel = 0; iTel < nbTel; iTel++)
- {
- double averagePhot=0.0;
- for (iFrame = 0; iFrame < allFrames; iFrame++)
- {
- amdlibDOUBLE *photData[amdlibNB_TEL];
- photData[0] = data->frame[iFrame].photo1;
- photData[1] = data->frame[iFrame].photo2;
- photData[2] = data->frame[iFrame].photo3;
- averagePhot+=photData[iTel][iDataChannel];
- }
- averagePhot /= allFrames;
-
- /* add corresponding vk*Pi in the last column in gp2vm */
- for (iPix = 0; iPix < nbPix; iPix++)
- {
- gp2vCkDkPtr[channel][iPix][2*nbBases] +=
- fabs(averagePhot) * vk[iTel][iPix];
- }
- }
-#if amdlibDEBUG
- for (iBase = 0; iBase < 2*nbBases+1; iBase++)
- {
- for (iPix = 0; iPix < nbPix; iPix++)
- {
- amdlibLogTrace("gp2vCkDkPtr[%d][%d][%d] = %f", channel, iPix,
- iBase, gp2vCkDkPtr[channel][iPix][iBase]);
- }
- }
-#endif
- /* Get bad pixels from Science */
- for (iPix = 0; iPix < nbPix; iPix++)
- {
- badPixelFlagsPtr[channel][iPix] =
- data->badPixelsPt[channel][iPix];
- }
- /* Add bad pixels from P2vm */
- for (iPix = 0; iPix < nbPix; iPix++)
- {
- if (p2vm->badPixelsPt[iP2vmChannel][iPix] == (unsigned char) 0)
- {
- badPixelFlagsPtr[channel][iPix] = (unsigned char) 0 ;
- }
- }
-
- /* Calculation of the averaged interferogram.*/
- for (iFrame = 0; iFrame < allFrames; iFrame++)
- {
- amdlibDOUBLE **intfPtr = NULL;
- amdlibDOUBLE **sigma2IntfPtr = NULL;
-
- intfPtr =
- amdlibWrap2DArrayDouble(data->frame[iFrame].intf,
- nbPix, data->nbChannels, errMsg);
- if (intfPtr == NULL)
- {
- amdlibCrossGeneralizedP2vmAndData_FREEALL();
- return amdlibFAILURE;
- }
-
- sigma2IntfPtr =
- amdlibWrap2DArrayDouble(data->frame[iFrame].sigma2Intf,
- nbPix, data->nbChannels, errMsg);
- if (sigma2IntfPtr == NULL)
- {
- amdlibFree2DArrayDoubleWrapping(intfPtr);
- amdlibCrossGeneralizedP2vmAndData_FREEALL();
- return amdlibFAILURE;
- }
-
- /* Wrap interferometric channels */
-
- for (iPix = 0; iPix < nbPix; iPix++)
- {
- /* Sum time sequence of ik into ikMean */
- ikMeanPtr[channel][iPix] +=
- fabs(intfPtr[iDataChannel][iPix]);
-
- /* Sum time sequence of sigma2_ik-ik (aka sigma2_det) into sigma2_ikMean */
- sigma2_ikMeanPtr[channel][iPix] +=
- fabs(sigma2IntfPtr[iDataChannel][iPix]-intfPtr[iDataChannel][iPix]);
- }
- amdlibFree2DArrayDoubleWrapping(intfPtr);
- amdlibFree2DArrayDoubleWrapping(sigma2IntfPtr);
- }
- for (iPix = 0; iPix < nbPix; iPix++)
- {
- /*Compute average ik value */
- ikMeanPtr[channel][iPix] /= allFrames;
- /*Compute average sigma2_det*/
- sigma2_ikMeanPtr[channel][iPix] /= allFrames;
- /*Sigma2 of average_X is 1/n times the variance of X: X+ron^2 */
- sigma2_ikMeanPtr[channel][iPix]=
- (ikMeanPtr[channel][iPix]+sigma2_ikMeanPtr[channel][iPix])/allFrames;
- }
- }
-
- amdlibCrossGeneralizedP2vmAndData_FREEALL();
-
- return amdlibSUCCESS;
-}
-#undef amdlibCrossGeneralizedP2vmAndData_FREEALL
-
-/**
- * Useful macro to free memory allocted in amdlibCrossP2vmAndData function
- */
-#define amdlibCrossP2vmAndData_FREEALL() \
- amdlibFree2DArrayDouble(vk); \
- amdlibFree2DArrayDouble(phot); \
- amdlibFree2DArrayDouble(sigma2Phot); \
- amdlibFree3DArrayDoubleWrapping(p2vCkDkPtr); \
- amdlibFree2DArrayDoubleWrapping(mkPtr); \
- amdlibFree2DArrayDoubleWrapping(sigma2_mkPtr); \
- amdlibFree3DArrayDoubleWrapping(cova_mkPtr); \
- amdlibFree2DArrayDoubleWrapping(ikMeanPtr); \
- amdlibFree2DArrayDoubleWrapping(sigma2_ikMeanPtr); \
- amdlibFree2DArrayDoubleWrapping(intfPtr); \
- amdlibFree2DArrayDoubleWrapping(sigma2IntfPtr); \
- amdlibFree2DArrayDouble(sumVk); \
- amdlibFree2DArrayUnsignedCharWrapping(badPixelFlagsPtr);
-/**
- * Extracts in the (large) input structures the relevant subset of values
- * needed, computes the mk and photometries.
- *
- * @param p2vm pointer to P2VM.
- * @param data pointer to science data.
- * @param waveData the wavelength definition structure
- * @param firstFrame first frame in science data to handle.
- * @param nbFrames number of frames in science data to handle.
- * @param channelNo indexes of valid spectral channels to treat.
- * @param nbChannels number of valid spectral channels to treat.
- * @param wave structure containing the wavelengths corresponding to the other
- * @param photometry output structure containing the (binned) photometry
- * results.
- * @param p2vCkDk ck and dk values of P2VM.
- * @param badPixelFlags pointer to the bad pixel map
- * @param mk the continumm-corrected values of the interferograms
- * @param sigma2_mk the associated variances of the mks
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned. */
-amdlibCOMPL_STAT amdlibCrossP2vmAndData(/* Input */
- amdlibP2VM_MATRIX *p2vm,
- amdlibSCIENCE_DATA *data,
- amdlibWAVEDATA *waveData,
- double *fudge,
- int iFrame,
- int *channelNo,
- int nbChannels,
- /* Output */
- amdlibWAVELENGTH *wave,
- double *p2vCkDk,
- unsigned char *badPixelFlags,
- double *mk,
- double *sigma2_mk,
- double *cova_mk,
- double *ikMean,
- double *sigma2_ikMean,
- amdlibERROR_MSG errMsg)
-{
-
- /* loop indexes and associated limits */
- /* Index on pixels */
- int iPix, jPix;
- int nbPix = data->col[amdlibINTERF_CHANNEL].nbPixels;
-
- /* Index on telescope */
- int iTel;
- int nbTel = data->nbCols - 1;
-
- /* Index on baselines */
- int iBase;
- int nbBases = nbTel * (nbTel - 1) / 2;
-
- /* Index on spectral channel in P2VM */
- int iP2vmChannel;
-
- /* Index on spectral channel in scienData */
- int iDataChannel;
-
- /* Index on spectral channel */
- int channel;
-
- /* Array to store Vk and sumVk */
- double **vk = NULL;
- double **sumVk = NULL;
- double **phot = NULL;
- double **sigma2Phot = NULL;
- double ***p2vCkDkPtr = NULL;
- double **mkPtr = NULL;
- double **sigma2_mkPtr = NULL;
- double ***cova_mkPtr = NULL;
- double **ikMeanPtr = NULL;
- double **sigma2_ikMeanPtr = NULL;
- double fluxi, fluxt;
- double sigma2Det;
- unsigned char **badPixelFlagsPtr = NULL;
-
- amdlibDOUBLE *photData[amdlibNB_TEL];
- amdlibDOUBLE *sigma2PhotData[amdlibNB_TEL];
- amdlibDOUBLE **intfPtr = NULL;
- amdlibDOUBLE **sigma2IntfPtr = NULL;
-
- amdlibLogTrace("amdlibCrossP2vmAndData()");
-
- /* Allocate memory */
- vk = amdlibAlloc2DArrayDouble(nbPix, nbTel, errMsg);
- if (vk == NULL)
- {
- amdlibCrossP2vmAndData_FREEALL();
- return amdlibFAILURE;
- }
- sumVk = amdlibAlloc2DArrayDouble(nbBases, nbChannels, errMsg);
- if (sumVk == NULL)
- {
- amdlibCrossP2vmAndData_FREEALL();
- return amdlibFAILURE;
- }
-
- phot = amdlibAlloc2DArrayDouble(nbTel, nbChannels, errMsg);
- if (phot == NULL)
- {
- amdlibCrossP2vmAndData_FREEALL();
- return amdlibFAILURE;
- }
- sigma2Phot = amdlibAlloc2DArrayDouble(nbTel, nbChannels, errMsg);
- if (sigma2Phot == NULL)
- {
- amdlibCrossP2vmAndData_FREEALL();
- return amdlibFAILURE;
- }
-
- /* And wrap already allocated array */
- p2vCkDkPtr = amdlibWrap3DArrayDouble(p2vCkDk, 2 * nbBases, nbPix,
- nbChannels, errMsg);
- if (p2vCkDkPtr == NULL)
- {
- amdlibCrossP2vmAndData_FREEALL();
- return amdlibFAILURE;
- }
- mkPtr = amdlibWrap2DArrayDouble(mk, nbPix, nbChannels, errMsg);
- if (mkPtr == NULL)
- {
- amdlibCrossP2vmAndData_FREEALL();
- return amdlibFAILURE;
- }
- sigma2_mkPtr = amdlibWrap2DArrayDouble(sigma2_mk, nbPix, nbChannels,
- errMsg);
- if (sigma2_mkPtr == NULL)
- {
- amdlibCrossP2vmAndData_FREEALL();
- return amdlibFAILURE;
- }
- cova_mkPtr = amdlibWrap3DArrayDouble(cova_mk, nbPix, nbPix, nbChannels,
- errMsg);
- if (cova_mkPtr == NULL)
- {
- amdlibCrossP2vmAndData_FREEALL();
- return amdlibFAILURE;
- }
- ikMeanPtr = amdlibWrap2DArrayDouble(ikMean, nbPix, nbChannels, errMsg);
- if (ikMeanPtr == NULL)
- {
- amdlibCrossP2vmAndData_FREEALL();
- return amdlibFAILURE;
- }
- sigma2_ikMeanPtr = amdlibWrap2DArrayDouble(sigma2_ikMean, nbPix, nbChannels,
- errMsg);
- if (sigma2_ikMeanPtr == NULL)
- {
- amdlibCrossP2vmAndData_FREEALL();
- return amdlibFAILURE;
- }
- badPixelFlagsPtr = amdlibWrap2DArrayUnsignedChar(badPixelFlags, nbPix,
- nbChannels, errMsg);
- if (badPixelFlagsPtr == NULL)
- {
- amdlibCrossP2vmAndData_FREEALL();
- return amdlibFAILURE;
- }
-
- /* Wrap interferometric channels */
- intfPtr =
- amdlibWrap2DArrayDouble(data->frame[iFrame].intf,
- nbPix, data->nbChannels, errMsg);
- if (intfPtr == NULL)
- {
- amdlibCrossP2vmAndData_FREEALL();
- return amdlibFAILURE;
- }
- sigma2IntfPtr =
- amdlibWrap2DArrayDouble(data->frame[iFrame].sigma2Intf,
- nbPix, data->nbChannels, errMsg);
- if (sigma2IntfPtr == NULL)
- {
- amdlibFree2DArrayDoubleWrapping(intfPtr);
- amdlibCrossP2vmAndData_FREEALL();
- return amdlibFAILURE;
- }
-
- /* For each channel */
- for (channel = 0; channel < nbChannels; channel++)
- {
- /* Check this channel is valid in P2VM, and get entry in P2VM
- * corresponding to channel */
- if (amdlibIsValidChannel(p2vm, channelNo[channel],
- &iP2vmChannel) == amdlibFALSE)
- {
- amdlibSetErrMsg("Channel '%d' is not in P2VM or it is not valid",
- channelNo[channel]);
- return amdlibFAILURE;
- }
-
- /* Check this channel belongs to science data */
- iDataChannel = 0;
- while ((data->channelNo[iDataChannel] != channelNo[channel]) &&
- (iDataChannel < data->nbChannels))
- {
- iDataChannel++;
- }
- if (iDataChannel == data->nbChannels)
- {
- amdlibSetErrMsg("Channel '%d' does not belong to science data",
- channelNo[channel]);
- return amdlibFAILURE;
- }
-
-#if amdlibDEBUG
- amdlibLogTrace("channelNo=%d, iDataChannel=%d, iP2vmChannel=%d, "
- "wlen=%f",
- channelNo[channel], iDataChannel, iP2vmChannel,
- p2vm->wlen[iP2vmChannel]);
-#endif
-
- /* Extract cks, dks for all pixel of spectral channel from P2VM and
- * store into p2v */
- for (iBase = 0; iBase < (2 * nbBases); iBase++)
- {
- for (iPix = 0; iPix < nbPix; iPix++)
- {
- p2vCkDkPtr[channel][iPix][iBase] =
- p2vm->matrixPt[iP2vmChannel][iPix][iBase];
- }
- }
-#if amdlibDEBUG
- for (iBase = 0; iBase < (2 * nbBases); iBase++)
- {
- for (iPix = 0; iPix < nbPix; iPix++)
- {
- amdlibLogTrace("p2vCkDkPtr[%d][%d][%d] = %f", channel, iPix,
- iBase, p2vCkDkPtr[channel][iPix][iBase]);
- }
- }
-#endif
- /* Get bad pixels from Science */
- for (iPix = 0; iPix < nbPix; iPix++)
- {
- badPixelFlagsPtr[channel][iPix] =
- data->badPixelsPt[channel][iPix];
- }
- /* Add bad pixels from P2vm */
- for (iPix = 0; iPix < nbPix; iPix++)
- {
- if (p2vm->badPixelsPt[iP2vmChannel][iPix] == (unsigned char) 0)
- {
- badPixelFlagsPtr[channel][iPix] = (unsigned char) 0 ;
- }
- }
-
- /* Then extract Vk */
- for (iTel = 0; iTel < nbTel; iTel++)
- {
- for (iPix = 0; iPix < nbPix; iPix++)
- { /* begin loop for iPix */
- vk[iTel][iPix] = p2vm->vkPt[iTel][iP2vmChannel][iPix]*
- fudge[channel];
- }
- }
-
- /* Then extract sumVk */
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- sumVk[channel][iBase] = p2vm->sumVkPt[iBase][iP2vmChannel]*
- fudge[channel]*fudge[channel];
- }
-
- /* Extract time sequence of photometry and associated noise, and
- * normalize them */
- photData[0] = data->frame[iFrame].photo1;
- photData[1] = data->frame[iFrame].photo2;
- photData[2] = data->frame[iFrame].photo3;
- sigma2PhotData[0] = data->frame[iFrame].sigma2Photo1;
- sigma2PhotData[1] = data->frame[iFrame].sigma2Photo2;
- sigma2PhotData[2] = data->frame[iFrame].sigma2Photo3;
- /* extract Phot and associated sigma2Phot */
- for (iTel = 0; iTel < nbTel; iTel++)
- {
- phot[channel][iTel] =
- fabs(photData[iTel][iDataChannel]) ;
- sigma2Phot[channel][iTel] =
- sigma2PhotData[iTel][iDataChannel];
- }
-
- /* Calculation of the continuum corrected interferogram.
- * See eq 24 */
- fluxi=0.0;
- fluxt=0.0;
- for (iPix = 0; iPix < nbPix; iPix++)
- {
- /* Extract time sequence of mk = interf - sum_tel(vk*Phot)
- * and associated flux of (sum of ik) */
- mkPtr[channel][iPix] = fabs(intfPtr[iDataChannel][iPix]);
- fluxi += mkPtr[channel][iPix];
- fluxt += fabs(ikMeanPtr[channel][iPix]);
- for (iTel = 0; iTel < nbTel; iTel++)
- {
- mkPtr[channel][iPix] -=
- phot[channel][iTel] * vk[iTel][iPix];
- }
- }
- /* Now we compute sigma2_mk not as the
- * (badly measured) instantaneous
- * pixel value, but evaluated by ratio between the flux
- * contained in the interferogram and the
- * shape of the long-exposure equivalent.
- * We need to retrieve the detector noise also */
-
- for (iPix = 0; iPix < nbPix; iPix++)
- {
- sigma2Det=sigma2IntfPtr[iDataChannel][iPix]-intfPtr[iDataChannel][iPix];
- sigma2_mkPtr[channel][iPix] =
- fabs(ikMeanPtr[channel][iPix]*fluxi/fluxt)+sigma2Det;
-
- for (iTel = 0; iTel < nbTel; iTel++)
- { /* add percentage of noise due to photometry correction */
- sigma2_mkPtr[channel][iPix] +=
- /* sigma2Phot[channel][iTel] * */ /*note: using this overcorrects the V2. ?? */
- phot[channel][iTel] *
- amdlibPow2(vk[iTel][iPix]);
- }
- }
-
- for (iPix = 0; iPix < nbPix; iPix++)
- {
- for (jPix = 0; jPix <= iPix; jPix++)
- {
- if (iPix==jPix)
- {
- sigma2Det=sigma2IntfPtr[iDataChannel][iPix]-intfPtr[iDataChannel][iPix];
- cova_mkPtr[channel][iPix][iPix] =
- fabs(ikMeanPtr[channel][iPix]*fluxi/fluxt)+sigma2Det;
-
- for (iTel = 0; iTel < nbTel; iTel++)
- { /* add percentage of noise due to photometry correction */
- cova_mkPtr[channel][iPix][iPix] +=
- /* sigma2Phot[channel][iTel] * */
- phot[channel][iTel] *
- vk[iTel][iPix]*
- vk[iTel][iPix];
- }
- }
- else
- {
- cova_mkPtr[channel][iPix][jPix] = 0;
- for (iTel = 0; iTel < nbTel; iTel++)
- {
- cova_mkPtr[channel][iPix][jPix] +=
- /* sigma2Phot[channel][iTel] * */
- phot[channel][iTel] *
- vk[iTel][iPix] *
- vk[iTel][jPix];
- }
- }
- cova_mkPtr[channel][jPix][iPix] =
- cova_mkPtr[channel][iPix][jPix];
- }
- }
-
- /* Store corresponding wavelength in amdlibWAVELENGTH structure*/
- wave->bandwidth[channel] = waveData->bandwidth[channelNo[channel]];
- wave->wlen[channel] = p2vm->wlen[iP2vmChannel];
- }
- /* Set number of channels */
- wave->nbWlen = nbChannels;
-
- amdlibCrossP2vmAndData_FREEALL();
-
- return amdlibSUCCESS;
-}
-#undef amdlibCrossP2vmAndData_FREEALL
-
-
-/**
- * Useful macro to free memory allocated in amdlibGetInstantPhotometry function
- */
-#define amdlibGetInstantPhotometry_FREEALL() \
- amdlibFree2DArrayDouble(vk); \
- amdlibFree3DArrayDouble(phot); \
- amdlibFree3DArrayDouble(sigma2Phot); \
- amdlibFree2DArrayDouble(sumVk); \
- amdlibFree2DArrayWrapping((void **)photTablePtr);
-/**
- * @param p2vm pointer to P2VM.
- * @param data pointer to science data.
- * @param firstFrame first frame in science data to handle.
- * @param nbFrames number of frames in science data to handle.
- * @param channelNo indexes of valid spectral channels to treat.
- * @param nbChannels number of valid spectral channels to treat.
- * @param photometry output structure containing the (binned) photometry
- * results.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned. */
-amdlibCOMPL_STAT amdlibGetInstantPhotometry(/* Input */
- amdlibP2VM_MATRIX *p2vm,
- amdlibSCIENCE_DATA *data,
- double *fudge,
- int *channelNo,
- int nbChannels,
- /* Output */
- amdlibPHOTOMETRY *photometry,
- amdlibERROR_MSG errMsg)
-{
-
- /* loop indexes and associated limits */
- /* Index on pixels */
- int iPix;
- int nbPix = data->col[amdlibINTERF_CHANNEL].nbPixels;
-
- /* Index on telescope */
- int iTel;
- int nbTel = data->nbCols - 1;
-
- /* Index on baselines */
- int iBase;
- int nbBases = nbTel * (nbTel - 1) / 2;
-
- /* Index on frames */
- int nbFrames=data->nbFrames;
- int iFrame;
-
- /* Index on spectral channel in P2VM */
- int iP2vmChannel;
-
- /* Index on spectral channel in scienData */
- int iDataChannel;
-
- /* Index on spectral channel */
- int channel;
-
- double **vk = NULL;
- double v1,v2;
- double **sumVk = NULL;
- double ***phot = NULL;
- double ***sigma2Phot = NULL;
- int tel1, tel2;
- double P1P2, P1, P2, sigma2P1, sigma2P2;
- double minimumFlux=0.0;
- amdlibPHOTOMETRY_TABLE_ENTRY **photTablePtr = NULL;
-
-
- amdlibLogTrace("amdlibGetInstantPhotometry()");
-
- if (amdlibGetUserPref(amdlibMIN_PHOTOMETRY).set==amdlibTRUE)
- minimumFlux=amdlibGetUserPref(amdlibMIN_PHOTOMETRY).value;
-
- /* Allocate memory */
- vk = amdlibAlloc2DArrayDouble(nbPix, nbTel, errMsg);
- if (vk == NULL)
- {
- amdlibGetInstantPhotometry_FREEALL();
- return amdlibFAILURE;
- }
- sumVk = amdlibAlloc2DArrayDouble(nbBases, nbChannels, errMsg);
- if (sumVk == NULL)
- {
- amdlibGetInstantPhotometry_FREEALL();
- return amdlibFAILURE;
- }
-
- phot = amdlibAlloc3DArrayDouble(nbTel, nbChannels, nbFrames, errMsg);
- if (phot == NULL)
- {
- amdlibGetInstantPhotometry_FREEALL();
- return amdlibFAILURE;
- }
- sigma2Phot = amdlibAlloc3DArrayDouble(nbTel, nbChannels, nbFrames, errMsg);
- if (sigma2Phot == NULL)
- {
- amdlibGetInstantPhotometry_FREEALL();
- return amdlibFAILURE;
- }
-
- /* For each channel */
- photTablePtr = (amdlibPHOTOMETRY_TABLE_ENTRY **)
- amdlibWrap2DArray(photometry->table, nbBases, nbFrames,
- sizeof(*(photometry->table)), errMsg);
-
- for (channel = 0; channel < nbChannels; channel++)
- {
- /* Check this channel is valid in P2VM, and get entry in P2VM
- * corresponding to channel */
- if (amdlibIsValidChannel(p2vm, channelNo[channel],
- &iP2vmChannel) == amdlibFALSE)
- {
- amdlibSetErrMsg("Channel '%d' is not in P2VM or it is not valid",
- channelNo[channel]);
- return amdlibFAILURE;
- }
-
- /* Check this channel belongs to science data */
- iDataChannel = 0;
- while ((data->channelNo[iDataChannel] != channelNo[channel]) &&
- (iDataChannel < data->nbChannels))
- {
- iDataChannel++;
- }
- if (iDataChannel == data->nbChannels)
- {
- amdlibSetErrMsg("Channel '%d' does not belong to science data",
- channelNo[channel]);
- return amdlibFAILURE;
- }
-
- /* get Vks */
- for (iTel = 0; iTel < nbTel; iTel++)
- {
- for (iPix = 0; iPix < nbPix; iPix++)
- { /* begin loop for iPix */
- vk[iTel][iPix] = p2vm->vkPt[iTel][iP2vmChannel][iPix]*
- fudge[channel];
- }
- }
-
- /* then sumVk */
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- sumVk[channel][iBase] = p2vm->sumVkPt[iBase][iP2vmChannel]*
- fudge[channel]*fudge[channel];
- }
-
- /* Extract time sequence of photometry and associated noise, and
- * normalize them */
- for (iFrame = 0; iFrame < nbFrames; iFrame++)
- {
- amdlibDOUBLE *photData[amdlibNB_TEL];
- amdlibDOUBLE *sigma2PhotData[amdlibNB_TEL];
- photData[0] = data->frame[iFrame].photo1;
- photData[1] = data->frame[iFrame].photo2;
- photData[2] = data->frame[iFrame].photo3;
- sigma2PhotData[0] = data->frame[iFrame].sigma2Photo1;
- sigma2PhotData[1] = data->frame[iFrame].sigma2Photo2;
- sigma2PhotData[2] = data->frame[iFrame].sigma2Photo3;
- /* extract time sequence of Phot and associated sigma2Phot */
- for (iTel = 0; iTel < nbTel; iTel++)
- {
- phot[iFrame][channel][iTel] =
- photData[iTel][iDataChannel] ;
- sigma2Phot[iFrame][channel][iTel] =
- sigma2PhotData[iTel][iDataChannel];
- }
- }
-
- for (iFrame = 0; iFrame < nbFrames; iFrame++)
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- /* Set used telescope according to the baseline */
- if (iBase == amdlibBASE12)
- {
- tel1 = amdlibTEL1;
- tel2 = amdlibTEL2;
- }
- else if (iBase == amdlibBASE23)
- {
- tel1 = amdlibTEL2;
- tel2 = amdlibTEL3;
- }
- else
- {
- tel1 = amdlibTEL1;
- tel2 = amdlibTEL3;
- }
- /* P1P2 is directly estimated, giving PiMultPj.
- * if P1 or P2 is negative, tag everything unavailable
- * using Blanking Value: photometries having no
- * associated flags */
- P1 = phot[iFrame][channel][tel1] ;
- P2 = phot[iFrame][channel][tel2] ;
- if (P1<minimumFlux||P2<minimumFlux)
- {
- if (P1<0.0) amdlibLogTrace("Too Low photometry frame %d channel %d tel %d:%lf (%lf)",iFrame+1,channel+1,tel1+1,P1,sigma2Phot[iFrame][channel][tel1]);
- photTablePtr[iFrame][iBase].PiMultPj[channel] = amdlibBLANKING_VALUE;
- photTablePtr[iFrame][iBase].fluxSumPiPj[channel] = amdlibBLANKING_VALUE;
- photTablePtr[iFrame][iBase].sigma2FluxSumPiPj[channel] = amdlibBLANKING_VALUE;
- photTablePtr[iFrame][iBase].fluxRatPiPj[channel] = amdlibBLANKING_VALUE;
- photTablePtr[iFrame][iBase].sigma2FluxRatPiPj[channel] = amdlibBLANKING_VALUE;
- }
- else
- {
- P1P2 = P1*P2;
- photTablePtr[iFrame][iBase].PiMultPj[channel] =
- P1P2 * sumVk[channel][iBase];
- /* Get integrated photometry and associated noise for each
- * beam . Involves a summation on interferometry pixels.*/
- v1=0;
- v2=0;
- for (iPix = 0; iPix < nbPix; iPix++)
- {
- v1 += vk[tel1][iPix];
- v2 += vk[tel2][iPix];
- }
- P1 = phot[iFrame][channel][tel1] * v1;
- sigma2P1 = sigma2Phot[iFrame][channel][tel1] * v1 * v1;
-
- P2 = phot[iFrame][channel][tel2] * v2;
- sigma2P2 = sigma2Phot[iFrame][channel][tel2] * v2 * v2;
-
- /* Get integrated photometry and associated noise for both.
- * Since we want to be able afterwards to retrieve the
- * individual photometries and errors, the errors of ratio
- * is just ratio of errors, (its just a coding)*/
-
- photTablePtr[iFrame][iBase].fluxSumPiPj[channel] = P1 + P2;
-
- photTablePtr[iFrame][iBase].sigma2FluxSumPiPj[channel] =
- sigma2P1 + sigma2P2;
-
- photTablePtr[iFrame][iBase].fluxRatPiPj[channel] =
- P1/P2;
-
- photTablePtr[iFrame][iBase].sigma2FluxRatPiPj[channel] =
- sigma2P1/sigma2P2;
- }
- }
- }
- }
- amdlibGetInstantPhotometry_FREEALL();
-
- return amdlibSUCCESS;
-}
-#undef amdlibGetInstantPhotometry_FREEALL
-
-/** Useful macro to free amdlibInvertGeneralizedP2v() structures */
-#define amdlibInvertGeneralizedP2v_FREEALL() \
- free(mat3); free(mat2); free(mat1); free(tgp2v); \
- amdlibFree2DArrayDouble(invcovmat); \
- amdlibFree2DArrayUnsignedCharWrapping(badp2vPtr); \
- amdlibFree3DArrayDoubleWrapping(gp2vPtr); \
- amdlibFree2DArrayDoubleWrapping(sigma2_ikMeanPtr); \
- amdlibFree3DArrayDoubleWrapping(gv2pPtr);
-/**
- * InvertGeneralized p2vm.
- *
- * @param p2v p2vm to invert.
- * @param badp2v part of bad pixels map related to the p2vm.
- * @param sigma2_ikMean the variance of the long exposure interferogram
- * (needed to estimate the covariance matrix).
- * @param binning number of frames in the current binning.
- * @param nbChannels number of valid spectral channels treated.
- * @param nbPix number of pixels (width of p2vm).
- * @param nbBases number of baselines.
- * @param gv2p output p2vm computed: invert of p2v.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibInvertGeneralizedP2v(/* Input */
- double *gp2v,
- unsigned char *badp2v,
- double *sigma2_ikMean,
- int nbChannels,
- int nbPix,
- int nbBases,
- /* Output */
- double *gv2p,
- amdlibERROR_MSG errMsg)
-{
- int iPix; /*usually loop on nbPix*/
- int lVis;
-
- double *tgp2v = NULL; /* gp2v's transposed matrix */
- double *mat1 = NULL;
- double *mat2 = NULL;
- double *mat3 = NULL;
- double **invcovmat = NULL;
-
- double ***gp2vPtr = NULL; /* Wrap on input gp2v */
- double **sigma2_ikMeanPtr = NULL; /* Wrap on input sigma2_ikMean */
- double ***gv2pPtr = NULL; /* Wrap on output gv2p */
- unsigned char **badp2vPtr = NULL;
-
-
- amdlibLogTrace("amdlibInvertGeneralizedP2v()");
-
- tgp2v = calloc(nbPix*(2*nbBases+1), sizeof(double));
- if (tgp2v == NULL)
- {
- amdlibSetErrMsg("Allocation of tgp2v failed");
- amdlibInvertGeneralizedP2v_FREEALL();
- return amdlibFAILURE;
- }
- mat1 = calloc((2*nbBases+1)*nbPix, sizeof(double));
- if (mat1 == NULL)
- {
- amdlibSetErrMsg("Allocation of mat1 failed");
- amdlibInvertGeneralizedP2v_FREEALL();
- return amdlibFAILURE;
- }
- mat2 = calloc((2*nbBases+1)*(2*nbBases+1), sizeof(double));
- if (mat2 == NULL)
- {
- amdlibSetErrMsg("Allocation of mat2 failed");
- amdlibInvertGeneralizedP2v_FREEALL();
- return amdlibFAILURE;
- }
- mat3 = calloc(nbPix*(2*nbBases+1), sizeof(double));
- if (mat3 == NULL)
- {
- amdlibSetErrMsg("Allocation of mat3 failed");
- amdlibInvertGeneralizedP2v_FREEALL();
- return amdlibFAILURE;
- }
- invcovmat = amdlibAlloc2DArrayDouble(nbPix, nbPix, errMsg);
- if (invcovmat == NULL)
- {
- amdlibInvertGeneralizedP2v_FREEALL();
- return amdlibFAILURE;
- }
-
- gp2vPtr = amdlibWrap3DArrayDouble(gp2v, nbPix, (2*nbBases+1), nbChannels, errMsg);
- if (gp2vPtr == NULL)
- {
- amdlibInvertGeneralizedP2v_FREEALL();
- return amdlibFAILURE;
- }
-
- sigma2_ikMeanPtr = amdlibWrap2DArrayDouble(sigma2_ikMean, nbPix, nbChannels, errMsg);
- if (sigma2_ikMeanPtr == NULL)
- {
- amdlibInvertGeneralizedP2v_FREEALL();
- return amdlibFAILURE;
- }
-
- gv2pPtr = amdlibWrap3DArrayDouble(gv2p, nbPix, (2*nbBases+1), nbChannels, errMsg);
- if (gv2pPtr == NULL)
- {
- amdlibInvertGeneralizedP2v_FREEALL();
- return amdlibFAILURE;
- }
-
- badp2vPtr = amdlibWrap2DArrayUnsignedChar(badp2v, nbPix, nbChannels, errMsg);
- if (badp2vPtr == NULL)
- {
- amdlibInvertGeneralizedP2v_FREEALL();
- return amdlibFAILURE;
- }
-
-
- for (lVis=0; lVis < nbChannels; lVis++)
- {
- memset(invcovmat[0], '\0', nbPix*nbPix*sizeof(double));
- /*see amdlibInvertP2v for details */
- for (iPix = 0; iPix < nbPix; iPix++)
- {
- if (badp2vPtr[lVis][iPix] == amdlibGOOD_PIXEL_FLAG)
- {
- invcovmat[iPix][iPix] = 1./sigma2_ikMeanPtr[lVis][iPix];
- }
- else
- {
- invcovmat[iPix][iPix] = 0.0;
- }
- }
- if (amdlibProductMatrix(invcovmat[0], gp2vPtr[lVis][0], mat1, nbPix,
- nbPix, (2*nbBases+1)) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Product matrix error.");
- amdlibInvertGeneralizedP2v_FREEALL();
- return amdlibFAILURE;
- }
-
- amdlibTransposeMatrix(gp2vPtr[lVis][0], tgp2v, nbPix, (2*nbBases+1));
-
- if (amdlibProductMatrix(tgp2v, mat1, mat2, (2*nbBases+1), nbPix,
- (2*nbBases+1)) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Product matrix error.");
- amdlibInvertGeneralizedP2v_FREEALL();
- return amdlibFAILURE;
- }
-
- amdlibInvertMatrix(mat2, (2*nbBases+1));
-
- if (amdlibProductMatrix(mat2, tgp2v, mat3, (2*nbBases+1), (2*nbBases+1),
- nbPix)!= amdlibSUCCESS)
- {
- amdlibSetErrMsg("Product matrix error.");
- amdlibInvertGeneralizedP2v_FREEALL();
- return amdlibFAILURE;
- }
- if (amdlibProductMatrix(mat3, invcovmat[0], gv2pPtr[lVis][0], (2*nbBases+1),
- nbPix, nbPix) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Product matrix error.");
- amdlibInvertGeneralizedP2v_FREEALL();
- return amdlibFAILURE;
- }
-
- }
- amdlibInvertGeneralizedP2v_FREEALL();
- return amdlibSUCCESS;
-}
-#undef amdlibInvertGeneralizedP2v_FREEALL
-
-/** Useful macro to free amdlibInvertP2v() structures */
-#define amdlibInvertP2v_FREEALL() \
- free(mat3); free(mat2); free(mat1); free(tp2v); \
- amdlibFree2DArrayDouble(covmat); \
- amdlibFree2DArrayUnsignedCharWrapping(badp2vPtr); \
- amdlibFree3DArrayDoubleWrapping(p2vPtr); \
- amdlibFree3DArrayDoubleWrapping(cova_mkPtr); \
- amdlibFree3DArrayDoubleWrapping(v2pPtr);
-/**
- * Invert p2vm, using theoretical variance of cova_mk , frame by frame
- *
- * @param p2v p2vm to invert.
- * @param badp2v part of bad pixels map related to the p2vm.
- * @param cova_mk the covariance of the continuum-corrected interferograms
- * @param binning number of frames in the current binning.
- * @param nbChannels number of valid spectral channels treated.
- * @param nbPix number of pixels (width of p2vm).
- * @param nbBases number of baselines.
- * @param v2p output p2vm computed: invert of p2v.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibInvertP2v(/* Input */
- double *p2v,
- unsigned char *badp2v,
- double *cova_mk,
- int nbChannels,
- int nbPix,
- int nbBases,
- /* Output */
- double *v2p,
- amdlibERROR_MSG errMsg)
-{
- int iPix,jPix; /*usually loop on nbPix*/
- int lVis;
-
- double *tp2v = NULL; /* p2v's transposed matrix */
- double *mat1 = NULL;
- double *mat2 = NULL;
- double *mat3 = NULL;
- double **covmat = NULL;
- double **invcovmat = NULL;
-
- double ***p2vPtr = NULL; /* Wrap on input p2v */
- double ***cova_mkPtr = NULL; /* Wrap on input cova_mk */
- double ***v2pPtr = NULL; /* Wrap on output v2p */
- unsigned char **badp2vPtr = NULL;
-
-
- amdlibLogTrace("amdlibInvertP2v()");
-
- tp2v = calloc(2*nbPix*nbBases, sizeof(double));
- if (tp2v == NULL)
- {
- amdlibSetErrMsg("Allocation of tp2v failed");
- amdlibInvertP2v_FREEALL();
- return amdlibFAILURE;
- }
- mat1 = calloc(2*nbBases*nbPix, sizeof(double));
- if (mat1 == NULL)
- {
- amdlibSetErrMsg("Allocation of mat1 failed");
- amdlibInvertP2v_FREEALL();
- return amdlibFAILURE;
- }
- mat2 = calloc(2*nbBases*2*nbBases, sizeof(double));
- if (mat2 == NULL)
- {
- amdlibSetErrMsg("Allocation of mat2 failed");
- amdlibInvertP2v_FREEALL();
- return amdlibFAILURE;
- }
- mat3 = calloc(2*nbPix*nbBases, sizeof(double));
- if (mat3 == NULL)
- {
- amdlibSetErrMsg("Allocation of mat3 failed");
- amdlibInvertP2v_FREEALL();
- return amdlibFAILURE;
- }
- covmat = amdlibAlloc2DArrayDouble(nbPix, nbPix, errMsg);
- if (covmat == NULL)
- {
- amdlibInvertP2v_FREEALL();
- return amdlibFAILURE;
- }
- /*invcovmat is just an alias for covmat after inversion for readibilty w.
- * the other invertPxx() programs */
- invcovmat=covmat;
-
- p2vPtr = amdlibWrap3DArrayDouble(p2v, nbPix, 2*nbBases, nbChannels, errMsg);
- if (p2vPtr == NULL)
- {
- amdlibInvertP2v_FREEALL();
- return amdlibFAILURE;
- }
- cova_mkPtr = amdlibWrap3DArrayDouble(cova_mk, nbPix, nbPix, nbChannels,
- errMsg);
- if (cova_mkPtr == NULL)
- {
- amdlibInvertP2v_FREEALL();
- return amdlibFAILURE;
- }
- v2pPtr = amdlibWrap3DArrayDouble(v2p, nbPix, 2*nbBases, nbChannels,
- errMsg);
- if (v2pPtr == NULL)
- {
- amdlibInvertP2v_FREEALL();
- return amdlibFAILURE;
- }
- badp2vPtr = amdlibWrap2DArrayUnsignedChar(badp2v, nbPix, nbChannels, errMsg);
- if (badp2vPtr == NULL)
- {
- amdlibInvertP2v_FREEALL();
- return amdlibFAILURE;
- }
-
- for (lVis=0; lVis < nbChannels; lVis++)
- {
- memset(covmat[0], '\0', nbPix*nbPix*sizeof(double));
- /* Define covariance Matrix */
- for (iPix = 0; iPix < nbPix; iPix++)
- {
- for (jPix = 0; jPix <= iPix; jPix++)
- {
- if (badp2vPtr[lVis][iPix] == amdlibGOOD_PIXEL_FLAG)
- {
- covmat[iPix][jPix] = cova_mkPtr[lVis][iPix][jPix];
- }
- else
- {
- if (iPix==jPix)
- {
- covmat[iPix][jPix] = 1.0;
- }
- else
- {
- covmat[iPix][jPix] = 0.0;
- }
- }
- covmat[jPix][iPix] = covmat[iPix][jPix];
- }
- }
- /* compute incovmat */
- amdlibInvertMatrix(covmat[0], nbPix);
- /* set Bad Pix influence to zero */
- for (iPix = 0; iPix < nbPix; iPix++)
- {
- if (badp2vPtr[lVis][iPix] != amdlibGOOD_PIXEL_FLAG)
- {
- for (jPix = 0; jPix < nbPix; jPix++)
- {
- invcovmat[jPix][iPix] = 0.0;
- invcovmat[iPix][jPix] = 0.0;
- }
- }
- }
-
-
- /* computing the v2p (inverse of p2v) of this lambda,
- * following notation of report amb-igr-xx:
- * compute mat1 = cov^-1 x p2v
- * compute mat2 = tp2v x cov^-1 x p2v
- * then mat2 = (mat2)^-1
- * then mat3 = tp2v cov^-1
- * the v2p being
- * (tp2v x cov^-1 x p2v)^-1 x tp2v x cov^-1
- * is also mat2 x mat3
- */
- if (amdlibProductMatrix(invcovmat[0], p2vPtr[lVis][0], mat1, nbPix,
- nbPix, 2*nbBases) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Product matrix error.");
- amdlibInvertP2v_FREEALL();
- return amdlibFAILURE;
- }
-
- amdlibTransposeMatrix(p2vPtr[lVis][0], tp2v, nbPix, 2*nbBases);
-
- if (amdlibProductMatrix(tp2v, mat1, mat2, 2*nbBases, nbPix,
- 2*nbBases) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Product matrix error.");
- amdlibInvertP2v_FREEALL();
- return amdlibFAILURE;
- }
-
- amdlibInvertMatrix(mat2, 2*nbBases);
-
- if (amdlibProductMatrix(mat2, tp2v, mat3, 2*nbBases, 2*nbBases,
- nbPix)!= amdlibSUCCESS)
- {
- amdlibSetErrMsg("Product matrix error.");
- amdlibInvertP2v_FREEALL();
- return amdlibFAILURE;
- }
- if (amdlibProductMatrix(mat3, invcovmat[0], v2pPtr[lVis][0], 2*nbBases,
- nbPix, nbPix) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Product matrix error.");
- amdlibInvertP2v_FREEALL();
- return amdlibFAILURE;
- }
- }
- amdlibInvertP2v_FREEALL();
- return amdlibSUCCESS;
-}
-#undef amdlibInvertP2v_FREEALL
-
-
-/** Useful macro to free amdlibComputeFudgeFactor() structures */
-#define amdlibComputeFudgeFactor_FREEALL() \
- amdlibFree2DArrayDoubleWrapping(ikMeanPtr); \
- amdlibFree3DArrayDoubleWrapping(gv2pPtr);
-/**
- * Compute fudge factor vector to apply on photometries.
- *
- * @param gv2p input p2vm used.
- * @param ikMean long-exposure interferogram.
- * @param nbLVis number of spectral channels treated.
- * @param nbPix number of pixels (width of p2vm).
- * @param nbBases number of baselines.
- * @param fudge factor vector
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibComputeFudgeFactor(/* Input */
- double *gv2p,
- double *ikMean,
- int nbLVis,
- int nbPix,
- int nbBases,
- /* Output */
- double *fudge,
- amdlibERROR_MSG errMsg)
-{
-
- /* loop indexes and associated limits */
- int iPix; /*usually loop on nbPix*/
- int lVis = 0;
-
- double meanFudge=0.0;
- double **ikMeanPtr = NULL; /* Wrap on input ikMean */
- double ***gv2pPtr = NULL; /* Wrap on input gv2p */
-
- amdlibLogTrace("amdlibComputeFudgeFactor()");
-
- ikMeanPtr = amdlibWrap2DArrayDouble(ikMean, nbPix, nbLVis, errMsg);
- if (ikMeanPtr == NULL)
- {
- amdlibComputeFudgeFactor_FREEALL();
- return amdlibFAILURE;
- }
- gv2pPtr = amdlibWrap3DArrayDouble(gv2p, nbPix, (2*nbBases+1), nbLVis, errMsg);
- if (gv2pPtr == NULL)
- {
- amdlibComputeFudgeFactor_FREEALL();
- return amdlibFAILURE;
- }
- if (amdlibGetUserPref(amdlibNO_FUDGE).set==amdlibTRUE)
- {
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- fudge[lVis]=1.0;
- }
- }
- else
- {
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- fudge[lVis] = 0.0;
- /* The matrix-vector product */
- for (iPix = 0; iPix < nbPix; iPix++)
- {
- fudge[lVis] += gv2pPtr[lVis][2*nbBases][iPix] *
- ikMeanPtr[lVis][iPix];
- }
- meanFudge+=fudge[lVis];
- }
- meanFudge/=nbLVis;
- if (meanFudge==meanFudge) /*nan protect*/
- {
- amdlibLogInfoDetail("Average Linearization Factor: %f",meanFudge);
- }
- else
- {
- amdlibLogInfoDetail("Average Linearization Factor: %f",meanFudge);
- amdlibLogInfoDetail("Not-A-Number trapped, Data May be Invalid");
- amdlibLogInfoDetail("Usually Means a Bad BadPixelMap,");
- amdlibLogInfoDetail("or a Wrong Dispersion Law (LR mode).");
- amdlibLogInfoDetail("Program will be slow. use with Caution.");
- /* try to avoid nan fudges anyway */
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- if(!(fudge[lVis]==fudge[lVis]))
- {
- fudge[lVis] = 1.0; /* */
- }
- }
- }
- }
- amdlibComputeFudgeFactor_FREEALL();
- return amdlibSUCCESS;
-}
-#undef amdlibComputeFudgeFactor_FREEALL
-
-void amdlibFilterByChiSquare(amdlibVIS *instantCorrFlux,double **chisq, double range)
-{
- double mean,rms,median;
- int nbFrames=instantCorrFlux->nbFrames;
- int nbBases=instantCorrFlux->nbBases;
- int nbLVis=instantCorrFlux->nbWlen;
- int iFrame, iBase, lVis, nbRejected=0;
-
- mean=amdlibAvgValues(nbFrames*nbLVis, chisq[0]);
- rms=amdlibRmsValues(nbFrames*nbLVis, chisq[0]);
- median=amdlibQuickSelectDble(chisq[0],nbFrames*nbLVis);
- amdlibLogInfoDetail("Correlated Flux fit statistics: mean = %lf, rms = %lf, median = %lf",mean,rms,median);
- if (range==0) range=median+3*rms;
- if (range>0)
- {
- for (iFrame=0; iFrame < nbFrames; iFrame++)
- {
- for (lVis=0; lVis < nbLVis; lVis++)
- {
- /* reject frames with worse chi2 than range */
- if (chisq[iFrame][lVis]>range)
- {
- nbRejected++;
- for (iBase=0; iBase < nbBases; iBase++)
- {
- instantCorrFlux->table[iFrame*nbBases+iBase].flag[lVis]=amdlibTRUE;
- }
- }
- }
- }
- if (nbRejected>0)
- {
- amdlibLogInfoDetail("(Rejecting %f %% data with fringe fit reduced Chi Square > %lf)",100.0*(float)nbRejected/(float)(nbLVis*nbFrames),range);
- }
- }
-}
-
-amdlibCOMPL_STAT amdlibCorrectFromPistonExtenuation(amdlibVIS *instantCorrFlux,
- amdlibPISTON *instantOpd,
- amdlibWAVELENGTH *wave,
- amdlibBAND band,
- double R,
- amdlibERROR_MSG errMsg)
-{
- amdlibLogWarning("Correction for piston extenuation not yet implemented.",R);
- return amdlibSUCCESS;
-}
-
-#if 0
-/** Useful macro to free all dynamically allocated structures */
-#define amdlibCorrectFromPistonExtenuation_FREEALL() \
- amdlibFree2DArrayDoubleWrapping(instantOpdPistonPtr); \
- amdlibFree2DArrayWrapping((void **)instantCorrFluxTablePt);
-
-amdlibCOMPL_STAT amdlibCorrectFromPistonExtenuation(amdlibVIS *instantCorrFlux,
- amdlibPISTON *instantOpd,
- amdlibWAVELENGTH *wave,
- amdlibBAND band,
- double R,
- amdlibERROR_MSG errMsg)
-{
- int nbFrames=instantCorrFlux->nbFrames;
- int nbBases=instantCorrFlux->nbBases;
- int nbLVis=instantCorrFlux->nbWlen;
- int iFrame, iBase, lVis;
- double extenuation;
- amdlibDOUBLE **instantOpdPistonPtr = NULL;
- amdlibVIS_TABLE_ENTRY **instantCorrFluxTablePt = NULL;
-
- amdlibLogTrace("amdlibCorrectFromPistonExtenuation()");
-
- if (instantOpd->bandFlag[band] == amdlibFALSE)
- {
- amdlibLogError("Piston for band '%d' not ever computed", band);
- return amdlibFAILURE;
- }
-
- amdlibLogInfoDetail("Correction for piston extenuation (R=%f)",R);
- instantOpdPistonPtr =
- amdlibWrap2DArrayDouble(instantOpd->pistonOPDArray[band],
- instantOpd->nbBases,
- instantOpd->nbFrames, errMsg);
- if (instantOpdPistonPtr == NULL)
- {
- amdlibLogError("amdlibWrap2DArrayDouble() failed !");
- amdlibLogErrorDetail(errMsg);
- amdlibCorrectFromPistonExtenuation_FREEALL();
- return amdlibFAILURE;
- }
- instantCorrFluxTablePt =
- (amdlibVIS_TABLE_ENTRY **)amdlibWrap2DArray(instantCorrFlux->table,
- nbBases, nbFrames,
- sizeof(amdlibVIS_TABLE_ENTRY),
- errMsg);
- if (instantCorrFluxTablePt == NULL)
- {
- amdlibCorrectFromPistonExtenuation_FREEALL();
- return amdlibFAILURE;
- }
-
- for (iFrame=0; iFrame < nbFrames; iFrame++)
- {
- for (iBase=0; iBase < nbBases; iBase++)
- {
- if(!amdlibCompareDouble(instantOpdPistonPtr[iFrame][iBase],amdlibBLANKING_VALUE))
- {
- for (lVis=0; lVis < nbLVis; lVis++)
- {
- if(instantCorrFluxTablePt[iFrame][iBase].flag[lVis]==amdlibFALSE)
- {
- extenuation=(M_PI*instantOpdPistonPtr[iFrame][iBase]/
- (R*wave->wlen[lVis]));
- extenuation=sin(extenuation)/extenuation;
- instantCorrFluxTablePt[iFrame][iBase].vis[lVis].re /= extenuation;
- instantCorrFluxTablePt[iFrame][iBase].vis[lVis].im /= extenuation;
- instantCorrFluxTablePt[iFrame][iBase].sigma2Vis[lVis].re /= extenuation;
- instantCorrFluxTablePt[iFrame][iBase].sigma2Vis[lVis].im /= extenuation;
- instantCorrFluxTablePt[iFrame][iBase].visCovRI[lVis] /= extenuation;
- fprintf(stderr,"%lf %lf %lf\n",instantOpdPistonPtr[iFrame][iBase],extenuation,sqrt(amdlibPow2(instantCorrFluxTablePt[iFrame][iBase].vis[lVis].re)+amdlibPow2(instantCorrFluxTablePt[iFrame][iBase].vis[lVis].im)));
- }
- }
- }
- }
- }
- return amdlibSUCCESS;
-}
-#undef amdlibCorrectFromPistonExtenuation_FREEALL
-#endif
-
-#define amdlibComputeChiSquare_FREEALL() \
- amdlibFree2DArrayDoubleWrapping(mkPtr); \
- amdlibFree2DArrayDoubleWrapping(sigma2_mkPtr); \
- amdlibFree2DArrayUnsignedCharWrapping(badp2vPtr); \
- amdlibFree3DArrayDoubleWrapping(p2vPtr); \
- amdlibFree2DArrayWrapping((void **)instantCorrFluxTablePt); \
- free(tp2v); free(model); free(mk_model); \
- free(mat1); free(mat2);
-
-amdlibCOMPL_STAT amdlibComputeChiSquare(/* Input */
- amdlibVIS *instantCorrFlux,
- double *p2v,
- unsigned char *badp2v,
- double *mk,
- double *sigma2_mk,
- int iFrame,
- int nbLVis,
- int nbPix,
- int nbBases,
- /* Output */
- double **chisq,
- amdlibERROR_MSG errMsg)
-{
- int iPix,jPix; /*usually loop on nbPix*/
- int lVis;
- int iBase;
-
- double *model=NULL;
- double *mk_model=NULL;
- double *tp2v = NULL;
- double *mat1, *mat2;
-
- double ***p2vPtr = NULL;
- double **mkPtr = NULL;
- double **sigma2_mkPtr = NULL;
- amdlibVIS_TABLE_ENTRY **instantCorrFluxTablePt = NULL; /* Wrap on output instantCorrFlux->table */
- unsigned char **badp2vPtr = NULL;
-
- amdlibLogTrace("amdlibComputeChiSquare()");
- model= calloc(2*nbBases, sizeof(double));
- mk_model= calloc(nbPix, sizeof(double));
- tp2v=calloc(nbPix*2*nbBases, sizeof(double));
- mat1=calloc(nbPix, sizeof(double));
- mat2=calloc(nbPix, sizeof(double));
- mkPtr = amdlibWrap2DArrayDouble(mk, nbPix, nbLVis, errMsg);
- if (mkPtr == NULL)
- {
- amdlibComputeChiSquare_FREEALL();
- return amdlibFAILURE;
- }
- sigma2_mkPtr = amdlibWrap2DArrayDouble(sigma2_mk, nbPix, nbLVis, errMsg);
- if (sigma2_mkPtr == NULL)
- {
- amdlibComputeChiSquare_FREEALL();
- return amdlibFAILURE;
- }
- p2vPtr = amdlibWrap3DArrayDouble(p2v, nbPix, 2*nbBases, nbLVis, errMsg);
- if (p2vPtr == NULL)
- {
- amdlibComputeChiSquare_FREEALL();
- return amdlibFAILURE;
- }
- badp2vPtr = amdlibWrap2DArrayUnsignedChar(badp2v, nbPix, nbLVis, errMsg);
- if (badp2vPtr == NULL)
- {
- amdlibComputeChiSquare_FREEALL();
- return amdlibFAILURE;
- }
-
- instantCorrFluxTablePt =
- (amdlibVIS_TABLE_ENTRY **)amdlibWrap2DArray(instantCorrFlux->table,
- nbBases, instantCorrFlux->nbFrames,
- sizeof(amdlibVIS_TABLE_ENTRY),
- errMsg);
- if (instantCorrFluxTablePt == NULL)
- {
- amdlibComputeChiSquare_FREEALL();
- return amdlibFAILURE;
- }
- for (lVis=0; lVis < nbLVis; lVis++)
- {
- /*transpose p2v*/
- amdlibTransposeMatrix(p2vPtr[lVis][0], tp2v, nbPix, 2*nbBases);
- /* create model vector */
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- model[iBase]= instantCorrFluxTablePt[iFrame][iBase].vis[lVis].re;
- model[iBase+nbBases]=instantCorrFluxTablePt[iFrame][iBase].vis[lVis].im;
- }
- /* convert to model mks */
- if (amdlibProductMatrix( model, tp2v, mk_model, 1, 2*nbBases, nbPix) != amdlibSUCCESS)
- {
- amdlibSetErrMsg("Product matrix error.");
- amdlibComputeChiSquare_FREEALL();
- return amdlibFAILURE;
- }
- chisq[iFrame][lVis]=0.0;
- jPix = 0;
- /* compute Sum[(model-measure)^2/sigma2] */
- for (iPix = 0; iPix < nbPix; iPix++)
- {
- if (badp2vPtr[lVis][iPix] == amdlibGOOD_PIXEL_FLAG)
- {
- mk_model[iPix]-=mkPtr[lVis][iPix];
- chisq[iFrame][lVis] += amdlibPow2(mk_model[iPix])/sigma2_mkPtr[lVis][iPix];
- jPix++;
- }
- }
- chisq[iFrame][lVis] /= jPix-(2*nbBases)-1;
- }
-
- amdlibComputeChiSquare_FREEALL();
- return amdlibSUCCESS;
-}
-#undef amdlibComputeChiSquare_FREEALL
-
-/** Useful macro to free amdlibComputeCorrFlux() structures */
-#define amdlibComputeCorrFlux_FREEALL() \
- amdlibFree2DArrayDoubleWrapping(mkPtr); \
- amdlibFree2DArrayDoubleWrapping(sigma2_mkPtr); \
- amdlibFree3DArrayDoubleWrapping(v2pPtr); \
- amdlibFree2DArrayWrapping((void **)instantCorrFluxTablePt);
-/**
- * Compute correlated flux.
- *
- * @param v2p input p2vm used.
- * @param mk continumm-corrected interferograms.
- * @param sigma2_mk the associated variances.
- * @param binning number of frames in the current binning.
- * @param nbLVis number of spectral channels treated.
- * @param nbPix number of pixels (width of p2vm).
- * @param nbBases number of baselines.
- * @param vis (instant vis) structure were results are stored.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibComputeCorrFlux(/* Input */
- double *v2p,
- double *mk,
- double *sigma2_mk,
- int iFrame,
- int nbLVis,
- int nbPix,
- int nbBases,
- /* Output */
- amdlibVIS *instantCorrFlux,
- amdlibERROR_MSG errMsg)
-{
-
- /* loop indexes and associated limits */
- int iPix; /*usually loop on nbPix*/
- int iBase; /*usually loop on nbBases*/
- int lVis = 0;
-
- amdlibCOMPLEX CorrFlux;
- amdlibCOMPLEX sigma2_CorrFlux;
-
- double cov_RI;
-
- double **mkPtr = NULL; /* Wrap on input mk */
- double **sigma2_mkPtr = NULL; /* Wrap on input sigma2_mk */
- double ***v2pPtr = NULL; /* Wrap on input v2p */
- amdlibVIS_TABLE_ENTRY **instantCorrFluxTablePt = NULL; /* Wrap on output instantCorrFlux->table */
-
- amdlibLogTrace("amdlibComputeCorrFlux()");
-
- mkPtr = amdlibWrap2DArrayDouble(mk, nbPix, nbLVis, errMsg);
- if (mkPtr == NULL)
- {
- amdlibComputeCorrFlux_FREEALL();
- return amdlibFAILURE;
- }
- sigma2_mkPtr = amdlibWrap2DArrayDouble(sigma2_mk, nbPix, nbLVis,
- errMsg);
- if (sigma2_mkPtr == NULL)
- {
- amdlibComputeCorrFlux_FREEALL();
- return amdlibFAILURE;
- }
- v2pPtr = amdlibWrap3DArrayDouble(v2p, nbPix, 2*nbBases, nbLVis, errMsg);
- if (v2pPtr == NULL)
- {
- amdlibComputeCorrFlux_FREEALL();
- return amdlibFAILURE;
- }
- instantCorrFluxTablePt =
- (amdlibVIS_TABLE_ENTRY **)amdlibWrap2DArray(instantCorrFlux->table,
- nbBases, instantCorrFlux->nbFrames,
- sizeof(amdlibVIS_TABLE_ENTRY),
- errMsg);
- if (instantCorrFluxTablePt == NULL)
- {
- amdlibComputeCorrFlux_FREEALL();
- return amdlibFAILURE;
- }
-
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- { /* begin loop for iBase */
-
- /* Initialization of the useful data */
- CorrFlux.re = 0.0;
- CorrFlux.im = 0.0;
- sigma2_CorrFlux.re = 0.0;
- sigma2_CorrFlux.im = 0.0;
- cov_RI = 0.0;
-
- /* The matrix-vector product */
- for (iPix = 0; iPix < nbPix; iPix++)
- {
- /* calculation of CorrFlux (eq 33) and
- * save those CorrFlux into table 'instantCorrFlux'
- */
- CorrFlux.re += v2pPtr[lVis][iBase][iPix] *
- mkPtr[lVis][iPix];
-
- CorrFlux.im += v2pPtr[lVis][iBase+nbBases][iPix] *
- mkPtr[lVis][iPix];
-
- /* calculation of sigma^2 of CorrFlux
- * and the COV(R,I) see eqs 44, 45 and 46
- * used in bias see formula AMB-IGR-019 number 36
- */
-
- /*eq 44*/
- sigma2_CorrFlux.re += v2pPtr[lVis][iBase][iPix] *
- v2pPtr[lVis][iBase][iPix] *
- sigma2_mkPtr[lVis][iPix];
-
- /*eq 45*/
- sigma2_CorrFlux.im += v2pPtr[lVis][iBase+nbBases][iPix] *
- v2pPtr[lVis][iBase+nbBases][iPix] *
- sigma2_mkPtr[lVis][iPix];
-
- cov_RI += v2pPtr[lVis][iBase][iPix] *
- v2pPtr[lVis][iBase+nbBases][iPix] *
- sigma2_mkPtr[lVis][iPix];
-
- }
-
- /* Store For time being Raw Correlated Flux in table Vis */
-
- instantCorrFluxTablePt[iFrame][iBase].vis[lVis].re = CorrFlux.re;
-
- instantCorrFluxTablePt[iFrame][iBase].vis[lVis].im = CorrFlux.im;
-
- instantCorrFluxTablePt[iFrame][iBase].sigma2Vis[lVis].re = sigma2_CorrFlux.re;
-
- instantCorrFluxTablePt[iFrame][iBase].sigma2Vis[lVis].im = sigma2_CorrFlux.im;
-
- instantCorrFluxTablePt[iFrame][iBase].visCovRI[lVis] = cov_RI;
- }
- }
- amdlibComputeCorrFlux_FREEALL();
- return amdlibSUCCESS;
-}
-#undef amdlibComputeCorrFlux_FREEALL
-
-/** Useful macro to free amdlibSumPhotometry() structures */
-#define amdlibSumPhotometry_FREEALL() \
- amdlibFree2DArrayWrapping((void **)instantPhotTablePtr); \
- amdlibFree2DArrayWrapping((void **)summedPhotTablePtr); \
- amdlibFree3DArrayDouble(tmpphot); \
- amdlibFree3DArrayDouble(s2phot);
-/**
- * Sum photometry.
- *
- * @param instantPhot photometry to sum.
- * @param iBin index of current binning.
- * @param summedPhot photometry structure were results are stored.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibSumPhotometry(amdlibPHOTOMETRY *instantPhot,
- int firstFrame,
- int nbFrames,
- int iBin,
- amdlibPHOTOMETRY *summedPhot)
-{
- int iFrame, runningFrame, nbGoodFrames; /* usually loop on number of frames */
- int iBase; /*usually loop on nbBases*/
- int nbBases = instantPhot->nbBases;
- int lPhot = 0;
- int nbLPhot = instantPhot->nbWlen;
-
- double ***tmpphot=NULL,***s2phot=NULL;
- double P1MoreP2, P1DiviP2, P1, P2,sigma2P1MoreP2,sigma2P1DiviP2, sigma2_P1, sigma2_P2;
-
- amdlibPHOTOMETRY_TABLE_ENTRY **instantPhotTablePtr = NULL;
- amdlibPHOTOMETRY_TABLE_ENTRY **summedPhotTablePtr = NULL;
- static amdlibERROR_MSG errMsg;
-
- instantPhotTablePtr =
- (amdlibPHOTOMETRY_TABLE_ENTRY **)amdlibWrap2DArray(instantPhot->table,
- nbBases, instantPhot->nbFrames,
- sizeof(amdlibPHOTOMETRY_TABLE_ENTRY),
- errMsg);
- if (instantPhotTablePtr == NULL)
- {
- amdlibSumPhotometry_FREEALL();
- return amdlibFAILURE;
- }
- summedPhotTablePtr =
- (amdlibPHOTOMETRY_TABLE_ENTRY **)amdlibWrap2DArray(summedPhot->table,
- nbBases, summedPhot->nbFrames,
- sizeof(amdlibPHOTOMETRY_TABLE_ENTRY),
- errMsg);
- if (summedPhotTablePtr == NULL)
- {
- amdlibSumPhotometry_FREEALL();
- return amdlibFAILURE;
- }
-
- /* Allocate memory for retrieval of individual (per-beam) photometries
- * prior to summation of per-beam photometries and errors before
- * reconversion to Sum and Ratio of Fluxes and Errors*/
- tmpphot = amdlibAlloc3DArrayDouble(2, nbLPhot, nbBases, errMsg);
- s2phot = amdlibAlloc3DArrayDouble(2, nbLPhot, nbBases, errMsg);
-
- amdlibLogTrace("amdlibSumPhotometry()");
-
- for (lPhot = 0; lPhot < nbLPhot; lPhot++)
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- summedPhotTablePtr[iBin][iBase].PiMultPj[lPhot] = 0.0;
- nbGoodFrames=0;
- for (iFrame = 0, runningFrame=firstFrame; iFrame < nbFrames;
- iFrame++, runningFrame++)
- {
- sigma2P1MoreP2 =
- instantPhotTablePtr[runningFrame][iBase].sigma2FluxSumPiPj[lPhot];
- if (!amdlibCompareDouble(sigma2P1MoreP2,amdlibBLANKING_VALUE))
- {
- P1MoreP2 =
- instantPhotTablePtr[runningFrame][iBase].fluxSumPiPj[lPhot];
- P1DiviP2 =
- instantPhotTablePtr[runningFrame][iBase].fluxRatPiPj[lPhot];
- sigma2P1DiviP2 =
- instantPhotTablePtr[runningFrame][iBase].sigma2FluxRatPiPj[lPhot];
-
- P2 = P1MoreP2 / (1.0 + P1DiviP2) ;
- sigma2_P2 = sigma2P1MoreP2 / (1.0 + sigma2P1DiviP2) ;
-
- P1 = P1MoreP2*P1DiviP2/(1.0+P1DiviP2);
- sigma2_P1 = sigma2P1MoreP2*sigma2P1DiviP2/(1.0+sigma2P1DiviP2);
-
- tmpphot[iBase][lPhot][0] += P1;
- tmpphot[iBase][lPhot][1] += P2;
-
- s2phot[iBase][lPhot][0] += sigma2_P1;
- s2phot[iBase][lPhot][1] += sigma2_P2;
-
- summedPhotTablePtr[iBin][iBase].PiMultPj[lPhot] +=
- instantPhotTablePtr[runningFrame][iBase].PiMultPj[lPhot];
- nbGoodFrames++;
- }
- }
- if (nbGoodFrames==0)
- {
- summedPhotTablePtr[iBin][iBase].fluxSumPiPj[lPhot] = amdlibBLANKING_VALUE;
- summedPhotTablePtr[iBin][iBase].sigma2FluxSumPiPj[lPhot] = amdlibBLANKING_VALUE;
- summedPhotTablePtr[iBin][iBase].fluxRatPiPj[lPhot] = amdlibBLANKING_VALUE;
- summedPhotTablePtr[iBin][iBase].sigma2FluxRatPiPj[lPhot] = amdlibBLANKING_VALUE;
- summedPhotTablePtr[iBin][iBase].PiMultPj[lPhot] = amdlibBLANKING_VALUE;
- }
- else
- {
- summedPhotTablePtr[iBin][iBase].fluxSumPiPj[lPhot]=
- tmpphot[iBase][lPhot][0]+tmpphot[iBase][lPhot][1];
- summedPhotTablePtr[iBin][iBase].sigma2FluxSumPiPj[lPhot]=
- s2phot[iBase][lPhot][0]+s2phot[iBase][lPhot][1];
- summedPhotTablePtr[iBin][iBase].fluxRatPiPj[lPhot]=
- tmpphot[iBase][lPhot][0]/tmpphot[iBase][lPhot][1];
- summedPhotTablePtr[iBin][iBase].sigma2FluxRatPiPj[lPhot]=
- s2phot[iBase][lPhot][0]/s2phot[iBase][lPhot][1];
- }
- }
- }
-
- amdlibSumPhotometry_FREEALL();
- return amdlibSUCCESS;
-}
-#undef amdlibSumPhotometry_FREEALL
-
-/** Useful macro to free amdlibMeanCpxVis() structures */
-#define amdlibMeanCpxVis_FREEALL() \
- free(sigma2_normedVis_im); free(sigma2_normedVis_re); \
- free(normedVis_im); free(normedVis_re); \
- amdlibFree2DArrayWrapping((void **)corrFluxTablePtr); \
- amdlibFree2DArrayWrapping((void **)photTablePtr); \
- amdlibFree2DArrayWrapping((void **)normedVisTablePtr);
-/**
- * Compute averaged, normalized visibilites from a sequence (bin) of
- * instanteous correlated fluxes.
- *
- * @param instantCorrFlux the bin of instanteous correlated fluxes.
- * @param photometry the associated bin of instantenous fluxes.
- * @param iBin index of the results to be written in the output (binned)
- * normedVis structure.
- * @param normedVis structure were results are stored.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibMeanCpxVis(amdlibVIS *instantCorrFlux,
- amdlibPHOTOMETRY *photometry,
- int firstFrame,
- int nbFrames,
- int iBin,
- amdlibVIS *normedVis)
-{
- int iFrame, runningFrame, nbGoodFrames; /* usually loop on number of frames */
- int iBase; /*usually loop on nbBases*/
- int nbBases = instantCorrFlux->nbBases;
-
- int lVis = 0;
- int nbLVis = instantCorrFlux->nbWlen;
-
- amdlibCOMPLEX CorrFlux, sigma2_CorrFlux;
-
- double P1P2;
- double *normedVis_re = NULL;
- double *normedVis_im = NULL;
- double *sigma2_normedVis_re = NULL;
- double *sigma2_normedVis_im = NULL;
-
- amdlibVIS_TABLE_ENTRY **corrFluxTablePtr = NULL;
- amdlibPHOTOMETRY_TABLE_ENTRY **photTablePtr = NULL;
- amdlibVIS_TABLE_ENTRY **normedVisTablePtr = NULL;
- static amdlibERROR_MSG errMsg;
-
-
- amdlibLogTrace("amdlibMeanCpxVis()");
-
- /* Allocate memory for intermediate structures */
- normedVis_re = calloc(nbFrames,sizeof(double));
- if (normedVis_re == NULL)
- {
- amdlibMeanCpxVis_FREEALL();
- return amdlibFAILURE;
- }
- normedVis_im = calloc(nbFrames,sizeof(double));
- if (normedVis_im == NULL)
- {
- amdlibMeanCpxVis_FREEALL();
- return amdlibFAILURE;
- }
- sigma2_normedVis_re = calloc(nbFrames,sizeof(double));
- if (sigma2_normedVis_re == NULL)
- {
- amdlibMeanCpxVis_FREEALL();
- return amdlibFAILURE;
- }
- sigma2_normedVis_im = calloc(nbFrames,sizeof(double));
- if (sigma2_normedVis_im == NULL)
- {
- amdlibMeanCpxVis_FREEALL();
- return amdlibFAILURE;
- }
-
- /* And wrap structures specified as parametres */
- corrFluxTablePtr =
- (amdlibVIS_TABLE_ENTRY **)amdlibWrap2DArray(instantCorrFlux->table,
- instantCorrFlux->nbBases,
- instantCorrFlux->nbFrames,
- sizeof(amdlibVIS_TABLE_ENTRY),
- errMsg);
- if (corrFluxTablePtr == NULL)
- {
- amdlibMeanCpxVis_FREEALL();
- return amdlibFAILURE;
- }
- photTablePtr =
- (amdlibPHOTOMETRY_TABLE_ENTRY **)amdlibWrap2DArray(photometry->table,
- nbBases, photometry->nbFrames,
- sizeof(amdlibPHOTOMETRY_TABLE_ENTRY),
- errMsg);
- if (photTablePtr == NULL)
- {
- amdlibMeanCpxVis_FREEALL();
- return amdlibFAILURE;
- }
- normedVisTablePtr =
- (amdlibVIS_TABLE_ENTRY **)amdlibWrap2DArray(normedVis->table,
- nbBases, normedVis->nbFrames,
- sizeof(amdlibVIS_TABLE_ENTRY),
- errMsg);
- if (normedVisTablePtr == NULL)
- {
- amdlibMeanCpxVis_FREEALL();
- return amdlibFAILURE;
- }
-
- /* Compute averaged, normalized visibilites */
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- nbGoodFrames =0;
- for (iFrame = 0, runningFrame=firstFrame; iFrame < nbFrames;
- iFrame++, runningFrame++)
- {
- P1P2 = photTablePtr[runningFrame][iBase].PiMultPj[lVis];
- if ((!amdlibCompareDouble(P1P2, amdlibBLANKING_VALUE)) &&
- (corrFluxTablePtr[runningFrame][iBase].flag[lVis] ==
- amdlibFALSE))
- {
- CorrFlux.re =
- corrFluxTablePtr[runningFrame][iBase].vis[lVis].re;
- CorrFlux.im =
- corrFluxTablePtr[runningFrame][iBase].vis[lVis].im;
-
- sigma2_CorrFlux.re =
- corrFluxTablePtr[runningFrame][iBase].sigma2Vis[lVis].re;
- sigma2_CorrFlux.im =
- corrFluxTablePtr[runningFrame][iBase].sigma2Vis[lVis].im;
-
- normedVis_re[nbGoodFrames] = CorrFlux.re /
- (2 * amdlibSignedSqrt(P1P2));
- normedVis_im[nbGoodFrames] = CorrFlux.im /
- (2 * amdlibSignedSqrt(P1P2));
- sigma2_normedVis_re[nbGoodFrames] = sigma2_CorrFlux.re /
- (4 * P1P2);
- sigma2_normedVis_im[nbGoodFrames] = sigma2_CorrFlux.im /
- (4 * P1P2);
- nbGoodFrames++;
- }
- }
- if (nbGoodFrames > 0)
- {
- /* Store results */
- normedVisTablePtr[iBin][iBase].flag[lVis]=amdlibFALSE;
- normedVisTablePtr[iBin][iBase].vis[lVis].re =
- amdlibAvgValues(nbGoodFrames, normedVis_re);
-
- normedVisTablePtr[iBin][iBase].vis[lVis].im =
- amdlibAvgValues(nbGoodFrames, normedVis_im);
-
- normedVisTablePtr[iBin][iBase].sigma2Vis[lVis].re =
- amdlibAvgValues(nbGoodFrames, sigma2_normedVis_re);
-
- normedVisTablePtr[iBin][iBase].sigma2Vis[lVis].im =
- amdlibAvgValues(nbGoodFrames, sigma2_normedVis_im);
- normedVisTablePtr[iBin][iBase].flag[lVis]=amdlibFALSE;
- }
- else
- {
- normedVisTablePtr[iBin][iBase].vis[lVis].re=amdlibBLANKING_VALUE;
- normedVisTablePtr[iBin][iBase].vis[lVis].im=amdlibBLANKING_VALUE;
- normedVisTablePtr[iBin][iBase].sigma2Vis[lVis].re =amdlibBLANKING_VALUE;
- normedVisTablePtr[iBin][iBase].sigma2Vis[lVis].im =amdlibBLANKING_VALUE;
- normedVisTablePtr[iBin][iBase].flag[lVis]=amdlibTRUE;
- }
-
- }
- }
-
- amdlibMeanCpxVis_FREEALL();
- return amdlibSUCCESS;
-}
-#undef amdlibMeanCpxVis_FREEALL
-
-/** Useful macro to free amdlibBinSqVis() structures */
-#define amdlibBinSqVis_FREEALL() free(I); free(R); free(sigma2_R); \
- free(sigma2_I); free(P1); free(P2); free(sigma2_P1); \
- free(sigma2_P2); free(cov_RI); free(instantP1P2); free(unbiased_CV); \
- amdlibFree2DArrayWrapping((void **)corrFluxTablePtr); \
- amdlibFree2DArrayWrapping((void **)photTablePtr); \
- amdlibFree2DArrayWrapping((void **)vis2TablePtr);
-
-/**
- * Compute averaged, normalized, debiassed, squared visibilities from a
- * sequence (bin) of instanteous correlated fluxes.
- *
- * @param instantCorrFlux the bin of instanteous correlated fluxes.
- * @param photometry the associated bin of instantenous fluxes.
- * @param iBin index of the results to be written in the output
- * (binned) vis2 structure.
- * @param band the current spectral band treated.
- * @param selection structure containing all data relative to frame selection.
- * @param errorType indicates wether the noise figures are estimated
- * statistically from the sequence of photometries during the bin
- * (amdlibSTATISTICAL_ERROR) or theoretically by the poisson error on N photons
- * (amdlibTHEORETICAL_ERROR). The latter is forced obviously when the binsize
- * is 1.
- * @param vis2 structure were results are stored.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibBinSqVis(/* Input */
- amdlibVIS *instantCorrFlux,
- amdlibPHOTOMETRY *photometry,
- int firstFrame,
- int nbFrames,
- int iBin,
- amdlibBAND band,
- amdlibERROR_TYPE errorType,
- /* Output */
- amdlibVIS2 *vis2,
- amdlibERROR_MSG errMsg)
-{
-
- int iFrame, runningFrame, nbGoodFrames; /* usually loops on number of frames */
- int iBase; /*usually loop on nbBases*/
- int nbBases = instantCorrFlux->nbBases;
- int lVis = 0;
- int nbLVis = instantCorrFlux->nbWlen;
-
- double P1MoreP2, P1DiviP2, sigma2P1MoreP2, sigma2P1DiviP2;
- double biased_CV;
- double bias;
-
- double *R = NULL;
- double *I = NULL;
- double *sigma2_R = NULL;
- double *sigma2_I = NULL;
- double *P1 = NULL;
- double *P2 = NULL;
- double *sigma2_P1 = NULL;
- double *sigma2_P2 = NULL;
- double *cov_RI = NULL;
- double *instantP1P2 = NULL;
- double *unbiased_CV = NULL;
- double averageP1P2;
- double sigma2_P1P2;
- double average_CV;
- double sigma2_CV;
- double averageV2;
- double sigma2_V2;
- double sigma_V2;
-
- amdlibVIS_TABLE_ENTRY **corrFluxTablePtr = NULL;
- amdlibPHOTOMETRY_TABLE_ENTRY **photTablePtr = NULL;
- amdlibVIS2_TABLE_ENTRY **vis2TablePtr = NULL;
-
- amdlibLogTrace("amdlibBinSqVis()");
-
- /* Allocate memory for intermediate structures, of maximum size in frames */
- R = calloc(nbFrames, sizeof(amdlibDOUBLE));
- if (R == NULL)
- {
- amdlibBinSqVis_FREEALL();
- return amdlibFAILURE;
- }
- I = calloc(nbFrames, sizeof(amdlibDOUBLE));
- if (I == NULL)
- {
- amdlibBinSqVis_FREEALL();
- return amdlibFAILURE;
- }
- sigma2_R = calloc(nbFrames, sizeof(amdlibDOUBLE));
- if (sigma2_R == NULL)
- {
- amdlibBinSqVis_FREEALL();
- return amdlibFAILURE;
- }
- sigma2_I = calloc(nbFrames, sizeof(amdlibDOUBLE));
- if (sigma2_I == NULL)
- {
- amdlibBinSqVis_FREEALL();
- return amdlibFAILURE;
- }
-
- P1 = calloc(nbFrames, sizeof(amdlibDOUBLE));
- if (P1 == NULL)
- {
- amdlibBinSqVis_FREEALL();
- return amdlibFAILURE;
- }
- P2 = calloc(nbFrames, sizeof(amdlibDOUBLE));
- if (P2 == NULL)
- {
- amdlibBinSqVis_FREEALL();
- return amdlibFAILURE;
- }
- sigma2_P1 = calloc(nbFrames, sizeof(amdlibDOUBLE));
- if (sigma2_P1 == NULL)
- {
- amdlibBinSqVis_FREEALL();
- return amdlibFAILURE;
- }
- sigma2_P2 = calloc(nbFrames, sizeof(amdlibDOUBLE));
- if (sigma2_P2 == NULL)
- {
- amdlibBinSqVis_FREEALL();
- return amdlibFAILURE;
- }
-
- cov_RI = calloc(nbFrames, sizeof(amdlibDOUBLE));
- if (cov_RI == NULL)
- {
- amdlibBinSqVis_FREEALL();
- return amdlibFAILURE;
- }
- instantP1P2 = calloc(nbFrames, sizeof(amdlibDOUBLE));
- if (instantP1P2 == NULL)
- {
- amdlibBinSqVis_FREEALL();
- return amdlibFAILURE;
- }
- unbiased_CV = calloc(nbFrames, sizeof(amdlibDOUBLE));
- if (unbiased_CV == NULL)
- {
- amdlibBinSqVis_FREEALL();
- return amdlibFAILURE;
- }
-
- /* Wrap structures given as parametres */
- corrFluxTablePtr =
- (amdlibVIS_TABLE_ENTRY **)amdlibWrap2DArray(instantCorrFlux->table,
- nbBases, instantCorrFlux->nbFrames,
- sizeof(amdlibVIS_TABLE_ENTRY),
- errMsg);
- if (corrFluxTablePtr == NULL)
- {
- amdlibBinSqVis_FREEALL();
- return amdlibFAILURE;
- }
- photTablePtr =
- (amdlibPHOTOMETRY_TABLE_ENTRY **)amdlibWrap2DArray(photometry->table,
- nbBases, photometry->nbFrames,
- sizeof(amdlibPHOTOMETRY_TABLE_ENTRY),
- errMsg);
- if (photTablePtr == NULL)
- {
- amdlibBinSqVis_FREEALL();
- return amdlibFAILURE;
- }
- vis2TablePtr =
- (amdlibVIS2_TABLE_ENTRY **)amdlibWrap2DArray(vis2->table,
- nbBases, vis2->nbFrames,
- sizeof(amdlibVIS2_TABLE_ENTRY),
- errMsg);
- if (vis2TablePtr == NULL)
- {
- amdlibBinSqVis_FREEALL();
- return amdlibFAILURE;
- }
-
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- averageP1P2 = 0.0;
- average_CV = 0.0;
- nbGoodFrames=0;
- for (iFrame = 0, runningFrame=firstFrame; iFrame < nbFrames;
- iFrame++, runningFrame++)
- {
- if (!amdlibCompareDouble(
- photTablePtr[runningFrame][iBase].PiMultPj[lVis],
- amdlibBLANKING_VALUE) &&
- (corrFluxTablePtr[runningFrame][iBase].flag[lVis] ==
- amdlibFALSE))
- {
-
- P1MoreP2 =
- photTablePtr[runningFrame][iBase].fluxSumPiPj[lVis];
-
- sigma2P1MoreP2 =
- photTablePtr[runningFrame][iBase].sigma2FluxSumPiPj[lVis];
-
- P1DiviP2 =
- photTablePtr[runningFrame][iBase].fluxRatPiPj[lVis];
- sigma2P1DiviP2 =
- photTablePtr[runningFrame][iBase].sigma2FluxRatPiPj[lVis];
-
- P2[nbGoodFrames] = P1MoreP2 / (1.0 + P1DiviP2);
-
- sigma2_P2[nbGoodFrames] = sigma2P1MoreP2 / (1.0 + sigma2P1DiviP2);
-
- P1[nbGoodFrames] = P1MoreP2*P1DiviP2/(1.0+P1DiviP2);
-
- sigma2_P1[nbGoodFrames] = sigma2P1MoreP2 * sigma2P1DiviP2 /
- (1.0 + sigma2P1DiviP2);
-
- R[nbGoodFrames] =
- corrFluxTablePtr[runningFrame][iBase].vis[lVis].re;
-
- I[nbGoodFrames] =
- corrFluxTablePtr[runningFrame][iBase].vis[lVis].im;
-
- sigma2_R[nbGoodFrames] =
- corrFluxTablePtr[runningFrame][iBase].sigma2Vis[lVis].re;
-
- sigma2_I[nbGoodFrames] =
- corrFluxTablePtr[runningFrame][iBase].sigma2Vis[lVis].im;
-
- cov_RI[nbGoodFrames] =
- corrFluxTablePtr[runningFrame][iBase].visCovRI[lVis];
-
- /* computation of the unbiased, weighted squared
- * visibilities
- * Clm^2 unbiased_CV: records C^2(iFrame) for each frame for
- * this wavelength we need this expression to calculate
- * sigma_V2
- */
- biased_CV = amdlibPow2(R[nbGoodFrames]) +
- amdlibPow2(I[nbGoodFrames]);
-
- /* bias: see formula AMB-IGR-019 number 36 */
- bias = sigma2_R[nbGoodFrames] +
- sigma2_I[nbGoodFrames];
-
- /*
- * <R^2 + I^2 - bias>_fram =
- * <R^2>_fram + <I^2>_fram - <bias>_fram averaged =
- * <C^2 - bias>
- */
- unbiased_CV[nbGoodFrames] = biased_CV - bias;
-
- /* computation of instantP1P2 for every frame/baseline for
- * this wavelength. We need this expression to calculate
- * sigma_V2 below. Remember also averageP1P2, the average
- * photometry as defined below */
-
- instantP1P2[nbGoodFrames] =
- photTablePtr[runningFrame][iBase].PiMultPj[lVis];
-
- averageP1P2 += instantP1P2[nbGoodFrames];
- average_CV += unbiased_CV[nbGoodFrames];
- nbGoodFrames++;
- }
- }
- if (nbGoodFrames>0)
- {
- /* compute average of P1P2 & CV */
- averageP1P2 /= nbGoodFrames;
- average_CV /= nbGoodFrames;
-
- /* computation of the average of V2 for this wavelength */
- averageV2 = average_CV / (4 * averageP1P2);
-
- /* For statistical errors we need to have only the selected values
- * as contiguous tables */
- if (errorType == amdlibSTATISTICAL_ERROR && nbGoodFrames>1 )
- {
- /* estimate sigma2_V2 as in Bram's formula 40. Since size
- * of arrays change with the number of frames selected per
- * baseline, use amdlibComputeCov instead of
- * amdlibComputeMatrixCov */
- sigma2_CV = amdlibComputeCov(unbiased_CV,
- unbiased_CV,
- nbGoodFrames);
-
- sigma2_P1P2 = amdlibComputeCov(instantP1P2,
- instantP1P2,
- nbGoodFrames);
-
- }
- else /* THEORETICAL ERROR */
- {
- /* We have to recompute averageP1P2 also. reason:
- * averageP1P2 above is an average of
- * P1*P2*sumvk. But sigma2_P1P2 retrieved above from P1+P2
- * and P1/P2 does not know about sumvk. P1 is in fact
- * P1*sumvk1 and P2 is P2*sumvk2. So we recompute
- * averageP1P2 as the average of P1*P2, that goes with
- * the theoretical sigma2_P1P2. */
- sigma2_CV = 0.0;
- averageP1P2 = 0.0;
- sigma2_P1P2 = 0.0;
- for (iFrame = 0; iFrame < nbGoodFrames; iFrame++)
- { /* begin loop for iFrame, selection has been done */
- sigma2_CV +=
- 4 * ((amdlibPow2(R[iFrame])*
- sigma2_R[iFrame]) +
- (amdlibPow2(I[iFrame])*
- sigma2_I[iFrame]) +
- 2 * R[iFrame] * I[iFrame] *
- cov_RI[iFrame]);
-
- averageP1P2 += P1[iFrame]*P2[iFrame];
- sigma2_P1P2 += amdlibPow2(P2[iFrame]) * sigma2_P1[iFrame] +
- amdlibPow2(P1[iFrame]) * sigma2_P2[iFrame];
- }
- sigma2_P1P2 /= nbGoodFrames;
- averageP1P2 /= nbGoodFrames;
- sigma2_CV /= nbGoodFrames;
- }
-
- /* whatever the errorType, computation of sigma_V2 writes the same */
- sigma2_V2 = amdlibPow2(averageV2) / nbGoodFrames *
- ((sigma2_CV / amdlibPow2(average_CV)) +
- (sigma2_P1P2 / amdlibPow2(averageP1P2)));
-
- if(sigma2_V2 >= 0)
- {
- sigma_V2 = sqrt(sigma2_V2);
- vis2TablePtr[iBin][iBase].vis2[lVis] = averageV2;
- vis2TablePtr[iBin][iBase].vis2Error[lVis] = sigma_V2;
- vis2TablePtr[iBin][iBase].flag[lVis]=amdlibFALSE;
- }
- else
- {
- vis2TablePtr[iBin][iBase].vis2[lVis] = amdlibBLANKING_VALUE;
- vis2TablePtr[iBin][iBase].vis2Error[lVis] = amdlibBLANKING_VALUE;
- vis2TablePtr[iBin][iBase].flag[lVis]=amdlibTRUE;
- amdlibLogTrace("Flagging bad Vis2Data baseline %d frame %d channel %d",iBase+1,iBin+1,lVis+1);
- }
-
- }
- else
- {
- vis2TablePtr[iBin][iBase].vis2[lVis] = amdlibBLANKING_VALUE;
- vis2TablePtr[iBin][iBase].vis2Error[lVis] = amdlibBLANKING_VALUE;
- vis2TablePtr[iBin][iBase].flag[lVis]=amdlibTRUE;
- amdlibLogTrace("No Data for Vis2Data baseline %d frame %d channel %d",iBase+1,iBin+1,lVis+1);
- }
- }
- }
-
- amdlibBinSqVis_FREEALL();
- return amdlibSUCCESS;
-}
-#undef amdlibBinSqVis_FREEALL
-
-/** Useful macro to free amdlibComputeSqVis() structures */
-#define amdlibComputeSqVis_FREEALL() free(I); free(R); free(sigma2_R); \
- free(sigma2_I); free(P1); free(P2); free(sigma2_P1); \
- free(sigma2_P2); free(cov_RI); free(instantP1P2); free(unbiased_CV); \
- amdlibFree2DArrayWrapping((void **)corrFluxTablePtr); \
- amdlibFree2DArrayWrapping((void **)photTablePtr); \
- amdlibFree2DArrayWrapping((void **)vis2TablePtr);
-
-/**
- * Compute averaged, normalized, debiassed, squared visibilities from a
- * sequence (bin) of instanteous correlated fluxes.
- *
- * @param instantCorrFlux the bin of instanteous correlated fluxes.
- * @param photometry the associated bin of instantenous fluxes.
- * @param iBin index of the results to be written in the output
- * (binned) vis2 structure.
- * @param band the current spectral band treated.
- * @param selection structure containing all data relative to frame selection.
- * @param errorType indicates wether the noise figures are estimated
- * statistically from the sequence of photometries during the bin
- * (amdlibSTATISTICAL_ERROR) or theoretically by the poisson error on N photons
- * (amdlibTHEORETICAL_ERROR). The latter is forced obviously when the binsize
- * is 1.
- * @param vis2 structure were results are stored.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-
-amdlibCOMPL_STAT amdlibComputeSqVis(/* Input */
- amdlibVIS *instantCorrFlux,
- amdlibPHOTOMETRY *photometry,
- int iBin,
- amdlibBAND band,
- amdlibSELECTION *selection,
- amdlibERROR_TYPE errorType,
- /* Output */
- amdlibVIS2 *vis2,
- amdlibERROR_MSG errMsg)
-{
-
- int iFrame, nbGoodFrames; /* usually loops on number of frames */
- int nbFrames = instantCorrFlux->nbFrames;
- int iBase; /*usually loop on nbBases*/
- int nbBases = instantCorrFlux->nbBases;
- int lVis = 0;
- int nbLVis = instantCorrFlux->nbWlen;
-
- double P1MoreP2, P1DiviP2, sigma2P1MoreP2, sigma2P1DiviP2;
- double biased_CV;
- double bias;
-
- double *R = NULL;
- double *I = NULL;
- double *sigma2_R = NULL;
- double *sigma2_I = NULL;
- double *P1 = NULL;
- double *P2 = NULL;
- double *sigma2_P1 = NULL;
- double *sigma2_P2 = NULL;
- double *cov_RI = NULL;
- double *instantP1P2 = NULL;
- double *unbiased_CV = NULL;
- double averageP1P2;
- double sigma2_P1P2;
- double average_CV;
- double sigma2_CV;
- double averageV2;
- double sigma2_V2;
- double sigma_V2;
-
- amdlibVIS_TABLE_ENTRY **corrFluxTablePtr = NULL;
- amdlibPHOTOMETRY_TABLE_ENTRY **photTablePtr = NULL;
- amdlibVIS2_TABLE_ENTRY **vis2TablePtr = NULL;
-
- amdlibLogTrace("amdlibComputeSqVis()");
-
- /* Allocate memory for intermediate structures, of maximum size in frames */
- R = calloc(nbFrames, sizeof(amdlibDOUBLE));
- if (R == NULL)
- {
- amdlibComputeSqVis_FREEALL();
- return amdlibFAILURE;
- }
- I = calloc(nbFrames, sizeof(amdlibDOUBLE));
- if (I == NULL)
- {
- amdlibComputeSqVis_FREEALL();
- return amdlibFAILURE;
- }
- sigma2_R = calloc(nbFrames, sizeof(amdlibDOUBLE));
- if (sigma2_R == NULL)
- {
- amdlibComputeSqVis_FREEALL();
- return amdlibFAILURE;
- }
- sigma2_I = calloc(nbFrames, sizeof(amdlibDOUBLE));
- if (sigma2_I == NULL)
- {
- amdlibComputeSqVis_FREEALL();
- return amdlibFAILURE;
- }
-
- P1 = calloc(nbFrames, sizeof(amdlibDOUBLE));
- if (P1 == NULL)
- {
- amdlibComputeSqVis_FREEALL();
- return amdlibFAILURE;
- }
- P2 = calloc(nbFrames, sizeof(amdlibDOUBLE));
- if (P2 == NULL)
- {
- amdlibComputeSqVis_FREEALL();
- return amdlibFAILURE;
- }
- sigma2_P1 = calloc(nbFrames, sizeof(amdlibDOUBLE));
- if (sigma2_P1 == NULL)
- {
- amdlibComputeSqVis_FREEALL();
- return amdlibFAILURE;
- }
- sigma2_P2 = calloc(nbFrames, sizeof(amdlibDOUBLE));
- if (sigma2_P2 == NULL)
- {
- amdlibComputeSqVis_FREEALL();
- return amdlibFAILURE;
- }
-
- cov_RI = calloc(nbFrames, sizeof(amdlibDOUBLE));
- if (cov_RI == NULL)
- {
- amdlibComputeSqVis_FREEALL();
- return amdlibFAILURE;
- }
- instantP1P2 = calloc(nbFrames, sizeof(amdlibDOUBLE));
- if (instantP1P2 == NULL)
- {
- amdlibComputeSqVis_FREEALL();
- return amdlibFAILURE;
- }
- unbiased_CV = calloc(nbFrames, sizeof(amdlibDOUBLE));
- if (unbiased_CV == NULL)
- {
- amdlibComputeSqVis_FREEALL();
- return amdlibFAILURE;
- }
-
- /* Wrap structures given as parametres */
- corrFluxTablePtr =
- (amdlibVIS_TABLE_ENTRY **)amdlibWrap2DArray(instantCorrFlux->table,
- nbBases, instantCorrFlux->nbFrames,
- sizeof(amdlibVIS_TABLE_ENTRY),
- errMsg);
- if (corrFluxTablePtr == NULL)
- {
- amdlibComputeSqVis_FREEALL();
- return amdlibFAILURE;
- }
- photTablePtr =
- (amdlibPHOTOMETRY_TABLE_ENTRY **)amdlibWrap2DArray(photometry->table,
- nbBases, photometry->nbFrames,
- sizeof(amdlibPHOTOMETRY_TABLE_ENTRY),
- errMsg);
- if (photTablePtr == NULL)
- {
- amdlibComputeSqVis_FREEALL();
- return amdlibFAILURE;
- }
- vis2TablePtr =
- (amdlibVIS2_TABLE_ENTRY **)amdlibWrap2DArray(vis2->table,
- nbBases, vis2->nbFrames,
- sizeof(amdlibVIS2_TABLE_ENTRY),
- errMsg);
- if (vis2TablePtr == NULL)
- {
- amdlibComputeSqVis_FREEALL();
- return amdlibFAILURE;
- }
-
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- averageP1P2 = 0.0;
- average_CV = 0.0;
- nbGoodFrames=0;
- for (iFrame = 0; iFrame < nbFrames; iFrame++)
- {
- if ((selection->band[band].isSelectedPt[iBase][iFrame] == amdlibTRUE) &&
- !amdlibCompareDouble(
- photTablePtr[iFrame][iBase].PiMultPj[lVis],
- amdlibBLANKING_VALUE) &&
- (corrFluxTablePtr[iFrame][iBase].flag[lVis]==amdlibFALSE))
- {
- P1MoreP2 =
- photTablePtr[iFrame][iBase].fluxSumPiPj[lVis];
-
- sigma2P1MoreP2 =
- photTablePtr[iFrame][iBase].sigma2FluxSumPiPj[lVis];
-
- P1DiviP2 =
- photTablePtr[iFrame][iBase].fluxRatPiPj[lVis];
- sigma2P1DiviP2 =
- photTablePtr[iFrame][iBase].sigma2FluxRatPiPj[lVis];
-
- P2[nbGoodFrames] = P1MoreP2 / (1.0 + P1DiviP2);
-
- sigma2_P2[nbGoodFrames] = sigma2P1MoreP2 / (1.0 + sigma2P1DiviP2);
-
- P1[nbGoodFrames] = P1MoreP2*P1DiviP2/(1.0+P1DiviP2);
-
- sigma2_P1[nbGoodFrames] = sigma2P1MoreP2 * sigma2P1DiviP2 /
- (1.0 + sigma2P1DiviP2);
-
- R[nbGoodFrames] =
- corrFluxTablePtr[iFrame][iBase].vis[lVis].re;
-
- I[nbGoodFrames] =
- corrFluxTablePtr[iFrame][iBase].vis[lVis].im;
-
- sigma2_R[nbGoodFrames] =
- corrFluxTablePtr[iFrame][iBase].sigma2Vis[lVis].re;
-
- sigma2_I[nbGoodFrames] =
- corrFluxTablePtr[iFrame][iBase].sigma2Vis[lVis].im;
-
- cov_RI[nbGoodFrames] =
- corrFluxTablePtr[iFrame][iBase].visCovRI[lVis];
-
- /* computation of the unbiased, weighted squared
- * visibilities
- * Clm^2 unbiased_CV: records C^2(iFrame) for each frame for
- * this wavelength we need this expression to calculate
- * sigma_V2
- */
- biased_CV = amdlibPow2(R[nbGoodFrames]) +
- amdlibPow2(I[nbGoodFrames]);
-
- /* bias: see formula AMB-IGR-019 number 36 */
- bias = sigma2_R[nbGoodFrames] +
- sigma2_I[nbGoodFrames];
-
- /*
- * <R^2 + I^2 - bias>_fram =
- * <R^2>_fram + <I^2>_fram - <bias>_fram averaged =
- * <C^2 - bias>
- */
- unbiased_CV[nbGoodFrames] = biased_CV - bias;
-
- /* computation of instantP1P2 for every frame/baseline for
- * this wavelength. We need this expression to calculate
- * sigma_V2 below. Remember also averageP1P2, the average
- * photometry as defined below */
-
- instantP1P2[nbGoodFrames] =
- photTablePtr[iFrame][iBase].PiMultPj[lVis];
-
- averageP1P2 += instantP1P2[nbGoodFrames];
- average_CV += unbiased_CV[nbGoodFrames];
- nbGoodFrames++;
- }
- }
- if (nbGoodFrames>0)
- {
- /* compute average of P1P2 & CV */
- averageP1P2 /= nbGoodFrames;
- average_CV /= nbGoodFrames;
-
- /* computation of the average of V2 for this wavelength */
- averageV2 = average_CV / (4 * averageP1P2);
-
- /* For statistical errors we need to have only the selected values
- * as contiguous tables */
- if (errorType == amdlibSTATISTICAL_ERROR && nbGoodFrames>1 )
- {
- /* estimate sigma2_V2 as in Bram's formula 40. Since size
- * of arrays change with the number of frames selected per
- * baseline, use amdlibComputeCov instead of
- * amdlibComputeMatrixCov */
- sigma2_CV = amdlibComputeCov(unbiased_CV,
- unbiased_CV,
- nbGoodFrames);
-
- sigma2_P1P2 = amdlibComputeCov(instantP1P2,
- instantP1P2,
- nbGoodFrames);
-
- }
- else /* THEORETICAL ERROR */
- {
- /* We have to recompute averageP1P2 also. reason:
- * averageP1P2 above is an average of
- * P1*P2*sumvk. But sigma2_P1P2 retrieved above from P1+P2
- * and P1/P2 does not know about sumvk. P1 is in fact
- * P1*sumvk1 and P2 is P2*sumvk2. So we recompute
- * averageP1P2 as the average of P1*P2, that goes with
- * the theoretical sigma2_P1P2. */
- sigma2_CV = 0.0;
- averageP1P2 = 0.0;
- sigma2_P1P2 = 0.0;
- for (iFrame = 0; iFrame < nbGoodFrames; iFrame++)
- { /* begin loop for iFrame, selection has been done */
- sigma2_CV +=
- 4 * ((amdlibPow2(R[iFrame])*
- sigma2_R[iFrame]) +
- (amdlibPow2(I[iFrame])*
- sigma2_I[iFrame]) +
- 2 * R[iFrame] * I[iFrame] *
- cov_RI[iFrame]);
-
- averageP1P2 += P1[iFrame]*P2[iFrame];
- sigma2_P1P2 += amdlibPow2(P2[iFrame]) * sigma2_P1[iFrame] +
- amdlibPow2(P1[iFrame]) * sigma2_P2[iFrame];
- }
- sigma2_P1P2 /= nbGoodFrames;
- averageP1P2 /= nbGoodFrames;
- sigma2_CV /= nbGoodFrames;
- }
-
- /* whatever the errorType, computation of sigma_V2 writes the same */
- sigma2_V2 = amdlibPow2(averageV2) / nbGoodFrames *
- ((sigma2_CV / amdlibPow2(average_CV)) +
- (sigma2_P1P2 / amdlibPow2(averageP1P2)));
-
- if(sigma2_V2 >= 0)
- {
- sigma_V2 = sqrt(sigma2_V2);
- vis2TablePtr[iBin][iBase].vis2[lVis] = averageV2;
- vis2TablePtr[iBin][iBase].vis2Error[lVis] = sigma_V2;
- vis2TablePtr[iBin][iBase].flag[lVis]=amdlibFALSE;
- }
- else
- {
- vis2TablePtr[iBin][iBase].vis2[lVis] = amdlibBLANKING_VALUE;
- vis2TablePtr[iBin][iBase].vis2Error[lVis] = amdlibBLANKING_VALUE;
- vis2TablePtr[iBin][iBase].flag[lVis]=amdlibTRUE;
- amdlibLogTrace("Flagging bad Vis2Data baseline %d frame %d channel %d",iBase+1,iBin+1,lVis+1);
- }
-
- }
- else
- {
- vis2TablePtr[iBin][iBase].vis2[lVis] = amdlibBLANKING_VALUE;
- vis2TablePtr[iBin][iBase].vis2Error[lVis] = amdlibBLANKING_VALUE;
- vis2TablePtr[iBin][iBase].flag[lVis]=amdlibTRUE;
- amdlibLogTrace("No Data for Vis2Data baseline %d frame %d channel %d",iBase+1,iBin+1,lVis+1);
- }
- }
- }
-
- amdlibComputeSqVis_FREEALL();
- return amdlibSUCCESS;
-}
-#undef amdlibComputeSqVis_FREEALL
-
-/** Useful macro to free amdlibAverageVis() structures */
-#define amdlibAverageVisData_FREEALL() \
- amdlibFree2DArrayWrapping((void **)cpxVisTablePtr); \
- amdlibFree2DArrayWrapping((void **)visTablePtr);
-
-/**
- * Update complex pseudo-visibilities in output table by averaging values and
- * computing rms
- *
- * @param instantCorrFlux the bin of instanteous correlated fluxes.
- * @param band the current band
- * @param iBin index of the results to be written in the output
- * (binned) vis structure.
- * @param selection the selection structure giving list of selected frames.
- * @param vis structure were results are stored.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibAverageVis(amdlibVIS *instantCorrFlux,
- int iBin,
- amdlibBAND band,
- amdlibSELECTION *selection,
- /* Output */
- amdlibVIS *vis,
- amdlibERROR_MSG errMsg)
-{
-
- int iFrame; /* usually loop on number of frames */
- int nbFrames = instantCorrFlux->nbFrames;
- int iBase; /*usually loop on nbBases*/
- int nbBases = instantCorrFlux->nbBases;
- int lVis = 0;
- int nbLVis = instantCorrFlux->nbWlen;
- int nbGoodFrames=0;
-
- amdlibVIS_TABLE_ENTRY **cpxVisTablePtr = NULL;
- amdlibVIS_TABLE_ENTRY **visTablePtr = NULL;
- amdlibCOMPLEX rmsVis, cpxVis;
-
-
- amdlibLogTrace("amdlibAverageVis()");
-
- /* Wrap structures given as parametres */
- cpxVisTablePtr =
- (amdlibVIS_TABLE_ENTRY **)amdlibWrap2DArray(instantCorrFlux->table,
- nbBases, nbFrames,
- sizeof(amdlibVIS_TABLE_ENTRY),
- errMsg);
- if (cpxVisTablePtr == NULL)
- {
- amdlibAverageVisData_FREEALL();
- return amdlibFAILURE;
- }
-
- visTablePtr =
- (amdlibVIS_TABLE_ENTRY **)amdlibWrap2DArray(vis->table,
- nbBases, vis->nbFrames,
- sizeof(amdlibVIS_TABLE_ENTRY),
- errMsg);
- if (visTablePtr == NULL)
- {
- amdlibAverageVisData_FREEALL();
- return amdlibFAILURE;
- }
- /* Finally, update complex pseudo-visibilities in output table by averaging
- * values and computing rms. Reuse cpxVis and rmsVis for intermediate
- * storage */
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- if (selection->band[band].nbSelectedFrames[iBase] != 0)
- {
- cpxVis.re = 0;
- cpxVis.im = 0;
- for (iFrame = 0, nbGoodFrames = 0; iFrame < nbFrames; iFrame++)
- {
- if ((selection->band[band].isSelectedPt[iBase][iFrame] == amdlibTRUE)&&(cpxVisTablePtr[iFrame][iBase].flag[lVis] == amdlibFALSE))
- {
- cpxVis.re += cpxVisTablePtr[iFrame][iBase].vis[lVis].re;
- cpxVis.im += cpxVisTablePtr[iFrame][iBase].vis[lVis].im;
- nbGoodFrames++;
- }
- }
- cpxVis.re /= nbGoodFrames;
- cpxVis.im /= nbGoodFrames;
- visTablePtr[iBin][iBase].vis[lVis].re=cpxVis.re;
- visTablePtr[iBin][iBase].vis[lVis].im=cpxVis.im;
- rmsVis.re = 0;
- rmsVis.im = 0;
- for (iFrame = 0, nbGoodFrames = 0; iFrame < nbFrames; iFrame++)
- {
- if ((selection->band[band].isSelectedPt[iBase][iFrame] == amdlibTRUE)&&(cpxVisTablePtr[iFrame][iBase].flag[lVis] == amdlibFALSE))
- {
- rmsVis.re += amdlibPow2(
- cpxVisTablePtr[iFrame][iBase].vis[lVis].re -
- cpxVis.re);
- rmsVis.im += amdlibPow2(
- cpxVisTablePtr[iFrame][iBase].vis[lVis].im -
- cpxVis.im);
- nbGoodFrames++;
- }
- }
- rmsVis.re /= nbGoodFrames;
- rmsVis.im /= nbGoodFrames;
- visTablePtr[iBin][iBase].sigma2Vis[lVis].re=rmsVis.re;
- visTablePtr[iBin][iBase].sigma2Vis[lVis].im=rmsVis.im;
- }
- }
- }
- amdlibAverageVisData_FREEALL();
- return amdlibSUCCESS;
-}
-#undef amdlibAverageVisData_FREEALL
-
-
-/** Useful macro to free amdlibComputeDiffVis() structures */
-
-#define amdlibComputeDiffVis_FREEALL() \
- free(cpxVisVectR); free(cpxVisVectI); \
- free(snrVect); free(phiVect); free(wlen); \
- amdlibFree2DArrayWrapping((void **)cpxVisTablePtr); \
- amdlibFree2DArrayWrapping((void **)visTablePtr); \
- amdlibFree2DArrayDoubleWrapping(instantOpdPistonPtr); \
- amdlibFree3DArrayComplex(cNopTable); \
- amdlibFree3DArrayComplex(w1); \
- amdlibFree3DArrayComplex(sigma2_w1); \
- amdlibFree3DArrayComplex(cpxVisTable); \
- amdlibFree3DArrayComplex(sigma2_cpxVisTable); \
- amdlibFree3DArrayComplex(cRefTable); \
- amdlibFree2DArrayDouble(opd); \
- amdlibFree3DArrayComplex(sigma2_cRefTable);
-
-
-/**
- * Compute differential visibility, in the way described by F. Millour et al's
- * ("DIFFERENTIAL INTERFEROMETRY WITH THE AMBER/VLTI INSTRUMENT: DESCRIPTION,
- * PERFORMANCES AND ILLUSTRATION", EAS Publications Series, Vol. ?, 2005)
- *
- * DiffVis are to be written in the final OI_FITS VISAMP and
- * VISPHI OI_VIS columns.
- *
- * @param instantCorrFlux the bin of instanteous correlated fluxes.
- * @param wave the table of wavelengths.
- * @param instantOpd the table of opds
- * @param band the current band
- * @param iBin index of the results to be written in the output
- * (binned) vis structure.
- * @param selection the selection structure giving list of selected frames.
- * @param vis structure were results are stored.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibComputeDiffVis(/* Input */
- amdlibVIS *instantCorrFlux,
- amdlibWAVELENGTH *wave,
- amdlibPISTON *instantOpd,
- int iBin,
- amdlibBAND band,
- amdlibSELECTION *selection,
- /* Output */
- amdlibVIS *vis,
- amdlibERROR_MSG errMsg)
-{
-
- int iFrame; /* usually loop on number of frames */
- int nbFrames = instantCorrFlux->nbFrames;
- int iBase; /*usually loop on nbBases*/
- int nbBases = instantCorrFlux->nbBases;
- int lVis = 0;
- int nbLVis = instantCorrFlux->nbWlen;
- int nbGoodFrames=0, nbGoodVis=0;
-
- amdlibVIS_TABLE_ENTRY **cpxVisTablePtr = NULL;
- amdlibVIS_TABLE_ENTRY **visTablePtr = NULL;
- amdlibDOUBLE **instantOpdPistonPtr = NULL;
- /* We try to follow the paper's notations */
- amdlibCOMPLEX *** cNopTable = NULL;
- amdlibCOMPLEX *** w1 = NULL;
- amdlibCOMPLEX *** sigma2_w1 = NULL;
- amdlibCOMPLEX *** cRefTable = NULL;
- amdlibCOMPLEX *** sigma2_cRefTable = NULL;
- amdlibCOMPLEX *** cpxVisTable = NULL;
- amdlibCOMPLEX *** sigma2_cpxVisTable = NULL;
- amdlibDOUBLE *wlen= NULL;
- amdlibDOUBLE **opd= NULL;
- double *cpxVisVectR= NULL;
- double *cpxVisVectI= NULL;
- double *snrVect = NULL;
- double *phiVect = NULL;
-
-
- amdlibCOMPLEX phasor, cpxVis, sigma2_cpxVis, w1Avg = {0.0,0.0};
- double x;
-
- amdlibLogTrace("amdlibComputeDiffVis()");
-
- /* Allocate memory for intermediate structures, of maximum size in frames */
- cNopTable = amdlibAlloc3DArrayComplex(nbLVis, nbBases, nbFrames, errMsg);
- if (cNopTable == NULL)
- {
- amdlibComputeDiffVis_FREEALL();
- amdlibSetErrMsg("Allocation of cNopTable failed");
- return amdlibFAILURE;
- }
- w1 = amdlibAlloc3DArrayComplex(nbLVis, nbBases, nbFrames, errMsg);
- if (w1 == NULL)
- {
- amdlibComputeDiffVis_FREEALL();
- amdlibSetErrMsg("Allocation of w1 failed");
- return amdlibFAILURE;
- }
- sigma2_w1 = amdlibAlloc3DArrayComplex(nbLVis, nbBases, nbFrames, errMsg);
- if (sigma2_w1 == NULL)
- {
- amdlibComputeDiffVis_FREEALL();
- amdlibSetErrMsg("Allocation of w1 failed");
- return amdlibFAILURE;
- }
- cpxVisTable = amdlibAlloc3DArrayComplex(nbLVis, nbBases, nbFrames, errMsg);
- if (cpxVisTable == NULL)
- {
- amdlibComputeDiffVis_FREEALL();
- amdlibSetErrMsg("Allocation of cpxVisTable failed");
- return amdlibFAILURE;
- }
- sigma2_cpxVisTable = amdlibAlloc3DArrayComplex(nbLVis, nbBases, nbFrames, errMsg);
- if (sigma2_cpxVisTable == NULL)
- {
- amdlibComputeDiffVis_FREEALL();
- amdlibSetErrMsg("Allocation of cpxVisTableErr failed");
- return amdlibFAILURE;
- }
- cRefTable = amdlibAlloc3DArrayComplex(nbLVis, nbBases, nbFrames, errMsg);
- if (cRefTable == NULL)
- {
- amdlibComputeDiffVis_FREEALL();
- amdlibSetErrMsg("Allocation of cRefTable failed");
- return amdlibFAILURE;
- }
- sigma2_cRefTable = amdlibAlloc3DArrayComplex(nbLVis, nbBases, nbFrames, errMsg);
- if (sigma2_cRefTable == NULL)
- {
- amdlibComputeDiffVis_FREEALL();
- amdlibSetErrMsg("Allocation of cRefTableErr failed");
- return amdlibFAILURE;
- }
- opd = amdlibAlloc2DArrayDouble(nbBases, nbFrames, errMsg);
- if (opd == NULL)
- {
- amdlibComputeDiffVis_FREEALL();
- amdlibSetErrMsg("Allocation of opd failed");
- return amdlibFAILURE;
- }
- wlen = calloc(nbLVis,sizeof(*wlen));
- if (wlen == NULL)
- {
- amdlibComputeDiffVis_FREEALL();
- amdlibSetErrMsg("Allocation of wlen failed");
- return amdlibFAILURE;
- }
-
- cpxVisVectR = calloc(nbFrames,sizeof(*cpxVisVectR));
- if (cpxVisVectR == NULL)
- {
- amdlibComputeDiffVis_FREEALL();
- amdlibSetErrMsg("Allocation of cpxVisVectR failed");
- return amdlibFAILURE;
- }
- cpxVisVectI = calloc(nbFrames,sizeof(*cpxVisVectI));
- if (cpxVisVectI == NULL)
- {
- amdlibComputeDiffVis_FREEALL();
- amdlibSetErrMsg("Allocation of cpxVisVectI failed");
- return amdlibFAILURE;
- }
- snrVect = calloc(nbFrames,sizeof(*snrVect));
- if ( snrVect== NULL)
- {
- amdlibComputeDiffVis_FREEALL();
- amdlibSetErrMsg("Allocation of snrVect failed");
- return amdlibFAILURE;
- }
- phiVect = calloc(nbFrames,sizeof(*phiVect));
- if ( phiVect== NULL)
- {
- amdlibComputeDiffVis_FREEALL();
- amdlibSetErrMsg("Allocation of phiVect failed");
- return amdlibFAILURE;
- }
- /* Wrap structures given as parametres */
- cpxVisTablePtr =
- (amdlibVIS_TABLE_ENTRY **)amdlibWrap2DArray(instantCorrFlux->table,
- nbBases, instantCorrFlux->nbFrames,
- sizeof(amdlibVIS_TABLE_ENTRY),
- errMsg);
- if (cpxVisTablePtr == NULL)
- {
- amdlibComputeDiffVis_FREEALL();
- return amdlibFAILURE;
- }
-
- instantOpdPistonPtr =
- amdlibWrap2DArrayDouble(instantOpd->pistonOPDArray[band],
- instantOpd->nbBases,
- instantOpd->nbFrames, errMsg);
- if (instantOpdPistonPtr == NULL)
- {
- amdlibSetErrMsg("Could not wrap 2D amdlibDOUBLE array");
- amdlibComputeDiffVis_FREEALL();
- return amdlibFAILURE;
- }
-
- visTablePtr =
- (amdlibVIS_TABLE_ENTRY **)amdlibWrap2DArray(vis->table,
- nbBases, vis->nbFrames,
- sizeof(amdlibVIS_TABLE_ENTRY),
- errMsg);
- if (visTablePtr == NULL)
- {
- amdlibComputeDiffVis_FREEALL();
- return amdlibFAILURE;
- }
-
- /* Initialize opd: local copy where all bad pistons are Blank:
- * if opd = BLANK, cNopTable[iFrame][iBase] will be BLANK, and the avg
- * and rms done at the end will avoid these values */
- for (iFrame = 0; iFrame < nbFrames; iFrame++)
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- if( selection->band[band].isSelectedPt[iBase][iFrame] == amdlibTRUE )
- {
- /*May contain blanks for other reasons...*/
- opd[iFrame][iBase] = instantOpdPistonPtr[iFrame][iBase];
- }
- else
- {
- opd[iFrame][iBase] = amdlibBLANKING_VALUE;
- }
- }
- }
-
- /* Immediately copy input cpxVis to 3D structure, flagging as BLANK when Flag is present */
-
- for (iFrame = 0; iFrame < nbFrames; iFrame++)
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- if (instantCorrFlux->table[iFrame*nbBases+iBase].flag[lVis]== amdlibFALSE)
- {
- cpxVisTable[iFrame][iBase][lVis].re =
- cpxVisTablePtr[iFrame][iBase].vis[lVis].re;
- cpxVisTable[iFrame][iBase][lVis].im =
- cpxVisTablePtr[iFrame][iBase].vis[lVis].im;
-
- sigma2_cpxVisTable[iFrame][iBase][lVis].re =
- cpxVisTablePtr[iFrame][iBase].sigma2Vis[lVis].re;
- sigma2_cpxVisTable[iFrame][iBase][lVis].im =
- cpxVisTablePtr[iFrame][iBase].sigma2Vis[lVis].im;
- }
- else
- {
- cpxVisTable[iFrame][iBase][lVis].re = amdlibBLANKING_VALUE;
- cpxVisTable[iFrame][iBase][lVis].im = amdlibBLANKING_VALUE;
- sigma2_cpxVisTable[iFrame][iBase][lVis].re = amdlibBLANKING_VALUE;
- sigma2_cpxVisTable[iFrame][iBase][lVis].im = amdlibBLANKING_VALUE;
- }
- }
- }
- }
- /* Initialize wlen */
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- wlen[lVis] = wave->wlen[lVis];
- }
-
- /* Correct from Piston, 1st time */
- /* First, correct coherent flux from achromatic piston phase (eq 2.2)*/
- if (amdlibCorrect3DVisTableFromAchromaticPiston(cpxVisTable,
- cNopTable,
- nbFrames,
- nbBases,
- nbLVis,
- wlen,
- opd,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- /* Production of the reference channel: mean of all R and I parts
- * of all channels except the one considered ( eq 2.3) */
- for (iFrame = 0; iFrame < nbFrames; iFrame++)
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- cpxVis.re = 0.0;
- cpxVis.im = 0.0;
- sigma2_cpxVis.re = 0.0;
- sigma2_cpxVis.im = 0.0;
- /* sum all R and I */
- for (nbGoodVis= 0, lVis = 0; lVis < nbLVis; lVis++)
- {
- if (!amdlibCompareDouble(cpxVisTable[iFrame][iBase][lVis].re,amdlibBLANKING_VALUE))
- {
- cpxVis.re += cNopTable[iFrame][iBase][lVis].re;
- cpxVis.im += cNopTable[iFrame][iBase][lVis].im;
- sigma2_cpxVis.re += sigma2_cpxVisTable[iFrame][iBase][lVis].re;
- sigma2_cpxVis.im += sigma2_cpxVisTable[iFrame][iBase][lVis].im;
- nbGoodVis++;
- }
- }
- /* then construct Cref by substracting current R and I
- * at that Wlen and make the arithmetic mean */
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- cRefTable[iFrame][iBase][lVis].re =
- (cpxVis.re - cNopTable[iFrame][iBase][lVis].re) /
- (nbGoodVis - 1);
- cRefTable[iFrame][iBase][lVis].im =
- (cpxVis.im - cNopTable[iFrame][iBase][lVis].im) /
- (nbGoodVis - 1);
-
- sigma2_cRefTable[iFrame][iBase][lVis].re =
- (sigma2_cpxVis.re -
- sigma2_cpxVisTable[iFrame][iBase][lVis].re) /
- (nbGoodVis - 1);
- sigma2_cRefTable[iFrame][iBase][lVis].im =
- (sigma2_cpxVis.im -
- sigma2_cpxVisTable[iFrame][iBase][lVis].im) /
- (nbGoodVis - 1);
- }
- }
- }
-
- /* Now the interspectrum is cNopTable*~cRefTable. Store in w1. */
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- for (iFrame = 0; iFrame < nbFrames; iFrame++)
- {
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- cpxVis.re = cNopTable[iFrame][iBase][lVis].re;
- cpxVis.im = cNopTable[iFrame][iBase][lVis].im;
-
- phasor.re = cRefTable[iFrame][iBase][lVis].re;
- phasor.im = -1*cRefTable[iFrame][iBase][lVis].im;
-
- amdlibCpxMul(cpxVis,phasor,w1[iFrame][iBase][lVis]);
-
- /* Please have a look to the F. Millour thesis
- (http://tel.archives-ouvertes.fr/tel-00134268),
- pp.91-892 (eq. 4.55 to 4.58) */
- sigma2_w1[iFrame][iBase][lVis].re =
- sigma2_cpxVisTable[iFrame][iBase][lVis].re *
- amdlibPow2(cRefTable[iFrame][iBase][lVis].re) +
- sigma2_cRefTable[iFrame][iBase][lVis].re *
- amdlibPow2(cpxVisTable[iFrame][iBase][lVis].re) +
- sigma2_cpxVisTable[iFrame][iBase][lVis].im *
- amdlibPow2(cRefTable[iFrame][iBase][lVis].im) +
- sigma2_cRefTable[iFrame][iBase][lVis].im *
- amdlibPow2(cpxVisTable[iFrame][iBase][lVis].im);
-
- sigma2_w1[iFrame][iBase][lVis].im =
- sigma2_cpxVisTable[iFrame][iBase][lVis].im *
- amdlibPow2(cRefTable[iFrame][iBase][lVis].re) +
- sigma2_cRefTable[iFrame][iBase][lVis].im *
- amdlibPow2(cpxVisTable[iFrame][iBase][lVis].re) +
- sigma2_cpxVisTable[iFrame][iBase][lVis].re *
- amdlibPow2(cRefTable[iFrame][iBase][lVis].im) +
- sigma2_cRefTable[iFrame][iBase][lVis].re *
- amdlibPow2(cpxVisTable[iFrame][iBase][lVis].im);
- }
- }
- }
-
- /* Compute mean VisPhi as average of selected frames. If snr is BLANK
- * (negative), averages take into account blanked values */
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- /* The SNR vector */
- for (iFrame = 0 , nbGoodFrames =0; iFrame < nbFrames; iFrame++)
- {
- if ((selection->band[band].isSelectedPt[iBase][iFrame] == amdlibTRUE) &&
- !amdlibCompareDouble(opd[iFrame][iBase],amdlibBLANKING_VALUE) &&
- !amdlibCompareDouble(cpxVisTable[iFrame][iBase][lVis].re,amdlibBLANKING_VALUE))
- {
- snrVect[iFrame] = 1.0;
- nbGoodFrames ++;
- }
- else
- {
- snrVect[iFrame] = -1.0;
- }
- }
- /* The W1 vector */
- for (iFrame = 0 ; iFrame < nbFrames; iFrame++)
- {
- cpxVisVectR[iFrame] = w1[iFrame][iBase][lVis].re;
- cpxVisVectI[iFrame] = w1[iFrame][iBase][lVis].im;
- }
- /* The Phase Herself */
- /* average re and im */
- w1Avg.re = amdlibAvgTable(nbFrames, cpxVisVectR, snrVect);
- w1Avg.im = amdlibAvgTable(nbFrames, cpxVisVectI, snrVect);
- /* store */
- visTablePtr[iBin][iBase].diffVisPhi[lVis] =
- (double)(nbGoodVis-1)/(double)nbGoodVis*atan2(w1Avg.im,w1Avg.re);
-
- /* WE USE THE STATISTICAL ERROR FOR BINNING */
- w1Avg.im=-1*w1Avg.im;
- for (iFrame = 0 ; iFrame < nbFrames; iFrame++)
- {
- /* add w1*conj(w1Avg) to vector*/
- amdlibCpxMul(w1[iFrame][iBase][lVis],w1Avg,cpxVis);
- /* use phiVect to store phases */
- phiVect[iFrame] = atan2(cpxVis.im,cpxVis.re);
- }
- x = amdlibRmsTable(nbFrames, phiVect, snrVect);
- /* Err on Phi must be corrected with an abacus*/
- visTablePtr[iBin][iBase].diffVisPhiErr[lVis] =
- amdlibAbacusErrPhi(x/sqrt(nbGoodFrames));
- }
- }
-
- /* Now for the differential vis, we use cNopTable/cRefTable. Store in w1.
- * note this is not exactly as complicated as in the computeDiff yorick
- * implementation by Millour */
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- for (iFrame = 0; iFrame < nbFrames; iFrame++)
- {
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- cpxVis.re = cNopTable[iFrame][iBase][lVis].re;
- cpxVis.im = cNopTable[iFrame][iBase][lVis].im;
- phasor.re = cRefTable[iFrame][iBase][lVis].re;
- phasor.im = cRefTable[iFrame][iBase][lVis].im;
- amdlibCpxDiv(cpxVis,phasor,w1[iFrame][iBase][lVis]);
- }
- }
- }
- /* Compute mean VisAmp as average of selected frames. */
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- /* The SNR vector */
- for (iFrame = 0, nbGoodFrames = 0 ; iFrame < nbFrames; iFrame++)
- {
- if((selection->band[band].isSelectedPt[iBase][iFrame] == amdlibTRUE) &&
- !amdlibCompareDouble(opd[iFrame][iBase],amdlibBLANKING_VALUE) &&
- !amdlibCompareDouble(cpxVisTable[iFrame][iBase][lVis].re,amdlibBLANKING_VALUE))
- {
- snrVect[iFrame] = 1.0;
- nbGoodFrames++;
- }
- else
- {
- snrVect[iFrame] = -1.0;
- }
- }
- /* The W1 vector */
- for (iFrame = 0 ; iFrame < nbFrames; iFrame++)
- {
- /* see eq 2.8 */
- x = visTablePtr[iBin][iBase].diffVisPhi[lVis];
- phasor.re = cos(x);
- phasor.im = -sin(x);
- cpxVis.re = w1[iFrame][iBase][lVis].re;
- cpxVis.im = w1[iFrame][iBase][lVis].im;
- cpxVisVectR[iFrame] =
- phasor.re * cpxVis.re - phasor.im * cpxVis.im;
- cpxVisVectI[iFrame] =
- phasor.re * cpxVis.im + phasor.im * cpxVis.re;
- }
- visTablePtr[iBin][iBase].diffVisAmp[lVis] =
- amdlibAvgTable(nbFrames, cpxVisVectR, snrVect);
- visTablePtr[iBin][iBase].diffVisAmpErr[lVis] =
- amdlibRmsTable(nbFrames, cpxVisVectR, snrVect) / sqrt(nbGoodFrames);
- }
- }
- amdlibComputeDiffVis_FREEALL();
- return amdlibSUCCESS;
-}
-#undef amdlibComputeDiffVis_FREEALL
-
-/** Useful macro to free amdlibBinDiffVis() structures */
-
-#define amdlibBinDiffVis_FREEALL() \
- free(cpxVisVectR); free(cpxVisVectI); \
- free(snrVect); free(phiVect); free(wlen); \
- amdlibFree2DArrayWrapping((void **)cpxVisTablePtr); \
- amdlibFree2DArrayWrapping((void **)visTablePtr); \
- amdlibFree2DArrayDoubleWrapping(instantOpdPistonPtr); \
- amdlibFree3DArrayComplex(cNopTable); \
- amdlibFree3DArrayComplex(w1); \
- amdlibFree3DArrayComplex(sigma2_w1); \
- amdlibFree3DArrayComplex(cpxVisTable); \
- amdlibFree3DArrayComplex(sigma2_cpxVisTable); \
- amdlibFree3DArrayComplex(cRefTable); \
- amdlibFree2DArrayDouble(opd); \
- amdlibFree3DArrayComplex(sigma2_cRefTable);
-
-
-/**
- * Compute differential visibility, in the way described by F. Millour et al's
- * ("DIFFERENTIAL INTERFEROMETRY WITH THE AMBER/VLTI INSTRUMENT: DESCRIPTION,
- * PERFORMANCES AND ILLUSTRATION", EAS Publications Series, Vol. ?, 2005)
- *
- * DiffVis are to be written in the final OI_FITS VISAMP and
- * VISPHI OI_VIS columns.
- *
- * @param instantCorrFlux the bin of instanteous correlated fluxes.
- * @param wave the table of wavelengths.
- * @param instantOpd the table of opds
- * @param band the current band
- * @param iBin index of the results to be written in the output
- * (binned) vis structure.
- * @param selection the selection structure giving list of selected frames.
- * @param vis structure were results are stored.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibBinDiffVis(/* Input */
- amdlibVIS *instantCorrFlux,
- amdlibWAVELENGTH *wave,
- amdlibPISTON *instantOpd,
- int firstFrame,
- int nbFrames,
- int iBin,
- amdlibBAND band,
- /* Output */
- amdlibVIS *vis,
- amdlibERROR_MSG errMsg)
-{
-
- int iFrame, runningFrame; /* usually loop on number of frames */
- int iBase; /*usually loop on nbBases*/
- int nbBases = instantCorrFlux->nbBases;
- int lVis = 0;
- int nbLVis = instantCorrFlux->nbWlen;
- int nbGoodFrames=0, nbGoodVis=0;
-
- amdlibVIS_TABLE_ENTRY **cpxVisTablePtr = NULL;
- amdlibVIS_TABLE_ENTRY **visTablePtr = NULL;
- amdlibDOUBLE **instantOpdPistonPtr = NULL;
- /* We try to follow the paper's notations */
- amdlibCOMPLEX *** cNopTable = NULL;
- amdlibCOMPLEX *** w1 = NULL;
- amdlibCOMPLEX *** sigma2_w1 = NULL;
- amdlibCOMPLEX *** cRefTable = NULL;
- amdlibCOMPLEX *** sigma2_cRefTable = NULL;
- amdlibCOMPLEX *** cpxVisTable = NULL;
- amdlibCOMPLEX *** sigma2_cpxVisTable = NULL;
- amdlibDOUBLE *wlen= NULL;
- amdlibDOUBLE **opd= NULL;
- double *cpxVisVectR= NULL;
- double *cpxVisVectI= NULL;
- double *snrVect = NULL;
- double *phiVect = NULL;
-
-
- amdlibCOMPLEX phasor, cpxVis, sigma2_cpxVis, w1Avg = {0.0,0.0};
- double x;
-
- amdlibLogTrace("amdlibBinDiffVis()");
-
- /* Allocate memory for intermediate structures, of maximum size in frames */
- cNopTable = amdlibAlloc3DArrayComplex(nbLVis, nbBases, nbFrames, errMsg);
- if (cNopTable == NULL)
- {
- amdlibBinDiffVis_FREEALL();
- amdlibSetErrMsg("Allocation of cNopTable failed");
- return amdlibFAILURE;
- }
- w1 = amdlibAlloc3DArrayComplex(nbLVis, nbBases, nbFrames, errMsg);
- if (w1 == NULL)
- {
- amdlibBinDiffVis_FREEALL();
- amdlibSetErrMsg("Allocation of w1 failed");
- return amdlibFAILURE;
- }
- sigma2_w1 = amdlibAlloc3DArrayComplex(nbLVis, nbBases, nbFrames, errMsg);
- if (sigma2_w1 == NULL)
- {
- amdlibBinDiffVis_FREEALL();
- amdlibSetErrMsg("Allocation of w1 failed");
- return amdlibFAILURE;
- }
- cpxVisTable = amdlibAlloc3DArrayComplex(nbLVis, nbBases, nbFrames, errMsg);
- if (cpxVisTable == NULL)
- {
- amdlibBinDiffVis_FREEALL();
- amdlibSetErrMsg("Allocation of cpxVisTable failed");
- return amdlibFAILURE;
- }
- sigma2_cpxVisTable = amdlibAlloc3DArrayComplex(nbLVis, nbBases, nbFrames, errMsg);
- if (sigma2_cpxVisTable == NULL)
- {
- amdlibBinDiffVis_FREEALL();
- amdlibSetErrMsg("Allocation of cpxVisTableErr failed");
- return amdlibFAILURE;
- }
- cRefTable = amdlibAlloc3DArrayComplex(nbLVis, nbBases, nbFrames, errMsg);
- if (cRefTable == NULL)
- {
- amdlibBinDiffVis_FREEALL();
- amdlibSetErrMsg("Allocation of cRefTable failed");
- return amdlibFAILURE;
- }
- sigma2_cRefTable = amdlibAlloc3DArrayComplex(nbLVis, nbBases, nbFrames, errMsg);
- if (sigma2_cRefTable == NULL)
- {
- amdlibBinDiffVis_FREEALL();
- amdlibSetErrMsg("Allocation of cRefTableErr failed");
- return amdlibFAILURE;
- }
- opd = amdlibAlloc2DArrayDouble(nbBases, nbFrames, errMsg);
- if (opd == NULL)
- {
- amdlibBinDiffVis_FREEALL();
- amdlibSetErrMsg("Allocation of opd failed");
- return amdlibFAILURE;
- }
- wlen = calloc(nbLVis,sizeof(*wlen));
- if (wlen == NULL)
- {
- amdlibBinDiffVis_FREEALL();
- amdlibSetErrMsg("Allocation of wlen failed");
- return amdlibFAILURE;
- }
-
- cpxVisVectR = calloc(nbFrames,sizeof(*cpxVisVectR));
- if (cpxVisVectR == NULL)
- {
- amdlibBinDiffVis_FREEALL();
- amdlibSetErrMsg("Allocation of cpxVisVectR failed");
- return amdlibFAILURE;
- }
- cpxVisVectI = calloc(nbFrames,sizeof(*cpxVisVectI));
- if (cpxVisVectI == NULL)
- {
- amdlibBinDiffVis_FREEALL();
- amdlibSetErrMsg("Allocation of cpxVisVectI failed");
- return amdlibFAILURE;
- }
- snrVect = calloc(nbFrames,sizeof(*snrVect));
- if ( snrVect== NULL)
- {
- amdlibBinDiffVis_FREEALL();
- amdlibSetErrMsg("Allocation of snrVect failed");
- return amdlibFAILURE;
- }
- phiVect = calloc(nbFrames,sizeof(*phiVect));
- if ( phiVect== NULL)
- {
- amdlibBinDiffVis_FREEALL();
- amdlibSetErrMsg("Allocation of phiVect failed");
- return amdlibFAILURE;
- }
- /* Wrap structures given as parametres */
- cpxVisTablePtr =
- (amdlibVIS_TABLE_ENTRY **)amdlibWrap2DArray(instantCorrFlux->table,
- nbBases, instantCorrFlux->nbFrames,
- sizeof(amdlibVIS_TABLE_ENTRY),
- errMsg);
- if (cpxVisTablePtr == NULL)
- {
- amdlibBinDiffVis_FREEALL();
- return amdlibFAILURE;
- }
-
- instantOpdPistonPtr =
- amdlibWrap2DArrayDouble(instantOpd->pistonOPDArray[band],
- instantOpd->nbBases,
- instantOpd->nbFrames, errMsg);
- if (instantOpdPistonPtr == NULL)
- {
- amdlibSetErrMsg("Could not wrap 2D amdlibDOUBLE array");
- amdlibBinDiffVis_FREEALL();
- return amdlibFAILURE;
- }
-
- visTablePtr =
- (amdlibVIS_TABLE_ENTRY **)amdlibWrap2DArray(vis->table,
- nbBases, vis->nbFrames,
- sizeof(amdlibVIS_TABLE_ENTRY),
- errMsg);
- if (visTablePtr == NULL)
- {
- amdlibBinDiffVis_FREEALL();
- return amdlibFAILURE;
- }
-
- /* Initialize opd: local copy where all bad pistons are Blank:
- * if opd = BLANK, cNopTable[iFrame][iBase] will be BLANK, and the avg
- * and rms done at the end will avoid these values */
- for (iFrame = 0, runningFrame=firstFrame; iFrame < nbFrames;
- iFrame++, runningFrame++)
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- opd[iFrame][iBase] = instantOpdPistonPtr[runningFrame][iBase];
- }
- }
-
- /* Immediately copy input cpxVis to 3D structure, flagging as BLANK when Flag is present */
-
- for (iFrame = 0, runningFrame=firstFrame; iFrame < nbFrames;
- iFrame++, runningFrame++)
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- if (instantCorrFlux->table[runningFrame*nbBases+iBase].flag[lVis]== amdlibFALSE)
- {
- cpxVisTable[iFrame][iBase][lVis].re =
- cpxVisTablePtr[runningFrame][iBase].vis[lVis].re;
- cpxVisTable[iFrame][iBase][lVis].im =
- cpxVisTablePtr[runningFrame][iBase].vis[lVis].im;
-
- sigma2_cpxVisTable[iFrame][iBase][lVis].re =
- cpxVisTablePtr[runningFrame][iBase].sigma2Vis[lVis].re;
- sigma2_cpxVisTable[iFrame][iBase][lVis].im =
- cpxVisTablePtr[runningFrame][iBase].sigma2Vis[lVis].im;
- }
- else
- {
- cpxVisTable[iFrame][iBase][lVis].re = amdlibBLANKING_VALUE;
- cpxVisTable[iFrame][iBase][lVis].im = amdlibBLANKING_VALUE;
- sigma2_cpxVisTable[iFrame][iBase][lVis].re = amdlibBLANKING_VALUE;
- sigma2_cpxVisTable[iFrame][iBase][lVis].im = amdlibBLANKING_VALUE;
- }
- }
- }
- }
- /* Initialize wlen */
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- wlen[lVis] = wave->wlen[lVis];
- }
-
- /* Correct from Piston, 1st time */
- /* First, correct coherent flux from achromatic piston phase (eq 2.2)*/
- if (amdlibCorrect3DVisTableFromAchromaticPiston(cpxVisTable,
- cNopTable,
- nbFrames,
- nbBases,
- nbLVis,
- wlen,
- opd,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
-
- /* Production of the reference channel: mean of all R and I parts
- * of all channels except the one considered ( eq 2.3) */
- for (iFrame = 0; iFrame < nbFrames; iFrame++)
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- cpxVis.re = 0.0;
- cpxVis.im = 0.0;
- sigma2_cpxVis.re = 0.0;
- sigma2_cpxVis.im = 0.0;
- /* sum all R and I */
- for (nbGoodVis= 0, lVis = 0; lVis < nbLVis; lVis++)
- {
- if (!amdlibCompareDouble(cpxVisTable[iFrame][iBase][lVis].re,amdlibBLANKING_VALUE))
- {
- cpxVis.re += cNopTable[iFrame][iBase][lVis].re;
- cpxVis.im += cNopTable[iFrame][iBase][lVis].im;
- sigma2_cpxVis.re += sigma2_cpxVisTable[iFrame][iBase][lVis].re;
- sigma2_cpxVis.im += sigma2_cpxVisTable[iFrame][iBase][lVis].im;
- nbGoodVis++;
- }
- }
- /* then construct Cref by substracting current R and I
- * at that Wlen and make the arithmetic mean */
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- cRefTable[iFrame][iBase][lVis].re =
- (cpxVis.re - cNopTable[iFrame][iBase][lVis].re) /
- (nbGoodVis - 1);
- cRefTable[iFrame][iBase][lVis].im =
- (cpxVis.im - cNopTable[iFrame][iBase][lVis].im) /
- (nbGoodVis - 1);
-
- sigma2_cRefTable[iFrame][iBase][lVis].re =
- (sigma2_cpxVis.re -
- sigma2_cpxVisTable[iFrame][iBase][lVis].re) /
- (nbGoodVis - 1);
- sigma2_cRefTable[iFrame][iBase][lVis].im =
- (sigma2_cpxVis.im -
- sigma2_cpxVisTable[iFrame][iBase][lVis].im) /
- (nbGoodVis - 1);
- }
- }
- }
-
- /* Now the interspectrum is cNopTable*~cRefTable. Store in w1. */
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- for (iFrame = 0; iFrame < nbFrames; iFrame++)
- {
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- cpxVis.re = cNopTable[iFrame][iBase][lVis].re;
- cpxVis.im = cNopTable[iFrame][iBase][lVis].im;
-
- phasor.re = cRefTable[iFrame][iBase][lVis].re;
- phasor.im = -1*cRefTable[iFrame][iBase][lVis].im;
-
- amdlibCpxMul(cpxVis,phasor,w1[iFrame][iBase][lVis]);
-
- /* Please have a look to the F. Millour thesis
- (http://tel.archives-ouvertes.fr/tel-00134268),
- pp.91-892 (eq. 4.55 to 4.58) */
- sigma2_w1[iFrame][iBase][lVis].re =
- sigma2_cpxVisTable[iFrame][iBase][lVis].re *
- amdlibPow2(cRefTable[iFrame][iBase][lVis].re) +
- sigma2_cRefTable[iFrame][iBase][lVis].re *
- amdlibPow2(cpxVisTable[iFrame][iBase][lVis].re) +
- sigma2_cpxVisTable[iFrame][iBase][lVis].im *
- amdlibPow2(cRefTable[iFrame][iBase][lVis].im) +
- sigma2_cRefTable[iFrame][iBase][lVis].im *
- amdlibPow2(cpxVisTable[iFrame][iBase][lVis].im);
-
- sigma2_w1[iFrame][iBase][lVis].im =
- sigma2_cpxVisTable[iFrame][iBase][lVis].im *
- amdlibPow2(cRefTable[iFrame][iBase][lVis].re) +
- sigma2_cRefTable[iFrame][iBase][lVis].im *
- amdlibPow2(cpxVisTable[iFrame][iBase][lVis].re) +
- sigma2_cpxVisTable[iFrame][iBase][lVis].re *
- amdlibPow2(cRefTable[iFrame][iBase][lVis].im) +
- sigma2_cRefTable[iFrame][iBase][lVis].re *
- amdlibPow2(cpxVisTable[iFrame][iBase][lVis].im);
- }
- }
- }
-
- /* Compute mean VisPhi as average of frames. If snr is BLANK
- * (negative), averages take into account blanked values */
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- /* The SNR vector */
- for (iFrame = 0 , nbGoodFrames =0; iFrame < nbFrames; iFrame++)
- {
- if ( !amdlibCompareDouble(opd[iFrame][iBase],amdlibBLANKING_VALUE) &&
- !amdlibCompareDouble(cpxVisTable[iFrame][iBase][lVis].re,amdlibBLANKING_VALUE) )
- {
- snrVect[iFrame] = 1.0;
- nbGoodFrames ++;
- }
- else
- {
- snrVect[iFrame] = -1.0;
- }
- }
- /* The W1 vector */
- for (iFrame = 0 ; iFrame < nbFrames; iFrame++)
- {
- cpxVisVectR[iFrame] = w1[iFrame][iBase][lVis].re;
- cpxVisVectI[iFrame] = w1[iFrame][iBase][lVis].im;
- }
- /* The Phase Herself */
- /* average re and im */
- w1Avg.re = amdlibAvgTable(nbFrames, cpxVisVectR, snrVect);
- w1Avg.im = amdlibAvgTable(nbFrames, cpxVisVectI, snrVect);
- /* store */
- visTablePtr[iBin][iBase].diffVisPhi[lVis] =
- (double)(nbGoodVis-1)/(double)nbGoodVis*atan2(w1Avg.im,w1Avg.re);
-
- /* WE USE THE STATISTICAL ERROR FOR BINNING */
- w1Avg.im=-1*w1Avg.im;
- for (iFrame = 0 ; iFrame < nbFrames; iFrame++)
- {
- /* add w1*conj(w1Avg) to vector*/
- amdlibCpxMul(w1[iFrame][iBase][lVis],w1Avg,cpxVis);
- /* use phiVect to store phases */
- phiVect[iFrame] = atan2(cpxVis.im,cpxVis.re);
- }
- x = amdlibRmsTable(nbFrames, phiVect, snrVect);
- /* Err on Phi must be corrected with an abacus*/
- visTablePtr[iBin][iBase].diffVisPhiErr[lVis] =
- amdlibAbacusErrPhi(x/sqrt(nbGoodFrames));
- }
- }
-
- /* Now for the differential vis, we use cNopTable/cRefTable. Store in w1.
- * note this is not exactly as complicated as in the computeDiff yorick
- * implementation by Millour */
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- for (iFrame = 0; iFrame < nbFrames; iFrame++)
- {
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- cpxVis.re = cNopTable[iFrame][iBase][lVis].re;
- cpxVis.im = cNopTable[iFrame][iBase][lVis].im;
- phasor.re = cRefTable[iFrame][iBase][lVis].re;
- phasor.im = cRefTable[iFrame][iBase][lVis].im;
- amdlibCpxDiv(cpxVis,phasor,w1[iFrame][iBase][lVis]);
- }
- }
- }
- /* Compute mean VisAmp as average of selected frames. */
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- /* The SNR vector */
- for (iFrame = 0, nbGoodFrames = 0 ; iFrame < nbFrames; iFrame++)
- {
- if( !amdlibCompareDouble(opd[iFrame][iBase],amdlibBLANKING_VALUE) &&
- !amdlibCompareDouble(cpxVisTable[iFrame][iBase][lVis].re,amdlibBLANKING_VALUE))
- {
- snrVect[iFrame] = 1.0;
- nbGoodFrames++;
- }
- else
- {
- snrVect[iFrame] = -1.0;
- }
- }
- /* The W1 vector */
- for (iFrame = 0 ; iFrame < nbFrames; iFrame++)
- {
- /* see eq 2.8 */
- x = visTablePtr[iBin][iBase].diffVisPhi[lVis];
- phasor.re = cos(x);
- phasor.im = -sin(x);
- cpxVis.re = w1[iFrame][iBase][lVis].re;
- cpxVis.im = w1[iFrame][iBase][lVis].im;
- cpxVisVectR[iFrame] =
- phasor.re * cpxVis.re - phasor.im * cpxVis.im;
- cpxVisVectI[iFrame] =
- phasor.re * cpxVis.im + phasor.im * cpxVis.re;
- }
- visTablePtr[iBin][iBase].diffVisAmp[lVis] =
- amdlibAvgTable(nbFrames, cpxVisVectR, snrVect);
- visTablePtr[iBin][iBase].diffVisAmpErr[lVis] =
- amdlibRmsTable(nbFrames, cpxVisVectR, snrVect) / sqrt(nbGoodFrames);
- }
- }
-
- amdlibBinDiffVis_FREEALL();
- return amdlibSUCCESS;
-}
-#undef amdlibBinDiffVis_FREEALL
-
-
-/** Useful macro to free all dynamically allocated structures */
-#define amdlibComputeFringeCriterion_FREEALL() \
- amdlibFree2DArrayWrapping((void **)corrFluxTablePtr); \
- amdlibFree2DArrayWrapping((void **)visTablePtr);
-/**
- * Compute fringe criterion.
- *
- * @param instantCorrFlux the bin of instanteous correlated fluxes.
- * @param iBin index of the results to be written in the output (binned) vis
- * structure.
- * @param band current band treated.
- * @param selection structure containing information relative to frame
- * selection. By default, all frames are selected.
- * @param vis structure were results are stored.
- */
-void amdlibComputeFringeCriterion(/* Input */
- amdlibVIS *instantCorrFlux,
- int iBin,
- amdlibBAND band,
- amdlibSELECTION *selection,
- /* Output */
- amdlibVIS *vis)
-{
- /* loop indexes and associated limits */
- int iFrame; /* usually loop on number of frames */
- int nbFrames = instantCorrFlux->nbFrames;
-
- int iBase; /*usually loop on nbBases*/
- int nbBases = instantCorrFlux->nbBases;
- /* Number of Baselines in Science Data*/
- int lVis = 0;
- int nbLVis = instantCorrFlux->nbWlen;
- int nbValid;
-
- /* Input values of the coherent flux */
- amdlibCOMPLEX CorrFlux;
- amdlibCOMPLEX sigma2_CorrFlux;
-
- /* Used for the fringes detection criterion */
- double num_SNR_CorrFlux_re;
- double num_SNR_CorrFlux_im;
- double denom_SNR_CorrFlux_re;
- double denom_SNR_CorrFlux_im;
- double frgContrastSNR;
- double sqFrgContrastSNR;
-
- amdlibVIS_TABLE_ENTRY **corrFluxTablePtr = NULL;
- amdlibVIS_TABLE_ENTRY **visTablePtr = NULL;
- static amdlibERROR_MSG errMsg;
-
- /* Computation of the fringe Criterion */
- /* This is useful for the fringe Criterion :
- * initialisation of the photometry and the sigma2 */
-
- amdlibLogTrace("amdlibComputeFringeCriterion()");
-
- /* Wrap structures given as parametres */
- visTablePtr =
- (amdlibVIS_TABLE_ENTRY **)amdlibWrap2DArray(vis->table,
- nbBases, vis->nbFrames,
- sizeof(amdlibVIS_TABLE_ENTRY),
- errMsg);
- if (visTablePtr == NULL)
- {
- amdlibComputeFringeCriterion_FREEALL();
- }
- corrFluxTablePtr =
- (amdlibVIS_TABLE_ENTRY **)amdlibWrap2DArray(instantCorrFlux->table,
- nbBases, nbFrames,
- sizeof(amdlibVIS_TABLE_ENTRY),
- errMsg);
- if (corrFluxTablePtr == NULL)
- {
- amdlibComputeFringeCriterion_FREEALL();
- }
-
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- if (selection->band[band].nbSelectedFrames[iBase] == 0)
- {
- continue;
- }
- num_SNR_CorrFlux_re = 0.0;
- num_SNR_CorrFlux_im = 0.0;
- denom_SNR_CorrFlux_re = 0.0;
- denom_SNR_CorrFlux_im = 0.0;
- nbValid=0;
-
- for (iFrame = 0; iFrame < nbFrames; iFrame++)
- {
- if (selection->band[band].isSelectedPt[iBase][iFrame] == amdlibTRUE)
- {
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- if (corrFluxTablePtr[iFrame][iBase].flag[lVis]==amdlibFALSE)
- {
- nbValid++;
- /* Get useful information for computing */
- sigma2_CorrFlux.re =
- corrFluxTablePtr[iFrame][iBase].sigma2Vis[lVis].re;
- sigma2_CorrFlux.im =
- corrFluxTablePtr[iFrame][iBase].sigma2Vis[lVis].im;
- CorrFlux.re = corrFluxTablePtr[iFrame][iBase].vis[lVis].re;
- CorrFlux.im = corrFluxTablePtr[iFrame][iBase].vis[lVis].im;
-
- /* summed over wavelength */
- num_SNR_CorrFlux_re +=
- ((amdlibPow2(CorrFlux.re) / sigma2_CorrFlux.re) - 1) /
- sigma2_CorrFlux.re;
-
- num_SNR_CorrFlux_im +=
- ((amdlibPow2(CorrFlux.im) / sigma2_CorrFlux.im) - 1) /
- sigma2_CorrFlux.im;
-
- denom_SNR_CorrFlux_re += 1 / sigma2_CorrFlux.re;
-
- denom_SNR_CorrFlux_im += 1 / sigma2_CorrFlux.im;
- }
- }
- }
- }
- if (nbValid!=0)
- {
- /* Compute fringe contrast SNR */
- sqFrgContrastSNR = num_SNR_CorrFlux_re / denom_SNR_CorrFlux_re +
- num_SNR_CorrFlux_im / denom_SNR_CorrFlux_im;
- frgContrastSNR = amdlibSignedSqrt(sqFrgContrastSNR);
-
- /* Store fringe contrast SNR */
- visTablePtr[iBin][iBase].bandFlag[band] = amdlibTRUE;
- visTablePtr[iBin][iBase].frgContrastSnrArray[band] = frgContrastSNR;
- visTablePtr[iBin][iBase].frgContrastSnr = frgContrastSNR;
- }
- else
- {
- visTablePtr[iBin][iBase].bandFlag[band] = amdlibFALSE;
- visTablePtr[iBin][iBase].frgContrastSnrArray[band] = amdlibBLANKING_VALUE;
- visTablePtr[iBin][iBase].frgContrastSnr = amdlibBLANKING_VALUE;
- }
- }
- amdlibComputeFringeCriterion_FREEALL();
-}
-#undef amdlibComputeFringeCriterion_FREEALL
-
-
-/** Useful macro to free all dynamically allocated structures */
-#define amdlibBinFringeCriterion_FREEALL() \
- amdlibFree2DArrayWrapping((void **)corrFluxTablePtr); \
- amdlibFree2DArrayWrapping((void **)visTablePtr);
-void amdlibBinFringeCriterion(/* Input */
- amdlibVIS *instantCorrFlux,
- int firstFrame,
- int nbFrames,
- int iBin,
- amdlibBAND band,
- /* Output */
- amdlibVIS *vis)
-{
- /* loop indexes and associated limits */
- int iFrame, runningFrame; /* usually loop on number of frames */
-
- int iBase; /*usually loop on nbBases*/
- int nbBases = instantCorrFlux->nbBases;
- /* Number of Baselines in Science Data*/
- int lVis = 0;
- int nbLVis = instantCorrFlux->nbWlen;
- int nbValid;
-
- /* Input values of the coherent flux */
- amdlibCOMPLEX CorrFlux;
- amdlibCOMPLEX sigma2_CorrFlux;
-
- /* Used for the fringes detection criterion */
- double num_SNR_CorrFlux_re;
- double num_SNR_CorrFlux_im;
- double denom_SNR_CorrFlux_re;
- double denom_SNR_CorrFlux_im;
- double frgContrastSNR;
- double sqFrgContrastSNR;
-
- amdlibVIS_TABLE_ENTRY **corrFluxTablePtr = NULL;
- amdlibVIS_TABLE_ENTRY **visTablePtr = NULL;
- static amdlibERROR_MSG errMsg;
-
- /* Computation of the fringe Criterion */
- /* This is useful for the fringe Criterion :
- * initialisation of the photometry and the sigma2 */
-
- amdlibLogTrace("amdlibBinFringeCriterion()");
-
- /* Wrap structures given as parametres */
- visTablePtr =
- (amdlibVIS_TABLE_ENTRY **)amdlibWrap2DArray(vis->table,
- vis->nbBases, vis->nbFrames,
- sizeof(amdlibVIS_TABLE_ENTRY),
- errMsg);
- if (visTablePtr == NULL)
- {
- amdlibBinFringeCriterion_FREEALL();
- }
- corrFluxTablePtr =
- (amdlibVIS_TABLE_ENTRY **)amdlibWrap2DArray(instantCorrFlux->table,
- instantCorrFlux->nbBases,
- instantCorrFlux->nbFrames,
- sizeof(amdlibVIS_TABLE_ENTRY),
- errMsg);
- if (corrFluxTablePtr == NULL)
- {
- amdlibBinFringeCriterion_FREEALL();
- }
-
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- num_SNR_CorrFlux_re = 0.0;
- num_SNR_CorrFlux_im = 0.0;
- denom_SNR_CorrFlux_re = 0.0;
- denom_SNR_CorrFlux_im = 0.0;
- nbValid=0;
- for (iFrame = 0, runningFrame=firstFrame; iFrame < nbFrames;
- iFrame++, runningFrame++)
- {
- for (lVis = 0; lVis < nbLVis; lVis++)
- {
- if(corrFluxTablePtr[runningFrame][iBase].flag[lVis]==amdlibFALSE)
- {
- nbValid++;
- /* Get useful information for computing */
- sigma2_CorrFlux.re =
- corrFluxTablePtr[runningFrame][iBase].sigma2Vis[lVis].re;
- sigma2_CorrFlux.im =
- corrFluxTablePtr[runningFrame][iBase].sigma2Vis[lVis].im;
- CorrFlux.re = corrFluxTablePtr[runningFrame][iBase].vis[lVis].re;
- CorrFlux.im = corrFluxTablePtr[runningFrame][iBase].vis[lVis].im;
-
- /* summed over wavelength */
- num_SNR_CorrFlux_re +=
- ((amdlibPow2(CorrFlux.re) / sigma2_CorrFlux.re) - 1) /
- sigma2_CorrFlux.re;
-
- num_SNR_CorrFlux_im +=
- ((amdlibPow2(CorrFlux.im) / sigma2_CorrFlux.im) - 1) /
- sigma2_CorrFlux.im;
-
- denom_SNR_CorrFlux_re += 1 / sigma2_CorrFlux.re;
-
- denom_SNR_CorrFlux_im += 1 / sigma2_CorrFlux.im;
- }
- }
- }
- if (nbValid!=0)
- {
- /* Compute fringe contrast SNR */
- sqFrgContrastSNR = num_SNR_CorrFlux_re / denom_SNR_CorrFlux_re +
- num_SNR_CorrFlux_im / denom_SNR_CorrFlux_im;
- frgContrastSNR = amdlibSignedSqrt(sqFrgContrastSNR);
-
- /* Store fringe contrast SNR */
- visTablePtr[iBin][iBase].bandFlag[band] = amdlibTRUE;
- visTablePtr[iBin][iBase].frgContrastSnrArray[band] = frgContrastSNR;
- visTablePtr[iBin][iBase].frgContrastSnr = frgContrastSNR;
- }
- else
- {
- visTablePtr[iBin][iBase].bandFlag[band] = amdlibFALSE;
- visTablePtr[iBin][iBase].frgContrastSnrArray[band] = amdlibBLANKING_VALUE;
- visTablePtr[iBin][iBase].frgContrastSnr = amdlibBLANKING_VALUE;
- }
- }
-
- amdlibBinFringeCriterion_FREEALL();
-}
-#undef amdlibBinFringeCriterion_FREEALL
-
-/**
- * Compute global averaged values of squared visibilities (used as quality
- * control).
- *
- * @param vis2 structure used in input and also were results are stored.
- */
-void amdlibAverageVis2(amdlibVIS2 *vis2)
-{
- double w, w1, w2, w3, ww, ww1, ww2, ww3;
- double vis12 = 0.;
- double vis23 = 0.;
- double vis31 = 0.;
- double sigmaVis12 = 0.;
- double sigmaVis23 = 0.;
- double sigmaVis31 = 0.;
- int lVis, nbWlen = vis2->nbWlen;
- int iBin, nbBins = vis2->nbFrames;
- int nbTel = 2;
- int nbBases = vis2->nbBases;
- amdlibVIS2_TABLE_ENTRY **vis2TablePtr = NULL;
- static amdlibERROR_MSG errMsg;
-
- amdlibLogTrace("amdlibAverageVis2()");
-
- /* Wrap input parametre */
- vis2TablePtr =
- (amdlibVIS2_TABLE_ENTRY **)amdlibWrap2DArray(vis2->table,
- nbBases, nbBins,
- sizeof(amdlibVIS2_TABLE_ENTRY),
- errMsg);
- if (vis2TablePtr == NULL)
- {
- amdlibFree2DArrayWrapping((void **)vis2TablePtr);
- }
-
- /* Initialize variables */
- if(nbBases == 3)
- {
- nbTel = 3;
- }
- vis2->vis12 = 0;
- vis2->vis23 = 0;
- vis2->vis31 = 0;
- vis2->sigmaVis12 = 0;
- vis2->sigmaVis23 = 0;
- vis2->sigmaVis31 = 0;
- ww1 = 0.;
- ww2 = 0.;
- ww3 = 0.;
-
- if(nbBases == 3)
- {
- amdlibLogTrace(" Wlen VIS2 12 ( err ) VIS2 23 ( err ) "
- "VIS2 31 ( err )");
- }
- else
- {
- amdlibLogTrace(" Wlen VIS2 ( err )");
- }
-
- /* Compute mean visibility per spectral channel */
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- vis12 = 0.;
- vis23 = 0.;
- vis31 = 0.;
- sigmaVis12 = 0.;
- sigmaVis23 = 0.;
- sigmaVis31 = 0.;
- w1 = 0.;
- w2 = 0.;
- w3 = 0.;
-
- for (iBin = 0; iBin < nbBins; iBin++)
- {
- w = 1.0 / amdlibPow2(vis2TablePtr[iBin][0].vis2Error[lVis]);
- w1 += w;
- sigmaVis12 += vis2TablePtr[iBin][0].vis2Error[lVis] * w;
- vis12 += vis2TablePtr[iBin][0].vis2[lVis] * w;
- if (nbTel == 3)
- {
- w= 1.0 / amdlibPow2(vis2TablePtr[iBin][1].vis2Error[lVis]);
- w2 += w;
- sigmaVis23 += vis2TablePtr[iBin][1].vis2Error[lVis] * w;
- vis23 += vis2TablePtr[iBin][1].vis2[lVis] * w;
- w = 1.0 / amdlibPow2(vis2TablePtr[iBin][2].vis2Error[lVis]);
- w3 += w;
- sigmaVis31 += vis2TablePtr[iBin][2].vis2Error[lVis] * w;
- vis31 += vis2TablePtr[iBin][2].vis2[lVis] * w;
- }
- }
- vis12 /= w1;
- sigmaVis12 /= w1;
- if (nbBases == 3)
- {
- vis23 /= w2;
- sigmaVis23 /= w2;
- vis31 /= w3;
- sigmaVis31 /= w3;
- }
- else
- {
- vis23 = 0.;
- vis31 = 0.;
- sigmaVis23 = 0.;
- sigmaVis31 = 0.;
- }
- ww = 1.0 / amdlibPow2(sigmaVis12);
- ww1 += ww;
- vis2->sigmaVis12 += sigmaVis12 * ww;
- vis2->vis12 += vis12 * ww;
-
- amdlibLogTrace("%d ", lVis);
- amdlibLogTrace("%8.3f(%8.03g)", vis12, sigmaVis12);
-
- if (nbBases == 3)
- {
- ww = 1.0 / amdlibPow2(sigmaVis23);
- ww2 += ww;
- vis2->sigmaVis23 += sigmaVis23 * ww;
- vis2->vis23 += vis23 * ww;
-
- ww = 1.0 / amdlibPow2(sigmaVis31);
- ww3 += ww;
- vis2->sigmaVis31 += sigmaVis31 * ww;
- vis2->vis31 += vis31 * ww;
-
- amdlibLogTrace("%8.3f(%8.03g)", vis23, sigmaVis23);
- amdlibLogTrace("%8.3f(%8.03g)", vis31, sigmaVis31);
- }
- else
- {
- amdlibLogTrace("");
- }
- }
-
- amdlibLogTrace("");
- vis2->vis12 /= ww1;
- vis2->sigmaVis12 /= ww1;
- if (nbBases == 3)
- {
- vis2->vis23 /= ww2;
- vis2->vis31 /= ww3;
- vis2->sigmaVis23 /= ww2;
- vis2->sigmaVis31 /= ww3;
- }
-
- amdlibFree2DArrayWrapping((void **)vis2TablePtr);
-}
-
-
-/**
- * Fills the target structure from the values in the header of the raw data.
- *
- * @param data pointer to raw data.
- * @param target pointer to target structure
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned. */
-amdlibCOMPL_STAT amdlibGetOiTargetFromRawData(amdlibRAW_DATA *rawData,
- amdlibOI_TARGET *target)
-{
-
- int i;
- int cIndex = 0;
- char targVal[amdlibKEYW_VAL_LEN];
-
- amdlibLogTrace("amdlibFillOiTargetTableEntry()");
-
- target->element[cIndex].targetId = 1;
-
- /* Retrieve from Configuration Keyword values used for various headers */
- for (i=0; i < rawData->insCfg.nbKeywords; i++)
- {
- if (strstr(rawData->insCfg.keywords[i].name, "ESO OBS TARG NAME") != NULL)
- {
- strncpy(targVal, rawData->insCfg.keywords[i].value,
- amdlibKEYW_VAL_LEN);
- amdlibStripQuotes(targVal);
- strncpy(target->element[cIndex].targetName, targVal, 16);
- }
- /*Use strncmp since RA or DEC are not unique in the header*/
- if (strncmp(rawData->insCfg.keywords[i].name, "RA ", 8) == 0)
- {
- sscanf(rawData->insCfg.keywords[i].value, "%lf",
- &target->element[cIndex].raEp0);
- }
- if (strncmp(rawData->insCfg.keywords[i].name, "DEC ", 8) == 0)
- {
- sscanf(rawData->insCfg.keywords[i].value, "%lf",
- &target->element[cIndex].decEp0);
- }
- if (strncmp(rawData->insCfg.keywords[i].name, "EQUINOX ", 8) == 0)
- {
- sscanf(rawData->insCfg.keywords[i].value, "%lf",
- &target->element[cIndex].equinox);
- }
- /* the following values are fixed until ESO's VLTICS writes a good
- * OI_TARGET by itself!*/
- strncpy(target->element[cIndex].velTyp, "UNKNOWN", 8 );
- strncpy(target->element[cIndex].velDef, "OPTICAL", 8 );
- strncpy(target->element[cIndex].specTyp, "UNKNOWN", 16 );
- }
- return amdlibSUCCESS;
-}
-
-
-/**
- * completes the description of the vis structure
- *
- * @param data pointer to science data.
- * @param vis the output vis structure.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned. */
-amdlibCOMPL_STAT amdlibFillInVisTableHeader(/* Input */
- amdlibSCIENCE_DATA *data,
- /* Output */
- amdlibVIS *vis,
- amdlibERROR_MSG errMsg)
-{
-
- int nbTel = data->nbCols-1;
- /*Number of Telescopes Used in the Science data*/
-
- int iBase; /* loop on nbBases */
- int nbBases = nbTel * (nbTel - 1) / 2;
- /* Number of Baselines in Science Data*/
-
- /* The index of the binned visibility */
- int iBin;
-
- /* The number of visibilities stored in output table (binned) */
- int nbBins = vis->nbFrames;
-
- /* The nuber of frames of (unbinned) input table in 1 bin */
- int nbFramesInOneBin = data->nbFrames / nbBins;
- int iFrame;
- double time, expTime, dateObsMJD, mjdObsAtStart;
-
- double mjdObs = 0;
- double utcTime = 0;
- int i;
- amdlibVIS_TABLE_ENTRY **visTablePtr = NULL;
-
- double **uCoord, **vCoord;
- double uCoordMean[amdlibNBASELINE], vCoordMean[amdlibNBASELINE];
-
- amdlibLogTrace("amdlibFillInVisTableHeader()");
-
- /* Wrap output parametre */
- visTablePtr =
- (amdlibVIS_TABLE_ENTRY **)amdlibWrap2DArray(vis->table,
- nbBases, nbBins,
- sizeof(amdlibVIS_TABLE_ENTRY),
- errMsg);
- if (visTablePtr == NULL)
- {
- amdlibFree2DArrayWrapping((void **)visTablePtr);
- return amdlibFAILURE;
- }
-
- /* Retrieve from Configuration Keyword values used for various headers */
- for (i = 0; i < data->insCfg.nbKeywords; i++)
- {
- if (strstr(data->insCfg.keywords[i].name, "MJD-OBS") != NULL)
- {
- sscanf(data->insCfg.keywords[i].value, "%lf", &mjdObs);
- }
- if (strncmp(data->insCfg.keywords[i].name, "UTC ",8) != 0)
- {
- sscanf(data->insCfg.keywords[i].value, "%lf", &utcTime);
- }
- }
-
- uCoord=amdlibAlloc2DArrayDouble(nbBases, data->nbFrames, errMsg);
- vCoord=amdlibAlloc2DArrayDouble(nbBases, data->nbFrames, errMsg);
- amdlibComputeUVCoords(data,nbBases,uCoord,vCoord);
-
- if (mjdObs == 0)
- {
- amdlibLogWarning("No MJD-OBS value present in file !");
- }
-
- /* Define date-obs as the daystart, i.e., 00:00 the same day */
- mjdObsAtStart = (int)mjdObs;
- strncpy(vis->dateObs, amdlibMJD2ISODate(mjdObsAtStart), amdlibDATE_LENGTH);
- /* Then, define time as "the mean UTC time of the measurement in seconds
- * since 0h on DATE-OBS.", and dateObsMJD as "the mean UTC time of the
- * measurement expressed as a modified Julian Day.". The latter is just
- * the Time Tag, the former is the differnce in seconds between the time
- * tag and mjdObsAtStart. Of course since there is a binning process we
- * must average these values over the bin.
- */
-
- expTime = data->expTime * nbFramesInOneBin;
-
- /* Set various Vis Table Entry values */
- for (iBin = 0; iBin < nbBins; iBin++)
- {
- /*compute averaged times */
- time = 0;
- for (iFrame = iBin * nbFramesInOneBin;
- iFrame < (iBin + 1) * nbFramesInOneBin;
- iFrame++)
- {
- time += data->timeTag[iFrame];
- }
- dateObsMJD = time / nbFramesInOneBin;
-
- time = (dateObsMJD - mjdObsAtStart) * 86400.0; /*in seconds...*/
-
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- uCoordMean[iBase]=0;
- vCoordMean[iBase]=0;
- /*compute averaged coords */
- for (iFrame = iBin * nbFramesInOneBin;
- iFrame < (iBin + 1) * nbFramesInOneBin;
- iFrame++)
- {
- uCoordMean[iBase] += uCoord[iFrame][iBase];
- vCoordMean[iBase] += vCoord[iFrame][iBase];
- }
- uCoordMean[iBase] /= nbFramesInOneBin;
- vCoordMean[iBase] /= nbFramesInOneBin;
- }
-
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- visTablePtr[iBin][iBase].targetId = 1;
- /*index to OI_TARGET table*/
- /* Resulting exposure time per Bin, in second */
- visTablePtr[iBin][iBase].expTime = expTime;
- visTablePtr[iBin][iBase].time = time;
- visTablePtr[iBin][iBase].dateObsMJD = dateObsMJD;
- /* U,V info */
- visTablePtr[iBin][iBase].uCoord = uCoordMean[iBase];
- visTablePtr[iBin][iBase].vCoord = vCoordMean[iBase];
- visTablePtr[iBin][0].stationIndex[0] =
- data->issInfo.stationIndex[0];
- visTablePtr[iBin][0].stationIndex[1] =
- data->issInfo.stationIndex[1];
- if (nbTel == 3)
- {
- visTablePtr[iBin][1].stationIndex[0] =
- data->issInfo.stationIndex[1];
- visTablePtr[iBin][1].stationIndex[1] =
- data->issInfo.stationIndex[2];
- visTablePtr[iBin][2].stationIndex[0] =
- data->issInfo.stationIndex[0];
- visTablePtr[iBin][2].stationIndex[1] =
- data->issInfo.stationIndex[2];
- }
- }
- }
-
- amdlibFree2DArrayWrapping((void **)visTablePtr);
- amdlibFree2DArrayDouble(uCoord);
- amdlibFree2DArrayDouble(vCoord);
- return amdlibSUCCESS;
-}
-
-/**
- * completes the description of the vis2 structure
- *
- * @param data pointer to science data.
- * @param vis2 the output vis2 structure.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned. */
-amdlibCOMPL_STAT amdlibFillInVis2TableHeader(/* Input */
- amdlibSCIENCE_DATA *data,
- /* Output */
- amdlibVIS2 *vis2,
- amdlibERROR_MSG errMsg)
-{
-
- int nbTel = data->nbCols - 1;
- /*Number of Telescopes Used in the Science data*/
-
- int iBase; /* loop on nbBases */
- int nbBases = nbTel * (nbTel - 1) / 2;
- /* Number of Baselines in Science Data*/
-
- /* The index of the binned visibility */
- int iBin;
-
- /* The number of visibilities stored in output table (binned) */
- int nbBins = vis2->nbFrames;
-
- /* The nuber of frames of (unbinned) input table in 1 bin */
- int nbFramesInOneBin = data->nbFrames / nbBins;
- int iFrame;
- double time, expTime, dateObsMJD, mjdObsAtStart;
-
- double mjdObs = 0;
- double utcTime = 0;
- int i;
- amdlibVIS2_TABLE_ENTRY **vis2TablePtr = NULL;
-
- double **uCoord, **vCoord;
- double uCoordMean[amdlibNBASELINE], vCoordMean[amdlibNBASELINE];
-
- amdlibLogTrace("amdlibFillInVis2TableHeader()");
-
- /* Wrap output parametre */
- vis2TablePtr =
- (amdlibVIS2_TABLE_ENTRY **)amdlibWrap2DArray(vis2->table,
- nbBases, nbBins,
- sizeof(amdlibVIS2_TABLE_ENTRY),
- errMsg);
- if (vis2TablePtr == NULL)
- {
- amdlibFree2DArrayWrapping((void **)vis2TablePtr);
- return amdlibFAILURE;
- }
-
- /* Retrieve from Configuration Keyword values used for various headers */
- for (i = 0; i < data->insCfg.nbKeywords; i++)
- {
- if (strstr(data->insCfg.keywords[i].name, "MJD-OBS") != NULL)
- {
- sscanf(data->insCfg.keywords[i].value, "%lf", &mjdObs);
- }
- if (strncmp(data->insCfg.keywords[i].name, "UTC ",8) != 0)
- {
- sscanf(data->insCfg.keywords[i].value, "%lf", &utcTime);
- }
- }
-
- uCoord=amdlibAlloc2DArrayDouble(nbBases, data->nbFrames, errMsg);
- vCoord=amdlibAlloc2DArrayDouble(nbBases, data->nbFrames, errMsg);
- amdlibComputeUVCoords(data,nbBases,uCoord,vCoord);
-
- if (mjdObs == 0)
- {
- amdlibLogWarning("No MJD-OBS value present in file !");
- }
-
- /* Define date-obs as the daystart, i.e., 00:00 the same day */
- mjdObsAtStart = (int)mjdObs;
- strncpy(vis2->dateObs, amdlibMJD2ISODate(mjdObsAtStart), amdlibDATE_LENGTH);
- /* Then, define time as "the mean UTC time of the measurement in seconds
- * since 0h on DATE-OBS.", and dateObsMJD as "the mean UTC time of the
- * measurement expressed as a modified Julian Day.". The latter is just
- * the Time Tag, the former is the differnce in seconds between the time
- * tag and mjdObsAtStart. Of course since there is a binning process we
- * must average these values over the bin.
- */
-
- expTime = data->expTime * nbFramesInOneBin;
-
- /* Set various Vis2 Table Entry values */
- for (iBin = 0; iBin < nbBins; iBin++)
- {
- /*compute averaged times */
- time = 0;
- for (iFrame = iBin * nbFramesInOneBin;
- iFrame < (iBin + 1) * nbFramesInOneBin;
- iFrame++)
- {
- time += data->timeTag[iFrame];
- }
- dateObsMJD = time / nbFramesInOneBin;
-
- time = (dateObsMJD - mjdObsAtStart) * 86400.0; /*in seconds...*/
-
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- uCoordMean[iBase]=0;
- vCoordMean[iBase]=0;
- /*compute averaged coords */
- for (iFrame = iBin * nbFramesInOneBin;
- iFrame < (iBin + 1) * nbFramesInOneBin;
- iFrame++)
- {
- uCoordMean[iBase] += uCoord[iFrame][iBase];
- vCoordMean[iBase] += vCoord[iFrame][iBase];
- }
- uCoordMean[iBase] /= nbFramesInOneBin;
- vCoordMean[iBase] /= nbFramesInOneBin;
- }
-
- for (iBase = 0; iBase < nbBases; iBase++)
- {
- vis2TablePtr[iBin][iBase].targetId = 1;
- /*index to OI_TARGET table*/
- /* Resulting exposure time per Bin, in second */
- vis2TablePtr[iBin][iBase].expTime = expTime;
- vis2TablePtr[iBin][iBase].time = time;
- vis2TablePtr[iBin][iBase].dateObsMJD = dateObsMJD;
- /* U,V info */
- vis2TablePtr[iBin][iBase].uCoord = uCoordMean[iBase];
- vis2TablePtr[iBin][iBase].vCoord = vCoordMean[iBase];
- vis2TablePtr[iBin][0].stationIndex[0] =
- data->issInfo.stationIndex[0];
- vis2TablePtr[iBin][0].stationIndex[1] =
- data->issInfo.stationIndex[1];
- if (nbTel == 3)
- {
- vis2TablePtr[iBin][1].stationIndex[0] =
- data->issInfo.stationIndex[1];
- vis2TablePtr[iBin][1].stationIndex[1] =
- data->issInfo.stationIndex[2];
- vis2TablePtr[iBin][2].stationIndex[0] =
- data->issInfo.stationIndex[0];
- vis2TablePtr[iBin][2].stationIndex[1] =
- data->issInfo.stationIndex[2];
- }
- }
- }
-
- amdlibFree2DArrayWrapping((void **)vis2TablePtr);
- amdlibFree2DArrayDouble(uCoord);
- amdlibFree2DArrayDouble(vCoord);
- return amdlibSUCCESS;
-}
-
-
-/**
- * completes the description of the vis3 structure
- *
- * @param data pointer to science data.
- * @param vis3 the output vis3 tructure
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned. */
-amdlibCOMPL_STAT amdlibFillInVis3TableHeader(/* Input */
- amdlibSCIENCE_DATA *data,
- /* Output */
- amdlibVIS3 *vis3,
- amdlibERROR_MSG errMsg)
-{
-
- int nbTel = data->nbCols - 1;
- /*Number of Telescopes Used in the Science data*/
-
- int iClos;
- const int nbClos = 1; /* Number of Closures FIXED */
-
- /* The index of the binned visibility */
- int iBin;
-
- /* The number of visibilities stored in output table (binned) */
- int nbBins = vis3->nbFrames;
-
- /* The nuber of frames of (unbinned) input table in 1 bin */
- int nbFramesInOneBin = data->nbFrames / nbBins;
- int iFrame;
- double time, expTime, dateObsMJD, mjdObsAtStart;
-
- double mjdObs = 0;
- double utcTime = 0;
- int i;
- /* give the impression we may have more than 3 baselines ...
- * without really doing the job! */
- const int tel1 = 0, tel2 = 1, tel3 = 2, nbBases = 3;
- amdlibVIS3_TABLE_ENTRY **vis3TablePtr = NULL;
-
- double **uCoord, **vCoord;
- double uCoordMean[amdlibNBASELINE], vCoordMean[amdlibNBASELINE];
-
- amdlibLogTrace("amdlibFillInVis3TableHeader()");
-
- /*Return if no use. Shall we confess we have been invoked in vain?*/
- if (nbTel < 3)
- {
- return amdlibSUCCESS;
- }
-
- /* Wrap output parametre */
- vis3TablePtr =
- (amdlibVIS3_TABLE_ENTRY **)amdlibWrap2DArray(vis3->table,
- nbClos, nbBins,
- sizeof(amdlibVIS3_TABLE_ENTRY),
- errMsg);
- if (vis3TablePtr == NULL)
- {
- amdlibFree2DArrayWrapping((void **)vis3TablePtr);
- return amdlibFAILURE;
- }
-
- /* Retrieve from Configuration Keyword values used for various headers */
- for (i = 0; i < data->insCfg.nbKeywords; i++)
- {
- if (strstr(data->insCfg.keywords[i].name, "MJD-OBS") != NULL)
- {
- sscanf(data->insCfg.keywords[i].value, "%lf", &mjdObs);
- }
- if (strncmp(data->insCfg.keywords[i].name, "UTC ",8) != 0)
- {
- sscanf(data->insCfg.keywords[i].value, "%lf", &utcTime);
- }
- }
-
- uCoord=amdlibAlloc2DArrayDouble(nbBases, data->nbFrames, errMsg);
- vCoord=amdlibAlloc2DArrayDouble(nbBases, data->nbFrames, errMsg);
- amdlibComputeUVCoords(data,nbBases,uCoord,vCoord);
-
- if (mjdObs == 0)
- {
- amdlibLogWarning("No MJD-OBS value present in file !");
- }
-
- /* Define date-obs as the daystart, i.e., 00:00 the same day */
- mjdObsAtStart = (int)mjdObs;
- strncpy (vis3->dateObs, amdlibMJD2ISODate(mjdObsAtStart),amdlibDATE_LENGTH);
- /* Then, define time as "the mean UTC time of the measurement in seconds
- * since 0h on DATE-OBS.", and dateObsMJD as "the mean UTC time of the
- * measurement expressed as a modified Julian Day.". The latter is just the
- * Time Tag, the former is the differnce in seconds between the time tag and
- * mjdObsAtStart. Of course since there is a binning process we must average
- * these values over the bin.
- */
-
- expTime = data->expTime * nbFramesInOneBin;
-
- /* Set various Vis3 Table Entry values */
- for (iBin = 0; iBin < nbBins; iBin++)
- {
- /*compute averaged times */
- time = 0;
- for (iFrame = iBin * nbFramesInOneBin;
- iFrame < (iBin + 1) * nbFramesInOneBin;
- iFrame++)
- {
- time += data->timeTag[iFrame];
- }
- dateObsMJD = time / nbFramesInOneBin;
-
- time = (dateObsMJD - mjdObsAtStart) * 86400.0; /*in seconds...*/
-
- uCoordMean[0]=0;
- vCoordMean[0]=0;
- uCoordMean[1]=0;
- vCoordMean[1]=0;
- /*compute averaged coords */
- for (iFrame = iBin * nbFramesInOneBin;
- iFrame < (iBin + 1) * nbFramesInOneBin;
- iFrame++)
- {
- uCoordMean[0] += uCoord[iFrame][0];
- vCoordMean[0] += vCoord[iFrame][0];
- uCoordMean[1] += uCoord[iFrame][1];
- vCoordMean[1] += vCoord[iFrame][1];
- }
- uCoordMean[0] /= nbFramesInOneBin;
- vCoordMean[0] /= nbFramesInOneBin;
- uCoordMean[1] /= nbFramesInOneBin;
- vCoordMean[1] /= nbFramesInOneBin;
-
- for (iClos = 0; iClos < nbClos; iClos++)
- {
- vis3TablePtr[iBin][iClos].targetId = 1; /*index to OI_TARGET table*/
- vis3TablePtr[iBin][iClos].expTime = expTime;
- vis3TablePtr[iBin][iClos].time = time;
- vis3TablePtr[iBin][iClos].dateObsMJD = dateObsMJD;
- vis3TablePtr[iBin][iClos].u1Coord = uCoordMean[0];
- vis3TablePtr[iBin][iClos].v1Coord = vCoordMean[0];
- vis3TablePtr[iBin][iClos].u2Coord = uCoordMean[1];
- vis3TablePtr[iBin][iClos].v2Coord = vCoordMean[1];
- /*this code could possibly be extended to more telescopes!*/
- vis3TablePtr[iBin][iClos].stationIndex[0] =
- data->issInfo.stationIndex[tel1];
- vis3TablePtr[iBin][iClos].stationIndex[1] =
- data->issInfo.stationIndex[tel2];
- vis3TablePtr[iBin][iClos].stationIndex[2] =
- data->issInfo.stationIndex[tel3];
- }
- }
-
- amdlibFree2DArrayWrapping((void **)vis3TablePtr);
- amdlibFree2DArrayDouble(uCoord);
- amdlibFree2DArrayDouble(vCoord);
- return amdlibSUCCESS;
-}
-
-
diff --git a/amber/amdlibWaveData.c b/amber/amdlibWaveData.c
deleted file mode 100644
index 57c4e0d..0000000
--- a/amber/amdlibWaveData.c
+++ /dev/null
@@ -1,518 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-/**
- * @file
- * Functions to handle the AMBER_WAVEDATA binary table.
- *
- * The AMBER_WAVEDATA binary table contains the spectral dispersion table for
- * the instrument configuration used during exposure.
- */
-#define _POSIX_SOURCE 1
-
-/*
- * System Headers
- */
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include "fitsio.h"
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/*
- * Global variable
- */
-/* this is the 3 bands, withous overlap */
-static amdlibBAND_DESC bands[amdlibNB_BANDS] = {{"J", 1000.0l, 1439.9999l},
- {"H", 1440.0l, 1894.4999l},
- {"K", 1894.5l, 3500.0l}};
-/* the following is the ESO-AMBER defined bands */
-/* static amdlibBAND_DESC bands[amdlibNB_BANDS] = {{"J", 1000.0000, 1411.0000}, */
-/* {"H", 1469.0000, 1869.0000}, */
-/* {"K", 1920.0000, 3500.0000}}; */
-/* The following was an old estimate of the overlap bands */
-/* static amdlibBAND_DESC bands[amdlibNB_BANDS] = {{"J", 1000.0000, 1469.0000}, */
-/* {"H", 1539.0000, 1892.0000}, */
-/* {"K", 1942.0000, 3500.0000}}; */
-/*
- * Protected functions definition
- */
-/* Protected functions */
-/**
- * Compute bandwidth
- *
- * This function compute the bandwith of the wavelength table. The bandwith is
- * just computed as :
- * \li band(i) = (wlen(i+1) - wlen(i-1)) / 2.0
- * additionnaly, Bw[0]=Bw[1] and
- * Bw[amdlibNB_SPECTRAL_CHANNELS-1]=Bw[amdlibNB_SPECTRAL_CHANNELS-2]
- * @return
- * Always amdlibSUCCESS
- */
-amdlibCOMPL_STAT amdlibComputeBandwidth(amdlibWAVEDATA *waveData)
-{
- int l;
- amdlibDOUBLE *wlenTbl = waveData->wlen;
- amdlibDOUBLE *widthTbl = waveData->bandwidth;
- for (l = 1; l < (amdlibNB_SPECTRAL_CHANNELS - 1); l++)
- {
- if (wlenTbl[l] != 0)
- {
- if ((wlenTbl[l-1] != 0) && (wlenTbl[l+1] != 0))
- {
- widthTbl[l] = fabs((wlenTbl[l+1] - wlenTbl[l-1]) / 2.0);
- }
- else if ((wlenTbl[l-1] == 0) && (wlenTbl[l+1] != 0))
- {
- widthTbl[l] = fabs((wlenTbl[l+1] - wlenTbl[l]));
- }
- else if ((wlenTbl[l-1] != 0) && (wlenTbl[l+1] == 0))
- {
- widthTbl[l] = fabs((wlenTbl[l-1] - wlenTbl[l]));
- }
- else
- {
- widthTbl[l] = 0.0;
- }
- }
- else
- {
- widthTbl[l] = 0.0;
- }
- }
- widthTbl[0] = widthTbl[1];
- widthTbl[amdlibNB_SPECTRAL_CHANNELS-1]=widthTbl[amdlibNB_SPECTRAL_CHANNELS-2];
- return amdlibSUCCESS;
-}
-
-
-/**
- * Load spectral dispersion table from file.
- *
- * This function reads informations from the AMBER_WAVEDATA binary table and
- * store them into the waveData structure. This concerns:
- * \li the origin of the data
- * \li the instrument name
- * \li the observation date
- * \li the INS dictionary name
- * \li the number of spectral channels
- * \li the offsets between the photometric channels and the interferometric
- * channel.
- * \li the effective wavelengths and bandwidths
- *
- * @param filePtr pointer to the FITS file containing wave data.
- * @param waveData structure where wave data information will be stored
- * @param errMsg error description message returned if function fails.
- *
- * @note Missing informations about origin of data, instrument name, date and
- * dictionary are ignored.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibReadWaveData (fitsfile *filePtr,
- amdlibWAVEDATA *waveData,
- amdlibERROR_MSG errMsg)
-
-{
- int status = 0;
- int anynull = 0;
- char fitsioMsg[256];
-#ifdef TEST
- int i;
-#endif
-
- amdlibLogTrace("amdlibReadWaveData()");
-
- /* Reset error message */
- memset(errMsg, '\0', sizeof(amdlibERROR_MSG));
-
- /* Clear 'AMBER_WAVEDATA' data structure */
- memset(waveData, '\0', sizeof(amdlibWAVEDATA));
-
- /* Go to the main header, retrieve ins mode */
- if (fits_movabs_hdu(filePtr, 1, NULL, &status) != 0)
- {
- amdlibReturnFitsError("AMBER_WAVEDATA");
- }
-
- /* Go to the IMAGING_DATA binary table */
- if (fits_movnam_hdu(filePtr, BINARY_TBL, "AMBER_WAVEDATA", 0, &status) != 0)
- {
- amdlibReturnFitsError("AMBER_WAVEDATA");
- }
-
- /*** Read header informations */
- /* Read origine of the data and instrument name. If not found, the error
- * is ignored */
- if (fits_read_key(filePtr, TSTRING, "ORIGIN", &waveData->origin,
- NULL, &status) != 0)
- {
- status = 0;
- }
- if (fits_read_key(filePtr, TSTRING, "INSTRUME",
- &waveData->instrument, NULL, &status) != 0)
- {
- status = 0;
- }
- /* Read dates */
- if (fits_read_key(filePtr, TDOUBLE, "MJD-OBS", &waveData->dateObsMJD,
- NULL, &status) != 0)
- {
- status = 0;
- }
- if (fits_read_key(filePtr, TSTRING, "DATE-OBS", &waveData->dateObs,
- NULL, &status) != 0)
- {
- status = 0;
- }
- if (fits_read_key(filePtr, TSTRING, "DATE", &waveData->date,
- NULL, &status) != 0)
- {
- status = 0;
- }
- /* Read dictionary names */
- if (fits_read_key(filePtr, TSTRING, "ESO INS DID",
- &waveData->insDictionaryId, NULL, &status) != 0)
- {
- status = 0;
- }
- if (fits_read_key(filePtr, TSTRING, "ESO INS ID", &waveData->insId,
- NULL, &status) != 0)
- {
- status = 0;
- }
- /* Read the number of spectral channels */
- if (fits_read_key(filePtr, TINT, "NWAVE", &waveData->nbWlen,
- NULL, &status) != 0)
- {
- amdlibReturnFitsError("NWAVE");
- }
- if (waveData->nbWlen != amdlibNB_SPECTRAL_CHANNELS)
- {
- amdlibSetErrMsg("Wrong number of wavelengths : %d, should be %d",
- waveData->nbWlen, amdlibNB_SPECTRAL_CHANNELS);
- return amdlibFAILURE;
- }
-
- /* Read the wavelength offset, in pixel, for each photometric column */
- if (fits_read_key(filePtr, TDOUBLE, "ESO DET1 P1 OFFSETY",
- &waveData->photoOffset[0], NULL, &status) != 0)
- {
- status = 0;
- if (fits_read_key(filePtr, TDOUBLE, "ESO INS P1 OFFSETY",
- &waveData->photoOffset[0], NULL, &status) != 0)
- {
- amdlibReturnFitsError("ESO DET1 P1 OFFSETY");
- }
- }
-
- if (fits_read_key(filePtr, TDOUBLE, "ESO DET1 P2 OFFSETY",
- &waveData->photoOffset[1], NULL, &status) != 0)
- {
- status = 0;
- if (fits_read_key(filePtr, TDOUBLE, "ESO INS P2 OFFSETY",
- &waveData->photoOffset[1], NULL, &status) != 0)
- {
- amdlibReturnFitsError("ESO DET1 P2 OFFSETY");
- }
- }
-
- if (fits_read_key(filePtr, TDOUBLE, "ESO DET1 P3 OFFSETY",
- &waveData->photoOffset[2], NULL, &status) != 0)
- {
- status = 0;
- if (fits_read_key(filePtr, TDOUBLE, "ESO INS P3 OFFSETY",
- &waveData->photoOffset[2], NULL, &status) != 0)
- {
- amdlibReturnFitsError("ESO DET1 P3 OFFSETY");
- }
- }
-
- /* Read the effective wavelengths */
- if (fits_read_col(filePtr, TDOUBLE, 1, 1, 1, waveData->nbWlen, NULL,
- (void *)waveData->wlen, &anynull, &status) != 0)
- {
- amdlibReturnFitsError("EFF_WAVE");
- }
-
- /* Read the effective bandwidths */
- if (fits_read_col(filePtr, TDOUBLE, 2, 1, 1, waveData->nbWlen, NULL,
- (void *)waveData->bandwidth, &anynull, &status) != 0)
- {
- amdlibReturnFitsError("EFF_BAND");
- }
-
-#ifdef TEST
- for (i=0; i < waveData->nbWlen; i++)
- {
- if ((i % 10) == 0)
- {
- amdlibLogTest("%3d : ", i);
- }
-
- amdlibLogTest("%.4f(%.4f)", waveData->wlen[i], waveData->bandwidth[i]);
-
- if (((i+1) % 10) == 0)
- {
- amdlibLogTest("");
- }
- }
- amdlibLogTest("");
-#endif
-
- return amdlibSUCCESS;
-}
-
-/**
- * Get the spectral band to which wavelength belongs
- *
- * @param wavelength wavelength in nm
- *
- * @return
- * The spectral band, amdlibUNKNOWN_BAND if wavelength does not belongs to J, H
- * or K band.
- */
-amdlibBAND amdlibGetBand (amdlibDOUBLE wavelength)
-{
- int band;
-
- amdlibLogTrace("amdlibGetBand()");
-
- for (band = amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- if ((wavelength-bands[band].lowerBound)>=0.0l &&
- (wavelength-bands[band].upperBound)<0.0l)
- {
- return band;
- }
- }
- return amdlibUNKNOWN_BAND;
-}
-
-/**
- * Return band as character (J, H or K)
- *
- * @param band spectral band
- *
- * @return
- * 'J', 'H' or 'K', or ' ' if invalid band.
- */
-char amdlibBandNumToStr(amdlibBAND band)
-{
- if (band == amdlibUNKNOWN_BAND)
- {
- return ' ';
- }
- return (bands[band].name[0]);
-}
-
-/**
- * Return band description.
- *
- * @param band spectral band
- *
- * @return
- * a pointer on the corresponding amdlibBAND_DESC structure, or NULL if invalid
- * band.
- */
-amdlibBAND_DESC *amdlibGetBandDescription(amdlibBAND band)
-{
- if (band == amdlibUNKNOWN_BAND)
- {
- return NULL;
- }
- return &bands[band];
-}
-
-/**
- * Retrieve wave data structure from the specified raw data
- *
- * @param rawData input raw data
- * @param waveData output duplicated wave data
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibGetWaveDataFromRawData(amdlibRAW_DATA *rawData,
- amdlibWAVEDATA *waveData,
- amdlibERROR_MSG errMsg)
-{
- /* Copy 'amdlibWAVEDATA' data structure */
- memcpy(waveData, &rawData->waveData, sizeof(amdlibWAVEDATA));
-
- return amdlibSUCCESS;
-}
-
-/**
- * Extract an amdlibWAVEDATA structure from p2vm data.
- *
- * @param p2vm input p2vm.
- * @param waveData amdlibWAVEDATA structure produced.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibGetWaveDataFromP2vm(amdlibP2VM_MATRIX *p2vm,
- amdlibWAVEDATA *waveData,
- amdlibERROR_MSG errMsg)
-{
- int l;
- char offsetValue[amdlibKEYW_VAL_LEN+1];
-
- waveData->nbWlen = amdlibNB_SPECTRAL_CHANNELS;
-
- /* Fill array wlen of waveData */
- memset(waveData->wlen, '\0',
- amdlibNB_SPECTRAL_CHANNELS * sizeof(amdlibDOUBLE));
- for (l = 0; l < p2vm->nbChannels; l++)
- {
- waveData->wlen[p2vm->firstChannel + l] = p2vm->wlen[l];
- }
-
- /* Compute bandwidth */
- if (amdlibComputeBandwidth(waveData) == amdlibFAILURE)
- {
- amdlibSetErrMsg("Could not compute bandwidth");
- return amdlibFAILURE;
- }
-
- /* Find photoOffsets */
- memset(offsetValue, '\0', (amdlibKEYW_VAL_LEN+1)*sizeof(char));
- if (amdlibGetInsCfgKeyword(&p2vm->insCfg,
- "HIERARCH ESO QC P1 OFFSETY",
- offsetValue, errMsg) != amdlibSUCCESS)
- {
- if (amdlibGetInsCfgKeyword(&p2vm->insCfg,
- "HIERARCH ESO DET1 P1 OFFSETY",
- offsetValue, errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- }
- sscanf(offsetValue, "%lf", &waveData->photoOffset[0]);
-
- memset(offsetValue, '\0', (amdlibKEYW_VAL_LEN+1)*sizeof(char));
- if (amdlibGetInsCfgKeyword(&p2vm->insCfg, "HIERARCH ESO QC P2 OFFSETY",
- offsetValue, errMsg) != amdlibSUCCESS)
- {
- if (amdlibGetInsCfgKeyword(&p2vm->insCfg,
- "HIERARCH ESO DET1 P2 OFFSETY",
- offsetValue, errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- }
- sscanf(offsetValue, "%lf", &waveData->photoOffset[1]);
-
- memset(offsetValue, '\0', (amdlibKEYW_VAL_LEN+1)*sizeof(char));
- if (amdlibGetInsCfgKeyword(&p2vm->insCfg, "HIERARCH ESO QC P3 OFFSETY",
- offsetValue, errMsg) != amdlibSUCCESS)
- {
- if (amdlibGetInsCfgKeyword(&p2vm->insCfg,
- "HIERARCH ESO DET1 P3 OFFSETY",
- offsetValue, errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- }
- sscanf(offsetValue, "%lf", &waveData->photoOffset[2]);
-
- return amdlibSUCCESS;
-}
-
-/**
- * Get valid channel for the given spectral band.
- *
- * This function cross-checks spectral channels of the science data with P2VM,
- * and returns the number of valid spectral channels belonging to the specified
- * spectral band.
- *
- * The returned channels are valid in the p2vm. This because the p2vm may
- * contain flagged 'lines' because of bad pixels or insufficient data during the
- * p2vm calibration phase.
- *
- * @param p2vm p2vm data.
- * @param data science data.
- * @param waveData data on wavelengths.
- * @param band spectral band considered : amdlibJ_BAND, amdlibH_BAND,
- * amdlibK_BAND.
- * @param nbChannelsInBand number of channels belonging to input band.
- * @param channelNoInBand array where indexes are stored.
- *
- * @warning channelNoInBand is assumed to be already allocated.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibGetChannelsInBand(amdlibP2VM_MATRIX *p2vm,
- amdlibSCIENCE_DATA *data,
- amdlibWAVEDATA *waveData,
- amdlibBAND band,
- int *nbChannelsInBand,
- int *channelNoInBand)
-{
- int channel;
- int channelNo;
- int nbValidChannel = 0;
-
- /* Search for first channel in band and compute nbChannelsInBand */
- for (channel = 0; channel < data->nbChannels; channel++)
- {
- channelNo = data->channelNo[channel];
- if ((amdlibGetBand(waveData->wlen[channelNo]) == band))
- {
- int lP2vm;
- if (amdlibIsValidChannel(p2vm, channelNo, &lP2vm) == amdlibTRUE)
- {
- channelNoInBand[nbValidChannel] = channelNo;
- nbValidChannel++;
- }
- }
- }
-
- *nbChannelsInBand = nbValidChannel;
-
- return amdlibSUCCESS;
-}
-
-amdlibBOOLEAN amdlibIsBandPresentInData(amdlibSCIENCE_DATA *data,
- amdlibP2VM_MATRIX *p2vm,
- amdlibWAVEDATA *waveData,
- amdlibBAND band)
-{
- int nbChannelsInBand = 0;
- int channelNoForBand[amdlibNB_SPECTRAL_CHANNELS];
-
- amdlibLogTrace("amdlibIsBandPresentInData()");
-
- /* Search for the number of valid (considering p2vm flags) spectral channels
- * for specified band */
- if (amdlibGetChannelsInBand(p2vm, data, waveData, band,
- &nbChannelsInBand,
- channelNoForBand) != amdlibSUCCESS)
- {
- return amdlibFALSE;
- }
-
- if (nbChannelsInBand == 0)
- {
- return amdlibFALSE;
- }
- else
- {
- return amdlibTRUE;
- }
-}
-
-/*___oOo___*/
diff --git a/amber/amdlibYorick.c b/amber/amdlibYorick.c
deleted file mode 100644
index 9e50840..0000000
--- a/amber/amdlibYorick.c
+++ /dev/null
@@ -1,857 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-
-/**
- * @file
- * Functions developped for Yorick interfacing
- *
- * In Yorick, it is not possible to easily handle data which has been
- * dynamicaly allocated by an external C function, and which is just refered by
- * pointer. Yorick pointer points to a Yorick array of any data type or
- * dimensions, therefore it is not possible to display or use such data in
- * Yorick program. In order to counterpass this problem, the following
- * functions have been implemented to copy data from data structures allocated
- * by amdlib C function into data structure allocated by an external program;
- * yorick for instance which know in this case data type and dimensions. These
- * functions assume the destination data structure have been correctly
- * allocated.
- */
-
-/*
- * System Headers
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-/*
- * Local Headers
- */
-#include "amdlib.h"
-#include "amdlibProtected.h"
-#include "amdlibYorick.h"
-
-/*
- * Public functions definition
- */
-/**
- * Copy region description part of amdlibREGION data structure.
- *
- * @param srcRegions pointer to source data structure
- * @param dstRegions pointer to destination data structure
- * @param nbRegions number of regions
- * @param errMsg error description message returned if function fails.
- *
- * @note
- * This function is called first to get region dimensions in order to allocate
- * memory for region data before calling amdlibCopyRegionData() to copy data.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibCopyRegionInfo(amdlibREGION *srcRegions,
- amdlibREGION *dstRegions,
- int nbRegions,
- amdlibERROR_MSG errMsg)
-{
- int i, j;
-
- /* For each regions */
- for (i=0; i < nbRegions; i++)
- {
- /* Copy regions info */
- dstRegions[i].regionNumber = srcRegions[i].regionNumber;
- strcpy((char *)dstRegions[i].regionName, srcRegions[i].regionName);
- dstRegions[i].detectorNumber = srcRegions[i].detectorNumber;
- for (j=0; j<amdlibNB_TEL; j++)
- {
- dstRegions[i].ports[j] = srcRegions[i].ports[j];
- }
- dstRegions[i].correlation = srcRegions[i].correlation;
- dstRegions[i].corner[0] = srcRegions[i].corner[0];
- dstRegions[i].corner[1] = srcRegions[i].corner[1];
- dstRegions[i].gain = srcRegions[i].gain;
- dstRegions[i].crVal[0] = srcRegions[i].crVal[0];
- dstRegions[i].crVal[1] = srcRegions[i].crVal[1];
- dstRegions[i].crPix[0] = srcRegions[i].crPix[0];
- dstRegions[i].crPix[1] = srcRegions[i].crPix[1];
- strcpy((char *)dstRegions[i].cType[0], srcRegions[i].cType[0]);
- strcpy((char *)dstRegions[i].cType[1], srcRegions[i].cType[1]);
- dstRegions[i].cd[0][0] = srcRegions[i].cd[0][0];
- dstRegions[i].cd[0][1] = srcRegions[i].cd[0][1];
- dstRegions[i].cd[1][0] = srcRegions[i].cd[1][0];
- dstRegions[i].cd[1][1] = srcRegions[i].cd[1][1];
- dstRegions[i].dimAxis[0] = srcRegions[i].dimAxis[0];
- dstRegions[i].dimAxis[1] = srcRegions[i].dimAxis[1];
- dstRegions[i].dimAxis[2] = srcRegions[i].dimAxis[2];
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Copy region data part of amdlibREGION data structure.
- *
- * @param srcRegions pointer to source data structure
- * @param dstRegions pointer to destination data structure
- * @param nbRegions number of regions
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibCopyRegionData(amdlibREGION *srcRegions,
- amdlibREGION *dstRegions,
- int nbRegions,
- amdlibERROR_MSG errMsg)
-{
- int i;
- int nbOfElements;
- /* For each regions */
- for (i=0; i < nbRegions; i++)
- {
- /* Compute the number of elements in the data array */
- nbOfElements = srcRegions[i].dimAxis[0] *
- srcRegions[i].dimAxis[1] *
- srcRegions[i].dimAxis[2];
-
- /* Check data pointer */
- if (srcRegions[i].data == NULL)
- {
- amdlibSetErrMsg("The (source) pointer to the data of region #%d "
- "is invalid", i);
- return amdlibFAILURE;
- }
- if (dstRegions[i].data == NULL)
- {
- amdlibSetErrMsg("The (destination) pointer to the data of "
- "region #%d is invalid", i);
- return amdlibFAILURE;
- }
-
- /* Copy the corresponding data */
- memcpy(dstRegions[i].data , srcRegions[i].data,
- nbOfElements * sizeof(amdlibDOUBLE));
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Copy amdlibSCIENCE_DATA data structure.
- *
- * @param srcScienceData pointer to source data structure
- * @param dstScienceData pointer to destination data structure
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibCopyScienceData(amdlibSCIENCE_DATA *srcScienceData,
- amdlibSCIENCE_DATA *dstScienceData,
- amdlibERROR_MSG errMsg)
-{
- int frame, i;
-
- /* Update thisPtr field (not allocated if destination structure comes from
- * yorick) */
- if (dstScienceData->thisPtr != dstScienceData)
- {
- dstScienceData->thisPtr = dstScienceData;
- }
-
- /* Copy fixed size fields */
- dstScienceData->p2vmId = srcScienceData->p2vmId;
-
- /* Copy insCfg */
- for (i=0; i < srcScienceData->insCfg.nbKeywords; i++)
- {
- if (amdlibSetInsCfgKeyword(&(dstScienceData->insCfg),
- srcScienceData->insCfg.keywords[i].name,
- srcScienceData->insCfg.keywords[i].value,
- srcScienceData->insCfg.keywords[i].comment,
- errMsg) != amdlibSUCCESS)
- {
- return amdlibFAILURE;
- }
- }
-
- dstScienceData->expTime = srcScienceData->expTime;
-
- dstScienceData->nbCols = srcScienceData->nbCols;
- memcpy(dstScienceData->col, srcScienceData->col,
- (amdlibMAX_NB_COLS-1) * sizeof(amdlibCOL_INFO));
-
- /* Copy fields allocated dynamically */
- memcpy(dstScienceData->timeTag,
- srcScienceData->timeTag,
- srcScienceData->nbFrames * sizeof(*(srcScienceData->timeTag)));
-
- dstScienceData->nbChannels = srcScienceData->nbChannels;
- memcpy(dstScienceData->channelNo,
- srcScienceData->channelNo,
- srcScienceData->nbChannels * sizeof(*(srcScienceData->channelNo)));
-
- dstScienceData->nbFrames = srcScienceData->nbFrames;
-
- for (frame = 0; frame < srcScienceData->nbFrames; frame++)
- {
- memcpy(dstScienceData->frame[frame].fluxRatio,
- srcScienceData->frame[frame].fluxRatio,
- amdlibNB_PHOTO_CHANNELS *
- sizeof(*(dstScienceData->frame[frame].fluxRatio)));
-
- if (srcScienceData->frame[frame].intf != NULL)
- {
- memcpy(dstScienceData->frame[frame].intf,
- srcScienceData->frame[frame].intf,
- srcScienceData->col[amdlibINTERF_CHANNEL].nbPixels *
- srcScienceData->nbChannels * sizeof(amdlibDOUBLE));
- }
- if (srcScienceData->frame[frame].sigma2Intf != NULL)
- {
- memcpy(dstScienceData->frame[frame].sigma2Intf,
- srcScienceData->frame[frame].sigma2Intf,
- srcScienceData->col[amdlibINTERF_CHANNEL].nbPixels *
- srcScienceData->nbChannels * sizeof(amdlibDOUBLE));
- }
- if (srcScienceData->frame[frame].photo1 != NULL)
- {
- memcpy(dstScienceData->frame[frame].photo1,
- srcScienceData->frame[frame].photo1,
- srcScienceData->nbChannels * sizeof(amdlibDOUBLE));
- }
- if (srcScienceData->frame[frame].photo2 != NULL)
- {
- memcpy(dstScienceData->frame[frame].photo2,
- srcScienceData->frame[frame].photo2,
- srcScienceData->nbChannels * sizeof(amdlibDOUBLE));
- }
- if (srcScienceData->frame[frame].photo3 != NULL)
- {
- memcpy(dstScienceData->frame[frame].photo3,
- srcScienceData->frame[frame].photo3,
- srcScienceData->nbChannels * sizeof(amdlibDOUBLE));
- }
-
- if (srcScienceData->frame[frame].sigma2Photo1 != NULL)
- {
- memcpy(dstScienceData->frame[frame].sigma2Photo1,
- srcScienceData->frame[frame].sigma2Photo1,
- srcScienceData->nbChannels * sizeof(amdlibDOUBLE));
- }
- if (srcScienceData->frame[frame].sigma2Photo2 != NULL)
- {
- memcpy(dstScienceData->frame[frame].sigma2Photo2,
- srcScienceData->frame[frame].sigma2Photo2,
- srcScienceData->nbChannels * sizeof(amdlibDOUBLE));
- }
- if (srcScienceData->frame[frame].sigma2Photo3 != NULL)
- {
- memcpy(dstScienceData->frame[frame].sigma2Photo3,
- srcScienceData->frame[frame].sigma2Photo3,
- srcScienceData->nbChannels * sizeof(amdlibDOUBLE));
- }
-
- if (srcScienceData->badPixels != NULL)
- {
- memcpy (dstScienceData->badPixels, srcScienceData->badPixels,
- srcScienceData->col[amdlibINTERF_CHANNEL].nbPixels *
- srcScienceData->nbChannels * sizeof(char));
- }
-
- dstScienceData->frame[frame].snrPhoto1 =
- srcScienceData->frame[frame].snrPhoto1;
- dstScienceData->frame[frame].snrPhoto2 =
- srcScienceData->frame[frame].snrPhoto2;
- dstScienceData->frame[frame].snrPhoto3 =
- srcScienceData->frame[frame].snrPhoto3;
- dstScienceData->frame[frame].integratedPhoto1 =
- srcScienceData->frame[frame].integratedPhoto1;
- dstScienceData->frame[frame].integratedPhoto2 =
- srcScienceData->frame[frame].integratedPhoto2;
- dstScienceData->frame[frame].integratedPhoto3 =
- srcScienceData->frame[frame].integratedPhoto3;
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Copy amdlibSELECTION data structure.
- *
- * @param srcSelection pointer to source data structure
- * @param dstSelection pointer to destination data structure
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibCopySelection(amdlibSELECTION *srcSelection,
- amdlibSELECTION *dstSelection,
- amdlibERROR_MSG errMsg)
-{
- int band, base;
-
- /* Copy fixed size fields */
- dstSelection->nbFrames = srcSelection->nbFrames;
- dstSelection->nbBases = srcSelection->nbBases;
-
- /* For each band */
- for (band = 0; band < amdlibNB_BANDS; band++)
- {
- for (base = 0; base < srcSelection->nbBases; base++)
- {
- dstSelection->band[band].nbSelectedFrames[base] =
- srcSelection->band[band].nbSelectedFrames[base];
- dstSelection->band[band].firstSelectedFrame[base] =
- srcSelection->band[band].firstSelectedFrame[base];
- }
- dstSelection->band[band].nbFramesOkForClosure =
- srcSelection->band[band].nbFramesOkForClosure;
-
- /* Dynamical array */
- memcpy(dstSelection->band[band].isSelected,
- srcSelection->band[band].isSelected,
- sizeof(char) * srcSelection->nbFrames * srcSelection->nbBases);
- memcpy(dstSelection->band[band].frameOkForClosure,
- srcSelection->band[band].frameOkForClosure,
- sizeof(int) * srcSelection->nbFrames);
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Copy amdlibOI_ARRAY data structure.
- *
- * @param srcOiArray pointer to source data structure
- * @param dstOiArray pointer to destination data structure
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibCopyOiArray(amdlibOI_ARRAY *srcOiArray,
- amdlibOI_ARRAY *dstOiArray,
- amdlibERROR_MSG errMsg)
-{
- int s, i;
-
- /* Update thisPtr field (not allocated if destination structure comes from
- * yorick) */
- if (dstOiArray->thisPtr != dstOiArray)
- {
- dstOiArray->thisPtr = dstOiArray;
- }
-
- /* Copy fixed size fields */
- dstOiArray->nbStations = srcOiArray->nbStations;
- strcpy(dstOiArray->arrayName, srcOiArray->arrayName);
- strcpy(dstOiArray->coordinateFrame, srcOiArray->coordinateFrame);
- for (i=0; i < 3; i++)
- {
- dstOiArray->arrayCenterCoordinates[i] =
- srcOiArray->arrayCenterCoordinates[i];
- }
-
- /* Copy fields allocated dynamically */
- for (s=0; s < dstOiArray->nbStations; s++)
- {
- strcpy(dstOiArray->element[s].telescopeName,
- srcOiArray->element[s].telescopeName);
- strcpy(dstOiArray->element[s].stationName,
- srcOiArray->element[s].stationName);
- dstOiArray->element[s].stationIndex =
- srcOiArray->element[s].stationIndex;
- dstOiArray->element[s].elementDiameter =
- srcOiArray->element[s].elementDiameter;
- for (i=0; i < 3; i++)
- {
- dstOiArray->element[s].stationCoordinates[i] =
- srcOiArray->element[s].stationCoordinates[i];
- }
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Copy amdlibOI_TARGET data structure.
- *
- * @param srcOiTarget pointer to source data structure
- * @param dstOiTarget pointer to destination data structure
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibCopyOiTarget(amdlibOI_TARGET *srcOiTarget,
- amdlibOI_TARGET *dstOiTarget,
- amdlibERROR_MSG errMsg)
-{
- int t;
-
- /* Update thisPtr field (not allocated if destination structure comes from
- * yorick) */
- if (dstOiTarget->thisPtr != dstOiTarget)
- {
- dstOiTarget->thisPtr = dstOiTarget;
- }
-
- /* Copy fixed size fields */
- dstOiTarget->nbTargets = srcOiTarget->nbTargets;
-
- /* Copy fields allocated dynamically */
- for (t=0; t < dstOiTarget->nbTargets; t++)
- {
- strcpy(dstOiTarget->element[t].targetName,
- srcOiTarget->element[t].targetName);
- strcpy(dstOiTarget->element[t].velTyp, srcOiTarget->element[t].velTyp);
- strcpy(dstOiTarget->element[t].velDef, srcOiTarget->element[t].velDef);
- strcpy(dstOiTarget->element[t].specTyp,
- srcOiTarget->element[t].specTyp);
-
- dstOiTarget->element[t].targetId = srcOiTarget->element[t].targetId;
- dstOiTarget->element[t].equinox = srcOiTarget->element[t].equinox;
- dstOiTarget->element[t].raEp0 = srcOiTarget->element[t].raEp0;
- dstOiTarget->element[t].decEp0 = srcOiTarget->element[t].decEp0;
- dstOiTarget->element[t].raErr = srcOiTarget->element[t].raErr;
- dstOiTarget->element[t].decErr = srcOiTarget->element[t].decErr;
- dstOiTarget->element[t].sysVel = srcOiTarget->element[t].sysVel;
- dstOiTarget->element[t].pmRa = srcOiTarget->element[t].pmRa;
- dstOiTarget->element[t].pmDec = srcOiTarget->element[t].pmDec;
- dstOiTarget->element[t].pmRaErr = srcOiTarget->element[t].pmRaErr;
- dstOiTarget->element[t].pmDecErr = srcOiTarget->element[t].pmDecErr;
- dstOiTarget->element[t].parallax = srcOiTarget->element[t].parallax;
- dstOiTarget->element[t].paraErr = srcOiTarget->element[t].paraErr;
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Copy amdlibPHOTOMETRY data structure.
- *
- * @param srcPhotometry pointer to source data structure
- * @param dstPhotometry pointer to destination data structure
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibCopyPhotometry(amdlibPHOTOMETRY *srcPhotometry,
- amdlibPHOTOMETRY *dstPhotometry,
- amdlibERROR_MSG errMsg)
-{
- int entry;
-
- /* Update thisPtr field (not allocated if destination structure comes from
- * yorick) */
- if (dstPhotometry->thisPtr != dstPhotometry)
- {
- dstPhotometry->thisPtr = dstPhotometry;
- }
-
- /* Copy fixed size fields */
- dstPhotometry->nbFrames = srcPhotometry->nbFrames;
- dstPhotometry->nbBases = srcPhotometry->nbBases;
- dstPhotometry->nbWlen = srcPhotometry->nbWlen;
-
- /* Copy fields allocated dynamically */
- for (entry=0; entry<dstPhotometry->nbFrames*srcPhotometry->nbBases; entry++)
- {
- memcpy(dstPhotometry->table[entry].fluxSumPiPj,
- srcPhotometry->table[entry].fluxSumPiPj,
- srcPhotometry->nbWlen * sizeof(double));
- memcpy(dstPhotometry->table[entry].sigma2FluxSumPiPj,
- srcPhotometry->table[entry].sigma2FluxSumPiPj,
- srcPhotometry->nbWlen * sizeof(double));
-
- memcpy(dstPhotometry->table[entry].fluxRatPiPj,
- srcPhotometry->table[entry].fluxRatPiPj,
- srcPhotometry->nbWlen * sizeof(double));
- memcpy(dstPhotometry->table[entry].sigma2FluxRatPiPj,
- srcPhotometry->table[entry].sigma2FluxRatPiPj,
- srcPhotometry->nbWlen * sizeof(double));
-
- memcpy(dstPhotometry->table[entry].PiMultPj,
- srcPhotometry->table[entry].PiMultPj,
- srcPhotometry->nbWlen * sizeof(double));
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Copy amdlibVIS data structure.
- *
- * @param srcVis pointer to source data structure
- * @param dstVis pointer to destination data structure
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibCopyVis(amdlibVIS *srcVis,
- amdlibVIS *dstVis,
- amdlibERROR_MSG errMsg)
-{
- int entry;
-
- /* Update thisPtr field (not allocated if destination structure comes from
- * yorick) */
- if (dstVis->thisPtr != dstVis)
- {
- dstVis->thisPtr = dstVis;
- }
- /* Copy fixed size fields */
- dstVis->nbFrames = srcVis->nbFrames;
- dstVis->nbBases = srcVis->nbBases;
- dstVis->nbWlen = srcVis->nbWlen;
-
- /* Copy fields allocated dynamically */
- for (entry=0; entry<dstVis->nbFrames*srcVis->nbBases; entry++)
- {
- dstVis->table[entry].targetId = srcVis->table[entry].targetId;
-
- dstVis->table[entry].time = srcVis->table[entry].time;
-
- dstVis->table[entry].dateObsMJD = srcVis->table[entry].dateObsMJD;
-
- dstVis->table[entry].expTime = srcVis->table[entry].expTime;
-
- dstVis->table[entry].uCoord = srcVis->table[entry].uCoord;
-
- dstVis->table[entry].vCoord = srcVis->table[entry].vCoord;
-
- dstVis->table[entry].stationIndex[0] =
- srcVis->table[entry].stationIndex[0];
-
- dstVis->table[entry].stationIndex[1] =
- srcVis->table[entry].stationIndex[1];
-
- memcpy(dstVis->table[entry].bandFlag, srcVis->table[entry].bandFlag,
- amdlibNB_BANDS * sizeof(amdlibBOOLEAN));
-
- memcpy(dstVis->table[entry].frgContrastSnrArray,
- srcVis->table[entry].frgContrastSnrArray,
- amdlibNB_BANDS * sizeof(double));
- dstVis->table[entry].frgContrastSnr =
- srcVis->table[entry].frgContrastSnr;
-
- memcpy(dstVis->table[entry].flag, srcVis->table[entry].flag,
- srcVis->nbWlen * sizeof(amdlibBOOLEAN));
-
- memcpy(dstVis->table[entry].vis, srcVis->table[entry].vis,
- srcVis->nbWlen * sizeof(amdlibCOMPLEX));
-
- memcpy(dstVis->table[entry].sigma2Vis, srcVis->table[entry].sigma2Vis,
- srcVis->nbWlen * sizeof(amdlibCOMPLEX));
-
- memcpy(dstVis->table[entry].visCovRI, srcVis->table[entry].visCovRI,
- srcVis->nbWlen * sizeof(double));
-
- memcpy(dstVis->table[entry].diffVisAmp, srcVis->table[entry].diffVisAmp,
- srcVis->nbWlen * sizeof(double));
-
- memcpy(dstVis->table[entry].diffVisAmpErr,
- srcVis->table[entry].diffVisAmpErr,
- srcVis->nbWlen * sizeof(double));
-
- memcpy(dstVis->table[entry].diffVisPhi, srcVis->table[entry].diffVisPhi,
- srcVis->nbWlen * sizeof(double));
-
- memcpy(dstVis->table[entry].diffVisPhiErr,
- srcVis->table[entry].diffVisPhiErr,
- srcVis->nbWlen * sizeof(double));
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Copy amdlibVIS2 data structure.
- *
- * @param srcVis2 pointer to source data structure
- * @param dstVis2 pointer to destination data structure
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibCopyVis2(amdlibVIS2 *srcVis2,
- amdlibVIS2 *dstVis2,
- amdlibERROR_MSG errMsg)
-{
- int entry;
-
- /* Update thisPtr field (not allocated if destination structure comes from
- * yorick) */
- if (dstVis2->thisPtr != dstVis2)
- {
- dstVis2->thisPtr = dstVis2;
- }
-
- /* Copy fixed size fields */
- dstVis2->nbFrames = srcVis2->nbFrames;
- dstVis2->nbBases = srcVis2->nbBases;
- dstVis2->nbWlen = srcVis2->nbWlen;
- dstVis2->vis12 = srcVis2->vis12;
- dstVis2->vis23 = srcVis2->vis23;
- dstVis2->vis31 = srcVis2->vis31;
- dstVis2->sigmaVis12 = srcVis2->sigmaVis12;
- dstVis2->sigmaVis23 = srcVis2->sigmaVis23;
- dstVis2->sigmaVis31 = srcVis2->sigmaVis31;
-
- /* Copy fields allocated dynamically */
- for (entry=0; entry<dstVis2->nbFrames*srcVis2->nbBases; entry++)
- {
- dstVis2->table[entry].targetId = srcVis2->table[entry].targetId;
- dstVis2->table[entry].time = srcVis2->table[entry].time;
- dstVis2->table[entry].dateObsMJD = srcVis2->table[entry].dateObsMJD;
- dstVis2->table[entry].expTime = srcVis2->table[entry].expTime;
- dstVis2->table[entry].uCoord = srcVis2->table[entry].uCoord;
- dstVis2->table[entry].vCoord = srcVis2->table[entry].vCoord;
- dstVis2->table[entry].stationIndex[0] =
- srcVis2->table[entry].stationIndex[0];
- dstVis2->table[entry].stationIndex[1] =
- srcVis2->table[entry].stationIndex[1];
- memcpy(dstVis2->table[entry].vis2, srcVis2->table[entry].vis2,
- srcVis2->nbWlen * sizeof(double));
- memcpy(dstVis2->table[entry].vis2Error,
- srcVis2->table[entry].vis2Error,
- srcVis2->nbWlen * sizeof(double));
- memcpy(dstVis2->table[entry].flag, srcVis2->table[entry].flag,
- srcVis2->nbWlen * sizeof(amdlibBOOLEAN));
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Copy amdlibVIS3 data structure.
- *
- * @param srcVis3 pointer to source data structure
- * @param dstVis3 pointer to destination data structure
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibCopyVis3(amdlibVIS3 *srcVis3,
- amdlibVIS3 *dstVis3,
- amdlibERROR_MSG errMsg)
-{
- int entry;
-
- /* Update thisPtr field (not allocated if destination structure comes from
- * yorick) */
- if (dstVis3->thisPtr != dstVis3)
- {
- dstVis3->thisPtr = dstVis3;
- }
-
- /* Copy fixed size fields */
- dstVis3->nbFrames = srcVis3->nbFrames;
- dstVis3->nbClosures = srcVis3->nbClosures;
- dstVis3->nbWlen = srcVis3->nbWlen;
- dstVis3->averageClosure = srcVis3->averageClosure;
- dstVis3->averageClosureError = srcVis3->averageClosureError;
-
- /* Copy fields allocated dynamically */
- for (entry=0; entry<dstVis3->nbFrames*dstVis3->nbClosures; entry++)
- {
- dstVis3->table[entry].targetId = srcVis3->table[entry].targetId;
- dstVis3->table[entry].time = srcVis3->table[entry].time;
- dstVis3->table[entry].dateObsMJD = srcVis3->table[entry].dateObsMJD;
- dstVis3->table[entry].expTime = srcVis3->table[entry].expTime;
- dstVis3->table[entry].u1Coord = srcVis3->table[entry].u1Coord;
- dstVis3->table[entry].v1Coord = srcVis3->table[entry].v1Coord;
- dstVis3->table[entry].u2Coord = srcVis3->table[entry].u2Coord;
- dstVis3->table[entry].v2Coord = srcVis3->table[entry].v2Coord;
- dstVis3->table[entry].stationIndex[0] =
- srcVis3->table[entry].stationIndex[0];
- dstVis3->table[entry].stationIndex[1] =
- srcVis3->table[entry].stationIndex[1];
- dstVis3->table[entry].stationIndex[2] =
- srcVis3->table[entry].stationIndex[2];
- memcpy(dstVis3->table[entry].vis3Amplitude,
- srcVis3->table[entry].vis3Amplitude,
- srcVis3->nbWlen * sizeof(double));
- memcpy(dstVis3->table[entry].vis3AmplitudeError,
- srcVis3->table[entry].vis3AmplitudeError,
- srcVis3->nbWlen * sizeof(double));
- memcpy(dstVis3->table[entry].vis3Phi, srcVis3->table[entry].vis3Phi,
- srcVis3->nbWlen * sizeof(double));
- memcpy(dstVis3->table[entry].vis3PhiError,
- srcVis3->table[entry].vis3PhiError,
- srcVis3->nbWlen * sizeof(double));
- memcpy(dstVis3->table[entry].flag, srcVis3->table[entry].flag,
- srcVis3->nbWlen * sizeof(amdlibBOOLEAN));
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Copy amdlibPISTON data structure.
- *
- * @param srcOpd pointer to source data structure
- * @param dstOpd pointer to destination data structure
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibCopyPiston(amdlibPISTON *srcOpd,
- amdlibPISTON *dstOpd,
- amdlibERROR_MSG errMsg)
-{
- int band;
-
- /* Update thisPtr field (not allocated if destination structure comes from
- * yorick) */
- if (dstOpd->thisPtr != dstOpd)
- {
- dstOpd->thisPtr = dstOpd;
- }
-
- /* Copy fixed size fields */
- dstOpd->nbFrames = srcOpd->nbFrames;
- dstOpd->nbBases = srcOpd->nbBases;
- memcpy(dstOpd->bandFlag, srcOpd->bandFlag,
- amdlibNB_BANDS * sizeof(amdlibBOOLEAN));
-
- /* Copy fields allocated dynamically */
- for (band=amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- memcpy(dstOpd->pistonOPDArray[band],
- srcOpd->pistonOPDArray[band],
- srcOpd->nbFrames * srcOpd->nbBases * sizeof(amdlibDOUBLE));
- memcpy(dstOpd->sigmaPistonArray[band],
- srcOpd->sigmaPistonArray[band],
- srcOpd->nbFrames * srcOpd->nbBases * sizeof(amdlibDOUBLE));
- }
- memcpy(dstOpd->pistonOPD, srcOpd->pistonOPD,
- srcOpd->nbFrames * srcOpd->nbBases * sizeof(amdlibDOUBLE));
- memcpy(dstOpd->sigmaPiston, srcOpd->sigmaPiston,
- srcOpd->nbFrames * srcOpd->nbBases * sizeof(amdlibDOUBLE));
-
- return amdlibSUCCESS;
-}
-
-/**
- * Copy amdlibWAVELENGTH data structure.
- *
- * @param srcWlen pointer to source data structure
- * @param dstWlen pointer to destination data structure
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibCopyWavelength(amdlibWAVELENGTH *srcWlen,
- amdlibWAVELENGTH *dstWlen,
- amdlibERROR_MSG errMsg)
-{
- /* Copy fixed size fields */
- dstWlen->nbWlen = srcWlen->nbWlen;
-
- /* Update thisPtr field (not allocated if destination structure comes from
- * yorick) */
- if (dstWlen->thisPtr != dstWlen)
- {
- dstWlen->thisPtr = dstWlen;
- }
- /* Copy fields allocated dynamically */
- memcpy(dstWlen->wlen, srcWlen->wlen,
- srcWlen->nbWlen * sizeof(amdlibDOUBLE));
- memcpy(dstWlen->bandwidth, srcWlen->bandwidth,
- srcWlen->nbWlen * sizeof(amdlibDOUBLE));
- return amdlibSUCCESS;
-}
-/**
- * Copy amdlibSPECTRUM data structure.
- *
- * @param srcSpectrum pointer to source data structure
- * @param dstSpectrum pointer to destination data structure
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibCopySpectrum(amdlibSPECTRUM *srcSpectrum,
- amdlibSPECTRUM *dstSpectrum,
- amdlibERROR_MSG errMsg)
-{
- int entry;
-
- /* Update thisPtr field (not allocated if destination structure comes from
- * yorick) */
- if (dstSpectrum->thisPtr != dstSpectrum)
- {
- dstSpectrum->thisPtr = dstSpectrum;
- }
-
- /* Copy fixed size fields */
- dstSpectrum->nbTels = srcSpectrum->nbTels;
- dstSpectrum->nbWlen = srcSpectrum->nbWlen;
-
- /* Copy fields allocated dynamically */
- for (entry=0; entry < dstSpectrum->nbTels; entry++)
- {
- memcpy(dstSpectrum->spec[entry],
- srcSpectrum->spec[entry],
- srcSpectrum->nbWlen * sizeof(double));
- memcpy(dstSpectrum->specErr[entry],
- srcSpectrum->specErr[entry],
- srcSpectrum->nbWlen * sizeof(double));
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Copy amdlibBAD_PIXEL_MAP data structure.
- *
- * @param dstBadPixel pointer to destination data structure
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibCopyBadPixelMap(amdlibBAD_PIXEL_MAP *dstBadPixel,
- amdlibERROR_MSG errMsg)
-{
- /* Get current bad pixel map */
- amdlibBAD_PIXEL_MAP *srcBadPixel;
- srcBadPixel = amdlibGetBadPixelMap();
-
- /* Copy it into destination structure */
- dstBadPixel->mapIsInitialized = srcBadPixel->mapIsInitialized;
- memcpy(dstBadPixel->data, srcBadPixel->data,
- amdlibDET_SIZE_Y * amdlibDET_SIZE_X * sizeof(amdlibDOUBLE));
-
- return amdlibSUCCESS;
-}
-
-/**
- * Copy amdlibFLAT_FIELD_MAP data structure.
- *
- * @param dstFlatField pointer to destination data structure
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibCopyFlatFieldMap(amdlibFLAT_FIELD_MAP *dstFlatField,
- amdlibERROR_MSG errMsg)
-{
- /* Get current bad pixel map */
- amdlibFLAT_FIELD_MAP *srcFlatField;
- srcFlatField = amdlibGetFlatFieldMap();
-
- /* Copy it into destination structure */
- dstFlatField->mapIsInitialized = srcFlatField->mapIsInitialized;
- memcpy(dstFlatField->data, srcFlatField->data,
- amdlibDET_SIZE_Y * amdlibDET_SIZE_X * sizeof(amdlibDOUBLE));
- return amdlibSUCCESS;
-}
-
-
-/*___oOo___*/
diff --git a/amber/amdlibYorick.h b/amber/amdlibYorick.h
deleted file mode 100644
index a00b14f..0000000
--- a/amber/amdlibYorick.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * JMMC project ( http://www.jmmc.fr ) - Copyright (C) CNRS.
- ******************************************************************************/
-#ifndef amdlib_H
-#define amdlib_H
-
-/**
- * @file
- * This file contains declaration of functions which have been developped for
- * Yorick interfacing
- */
-
-/* The following piece of code alternates the linkage type to C for all
- * functions declared within the braces, which is necessary to use the
- * functions in C++-code.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-amdlibCOMPL_STAT amdlibCopyRegionInfo (/* Input */
- amdlibREGION *srcRegions,
- /* Output */
- amdlibREGION *dstRegions,
- int nbRegions,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibCopyRegionData (/* Input */
- amdlibREGION *srcRegions,
- /* Output */
- amdlibREGION *dstRegions,
- int nbRegions,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibCopyScienceData (/* Input */
- amdlibSCIENCE_DATA *srcScienceData,
- /* Output */
- amdlibSCIENCE_DATA *dstScienceData,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibCopySelection (/* Input */
- amdlibSELECTION *srcSelection,
- /* Output */
- amdlibSELECTION *dstSelection,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibCopyOiArray(amdlibOI_ARRAY *srcOiArray,
- amdlibOI_ARRAY *dstOiArray,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibCopyOiTarget(amdlibOI_TARGET *srcOiTarget,
- amdlibOI_TARGET *dstOiTarget,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibCopyPhotometry (/* Input */
- amdlibPHOTOMETRY *srcPhotometry,
- /* Output */
- amdlibPHOTOMETRY *dstPhotometry,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibCopyVis(/* Input */
- amdlibVIS *srcVis,
- /* Output */
- amdlibVIS *dstVis,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibCopyVis2(/* Input */
- amdlibVIS2 *srcVis2,
- /* Output */
- amdlibVIS2 *dstVis2,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibCopyVis3(/* Input */
- amdlibVIS3 *srcVis3,
- /* Output */
- amdlibVIS3 *dstVis3,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibCopyWavelength (/* Input */
- amdlibWAVELENGTH *srcWlen,
- /* Output */
- amdlibWAVELENGTH *dstWlen,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibCopyPiston(/* Input */
- amdlibPISTON *srcOpd,
- /* Output */
- amdlibPISTON *dstOpd,
- amdlibERROR_MSG errMsg);
-amdlibCOMPL_STAT amdlibCopySpectrum(amdlibSPECTRUM *srcSpectrum,
- amdlibSPECTRUM *dstSpectrum,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibCopyBadPixelMap(amdlibBAD_PIXEL_MAP *dstBadPixel,
- amdlibERROR_MSG errMsg);
-
-amdlibCOMPL_STAT amdlibCopyFlatFieldMap(amdlibFLAT_FIELD_MAP *dstFlatField,
- amdlibERROR_MSG errMsg);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /*!amdlib_H*/
diff --git a/amber/amdms.h b/amber/amdms.h
deleted file mode 100644
index c0adc63..0000000
--- a/amber/amdms.h
+++ /dev/null
@@ -1,748 +0,0 @@
-#ifndef amdms_H
-#define amdms_H
-
-/* the following constants represent AMBER specific limits */
-#define amdmsMAX_TELS 3 /* 2 or 3 telescopes are used */
-#define amdmsMAX_TRAINS 3 /* 2 or 3 delay lines are used */
-#define amdmsMAX_COLS 5 /* number of subwindow columns */
-#define amdmsMAX_ROWS 3 /* number of subwindow rows */
-#define amdmsMAX_REGIONS (amdmsMAX_COLS*amdmsMAX_ROWS)
-#define amdmsMAX_COLNAME_LEN 17
-#define amdmsMAX_TARTYP_LEN 4
-#define amdmsMAX_BTBL_COLS 32
-
-#define amdmsGOOD_PIXEL 1.0
-#define amdmsBAD_PIXEL 0.0
-
-#define amdmsFIT_DATA_BIAS_ROW 0
-#define amdmsFIT_DATA_SATURATION_ROW 1
-#define amdmsFIT_CHI_SQR_ROW 2
-#define amdmsFIT_ABS_DIST_SQR_ROW 3
-#define amdmsFIT_REL_DIST_SQR_ROW 4
-#define amdmsFIT_LOWER_LIMIT_ROW 5
-#define amdmsFIT_UPPER_LIMIT_ROW 6
-#define amdmsFIT_A0_ROW 7
-#define amdmsFIT_A0_STDEV_ROW 8
-#define amdmsFIT_A1_ROW 9
-#define amdmsFIT_A1_STDEV_ROW 10
-#define amdmsFIT_A2_ROW 11
-#define amdmsFIT_A2_STDEV_ROW 12
-#define amdmsFIT_NROWS (amdmsFIT_A2_STDEV_ROW + 1)
-
-#define amdmsPIXEL_STAT_MEAN_ROW 0
-#define amdmsPIXEL_STAT_VAR_ROW 1
-#define amdmsPIXEL_STAT_NROWS (amdmsPIXEL_STAT_VAR_ROW + 1)
-
-#define amdmsPIXEL_BIAS_ROW 0
-#define amdmsPIXEL_BIAS_NROWS (amdmsPIXEL_BIAS_ROW + 1)
-
-#define amdmsBAD_PIXEL_ROW 0
-#define amdmsBAD_PIXEL_NROWS (amdmsBAD_PIXEL_ROW + 1)
-
-#define amdmsFLATFIELD_ROW 0
-#define amdmsFLATFIELD_NROWS (amdmsFLATFIELD_ROW + 1)
-#define amdmsFLATFIELD_FIT_NROWS (amdmsFIT_A0_STDEV_ROW + 1)
-
-#define amdmsCONVERSION_FACTOR_ROW 0
-#define amdmsCONVERSION_FACTOR_NROWS (amdmsCONVERSION_FACTOR_ROW + 1)
-#define amdmsCONVERSION_FACTOR_FIT_NROWS (amdmsFIT_A0_STDEV_ROW + 1)
-
-#define amdmsREADOUT_NOISE_ROW 0
-#define amdmsREADOUT_NOISE_NROWS (amdmsREADOUT_NOISE_ROW + 1)
-
-#define amdmsPHOTON_NOISE_ROW 0
-#define amdmsPHOTON_NOISE_NROWS (amdmsPHOTON_NOISE_ROW + 1)
-
-#define amdmsNONLINEARITY_LIMIT_ROW 0
-#define amdmsNONLINEARITY_A0_ROW 1
-#define amdmsNONLINEARITY_A1_ROW 2
-#define amdmsNONLINEARITY_DEGREE 2
-#define amdmsNONLINEARITY_NROWS (amdmsNONLINEARITY_A0_ROW + amdmsNONLINEARITY_DEGREE)
-#define amdmsNONLINEARITY_FIT_NROWS (amdmsFIT_A2_STDEV_ROW + 1)
-
-#define amdmsPTC_NROWS (amdmsFIT_A1_STDEV_ROW + 1)
-
-#define amdmsFFT_DATA_ROW 0
-#define amdmsFFT_NROWS (amdmsFFT_DATA_ROW + 1)
-
-#define amdmsFUZZY_DATA_ROW 0
-#define amdmsFUZZY_NROWS (amdmsFUZZY_DATA_ROW + 1)
-
-#define amdmsPARTICLE_EVENT_FIRST_IMG_ROW 0
-#define amdmsPARTICLE_EVENT_LAST_IMG_ROW 1
-#define amdmsPARTICLE_EVENT_NROWS (amdmsPARTICLE_EVENT_LAST_IMG_ROW + 1)
-
-#define amdmsELECTRONIC_BIAS_ROW 0
-#define amdmsELECTRONIC_BIAS_NROWS (amdmsELECTRONIC_BIAS_ROW + 1)
-
-#define amdmsDARK_CURRENT_NROWS (amdmsFIT_A1_STDEV_ROW + 1)
-
-#define amdmsHISTOGRAM_ROW 0
-#define amdmsHISTOGRAM_NROWS (amdmsHISTOGRAM_ROW + 1)
-
-#define amdmsMAX_INPUTS 128
-#define amdmsMAX_OUTPUTS 32
-#define amdmsMAX_NAME_LEN 256
-#define amdmsMAX_STRIPES 16
-#define amdmsMAX_LIMITS 21 /* depends on the number of USE_ flags */
-
-#define amdmsABS_LOWER_LIMIT 1
-#define amdmsABS_EQUAL_LIMIT 2
-#define amdmsABS_UPPER_LIMIT 3
-#define amdmsREL_LOWER_LIMIT 4
-#define amdmsREL_EQUAL_LIMIT 5
-#define amdmsREL_UPPER_LIMIT 6
-#define amdmsSIGMA_LOWER_LIMIT 7
-#define amdmsSIGMA_EQUAL_LIMIT 8
-#define amdmsSIGMA_UPPER_LIMIT 9
-
-#define amdmsUSE_NOTHING 0
-#define amdmsUSE_PS_MEAN_PIXEL (1 << 0)
-#define amdmsUSE_PS_VAR_PIXEL (1 << 1)
-#define amdmsUSE_PIXEL_BIAS (1 << 2)
-#define amdmsUSE_FLATFIELD (1 << 3)
-#define amdmsUSE_BAD_PIXEL (1 << 4)
-#define amdmsUSE_CONVERSION_FACTOR (1 << 5)
-#define amdmsUSE_READOUT_NOISE (1 << 6)
-#define amdmsUSE_PHOTON_NOISE (1 << 7)
-#define amdmsUSE_DATA_BIAS (1 << 8)
-#define amdmsUSE_DATA_SATURATION (1 << 9)
-#define amdmsUSE_FIT_CHI_SQR (1 << 10)
-#define amdmsUSE_FIT_ABS_DIST_SQR (1 << 11)
-#define amdmsUSE_FIT_REL_DIST_SQR (1 << 12)
-#define amdmsUSE_FIT_LOWER_LIMIT (1 << 13)
-#define amdmsUSE_FIT_UPPER_LIMIT (1 << 14)
-#define amdmsUSE_FIT_A0 (1 << 15)
-#define amdmsUSE_FIT_A0_STDEV (1 << 16)
-#define amdmsUSE_FIT_A1 (1 << 17)
-#define amdmsUSE_FIT_A1_STDEV (1 << 18)
-#define amdmsUSE_FIT_A2 (1 << 19)
-#define amdmsUSE_FIT_A2_STDEV (1 << 20)
-
-#define amdmsNO_CORRECTION 0
-#define amdmsELECTRONIC_BIAS_CORRECTION (1 << 0)
-#define amdmsPIXEL_BIAS_CORRECTION (1 << 1)
-#define amdmsGLOBAL_BIAS_CORRECTION (1 << 2)
-#define amdmsROW_OFFSET_CORRECTION (1 << 3)
-#define amdmsFLATFIELD_CORRECTION (1 << 4)
-#define amdmsNONLINEARITY_CORRECTION (1 << 5)
-#define amdmsBAD_PIXEL_CORRECTION (1 << 6)
-
-#define amdmsDEFAULT_IN_FORMAT amdmsCUBE_FORMAT
-#define amdmsDEFAULT_OUT_FORMAT amdmsCUBE_FORMAT
-#define amdmsDEFAULT_MAP_FORMAT amdmsCUBE_FORMAT
-
-/* completion code */
-typedef enum {amdmsFAILURE, amdmsSUCCESS} amdmsCOMPL;
-
-/* boolean data type */
-typedef enum {amdmsFALSE, amdmsTRUE} amdmsBOOL;
-
-/* severity */
-typedef enum {
- amdmsDEBUG, amdmsINFO, amdmsNOTICE, amdmsWARNING, amdmsERROR, amdmsFATAL
-} amdmsSEVERITY;
-
-
-/****************************************************************/
-/* structure for storing error messages */
-/****************************************************************/
-typedef struct {
- char timeStamp[32]; /* time stamp as a string */
- amdmsSEVERITY severity; /* severity (see amdmsSEVERITY) */
- char *locFile; /* filename */
- int locLine; /* line number in file */
- char text[1024]; /* additional formatted text */
-} amdmsEVENT;
-/****************************************************************/
-
-
-typedef float amdmsPIXEL;
-
-
-/***********************************************************/
-/* algorithm for electronic bias compensation */
-/***********************************************************/
-typedef enum {
- amdmsEBA_MAP, /* use a electronic bias map */
- amdmsEBA_SIMPLE_EXP1D, /* use a exponential curve */
- amdmsEBA_SIMPLE_SMOOTH1D /* smooth the pixel row offsets */
-} amdmsEBIAS_ALGO;
-/***********************************************************/
-
-
-/***********************************************************************/
-/* direction for projecting pixels */
-/***********************************************************************/
-typedef enum {
- amdmsNO_PROJ, /* no projection */
- amdmsHOROZONTAL_PROJ, /* mean values are calculated per pixel line */
- amdmsVERTICAL_PROJ /* mean values are calculated per pixel column */
-} amdmsPROJ_MODE;
-/***********************************************************************/
-
-
-/************************************************************/
-/* algorithm for conversion factor calculation */
-/************************************************************/
-typedef enum {
- amdmsCFA_AMBER, /* (old) algorithm used for AMBER */
- amdmsCFA_GLOBAL_LINE, /* a straight line with all values */
- amdmsCFA_CENTRAL_LINE, /* use only the central part */
- amdmsCFA_LOCAL_PAIRS /* use pairs of pixel */
-} amdmsCF_ALGO;
-/************************************************************/
-
-
-/*********************************************************/
-/* content definition for a 2-d histogram axis */
-/*********************************************************/
-typedef enum {
- amdmsHC_EXPTIME, /* use the exposure time as value */
- amdmsHC_MEAN, /* use the mean intensity as value */
- amdmsHC_VARIANCE, /* use the variance as value */
- amdmsHC_NOISE /* use the noise as value */
-} amdmsHISTO_CONTENT;
-/*********************************************************/
-
-
-/**********************************************************/
-/* axis scaling definition */
-/**********************************************************/
-typedef enum {
- amdmsHS_LINEAR, /* use a linear scaling for an axis */
- amdmsHS_SQRT, /* use a sqare root scaling for an axis */
- amdmsHS_LOG /* use a logarithmic scaling */
-} amdmsHISTO_SCALE;
-/**********************************************************/
-
-
-/**********************************************************************/
-/* file content definition */
-/**********************************************************************/
-typedef enum {
- amdmsUNKNOWN_CONTENT, /* unknown */
- amdmsIMAGING_DETECTOR_CONTENT, /* subwindow/region setup */
- amdmsIMAGING_DATA_CONTENT, /* imaging data (images) */
- amdmsAMBER_WAVE_CONTENT, /* AMBER wavelength mapping */
- amdmsPIXEL_STAT_CONTENT, /* pixel flux mean and variance */
- amdmsPIXEL_BIAS_CONTENT, /* pixel bias map */
- amdmsBAD_PIXEL_CONTENT, /* bad pixel map */
- amdmsFLATFIELD_CONTENT, /* flatfield map */
- amdmsFLATFIELD_FIT_CONTENT, /* flatfield fit */
- amdmsCONVERSION_FACTOR_CONTENT, /* conversion factor [e-/DU] */
- amdmsREADOUT_NOISE_CONTENT, /* readout noise [e-] */
- amdmsPHOTON_NOISE_CONTENT, /* pixel noise as photon noise */
- amdmsNONLINEARITY_CONTENT, /* nonlinearity coeefficients */
- amdmsNONLINEARITY_FIT_CONTENT, /* nonlinearity fit */
- amdmsPTC_CONTENT, /* photon transfer curve fit */
- amdmsFFT_CONTENT, /* fast fourier transform */
- amdmsFUZZY_CONTENT, /* fuzzy bad pixel map counter */
- amdmsPARTICLE_EVENT_CONTENT, /* particle events */
- amdmsELECTRONIC_BIAS_CONTENT, /* electronic bias map */
- amdmsDARK_CURRENT_CONTENT, /* dark current map (line) */
- amdmsHISTOGRAM_CONTENT /* 2-d histogram */
-} amdmsFITS_CONTENT;
-/**********************************************************************/
-
-
-/***************************************************/
-/* file format definition */
-/***************************************************/
-typedef enum {
- amdmsUNKNOWN_FORMAT, /* unknown */
- amdmsCUBE_FORMAT, /* FITS image or cube */
- amdmsTABLE_FORMAT, /* FITS binary table */
- amdmsC40_FORMAT, /* speckle C40/Astro format */
- amdmsIXON_FORMAT, /* iXon camera format */
- amdmsSCAM_FORMAT, /* Sensicam camera format */
- amdmsJPEG_FORMAT, /* JPEG image format */
- amdmsTEXT_FORMAT /* ASCII text format */
-} amdmsFITS_FORMAT;
-/***************************************************/
-
-
-/**************************************************/
-/* data type definition */
-/**************************************************/
-typedef enum {
- amdmsUNKNOWN_TYPE, /* unknown */
- amdmsBYTE_TYPE, /* byte (8 bit integer) */
- amdmsSHORT_TYPE, /* short (16 bit integer) */
- amdmsINT_TYPE, /* int (32 bit integer) */
- amdmsLONG_TYPE, /* long (32/64 bit integer) */
- amdmsFLOAT_TYPE, /* float (32 bit) */
- amdmsDOUBLE_TYPE, /* double (64 bit) */
- amdmsSTRING_TYPE /* char * (arbitrary length) */
-} amdmsFITS_TYPE;
-/**************************************************/
-
-
-/*************************************************************/
-/* define which data should be imported from C40 data */
-/*************************************************************/
-typedef enum {
- amdmsREAD_DIFFERENCE_IMAGE, /* import the difference image */
- amdmsREAD_FIRST_READ, /* import the first read */
- amdmsREAD_SECOND_READ /* import the second read */
-} amdmsREAD_TYPE;
-/*************************************************************/
-
-
-/*******************************************************/
-/* 2-dimensional image (pixel array) */
-/*******************************************************/
-typedef struct {
- int nx; /* image width */
- int ny; /* image height */
- double index; /* image index value (from input) */
- amdmsPIXEL *data; /* image data */
-} amdmsDATA;
-/*******************************************************/
-
-
-/**********************************************/
-/* file flags */
-/**********************************************/
-typedef struct {
- amdmsFITS_CONTENT content : 8; /* content */
- amdmsFITS_FORMAT format : 8; /* format */
- amdmsFITS_TYPE type : 8; /* data type */
-} amdmsFITS_FLAGS;
-/**********************************************/
-
-
-/****************************************************/
-/* list of fits file names including flags */
-/****************************************************/
-typedef struct {
- amdmsFITS_FLAGS defFlags; /* default fits flags */
- int nNames; /* number of names */
- char **names; /* list of names */
- amdmsFITS_FLAGS *flags; /* list of flags */
-} amdmsFILE_LIST;
-/****************************************************/
-
-
-/********************************************************/
-/* region definition (rectangular subwindow) */
-/********************************************************/
-typedef struct {
- int x; /* first pixel column of the region */
- int y; /* first pixel row of the region */
- int width; /* width of the region */
- int height; /* height of the region */
- int offset; /* offset into data array */
- int size; /* number of pixels in region */
-} amdmsREGION;
-/********************************************************/
-
-
-/************************************************************************/
-/* specification of one particle event */
-/************************************************************************/
-typedef struct {
- int idx; /* pixel index */
- int x; /* x coordinate */
- int y; /* y coordinate */
- amdmsBOOL isBad; /* flag if pixel is a bad pixel */
- amdmsBOOL isPE; /* flag if pixel is a detected particle event */
- amdmsBOOL isUpToDate; /* flag if mean and variance is up to date */
- int nextPE; /* index of next PE (ring structure) */
- int prevPE; /* index of previous PE (ring structure) */
- int start; /* first affected image number */
- int end; /* last affected image number */
- float mean; /* new flux mean */
- float var; /* new flux variance */
- amdmsPIXEL *values; /* flux data for this pixel */
-} amdmsPARTICLE_EVENT;
-/************************************************************************/
-
-
-/*********************************************************************/
-/* particle event setup */
-/*********************************************************************/
-typedef struct {
- amdmsBOOL peFlag; /* flag if PE detection is requested */
- float peLimit; /* variance limit for PE detection */
- int nPE; /* number of particle events */
- int nSPE; /* number of single particle events */
- int nValues; /* number of values for each pixel */
- amdmsPARTICLE_EVENT *pes; /* array of particle events */
-} amdmsPARTICLE_EVENT_SETUP;
-/*********************************************************************/
-
-
-/**************************************************/
-/* setup for one stripe */
-/**************************************************/
-typedef struct {
- int pos; /* stripe border (left or bottom) */
- int size; /* stripe size (width or height) */
- int flags; /* stripe flags (amdmsUSE_...) */
-} amdmsSTRIPE;
-/**************************************************/
-
-
-/*************************************************************************/
-/* stripe setup (horizontal and vertical stripes, regions as defaults) */
-/*************************************************************************/
-typedef struct {
- int nHStripes; /* number of horizontal stripes */
- amdmsSTRIPE hStripes[amdmsMAX_STRIPES];/* horizontal stripes */
- int nVStripes; /* number of vertical stripes */
- amdmsSTRIPE vStripes[amdmsMAX_STRIPES];/* vertical stripes */
-} amdmsSTRIPE_SETUP;
-/*************************************************************************/
-
-
-/***************************************************************************/
-/* specification for calibration */
-/***************************************************************************/
-typedef struct {
- int detNX; /* detector width in pixels (512) */
- int detNY; /* detector height in pixels (512) */
- /***** compensation specification (input) ********************************/
- int corrFlag; /* flags for requested compensations */
- /***** detector calibration maps (input) *********************************/
- amdmsFILE_LIST mapFiles; /* list of filenames */
- /***** shielded area for 1/f noise compensation (input) ******************/
- int saWinX; /* left border */
- int saWinWidth; /* width */
- int saWinY; /* bottom border */
- int saWinHeight; /* height */
- int saGaussHeight; /* number of used pixel lines */
- float saGaussSigma; /* sigma for vertical gauss profile */
- /***** bad pixel interpolation (input) ***********************************/
- int bpiRadius; /* radius of area used for interpolation */
- amdmsPIXEL bpiSigma; /* digma for gauss profile */
- amdmsPIXEL *bpiWeights; /* array of calculated weights */
- /***** bad pixel map *****************************************************/
- amdmsDATA bpmData; /* flagged pixels */
- int nGoodPixels; /* number of good pixels */
- /***** electronic bias map (input) ***************************************/
- amdmsDATA ebmData; /* individual electronic bias */
- /***** pixel bias map (input) ********************************************/
- amdmsDATA pbmData; /* individual pixel bias */
- /***** flatfield map (input) *********************************************/
- amdmsDATA ffmData; /* individual pixel gain */
- /***** nonlinearity map (input) ******************************************/
- amdmsDATA nlmDataLimit; /* flux limit */
- amdmsDATA nlmDataA0; /* parameter for gain */
- amdmsDATA nlmDataA1; /* parameter for curvature */
- /***** particle event map (input) ****************************************/
- amdmsDATA pemDataFI; /* number of first affected image */
- amdmsDATA pemDataLI; /* number of last affected image */
- /***** detector offset (calculated) **************************************/
- amdmsPIXEL globalBias; /* global bias for current image */
- /***** row offset (1/f noise) (calculated) *******************************/
- amdmsPIXEL *rowOffsets; /* row offsets for current image */
- int *rowGood; /* number of goob pixels for each row */
- amdmsPIXEL *rowWeight; /* ??? */
- amdmsPIXEL *rowSum; /* ??? */
- /***** electronic bias parameters ****************************************/
- amdmsEBIAS_ALGO ebAlgo; /* algorithm to use for compensation */
- double *ebX; /* ??? */
- double *ebY; /* ??? */
- double *ebYe; /* ??? */
-} amdmsCALIBRATION_SETUP;
-/***************************************************************************/
-
-
-/***************************************************************/
-/* specification for data filtering */
-/***************************************************************/
-typedef struct {
- /***** images of interest (input) ****************************/
- amdmsBOOL ioiFlag; /* flag if image range is specified */
- int ioiFrom; /* number of the first image */
- int ioiTo; /* number of the last image (including) */
- /***** area of interest (input) ******************************/
- amdmsBOOL aoiFlag; /* flag is image area is specified */
- int aoiX; /* left border of image area */
- int aoiY; /* bottom border of image area */
- int aoiWidth; /* width of image area */
- int aoiHeight; /* height of image area */
- /***** pixel of interest (input) *****************************/
- amdmsBOOL poiFlag; /* flag if pixel position is specified */
- int poiX; /* x position */
- int poiY; /* y position */
-} amdmsDATA_FILTER_SETUP;
-/***************************************************************/
-
-
-/**********************************************************/
-/* limit definition for the bad pixel map generation */
-/**********************************************************/
-typedef struct {
- int flag; /* flag (amdmsUSE_XXX) */
- int type; /* type of the limit (amdmsXXX_LIMIT) */
- amdmsPIXEL value; /* limit value */
- amdmsPIXEL ref; /* reference value for fuzzy approach */
-} amdmsLIMIT;
-/**********************************************************/
-
-
-/*******************************************************************/
-/* specification for the bad pixel map limits */
-/*******************************************************************/
-typedef struct {
- int nLimits; /* number of defined limits */
- amdmsLIMIT limits[amdmsMAX_LIMITS]; /* list of defined limits */
-} amdmsLIMIT_SETUP;
-/*******************************************************************/
-
-
-/********************************************************************/
-/* setup for an axis of a 2-d histogram */
-/********************************************************************/
-typedef struct {
- amdmsHISTO_CONTENT content; /* content to be used for an axis */
- amdmsHISTO_SCALE scale; /* scaling for an axis */
- int steps; /* number of steps for this axis */
- double min; /* minimum value for this axis */
- double max; /* maximum value for this axis */
-} amdmsHISTO_SETUP;
-/********************************************************************/
-
-
-/***************************************************************************/
-/* environment for all algorithms */
-/***************************************************************************/
-typedef struct {
- int detNX; /* detector width in pixels (512) */
- int detNY; /* detector height in pixels (512) */
- int nReads; /* number of reads in input files (1) */
- amdmsBOOL q4Flag; /* flag if data are 4-quadrant data */
- amdmsFILE_LIST inFiles; /* input files (names and flags) */
- amdmsFILE_LIST outFiles; /* output files (names and flags) */
- amdmsCALIBRATION_SETUP calib; /* calibration setup */
- amdmsSTRIPE_SETUP stripes; /* stripe setup */
- amdmsDATA_FILTER_SETUP filter; /* data filter setup */
- amdmsBOOL allocated; /* flag if structure was allocated */
-} amdmsALGO_ENV;
-/***************************************************************************/
-
-
-/*********************************************************************************/
-/* environment for pixel statistics */
-/*********************************************************************************/
-typedef struct {
- amdmsALGO_ENV env; /* embedded basic environment */
- float cf; /* conversion factor */
- int ebNIter; /* number of iterations for EB */
- float ebLower; /* lower limit for EB bad pixels */
- float ebUpper; /* upper limit for EB bad pixels */
- amdmsBOOL ebHFlag; /* flag if horizontal ebm is calculated */
- amdmsBOOL ebVFlag; /* flag if vertical ebm is calculated */
- amdmsBOOL analyzeFlag; /* flag for image analyzation */
- amdmsBOOL histoFlag; /* flag for 1-d histogram */
- amdmsPROJ_MODE projMode; /* projection mode */
- int *histoData; /* 1-d histogram */
- amdmsDATA meanPixels; /* individual flux mean */
- amdmsDATA varPixels; /* individual flux variance */
- amdmsPARTICLE_EVENT_SETUP events; /* all found particle events */
- amdmsBOOL allocated; /* flag if structure was allocated */
-} amdmsALGO_STAT_ENV;
-/*********************************************************************************/
-
-
-/****************************************************************************/
-/* environment for bad pixel map generation */
-/****************************************************************************/
-typedef struct {
- amdmsALGO_ENV env; /* embedded basic environment */
- amdmsBOOL nuicFlag; /* non uniform illumination compensation */
- int fuzzyCount; /* counter limit for fuzzy map generation */
- float fuzzyLimit; /* relative fuzzy limit */
- amdmsDATA fuzzyMap; /* cumulative fuzzy counters */
- amdmsBOOL winFlag; /* flag if the neighbourhood is reference */
- int winInnerSize; /* inner (unused) part of window */
- int winOuterSize; /* outer (used) part of window */
- int nIter; /* number of iterations for sigma limits */
- amdmsLIMIT_SETUP limits; /* limit definitions */
- amdmsBOOL allocated; /* flag if structure was allocated */
-} amdmsALGO_BAD_PIXEL_ENV;
-/****************************************************************************/
-
-
-/*************************************************************************/
-/* environment for pixel property map generation */
-/*************************************************************************/
-typedef struct {
- amdmsALGO_ENV env; /* embedded basic environment */
- amdmsBOOL nuicFlag; /* non uniform illumination compensation */
- double kADC; /* ADC amplification */
- amdmsBOOL satFlag; /* Flag if a saturation box is specified */
- double satWidth; /* relative width of the saturation box */
- double satHeight; /* relative height of the saturation box */
- int nDelStart; /* number of possible outliers (start) */
- int nDelMiddle; /* number of possible outliers (middle) */
- int nDelEnd; /* number of possible outliers (end) */
- amdmsCF_ALGO cfAlgo; /* algorithm for the conversion factor */
- amdmsHISTO_SETUP hX; /* setup for the horizontal axis */
- amdmsHISTO_SETUP hY; /* setup for the vertical axis */
- int nInputs; /* number of input data */
- double *exptimes; /* array of all exposure times */
- amdmsDATA *meanPixels; /* array of all mean data */
- amdmsDATA *varPixels; /* array of all variance data */
- amdmsDATA ffFit[amdmsFLATFIELD_FIT_NROWS];
- amdmsDATA cfFit[amdmsCONVERSION_FACTOR_FIT_NROWS];
- amdmsDATA nlFit[amdmsNONLINEARITY_FIT_NROWS];
- amdmsDATA ptcFit[amdmsPTC_NROWS];
- amdmsDATA dcFit[amdmsDARK_CURRENT_NROWS];
- amdmsDATA cfmData; /* conversion factor map */
- amdmsDATA histoData; /* 2-d histogram */
- amdmsBOOL allocated; /* flag if structure was allocated */
-} amdmsALGO_PROPERTIES_ENV;
-/*************************************************************************/
-
-
-/*************************************************************************/
-/* environment for importing data into Fits files */
-/*************************************************************************/
-typedef struct {
- amdmsALGO_ENV env; /* embedded basic environment */
- double exptime; /* exposure time in seconds */
- int pixelOffset; /* pixel offset which is subtracted */
- amdmsREAD_TYPE readType; /* readtype (for importing C40 data) */
- int firstRead; /* first read for DIFFERENCE or FIRST */
- int secondRead; /* second read for DIFFERENCE or SECOND */
- int nImages; /* number of images to be imported */
- int nReads; /* number of reads (only for JPEG) */
- amdmsBOOL zoFlag; /* zero offset flag for bad image list */
- int nBadImages; /* number of bad images which are ignored */
- int *badImages; /* index list of bad images */
- amdmsBOOL allocated; /* flag if structure was allocated */
-} amdmsALGO_IMPORT_ENV;
-/*************************************************************************/
-
-
-/*************************************************************************/
-/* environment for exporting data into fits files */
-/*************************************************************************/
-typedef struct {
- amdmsALGO_ENV env; /* embedded basic environment */
- amdmsBOOL allocated; /* flag if structure was allocated */
-} amdmsALGO_EXPORT_ENV;
-/*************************************************************************/
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- void amdmsSupressLogMessages(int flag);
- void amdmsShowOnlyMessage(int flag);
- void amdmsSetSeverityLevel(amdmsSEVERITY level);
- void amdmsFatal(char *file, int line, char *format, ...);
- void amdmsError(char *file, int line, char *format, ...);
- void amdmsWarning(char *file, int line, char *format, ...);
- void amdmsNotice(char *file, int line, char *format, ...);
- void amdmsInfo(char *file, int line, char *format, ...);
- void amdmsDebug(char *file, int line, char *format, ...);
- extern int amdmsOnlyMessage;
- extern amdmsEVENT amdmsLastEvent;
-
- amdmsCOMPL amdmsInitData(amdmsDATA *data);
- amdmsCOMPL amdmsAllocateData(amdmsDATA *data,
- int nx,
- int ny);
- amdmsCOMPL amdmsFreeData(amdmsDATA *data);
- amdmsCOMPL amdmsCopyData(amdmsDATA *dst,
- amdmsDATA *src);
- amdmsCOMPL amdmsSetData(amdmsDATA *data,
- amdmsPIXEL value);
- amdmsCOMPL amdmsSetDataR(amdmsDATA *data,
- int rX, int rY, int rW, int rH,
- amdmsPIXEL value);
-
- amdmsCOMPL amdmsInitFileList(amdmsFILE_LIST *list,
- amdmsFITS_FLAGS flags);
- amdmsCOMPL amdmsFreeFileList(amdmsFILE_LIST *list);
- amdmsCOMPL amdmsAddFileToList(amdmsFILE_LIST *list,
- char *name,
- amdmsFITS_FLAGS flags);
-
- amdmsCOMPL amdmsInitParticleEventSetup(amdmsPARTICLE_EVENT_SETUP *setup);
- amdmsCOMPL amdmsFreeParticleEventSetup(amdmsPARTICLE_EVENT_SETUP *setup);
-
- amdmsCOMPL amdmsInitStripeSetup(amdmsSTRIPE_SETUP *setup);
- amdmsCOMPL amdmsFreeStripeSetup(amdmsSTRIPE_SETUP *setup);
- amdmsCOMPL amdmsRecalcStripes(amdmsSTRIPE_SETUP *setup,
- int nx,
- int ny);
-
- amdmsCOMPL amdmsInitCalibrationSetup(amdmsCALIBRATION_SETUP *setup);
- amdmsCOMPL amdmsFreeCalibrationSetup(amdmsCALIBRATION_SETUP *setup);
-
- amdmsCOMPL amdmsInitDataFilterSetup(amdmsDATA_FILTER_SETUP *setup);
- amdmsCOMPL amdmsFreeDataFilterSetup(amdmsDATA_FILTER_SETUP *setup);
-
- amdmsCOMPL amdmsInitLimitSetup(amdmsLIMIT_SETUP *setup);
- amdmsCOMPL amdmsFreeLimitSetup(amdmsLIMIT_SETUP *setup);
-
-
- amdmsCOMPL amdmsReadAllMaps(amdmsCALIBRATION_SETUP *setup);
- amdmsCOMPL amdmsCalibrateData(amdmsCALIBRATION_SETUP *setup,
- amdmsDATA *rawData,
- amdmsDATA *calData);
- amdmsBOOL amdmsIsPixelValid(amdmsCALIBRATION_SETUP *setup,
- int iImage,
- int iPixel);
- amdmsBOOL amdmsIsPixelAffectedByPE(amdmsCALIBRATION_SETUP *setup,
- int iImage,
- int iPixel);
- amdmsCOMPL amdmsCalcStat(amdmsCALIBRATION_SETUP *setup,
- amdmsDATA *data,
- int iImage,
- int x,
- int y,
- int width,
- int height,
- amdmsPIXEL *mean,
- amdmsPIXEL *var);
- amdmsCOMPL amdmsCalcStatBox(amdmsCALIBRATION_SETUP *setup, amdmsDATA *data, int iImage,
- int xLimit, int yLimit, int widthLimit, int heightLimit,
- int xCenter, int yCenter, int innerSize, int outerSize,
- amdmsPIXEL *mean, amdmsPIXEL *var);
- amdmsCOMPL amdmsSmoothData(amdmsCALIBRATION_SETUP *calib,
- amdmsDATA *src,
- amdmsDATA *dst);
- amdmsCOMPL amdmsCleanUpFlatfield(amdmsCALIBRATION_SETUP *calib,
- amdmsSTRIPE_SETUP *stripes,
- amdmsDATA *mean,
- amdmsDATA *var);
- amdmsCOMPL amdmsCleanUpFlatfieldSmooth(amdmsCALIBRATION_SETUP *calib,
- amdmsSTRIPE_SETUP *stripes,
- amdmsDATA *mean,
- amdmsDATA *var);
-
- amdmsCOMPL amdmsCreateAlgo(amdmsALGO_ENV **env);
- amdmsCOMPL amdmsDestroyAlgo(amdmsALGO_ENV **env);
-
- amdmsCOMPL amdmsCreateStatisticsAlgo(amdmsALGO_STAT_ENV **env);
- amdmsCOMPL amdmsDestroyStatisticsAlgo(amdmsALGO_STAT_ENV **env);
- amdmsCOMPL amdmsDoPixelStatistics(amdmsALGO_STAT_ENV *env);
-
- amdmsCOMPL amdmsCreateBadPixelAlgo(amdmsALGO_BAD_PIXEL_ENV **env);
- amdmsCOMPL amdmsDestroyBadPixelAlgo(amdmsALGO_BAD_PIXEL_ENV **env);
- amdmsCOMPL amdmsDoBadPixel(amdmsALGO_BAD_PIXEL_ENV *env);
-
- amdmsCOMPL amdmsCreatePropertiesAlgo(amdmsALGO_PROPERTIES_ENV **env);
- amdmsCOMPL amdmsDestroyPropertiesAlgo(amdmsALGO_PROPERTIES_ENV **env);
- amdmsCOMPL amdmsDoProperties(amdmsALGO_PROPERTIES_ENV *env);
-
- amdmsCOMPL amdmsCreateImportAlgo(amdmsALGO_IMPORT_ENV **env);
- amdmsCOMPL amdmsDestroyImportAlgo(amdmsALGO_IMPORT_ENV **env);
- amdmsCOMPL amdmsDoImport(amdmsALGO_IMPORT_ENV *env);
-
- amdmsCOMPL amdmsCreateExportAlgo(amdmsALGO_EXPORT_ENV **env);
- amdmsCOMPL amdmsDestroyExportAlgo(amdmsALGO_EXPORT_ENV **env);
- amdmsCOMPL amdmsDoExport(amdmsALGO_EXPORT_ENV *env);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !amdms_H */
diff --git a/amber/amdmsAlgo.c b/amber/amdmsAlgo.c
deleted file mode 100644
index 3af141e..0000000
--- a/amber/amdmsAlgo.c
+++ /dev/null
@@ -1,362 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <memory.h>
-#include <math.h>
-
-#include "amdms.h"
-
-#define amdmsGRANULARITY 8
-
-#define MIN(x,y) ((x) < (y) ? (x) : (y))
-#define MAX(x,y) ((x) > (y) ? (x) : (y))
-#define ABS(x) ((x) > 0 ? (x) : -(x))
-
-amdmsCOMPL amdmsCreateAlgo(amdmsALGO_ENV **env)
-{
- amdmsALGO_ENV *henv = NULL;
- amdmsFITS_FLAGS flags = {amdmsIMAGING_DATA_CONTENT, amdmsDEFAULT_IN_FORMAT, amdmsFLOAT_TYPE};
-
- if (*env == NULL) {
- henv = (amdmsALGO_ENV*)calloc(1L, sizeof(amdmsALGO_ENV));
- if (henv == NULL) {
- return amdmsFAILURE;
- }
- henv->allocated = 1;
- *env = henv;
- } else {
- henv = *env;
- henv->allocated = 0;
- }
- henv->detNX = 512;
- henv->detNY = 512;
- henv->nReads = 1;
- henv->q4Flag = amdmsFALSE;
- flags.format = amdmsDEFAULT_IN_FORMAT;
- amdmsInitFileList(&(henv->inFiles), flags);
- flags.format = amdmsDEFAULT_OUT_FORMAT;
- amdmsInitFileList(&(henv->outFiles), flags);
- amdmsInitCalibrationSetup(&(henv->calib));
- amdmsInitStripeSetup(&(henv->stripes));
- amdmsInitDataFilterSetup(&(henv->filter));
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsDestroyAlgo(amdmsALGO_ENV **env)
-{
- amdmsALGO_ENV *henv = NULL;
-
- if (env == NULL) {
- return amdmsFAILURE;
- }
- if (*env == NULL) {
- return amdmsSUCCESS;
- }
- henv = *env;
- amdmsFreeFileList(&(henv->inFiles));
- amdmsFreeFileList(&(henv->outFiles));
- amdmsFreeCalibrationSetup(&(henv->calib));
- amdmsFreeStripeSetup(&(henv->stripes));
- amdmsFreeDataFilterSetup(&(henv->filter));
- if (henv->allocated) {
- henv->allocated = amdmsFALSE;
- free(henv);
- *env = NULL;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsInitFileList(amdmsFILE_LIST *list, amdmsFITS_FLAGS flags)
-{
- if (list == NULL) {
- return amdmsFAILURE;
- }
- list->defFlags = flags;
- list->nNames = 0;
- list->names = NULL;
- list->flags = NULL;
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsFreeFileList(amdmsFILE_LIST *list)
-{
- int i;
-
- if (list == NULL) {
- return amdmsFAILURE;
- }
- if (list->names != NULL) {
- for (i = 0; i < list->nNames; i++) {
- if (list->names[i] != NULL) {
- free(list->names[i]);
- list->names[i] = NULL;
- }
- }
- free(list->names);
- }
- list->names = NULL;
- list->nNames = 0;
- if (list->flags != NULL) {
- free(list->flags);
- list->flags = NULL;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsAddFileToList(amdmsFILE_LIST *list, char *name, amdmsFITS_FLAGS flags)
-{
- int i;
- size_t len;
- char **hnames = NULL;
- char *hname = NULL;
- amdmsFITS_FLAGS *hflags = NULL;
-
- amdmsDebug(__FILE__, __LINE__,
- "amdmsAddFileToList(.., %s, (%d, %d, %d))",
- name, flags.content, flags.format, flags.type);
- if (list->nNames%amdmsGRANULARITY == 0) {
- hnames = (char **)calloc((size_t)(list->nNames + amdmsGRANULARITY), sizeof(char *));
- if (hnames == NULL) {
- return amdmsFAILURE;
- }
- hflags = (amdmsFITS_FLAGS *)calloc((size_t)(list->nNames + amdmsGRANULARITY), sizeof(amdmsFITS_FLAGS));
- if (hflags == NULL) {
- free(hnames);
- return amdmsFAILURE;
- }
- for (i = 0; i < list->nNames; i++) {
- hnames[i] = list->names[i];
- hflags[i] = list->flags[i];
- }
- free(list->names);
- list->names = hnames;
- free(list->flags);
- list->flags = hflags;
- }
- len = (size_t)(strlen(name) + 1);
- hname = (char*)calloc(len, sizeof(char));
- if (hname == NULL) {
- return amdmsFAILURE;
- }
- memcpy(hname, name, len);
- list->names[list->nNames] = hname;
- list->flags[list->nNames] = flags;
- list->nNames++;
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsInitStripeSetup(amdmsSTRIPE_SETUP *setup)
-{
- int iStripe;
-
- if (setup == NULL) {
- return amdmsFAILURE;
- }
- setup->nHStripes = 0;
- setup->nVStripes = 0;
- for (iStripe = 0; iStripe < amdmsMAX_STRIPES; iStripe++) {
- setup->hStripes[iStripe].pos = 0;
- setup->hStripes[iStripe].size = 0;
- setup->hStripes[iStripe].flags = amdmsUSE_NOTHING;
- setup->vStripes[iStripe].pos = 0;
- setup->vStripes[iStripe].size = 0;
- setup->vStripes[iStripe].flags = amdmsUSE_NOTHING;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsFreeStripeSetup(amdmsSTRIPE_SETUP *setup)
-{
- int iStripe;
-
- if (setup == NULL) {
- return amdmsFAILURE;
- }
- setup->nHStripes = 0;
- setup->nVStripes = 0;
- for (iStripe = 0; iStripe < amdmsMAX_STRIPES; iStripe++) {
- setup->hStripes[iStripe].pos = 0;
- setup->hStripes[iStripe].size = 0;
- setup->hStripes[iStripe].flags = amdmsUSE_NOTHING;
- setup->vStripes[iStripe].pos = 0;
- setup->vStripes[iStripe].size = 0;
- setup->vStripes[iStripe].flags = amdmsUSE_NOTHING;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsRecalcStripes(amdmsSTRIPE_SETUP *setup, int nx, int ny)
-{
- int iHS;
- int iVS;
-
- if (setup == NULL) {
- return amdmsFAILURE;
- }
- /* check horizontal stripes */
- setup->hStripes[0].pos = 0;
- for (iHS = 0; iHS < setup->nHStripes; iHS++) {
- if (iHS != 0) {
- /* recalculate stripe position */
- setup->hStripes[iHS].pos = setup->hStripes[iHS - 1].pos + setup->hStripes[iHS - 1].size;
- }
- if ((ny != 0) && (setup->hStripes[iHS].pos + setup->hStripes[iHS].size > ny)) {
- /* recalculate stripe height and discard next stripes */
- setup->hStripes[iHS].size = ny - setup->hStripes[iHS].pos;
- setup->nHStripes = iHS + 1;
- }
- }
- /* check vertical stripes */
- setup->vStripes[0].pos = 0;
- for (iVS = 0; iVS < setup->nVStripes; iVS++) {
- if (iVS != 0) {
- /* recalculate stripe position */
- setup->vStripes[iVS].pos = setup->vStripes[iVS - 1].pos + setup->vStripes[iVS - 1].size;
- }
- if ((nx != 0) && (setup->vStripes[iVS].pos + setup->vStripes[iVS].size > nx)) {
- /* recalculate stripe width and discard next stripes */
- setup->vStripes[iVS].size = nx - setup->vStripes[iVS].pos;
- setup->nVStripes = iVS + 1;
- }
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsInitDataFilterSetup(amdmsDATA_FILTER_SETUP *setup)
-{
- if (setup == NULL) {
- return amdmsFAILURE;
- }
- setup->ioiFlag = amdmsFALSE; /* no image range specified */
- setup->ioiFrom = -1;
- setup->ioiTo = -1;
- setup->aoiFlag = amdmsFALSE; /* no image area specified */
- setup->aoiX = -1;
- setup->aoiY = -1;
- setup->aoiWidth = -1;
- setup->aoiHeight = -1;
- setup->poiFlag = amdmsFALSE; /* no pixel position specified */
- setup->poiX = -1;
- setup->poiY = -1;
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsFreeDataFilterSetup(amdmsDATA_FILTER_SETUP *setup)
-{
- if (setup == NULL) {
- return amdmsFAILURE;
- }
- setup->ioiFlag = amdmsFALSE; /* no image range specified */
- setup->ioiFrom = -1;
- setup->ioiTo = -1;
- setup->aoiFlag = amdmsFALSE; /* no image area specified */
- setup->aoiX = -1;
- setup->aoiY = -1;
- setup->aoiWidth = -1;
- setup->aoiHeight = -1;
- setup->poiFlag = amdmsFALSE; /* no pixel position specified */
- setup->poiX = -1;
- setup->poiY = -1;
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsInitData(amdmsDATA *data)
-{
- if (data == NULL) {
- return amdmsFAILURE;
- }
- data->nx = 0;
- data->ny = 0;
- data->index = 0.0;
- data->data = NULL;
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsAllocateData(amdmsDATA *data, int nx, int ny)
-{
- if ((data->data == NULL) || (data->nx*data->ny < nx*ny)) {
- if (data->data != NULL) {
- free(data->data);
- data->data = NULL;
- }
- data->data = (amdmsPIXEL*)calloc((size_t)(nx*ny), sizeof(amdmsPIXEL));
- if (data->data == NULL) {
- return amdmsFAILURE;
- }
- }
- data->nx = nx;
- data->ny = ny;
- data->index = 0.0;
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsFreeData(amdmsDATA *data)
-{
- if (data == NULL) {
- return amdmsFAILURE;
- }
- data->nx = 0;
- data->ny = 0;
- data->index = 0.0;
- if (data->data != NULL) {
- free(data->data);
- data->data = NULL;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCopyData(amdmsDATA *dst, amdmsDATA *src)
-{
- int n;
-
- if ((dst == NULL) || (src == NULL)) {
- return amdmsFAILURE;
- }
- n = src->nx*src->ny;
- if (amdmsAllocateData(dst, src->nx, src->ny) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- dst->index = src->index;
- memcpy(dst->data, src->data, n*sizeof(amdmsPIXEL));
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsSetData(amdmsDATA *data, amdmsPIXEL value)
-{
- int i, n;
- amdmsPIXEL *d;
-
- if (data == NULL) {
- return amdmsFAILURE;
- }
- n = data->nx*data->ny;
- d = data->data;
- for (i = 0; i < n; i++) {
- *d++ = value;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsSetDataR(amdmsDATA *data, int rX, int rY, int rW, int rH, amdmsPIXEL value)
-{
- int i, j;
- amdmsPIXEL *d;
-
- if (data == NULL) {
- return amdmsFAILURE;
- }
- if (rX < 0) rX = 0;
- if (rX >= data->nx) rX = data->nx - 1;
- if (rX + rW > data->nx) rW = data->nx - rX;
- if (rY < 0) rY = 0;
- if (rY >= data->ny) rY = data->ny - 1;
- if (rY + rH > data->ny) rH = data->ny - rY;
- for (j = 0; j < rH; j++) {
- d = data->data + data->nx*(rY + j) + rX;
- for (i = 0; i < rW; i++) {
- *d++ = value;
- }
- }
- return amdmsSUCCESS;
-}
-
diff --git a/amber/amdmsBadPixels.c b/amber/amdmsBadPixels.c
deleted file mode 100644
index 77d8d9a..0000000
--- a/amber/amdmsBadPixels.c
+++ /dev/null
@@ -1,691 +0,0 @@
-#include <math.h>
-
-#include "amdms.h"
-#include "amdmsFits.h"
-
-#define amdmsEPS 0.001
-
-#define MIN(x,y) ((x) < (y) ? (x) : (y))
-#define MAX(x,y) ((x) > (y) ? (x) : (y))
-
-static void amdmsCalcLimit(amdmsLIMIT *spec, amdmsPIXEL mean, amdmsPIXEL var, amdmsPIXEL *limit, amdmsPIXEL *ref);
-
-static amdmsCOMPL amdmsDoBadPixelPass(amdmsALGO_BAD_PIXEL_ENV *env,
- amdmsDATA *data,
- int dataFlag);
-static amdmsCOMPL amdmsExportBadPixelMap(FILE *outfile, amdmsDATA *bpm);
-static amdmsCOMPL amdmsCreateBadPixelMap(amdmsFITS *outfile,
- amdmsFITS_FLAGS flags,
- amdmsDATA *bpm);
-static amdmsCOMPL amdmsCreateFuzzyMap(amdmsALGO_BAD_PIXEL_ENV *env,
- amdmsFITS *outfile,
- amdmsFITS_FLAGS flags);
-
-amdmsCOMPL amdmsCreateBadPixelAlgo(amdmsALGO_BAD_PIXEL_ENV **env)
-{
- amdmsALGO_ENV *henv = NULL;
- amdmsALGO_BAD_PIXEL_ENV *hhenv = NULL;
-
- /* allocate the structure if neccessary */
- if (*env == NULL) {
- hhenv = (amdmsALGO_BAD_PIXEL_ENV*)calloc(1L, sizeof(amdmsALGO_BAD_PIXEL_ENV));
- if (hhenv == NULL) {
- return amdmsFAILURE;
- }
- henv = &(hhenv->env);
- /* call the initialization of a simple algorithm environment */
- if (amdmsCreateAlgo(&henv) != amdmsSUCCESS) {
- free(hhenv);
- return amdmsFAILURE;
- }
- hhenv->allocated = 1;
- *env = hhenv;
- } else {
- /* call the initialization of a simple algorithm environment */
- hhenv = *env;
- henv = &(hhenv->env);
- if (amdmsCreateAlgo(&henv) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- hhenv->allocated = 0;
- }
- /* initialize only the additional members */
- hhenv->nuicFlag = amdmsFALSE;
- hhenv->fuzzyCount = 1;
- hhenv->fuzzyLimit = 1.0;
- amdmsInitData(&(hhenv->fuzzyMap));
- hhenv->winFlag = amdmsFALSE;
- hhenv->winInnerSize = 0;
- hhenv->winOuterSize = 4;
- hhenv->nIter = 1;
- amdmsInitLimitSetup(&(hhenv->limits));
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsDestroyBadPixelAlgo(amdmsALGO_BAD_PIXEL_ENV **env)
-{
- amdmsALGO_BAD_PIXEL_ENV *henv = NULL;
- amdmsALGO_ENV *hhenv = NULL;
-
- if (env == NULL) {
- return amdmsFAILURE;
- }
- if (*env == NULL) {
- return amdmsSUCCESS;
- }
- henv = *env;
- amdmsFreeData(&(henv->fuzzyMap));
- amdmsFreeLimitSetup(&(henv->limits));
- hhenv = &(henv->env);
- amdmsDestroyAlgo(&hhenv);
- if (henv->allocated) {
- henv->allocated = amdmsFALSE;
- free(henv);
- *env = NULL;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsDoBadPixel(amdmsALGO_BAD_PIXEL_ENV *env)
-{
- amdmsCOMPL retVal = amdmsSUCCESS;
- int iInput;
- amdmsFITS *infile = NULL;
- int iOutput;
- amdmsFITS *outfile = NULL;
- amdmsDATA data;
- amdmsDATA hdata;
- int iPixel;
- int nPixels;
- FILE *fp = NULL;
-
- amdmsInfo(__FILE__, __LINE__, "amdmsDoBadPixel(...)");
- if (env->env.inFiles.nNames == 0) {
- /* no filename(s) given but we need exactly one file */
- amdmsError(__FILE__, __LINE__, "no filename given");
- return amdmsFAILURE;
- }
- if (amdmsReadAllMaps(&(env->env.calib)) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsAllocateData(&(env->fuzzyMap), env->env.calib.bpmData.nx, env->env.calib.bpmData.ny) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- amdmsSetData(&(env->fuzzyMap), 0.0);
- amdmsInitData(&data);
- amdmsInitData(&hdata);
- for (iInput = 0; (iInput < env->env.inFiles.nNames) && (retVal == amdmsSUCCESS); iInput++) {
- if (amdmsOpenFitsFile(&infile, env->env.inFiles.names[iInput]) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsOpenData(infile, env->env.inFiles.flags[iInput], 1) != amdmsSUCCESS) {
- amdmsCloseFitsFile(&infile);
- return amdmsFAILURE;
- }
- amdmsRecalcStripes(&(env->env.stripes), infile->nx, infile->ny);
- switch (env->env.inFiles.flags[iInput].content) {
- case amdmsPIXEL_STAT_CONTENT:
- amdmsNotice(__FILE__, __LINE__, " using PIXEL_STAT in file %s", env->env.inFiles.names[iInput]);
- retVal = amdmsReadData(infile, &data, amdmsPIXEL_STAT_MEAN_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &hdata, amdmsPIXEL_STAT_VAR_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- if (env->nuicFlag) {
- amdmsCleanUpFlatfield(&(env->env.calib), &(env->env.stripes), &data, &hdata);
- }
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_PS_MEAN_PIXEL);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &hdata, amdmsUSE_PS_VAR_PIXEL);
- break;
- case amdmsPIXEL_BIAS_CONTENT:
- amdmsNotice(__FILE__, __LINE__, " using PIXEL_BIAS in file %s", env->env.inFiles.names[iInput]);
- retVal = amdmsReadData(infile, &data, amdmsPIXEL_BIAS_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_PIXEL_BIAS);
- break;
- case amdmsFLATFIELD_CONTENT:
- amdmsNotice(__FILE__, __LINE__, " using FLATFIELD in file %s", env->env.inFiles.names[iInput]);
- retVal = amdmsReadData(infile, &data, amdmsFLATFIELD_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FLATFIELD);
- break;
- case amdmsFLATFIELD_FIT_CONTENT:
- case amdmsPTC_CONTENT:
- amdmsNotice(__FILE__, __LINE__, " using FIT or PTC in file %s", env->env.inFiles.names[iInput]);
- retVal = amdmsReadData(infile, &data, amdmsFIT_DATA_BIAS_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_DATA_BIAS);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_DATA_SATURATION_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_DATA_SATURATION);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_CHI_SQR_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_CHI_SQR);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_ABS_DIST_SQR_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_ABS_DIST_SQR);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_REL_DIST_SQR_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_REL_DIST_SQR);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_LOWER_LIMIT_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_LOWER_LIMIT);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_UPPER_LIMIT_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_UPPER_LIMIT);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_A0_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_A0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_A0_STDEV_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_A0_STDEV);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_A1_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_A1);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_A1_STDEV_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_A1_STDEV);
- break;
- case amdmsCONVERSION_FACTOR_CONTENT:
- amdmsNotice(__FILE__, __LINE__, " using CONVERSION_FACTOR in file %s", env->env.inFiles.names[iInput]);
- retVal = amdmsReadData(infile, &data, amdmsCONVERSION_FACTOR_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_CONVERSION_FACTOR);
- break;
- case amdmsREADOUT_NOISE_CONTENT:
- amdmsNotice(__FILE__, __LINE__, " using READOUT_NOISE in file %s", env->env.inFiles.names[iInput]);
- retVal = amdmsReadData(infile, &data, amdmsREADOUT_NOISE_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_READOUT_NOISE);
- break;
- case amdmsPHOTON_NOISE_CONTENT:
- amdmsNotice(__FILE__, __LINE__, " using PHOTON_NOISE in file %s", env->env.inFiles.names[iInput]);
- retVal = amdmsReadData(infile, &data, amdmsPHOTON_NOISE_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_PHOTON_NOISE);
- break;
- case amdmsNONLINEARITY_CONTENT:
- amdmsNotice(__FILE__, __LINE__, " using NONLINEARITY in file %s", env->env.inFiles.names[iInput]);
- retVal = amdmsReadData(infile, &data, amdmsFIT_DATA_BIAS_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_DATA_BIAS);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_DATA_SATURATION_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_DATA_SATURATION);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_CHI_SQR_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_CHI_SQR);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_ABS_DIST_SQR_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_ABS_DIST_SQR);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_REL_DIST_SQR_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_REL_DIST_SQR);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_LOWER_LIMIT_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_LOWER_LIMIT);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_UPPER_LIMIT_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_UPPER_LIMIT);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_A0_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_A0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_A0_STDEV_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_A0_STDEV);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_A1_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_A1);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_A1_STDEV_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_A1_STDEV);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_A2_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_A2);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_A2_STDEV_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_A2_STDEV);
- break;
- case amdmsDARK_CURRENT_CONTENT:
- amdmsNotice(__FILE__, __LINE__, " using DARK_CURRENT in file %s", env->env.inFiles.names[iInput]);
- retVal = amdmsReadData(infile, &data, amdmsFIT_DATA_BIAS_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_DATA_BIAS);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_DATA_SATURATION_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_DATA_SATURATION);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_CHI_SQR_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_CHI_SQR);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_ABS_DIST_SQR_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_ABS_DIST_SQR);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_REL_DIST_SQR_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_REL_DIST_SQR);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_LOWER_LIMIT_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_LOWER_LIMIT);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_UPPER_LIMIT_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_UPPER_LIMIT);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_A0_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_A0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_A0_STDEV_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_A0_STDEV);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_A1_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_A1);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsReadData(infile, &data, amdmsFIT_A1_STDEV_ROW, 0);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsDoBadPixelPass(env, &data, amdmsUSE_FIT_A1_STDEV);
- break;
- default:
- amdmsError(__FILE__, __LINE__,
- "unsupported file content (%d)",
- env->env.inFiles.flags[iInput].content);
- retVal = amdmsFAILURE;
- }
- amdmsCloseFitsFile(&infile);
- }
- /* compute which pixels are bad pixels from fuzzy map */
- nPixels = env->env.calib.bpmData.nx*env->env.calib.bpmData.ny;
- env->env.calib.nGoodPixels = nPixels;
- for (iPixel = 0; iPixel < nPixels; iPixel++) {
- if (env->fuzzyMap.data[iPixel] >= env->fuzzyCount) {
- env->env.calib.bpmData.data[iPixel] = amdmsBAD_PIXEL;
- }
- if (env->env.calib.bpmData.data[iPixel] == amdmsBAD_PIXEL) {
- env->env.calib.nGoodPixels--;
- }
- }
- amdmsNotice(__FILE__, __LINE__, "DCM: GOODPIX = %d", env->env.calib.nGoodPixels);
- amdmsNotice(__FILE__, __LINE__, "DCM: BADPIX = %d", nPixels - env->env.calib.nGoodPixels);
- /* reopen the first input file for the header keywords */
- if (amdmsOpenFitsFile(&infile, env->env.inFiles.names[0]) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsOpenData(infile, env->env.inFiles.flags[0], 1) != amdmsSUCCESS) {
- amdmsCloseFitsFile(&infile);
- return amdmsFAILURE;
- }
- /* generate all outputs */
- for (iOutput = 0; (iOutput < env->env.outFiles.nNames) && (retVal == amdmsSUCCESS); iOutput++) {
- if (env->env.outFiles.flags[iOutput].format == amdmsTEXT_FORMAT) {
- fp = fopen(env->env.outFiles.names[iOutput], "w");
- if (fp != NULL) {
- amdmsExportBadPixelMap(fp, &(env->env.calib.bpmData));
- fclose(fp);
- }
- continue;
- }
- retVal = amdmsCreateFitsFile(&outfile, env->env.outFiles.names[iOutput]);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsCopyHeader(outfile, infile);
- if (retVal != amdmsSUCCESS) {
- amdmsCloseFitsFile(&outfile);
- break;
- }
- amdmsSetRegions(outfile, infile);
- switch (env->env.outFiles.flags[iOutput].content) {
- case amdmsBAD_PIXEL_CONTENT:
- retVal = amdmsCreateBadPixelMap(outfile, env->env.outFiles.flags[iOutput], &(env->env.calib.bpmData));
- break;
- case amdmsFUZZY_CONTENT:
- retVal = amdmsCreateFuzzyMap(env, outfile, env->env.outFiles.flags[iOutput]);
- break;
- default:
- amdmsError(__FILE__, __LINE__,
- "unsupported file content (%d)",
- env->env.outFiles.flags[iOutput].content);
- retVal = amdmsFAILURE;
- }
- retVal = amdmsCloseFitsFile(&outfile);
- }
- amdmsCloseFitsFile(&infile);
-
- if (&data != NULL) {
- amdmsFreeData(&(data));
- }
- if (&hdata != NULL) {
- amdmsFreeData(&(hdata));
- }
-
- return retVal;
-}
-
-amdmsCOMPL amdmsDoBadPixelPass(amdmsALGO_BAD_PIXEL_ENV *env, amdmsDATA *data, int dataFlag)
-{
- int iHS;
- int iVS;
- int iLimit;
- int iX;
- int iY;
- amdmsPIXEL meanValues;
- amdmsPIXEL varValues;
- amdmsPIXEL sigVar;
- amdmsLIMIT *limitSpec = NULL;
- amdmsPIXEL limit;
- amdmsPIXEL ref;
- int flags;
- int x;
- int y;
- int width;
- int height;
- amdmsPIXEL fv;
- int iPixel;
- int nPixels;
- int nNewBadPixels;
- int iIter;
- int hNIter;
-
- amdmsInfo(__FILE__, __LINE__, " amdmsDoBadPixelPass()");
- if ((env == NULL) && (data == NULL)) {
- return amdmsFAILURE;
- }
- nPixels = data->nx*data->ny;
- for (iHS = 0; iHS < env->env.stripes.nHStripes; iHS++) {
- for (iVS = 0; iVS < env->env.stripes.nVStripes; iVS++) {
- flags = env->env.stripes.hStripes[iHS].flags & env->env.stripes.vStripes[iVS].flags;
- if ((flags & dataFlag) == 0) continue;
- x = env->env.stripes.vStripes[iVS].pos;
- y = env->env.stripes.hStripes[iHS].pos;
- width = env->env.stripes.vStripes[iVS].size;
- height = env->env.stripes.hStripes[iHS].size;
- amdmsInfo(__FILE__, __LINE__,
- " area (%d .. %d, %d .. %d)",
- x, x + width - 1, y, y + height - 1);
- for (iLimit = 0; iLimit < env->limits.nLimits; iLimit++) {
- limitSpec = &(env->limits.limits[iLimit]);
- if ((limitSpec->flag & dataFlag) == 0) continue;
- switch (limitSpec->type) {
- case amdmsSIGMA_LOWER_LIMIT:
- case amdmsSIGMA_EQUAL_LIMIT:
- case amdmsSIGMA_UPPER_LIMIT:
- hNIter = env->nIter;
- break;
- default:
- hNIter = 1;
- }
- for (iIter = 0; iIter < hNIter; iIter++) {
- nNewBadPixels = 0;
- amdmsCalcStat(&(env->env.calib), data, 0, x, y, width, height, &meanValues, &varValues);
- sigVar = sqrt(varValues);
- amdmsInfo(__FILE__, __LINE__,
- " iteration #%d: mean = %12.4f var = %12.4f sig = %12.4f",
- iIter, meanValues, varValues, sigVar);
- amdmsCalcLimit(limitSpec, meanValues, varValues, &limit, &ref);
- amdmsInfo(__FILE__, __LINE__, " limit = %12.4f", limit);
- for (iY = y; iY < (y + height); iY ++) {
- for (iX = x; iX < (x + width); iX++) {
- iPixel = data->nx*iY + iX;
- if (env->env.calib.bpmData.data[iPixel] != amdmsGOOD_PIXEL) continue;
- if (env->winFlag) {
- /* we have to update the limits according to the neighbourhood */
- amdmsCalcStatBox(&(env->env.calib), data, 0,
- x, y, width, height,
- iX, iY, env->winInnerSize, env->winOuterSize,
- &meanValues, &varValues);
- amdmsCalcLimit(limitSpec, meanValues, varValues, &limit, &ref);
- }
- switch (limitSpec->type) {
- case amdmsABS_LOWER_LIMIT:
- case amdmsREL_LOWER_LIMIT:
- case amdmsSIGMA_LOWER_LIMIT:
- fv = (data->data[iPixel] - ref)/(limit - ref);
- fv = MAX(0.0, MIN(fv, 1.0));
- if (data->data[iPixel] >= limit) {
- /* the current pixel is a bad pixel */
- env->env.calib.bpmData.data[iPixel] = amdmsBAD_PIXEL;
- env->fuzzyMap.data[iPixel] += env->fuzzyCount;
- nNewBadPixels++;
- } else if (fv > env->fuzzyLimit) {
- /* increase the fuzzy counter */
- env->fuzzyMap.data[iPixel] += 1.0;
- }
- break;
- case amdmsABS_EQUAL_LIMIT:
- case amdmsREL_EQUAL_LIMIT:
- case amdmsSIGMA_EQUAL_LIMIT:
- if (fabs(data->data[iPixel]- limit) < amdmsEPS) {
- /* the current pixel is a bad pixel */
- env->env.calib.bpmData.data[iPixel] = amdmsBAD_PIXEL;
- nNewBadPixels++;
- env->fuzzyMap.data[iPixel] += env->fuzzyCount;
- }
- break;
- case amdmsABS_UPPER_LIMIT:
- case amdmsREL_UPPER_LIMIT:
- case amdmsSIGMA_UPPER_LIMIT:
- fv = (ref - data->data[iPixel])/(ref - limit);
- fv = MAX(0.0, MIN(fv, 1.0));
- if (data->data[iPixel] <= limit) {
- /* the current pixel is a bad pixel */
- env->env.calib.bpmData.data[iPixel] = amdmsBAD_PIXEL;
- nNewBadPixels++;
- env->fuzzyMap.data[iPixel] += env->fuzzyCount;
- } else if (fv > env->fuzzyLimit) {
- /* increase the fuzzy counter */
- env->fuzzyMap.data[iPixel] += 1.0;
- }
- break;
- default:;
- }
- }
- }
- amdmsInfo(__FILE__, __LINE__, " %d bad pixels added", nNewBadPixels);
- if (nNewBadPixels == 0) break;
- }
- }
- }
- }
- return amdmsSUCCESS;
-}
-
-void amdmsCalcLimit(amdmsLIMIT *spec, amdmsPIXEL mean, amdmsPIXEL var, amdmsPIXEL *limit, amdmsPIXEL *ref)
-{
- switch (spec->type) {
- case amdmsABS_LOWER_LIMIT:
- case amdmsABS_EQUAL_LIMIT:
- case amdmsABS_UPPER_LIMIT:
- *limit = spec->value;
- *ref = spec->ref;
- break;
- case amdmsREL_LOWER_LIMIT:
- case amdmsREL_EQUAL_LIMIT:
- case amdmsREL_UPPER_LIMIT:
- *limit = spec->value*mean;
- *ref = spec->ref*mean;
- break;
- case amdmsSIGMA_LOWER_LIMIT:
- case amdmsSIGMA_EQUAL_LIMIT:
- case amdmsSIGMA_UPPER_LIMIT:
- *limit = mean + spec->value*sqrt(var);
- *ref = mean + spec->ref*sqrt(var);
- break;
- default:
- *limit = 0.0;
- *ref = 0.0;
- }
-}
-
-amdmsCOMPL amdmsExportBadPixelMap(FILE *outfile, amdmsDATA *bpm)
-{
- int iPixel;
- int nPixels = bpm->nx*bpm->ny;
- int x, y;
-
- for (iPixel = 0; iPixel < nPixels; iPixel++) {
- if (bpm->data[iPixel] != amdmsBAD_PIXEL) continue;
- x = iPixel%bpm->ny;
- y = iPixel/bpm->ny;
- fprintf(outfile, "%d %d\n", x, y);
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCreateBadPixelMap(amdmsFITS *outfile, amdmsFITS_FLAGS flags, amdmsDATA *bpm)
-{
- int nPixels = bpm->nx*bpm->ny;
- int nGoodPixels = nPixels;
- int nBadPixels = 0;
- int iPixel;
-
- for (iPixel = 0; iPixel < nPixels; iPixel++) {
- if (bpm->data[iPixel] == amdmsBAD_PIXEL) {
- nGoodPixels--;
- nBadPixels++;
- }
- }
- if (amdmsUpdateKeywordString(outfile,
- "HIERARCH ESO DPR CATG", "CALIB",
- "Observation category")
- != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsUpdateKeywordString(outfile,
- "HIERARCH ESO DPR TECH", "INTERFEROMETRY",
- "Observation technique")
- != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsUpdateKeywordString(outfile,
- "HIERARCH ESO DPR TYPE", "BADPIX",
- "Observation type")
- != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsUpdateKeywordInt(outfile,
- "GOODPIX", nGoodPixels,
- "number of good pixels")
- != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsUpdateKeywordInt(outfile,
- "BADPIX", nBadPixels,
- "number of bad pixels")
- != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsCreateData(outfile, flags, amdmsBAD_PIXEL_NROWS, 1) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- bpm->index = 1.0;
- if (amdmsWriteData(outfile, bpm, amdmsBAD_PIXEL_ROW, 0) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCreateFuzzyMap(amdmsALGO_BAD_PIXEL_ENV *env, amdmsFITS *outfile, amdmsFITS_FLAGS flags)
-{
- int nPixels = env->env.calib.bpmData.nx*env->env.calib.bpmData.ny;
-
- if (amdmsUpdateKeywordString(outfile,
- "HIERARCH ESO DPR CATG", "CALIB",
- "Observation category")
- != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsUpdateKeywordString(outfile,
- "HIERARCH ESO DPR TECH", "INTERFEROMETRY",
- "Observation technique")
- != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsUpdateKeywordString(outfile,
- "HIERARCH ESO DPR TYPE", "BADPIX",
- "Observation type")
- != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsUpdateKeywordInt(outfile,
- "GOODPIX", env->env.calib.nGoodPixels,
- "number of good pixels")
- != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsUpdateKeywordInt(outfile,
- "BADPIX", nPixels - env->env.calib.nGoodPixels,
- "number of bad pixels")
- != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsCreateData(outfile, flags, amdmsFUZZY_NROWS, 1) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- env->fuzzyMap.index = 1.0;
- if (amdmsWriteData(outfile, &(env->fuzzyMap), amdmsFUZZY_DATA_ROW, 0) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsInitLimitSetup(amdmsLIMIT_SETUP *setup)
-{
- int iLimit;
-
- if (setup == NULL) {
- return amdmsFAILURE;
- }
- setup->nLimits = 0;
- for (iLimit = 0; iLimit < amdmsMAX_LIMITS; iLimit++) {
- setup->limits[iLimit].flag = 0;
- setup->limits[iLimit].type = 0;
- setup->limits[iLimit].value = 0.0;
- setup->limits[iLimit].ref = 0.0;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsFreeLimitSetup(amdmsLIMIT_SETUP *setup)
-{
- int iLimit;
-
- if (setup == NULL) {
- return amdmsFAILURE;
- }
- setup->nLimits = 0;
- for (iLimit = 0; iLimit < amdmsMAX_LIMITS; iLimit++) {
- setup->limits[iLimit].flag = 0;
- setup->limits[iLimit].type = 0;
- setup->limits[iLimit].value = 0.0;
- setup->limits[iLimit].ref = 0.0;
- }
- return amdmsSUCCESS;
-}
-
diff --git a/amber/amdmsCalibration.c b/amber/amdmsCalibration.c
deleted file mode 100644
index 5e4f456..0000000
--- a/amber/amdmsCalibration.c
+++ /dev/null
@@ -1,1304 +0,0 @@
-#include <math.h>
-#include <string.h>
-
-#include "amdms.h"
-#include "amdmsFit.h"
-#include "amdmsFits.h"
-
-#define amdmsCU_NROWS 20
-#define amdmsCU_ROW 100
-
-#define MIN(x,y) ((x) < (y) ? (x) : (y))
-#define MAX(x,y) ((x) > (y) ? (x) : (y))
-#define ABS(x) ((x) > 0 ? (x) : -(x))
-
-static amdmsCOMPL amdmsReadMap(amdmsCALIBRATION_SETUP *setup,
- char *fileName,
- amdmsFITS_FLAGS flags,
- int mapRow,
- amdmsDATA *map,
- amdmsPIXEL defValue);
-
-static amdmsCOMPL amdmsReadMultiMap(amdmsCALIBRATION_SETUP *setup,
- char *fileName,
- amdmsFITS_FLAGS flags,
- int mapFirstRow, int mapNRows,
- amdmsDATA **map,
- amdmsPIXEL *defValues);
-
-static amdmsCOMPL amdmsCompensatePixelBias(amdmsCALIBRATION_SETUP *setup,
- amdmsDATA *calData);
-static amdmsCOMPL amdmsCompensateEBiasByMap(amdmsCALIBRATION_SETUP *setup,
- amdmsDATA *calData);
-static amdmsCOMPL amdmsCompensateEBiasBySimpleExp1D(amdmsCALIBRATION_SETUP *setup,
- amdmsDATA *calData);
-static amdmsCOMPL amdmsCompensateEBias(amdmsCALIBRATION_SETUP *setup,
- amdmsDATA *calData);
-static amdmsCOMPL amdmsCompensateGlobalBias(amdmsCALIBRATION_SETUP *setup,
- amdmsDATA *calData);
-static amdmsCOMPL amdmsCompensateFNoise(amdmsCALIBRATION_SETUP *setup,
- amdmsDATA *calData);
-static amdmsCOMPL amdmsCompensateNonlinearity(amdmsCALIBRATION_SETUP *setup,
- amdmsDATA *calData);
-static amdmsCOMPL amdmsCompensateFlatfield(amdmsCALIBRATION_SETUP *setup,
- amdmsDATA *calData);
-static amdmsCOMPL amdmsCompensateBadPixel(amdmsCALIBRATION_SETUP *setup,
- amdmsDATA *calData);
-
-amdmsCOMPL amdmsInitCalibrationSetup(amdmsCALIBRATION_SETUP *setup)
-{
- amdmsFITS_FLAGS flags = {amdmsIMAGING_DATA_CONTENT, amdmsDEFAULT_MAP_FORMAT, amdmsFLOAT_TYPE};
-
- if (setup == NULL) {
- return amdmsFAILURE;
- }
- setup->detNX = 512;
- setup->detNY = 512;
- setup->corrFlag = amdmsNO_CORRECTION;
- amdmsInitFileList(&(setup->mapFiles), flags);
- setup->saWinX = 0;
- setup->saWinWidth = 16;
- setup->saWinY = 0;
- setup->saWinHeight = 0;
- setup->saGaussHeight = 16;
- setup->saGaussSigma = 8.0;
- setup->bpiRadius = 4;
- setup->bpiSigma = 2;
- setup->bpiWeights = NULL;
- amdmsInitData(&(setup->bpmData));
- setup->nGoodPixels = 0;
- amdmsInitData(&(setup->ebmData));
- amdmsInitData(&(setup->pbmData));
- amdmsInitData(&(setup->ffmData));
- amdmsInitData(&(setup->nlmDataLimit));
- amdmsInitData(&(setup->nlmDataA0));
- amdmsInitData(&(setup->nlmDataA1));
- amdmsInitData(&(setup->pemDataFI));
- amdmsInitData(&(setup->pemDataLI));
- setup->globalBias = 0.0;
- setup->rowOffsets = NULL;
- setup->rowGood = NULL;
- setup->rowWeight = NULL;
- setup->rowSum = NULL;
- setup->ebAlgo = amdmsEBA_MAP;
- setup->ebX = NULL;
- setup->ebY = NULL;
- setup->ebYe = NULL;
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsFreeCalibrationSetup(amdmsCALIBRATION_SETUP *setup)
-{
- if (setup == NULL) {
- return amdmsFAILURE;
- }
- setup->detNX = 512;
- setup->detNY = 512;
- setup->corrFlag = amdmsNO_CORRECTION;
- amdmsFreeFileList(&(setup->mapFiles));
- setup->saWinX = 0;
- setup->saWinWidth = 16;
- setup->saWinY = 0;
- setup->saWinHeight = 0;
- setup->saGaussHeight = 16;
- setup->saGaussSigma = 8.0;
- setup->bpiRadius = 4;
- setup->bpiSigma = 2;
- if (setup->bpiWeights != NULL) {
- free(setup->bpiWeights);
- setup->bpiWeights = NULL;
- }
- amdmsFreeData(&(setup->bpmData));
- setup->nGoodPixels = 0;
- amdmsFreeData(&(setup->ebmData));
- amdmsFreeData(&(setup->pbmData));
- amdmsFreeData(&(setup->ffmData));
- amdmsFreeData(&(setup->nlmDataLimit));
- amdmsFreeData(&(setup->nlmDataA0));
- amdmsFreeData(&(setup->nlmDataA1));
- amdmsFreeData(&(setup->pemDataFI));
- amdmsFreeData(&(setup->pemDataLI));
- setup->globalBias = 0.0;
- if (setup->rowOffsets != NULL) {
- free(setup->rowOffsets);
- setup->rowOffsets = NULL;
- }
- if (setup->rowGood != NULL) {
- free(setup->rowGood);
- setup->rowGood = NULL;
- }
- if (setup->rowWeight != NULL) {
- free(setup->rowWeight);
- setup->rowWeight = NULL;
- }
- if (setup->rowSum != NULL) {
- free(setup->rowSum);
- setup->rowSum = NULL;
- }
- if (setup->ebX != NULL) {
- free(setup->ebX);
- setup->ebX = NULL;
- }
- if (setup->ebY != NULL) {
- free(setup->ebY);
- setup->ebY = NULL;
- }
- if (setup->ebYe != NULL) {
- free(setup->ebYe);
- setup->ebYe = NULL;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsReadMap(amdmsCALIBRATION_SETUP *setup,
- char *fileName,
- amdmsFITS_FLAGS flags,
- int mapRow,
- amdmsDATA *map,
- amdmsPIXEL defValue)
-{
- amdmsFITS *file = NULL;
- int iPixel;
-
- if ((fileName == NULL) || (fileName[0] == '\0')) {
- /* no filename given, create default map with default content */
- if (amdmsAllocateData(map, setup->detNX, setup->detNY) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- for (iPixel = 0; iPixel < setup->detNX*setup->detNY; iPixel++) {
- map->data[iPixel] = defValue;
- }
- return amdmsSUCCESS;
- }
- if (amdmsOpenFitsFile(&file, fileName) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsOpenData(file, flags, 1) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsReadData(file, map, mapRow, 0) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- return amdmsCloseFitsFile(&file);
-}
-
-amdmsCOMPL amdmsReadMultiMap(amdmsCALIBRATION_SETUP *setup,
- char *fileName,
- amdmsFITS_FLAGS flags,
- int mapFirstRow,
- int mapNRows,
- amdmsDATA **map,
- amdmsPIXEL *defValues)
-{
- amdmsFITS *file = NULL;
- int iRow;
- int iPixel;
-
- if ((fileName == NULL) || (fileName[0] == '\0')) {
- /* no filename given, create default map with default content */
- for (iRow = 0; iRow < mapNRows; iRow++) {
- if (amdmsAllocateData(map[iRow], setup->detNX, setup->detNY) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- for (iPixel = 0; iPixel < setup->detNX*setup->detNY; iPixel++) {
- map[iRow]->data[iPixel] = defValues[iRow];
- }
- }
- return amdmsSUCCESS;
- }
- if (amdmsOpenFitsFile(&file, fileName) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsOpenData(file, flags, 1) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- for (iRow = 0; iRow < mapNRows; iRow++) {
- if (amdmsReadData(file, map[iRow], mapFirstRow + iRow, 0) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- }
- return amdmsCloseFitsFile(&file);
-}
-
-amdmsCOMPL amdmsReadAllMaps(amdmsCALIBRATION_SETUP *setup)
-{
- int iFile;
- char *fileName = NULL;
- amdmsFITS_FLAGS flags;
- amdmsDATA *nlm[3];
- amdmsPIXEL nlmDefaults[3];
- amdmsDATA *pem[2];
- amdmsPIXEL pemDefaults[2];
- int iPixel;
- int iX;
- int iY;
-
- amdmsDebug(__FILE__, __LINE__, "amdmsReadAllMaps()");
- fileName = NULL;
- for (iFile = 0; iFile < setup->mapFiles.nNames; iFile++) {
- if (setup->mapFiles.flags[iFile].content == amdmsELECTRONIC_BIAS_CONTENT) {
- fileName = setup->mapFiles.names[iFile];
- flags = setup->mapFiles.flags[iFile];
- break;
- }
- }
- if (amdmsReadMap(setup, fileName, flags, amdmsELECTRONIC_BIAS_ROW,
- &(setup->ebmData), 0.0) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- fileName = NULL;
- for (iFile = 0; iFile < setup->mapFiles.nNames; iFile++) {
- if (setup->mapFiles.flags[iFile].content == amdmsPIXEL_BIAS_CONTENT) {
- fileName = setup->mapFiles.names[iFile];
- flags = setup->mapFiles.flags[iFile];
- break;
- }
- }
- if (amdmsReadMap(setup, fileName, flags, amdmsPIXEL_BIAS_ROW,
- &(setup->pbmData), 0.0) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- fileName = NULL;
- for (iFile = 0; iFile < setup->mapFiles.nNames; iFile++) {
- if (setup->mapFiles.flags[iFile].content == amdmsBAD_PIXEL_CONTENT) {
- fileName = setup->mapFiles.names[iFile];
- flags = setup->mapFiles.flags[iFile];
- break;
- }
- }
- if (amdmsReadMap(setup, fileName, flags, amdmsBAD_PIXEL_ROW,
- &(setup->bpmData), amdmsGOOD_PIXEL) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- setup->nGoodPixels = setup->bpmData.nx*setup->bpmData.ny;
- for (iPixel = 0; iPixel < setup->bpmData.nx*setup->bpmData.ny; iPixel++) {
- if (setup->bpmData.data[iPixel] == amdmsBAD_PIXEL) {
- setup->nGoodPixels--;
- }
- }
- fileName = NULL;
- for (iFile = 0; iFile < setup->mapFiles.nNames; iFile++) {
- if (setup->mapFiles.flags[iFile].content == amdmsFLATFIELD_CONTENT) {
- fileName = setup->mapFiles.names[iFile];
- flags = setup->mapFiles.flags[iFile];
- break;
- }
- }
- if (amdmsReadMap(setup, fileName, flags, amdmsFLATFIELD_ROW,
- &(setup->ffmData), 1.0) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- nlm[0] = &(setup->nlmDataLimit);
- nlm[1] = &(setup->nlmDataA0);
- nlm[2] = &(setup->nlmDataA1);
- nlmDefaults[0] = 1.0e6;
- nlmDefaults[1] = 1.0;
- nlmDefaults[2] = 0.0;
- fileName = NULL;
- for (iFile = 0; iFile < setup->mapFiles.nNames; iFile++) {
- if (setup->mapFiles.flags[iFile].content == amdmsNONLINEARITY_CONTENT) {
- fileName = setup->mapFiles.names[iFile];
- flags = setup->mapFiles.flags[iFile];
- break;
- }
- }
- if (amdmsReadMultiMap(setup, fileName, flags,
- amdmsNONLINEARITY_LIMIT_ROW, amdmsNONLINEARITY_NROWS,
- nlm, nlmDefaults) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- pem[0] = &(setup->pemDataFI);
- pem[1] = &(setup->pemDataLI);
- pemDefaults[0] = -1.0;
- pemDefaults[1] = -1.0;
- fileName = NULL;
- for (iFile = 0; iFile < setup->mapFiles.nNames; iFile++) {
- if (setup->mapFiles.flags[iFile].content == amdmsPARTICLE_EVENT_CONTENT) {
- fileName = setup->mapFiles.names[iFile];
- flags = setup->mapFiles.flags[iFile];
- break;
- }
- }
- if (amdmsReadMultiMap(setup, fileName, flags,
- amdmsPARTICLE_EVENT_FIRST_IMG_ROW, amdmsPARTICLE_EVENT_NROWS,
- pem, pemDefaults) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (setup->bpiWeights == NULL) {
- setup->bpiWeights = (amdmsPIXEL *)calloc((size_t)(setup->bpiRadius*setup->bpiRadius),
- sizeof(amdmsPIXEL));
- if (setup->bpiWeights == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (bpiWeights)!");
- return amdmsFAILURE;
- }
- for (iX = 0; iX < setup->bpiRadius; iX++) {
- for (iY = 0; iY < setup->bpiRadius; iY++) {
- setup->bpiWeights[iY*setup->bpiRadius + iX] =
- exp(-((amdmsPIXEL)(iX*iX + iY*iY))/2.0/setup->bpiSigma/setup->bpiSigma);
- }
- }
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCompensatePixelBias(amdmsCALIBRATION_SETUP *setup, amdmsDATA *calData)
-{
- int nPixels;
- int iPixel;
-
- if ((setup == NULL) || (calData == NULL)) {
- return amdmsFAILURE;
- }
- if ((setup->corrFlag & amdmsPIXEL_BIAS_CORRECTION) == 0) {
- return amdmsSUCCESS;
- }
- nPixels = calData->nx*calData->ny;
- for (iPixel = 0; iPixel < nPixels; iPixel++) {
- calData->data[iPixel] -= setup->pbmData.data[iPixel];
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCompensateEBiasByMap(amdmsCALIBRATION_SETUP *setup, amdmsDATA *calData)
-{
- int nPixels;
- int iPixel;
-
- if ((setup == NULL) || (calData == NULL)) {
- return amdmsFAILURE;
- }
- if ((setup->corrFlag & amdmsELECTRONIC_BIAS_CORRECTION) == 0) {
- return amdmsSUCCESS;
- }
- nPixels = calData->nx*calData->ny;
- for (iPixel = 0; iPixel < nPixels; iPixel++) {
- calData->data[iPixel] -= setup->ebmData.data[iPixel];
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCompensateEBiasBySimpleExp1D(amdmsCALIBRATION_SETUP *setup, amdmsDATA *calData)
-{
- int nPixels;
- int iPixel;
- int iX, iY;
- int nDP;
- amdmsFIT_NONLINEAR_ENV *ebFitEnv = NULL; /* fit environment for electronic bias */
-
- if ((setup == NULL) || (calData == NULL)) {
- return amdmsFAILURE;
- }
- if ((setup->corrFlag & amdmsELECTRONIC_BIAS_CORRECTION) == 0) {
- return amdmsSUCCESS;
- }
- if (amdmsCreateGeneralExpFit(&ebFitEnv) != amdmsSUCCESS) {
- amdmsFatal(__FILE__, __LINE__, "could not create fit for electronic bias!");
- return amdmsFAILURE;
- }
- nPixels = calData->nx*calData->ny;
- if (setup->rowOffsets == NULL) {
- setup->rowOffsets = (amdmsPIXEL *)calloc((size_t)setup->detNY, sizeof(amdmsPIXEL));
- if (setup->rowOffsets == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (rowOffsets)!");
- amdmsDestroyNonLinearFit(&ebFitEnv);
- return amdmsFAILURE;
- }
- }
- if (setup->rowGood == NULL) {
- setup->rowGood = (int *)calloc((size_t)setup->detNY, sizeof(int));
- if (setup->rowGood == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (rowGood)!");
- amdmsDestroyNonLinearFit(&ebFitEnv);
- return amdmsFAILURE;
- }
- }
- if (setup->rowWeight == NULL) {
- setup->rowWeight = (amdmsPIXEL *)calloc((size_t)setup->detNY, sizeof(amdmsPIXEL));
- if (setup->rowWeight == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (rowWeight)!");
- amdmsDestroyNonLinearFit(&ebFitEnv);
- return amdmsFAILURE;
- }
- }
- if (setup->ebX == NULL) {
- setup->ebX = (double *)calloc((size_t)setup->detNY, sizeof(double));
- if (setup->ebX == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (ebX)!");
- amdmsDestroyNonLinearFit(&ebFitEnv);
- return amdmsFAILURE;
- }
- }
- if (setup->ebY == NULL) {
- setup->ebY = (double *)calloc((size_t)setup->detNY, sizeof(double));
- if (setup->ebY == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (ebY)!");
- amdmsDestroyNonLinearFit(&ebFitEnv);
- return amdmsFAILURE;
- }
- }
- if (setup->ebYe == NULL) {
- setup->ebYe = (double *)calloc((size_t)setup->detNY, sizeof(double));
- if (setup->ebYe == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (ebYe)!");
- amdmsDestroyNonLinearFit(&ebFitEnv);
- return amdmsFAILURE;
- }
- }
- nDP = 0;
- for (iY = 8; iY < calData->ny - 8 ; iY++) {
- setup->rowOffsets[iY] = 0.0;
- setup->rowGood[iY] = 0;
- for (iX = setup->saWinX; iX < (setup->saWinX + setup->saWinWidth); iX++) {
- iPixel = calData->nx*iY + iX;
- if (setup->bpmData.data[iPixel] == amdmsGOOD_PIXEL) {
- setup->rowOffsets[iY] += calData->data[iPixel];
- setup->rowGood[iY]++;
- }
- }
- if (setup->rowGood[iY] != 0) {
- setup->ebX[nDP] = (double)iY/(double)calData->ny;
- setup->ebY[nDP] = setup->rowOffsets[iY]/(amdmsPIXEL)setup->rowGood[iY];
- setup->ebYe[nDP] = 1.0;
- if (calData->index == 31) {
- amdmsInfo(__FILE__, __LINE__, "ROM %d = %.2f", iY, setup->ebY[nDP]);
- }
- nDP++;
- }
- }
- if (amdmsDoFit((amdmsFIT_ENV*)ebFitEnv, nDP, setup->ebX, setup->ebY, setup->ebYe) == amdmsSUCCESS) {
- /*
- amdmsInfo(__FILE__, __LINE__,
- "EB%d(x) = %f + %f * exp(%f*x)",
- (int)(calData->index),
- ebFitEnv->env.a[0],
- ebFitEnv->env.a[1],
- ebFitEnv->env.a[2]);
- */
- for (iY = 0; iY < calData->ny ; iY++) {
- setup->rowOffsets[iY] = (amdmsPIXEL)amdmsEvalFit((amdmsFIT_ENV*)ebFitEnv, (double)iY/(double)calData->ny);
- if (calData->index == 31) {
- amdmsInfo(__FILE__, __LINE__, "ROS %d = %.4f", iY, setup->rowOffsets[iY]);
- }
- for (iX = 0; iX < calData->nx; iX++) {
- iPixel = calData->nx*iY + iX;
- calData->data[iPixel] -= setup->rowOffsets[iY];
- }
- }
- } else {
- amdmsWarning(__FILE__, __LINE__, "fit of the electronic bias does not work!");
- }
- return amdmsDestroyNonLinearFit(&ebFitEnv);
-}
-
-amdmsCOMPL amdmsCompensateEBiasBySimpleSmooth1D(amdmsCALIBRATION_SETUP *setup, amdmsDATA *calData)
-{
- int nPixels;
- int iPixel;
- int iX, iY;
-
- if ((setup == NULL) || (calData == NULL)) {
- return amdmsFAILURE;
- }
- if ((setup->corrFlag & amdmsELECTRONIC_BIAS_CORRECTION) == 0) {
- return amdmsSUCCESS;
- }
- nPixels = calData->nx*calData->ny;
- if (setup->rowOffsets == NULL) {
- setup->rowOffsets = (amdmsPIXEL *)calloc((size_t)setup->detNY, sizeof(amdmsPIXEL));
- if (setup->rowOffsets == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (rowOffsets)!");
- return amdmsFAILURE;
- }
- }
- if (setup->rowGood == NULL) {
- setup->rowGood = (int *)calloc((size_t)setup->detNY, sizeof(int));
- if (setup->rowGood == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (rowGood)!");
- return amdmsFAILURE;
- }
- }
- if (setup->ebX == NULL) {
- setup->ebX = (double *)calloc((size_t)setup->detNY, sizeof(double));
- if (setup->ebX == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (ebX)!");
- return amdmsFAILURE;
- }
- }
- if (setup->ebY == NULL) {
- setup->ebY = (double *)calloc((size_t)setup->detNY, sizeof(double));
- if (setup->ebY == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (ebY)!");
- return amdmsFAILURE;
- }
- }
- if (setup->ebYe == NULL) {
- setup->ebYe = (double *)calloc((size_t)setup->detNY, sizeof(double));
- if (setup->ebYe == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (ebYe)!");
- return amdmsFAILURE;
- }
- }
- for (iY = 0; iY < calData->ny; iY++) {
- setup->rowOffsets[iY] = 0.0;
- setup->rowGood[iY] = 0;
- for (iX = setup->saWinX; iX < (setup->saWinX + setup->saWinWidth); iX++) {
- iPixel = calData->nx*iY + iX;
- if (setup->bpmData.data[iPixel] == amdmsGOOD_PIXEL) {
- setup->rowOffsets[iY] += calData->data[iPixel];
- setup->rowGood[iY]++;
- }
- }
- if (setup->rowGood[iY] != 0) {
- setup->ebX[iY] = 1.0;
- setup->ebY[iY] = setup->rowOffsets[iY]/(amdmsPIXEL)setup->rowGood[iY];
- } else {
- setup->ebX[iY] = 0.0;
- setup->ebY[iY] = 0.0;
- }
- if (iY == 0) {
- setup->ebX[iY] = 0.0;
- }
- if (calData->index == 31) {
- amdmsInfo(__FILE__, __LINE__, "ROM %d = %.2f", iY, setup->ebY[iY]);
- }
- }
- if (amdmsSmoothDataByFiniteDiff2W(setup->ebX, setup->ebY, setup->ebYe, 1000.0, calData->ny) == amdmsSUCCESS) {
- for (iY = 0; iY < calData->ny ; iY++) {
- if (calData->index == 31) {
- amdmsInfo(__FILE__, __LINE__, "ROS %d = %.2f", iY, setup->ebYe[iY]);
- }
- setup->rowOffsets[iY] = (amdmsPIXEL)(setup->ebYe[iY]);
- for (iX = 0; iX < calData->nx; iX++) {
- iPixel = calData->nx*iY + iX;
- calData->data[iPixel] -= setup->rowOffsets[iY];
- }
- }
- } else {
- amdmsWarning(__FILE__, __LINE__, "smoothing of the electronic bias does not work!");
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCompensateEBias(amdmsCALIBRATION_SETUP *setup, amdmsDATA *calData)
-{
- if ((setup == NULL) || (calData == NULL)) {
- return amdmsFAILURE;
- }
- if ((setup->corrFlag & amdmsELECTRONIC_BIAS_CORRECTION) == 0) {
- return amdmsSUCCESS;
- }
- switch (setup->ebAlgo) {
- case amdmsEBA_MAP: return amdmsCompensateEBiasByMap(setup, calData);
- case amdmsEBA_SIMPLE_EXP1D: return amdmsCompensateEBiasBySimpleExp1D(setup, calData);
- case amdmsEBA_SIMPLE_SMOOTH1D: return amdmsCompensateEBiasBySimpleSmooth1D(setup, calData);
- default:
- amdmsError(__FILE__, __LINE__,
- "unsupported electronic bias compensation algorithm (%d)",
- setup->ebAlgo);
- return amdmsFAILURE;
- }
-}
-
-amdmsCOMPL amdmsCompensateGlobalBias(amdmsCALIBRATION_SETUP *setup, amdmsDATA *calData)
-{
- int nPixels;
- int iPixel;
- amdmsPIXEL m;
- amdmsPIXEL v;
-
- if ((setup == NULL) || (calData == NULL)) {
- return amdmsFAILURE;
- }
- if ((setup->corrFlag & amdmsGLOBAL_BIAS_CORRECTION) == 0) {
- return amdmsSUCCESS;
- }
- nPixels = calData->nx*calData->ny;
- if (amdmsCalcStat(setup, calData, 0, setup->saWinX, setup->saWinY, setup->saWinWidth, setup->saWinHeight, &m, &v) != amdmsFAILURE) {
- setup->globalBias = m;
- } else {
- setup->globalBias = 0.0;
- }
- for (iPixel = 0; iPixel < nPixels; iPixel++) {
- calData->data[iPixel] -= setup->globalBias;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCompensateFNoise(amdmsCALIBRATION_SETUP *setup, amdmsDATA *calData)
-{
- int nPixels;
- int iPixel;
- int iX, iY;
- int iW;
- float w;
-
- if ((setup == NULL) || (calData == NULL)) {
- return amdmsFAILURE;
- }
- if ((setup->corrFlag & amdmsROW_OFFSET_CORRECTION) == 0) {
- return amdmsSUCCESS;
- }
- nPixels = calData->nx*calData->ny;
- if (setup->rowOffsets == NULL) {
- setup->rowOffsets = (amdmsPIXEL *)calloc((size_t)setup->detNY, sizeof(amdmsPIXEL));
- if (setup->rowOffsets == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (rowOffsets)!");
- return amdmsFAILURE;
- }
- }
- if (setup->rowGood == NULL) {
- setup->rowGood = (int *)calloc((size_t)setup->detNY, sizeof(int));
- if (setup->rowGood == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (rowGood)!");
- return amdmsFAILURE;
- }
- }
- if (setup->rowWeight == NULL) {
- setup->rowWeight = (amdmsPIXEL *)calloc((size_t)setup->detNY, sizeof(amdmsPIXEL));
- if (setup->rowWeight == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (rowWeight)!");
- return amdmsFAILURE;
- }
- }
- if (setup->rowSum == NULL) {
- setup->rowSum = (amdmsPIXEL *)calloc((size_t)setup->detNY, sizeof(amdmsPIXEL));
- if (setup->rowSum == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (rowSum)!");
- return amdmsFAILURE;
- }
- }
- for (iY = 0; iY < setup->detNY; iY++) {
- setup->rowOffsets[iY] = 0.0;
- setup->rowGood[iY] = 0;
- }
- for (iY = 0; iY < calData->ny ; iY++) {
- for (iX = setup->saWinX; iX < (setup->saWinX + setup->saWinWidth); iX++) {
- iPixel = calData->nx*iY + iX;
- if (setup->bpmData.data[iPixel] == amdmsGOOD_PIXEL) {
- setup->rowOffsets[iY] += calData->data[iPixel];
- setup->rowGood[iY]++;
- }
- }
- if (setup->rowGood[iY] == 0) {
- setup->rowOffsets[iY] = 0.0;
- } else {
- setup->rowOffsets[iY] /= (amdmsPIXEL)setup->rowGood[iY];
- /*if (calData->index == 0) {*/
- amdmsDebug(__FILE__, __LINE__, "RO %f %d = %.2f", calData->index, iY, setup->rowOffsets[iY]);
- /*}*/
- }
- }
- if (setup->saGaussHeight != 0) {
- /* use several rows for 1/f noise compensation */
- for (iY = 0; iY < setup->detNY; iY++) {
- setup->rowWeight[iY] = 0.0;
- setup->rowSum[iY] = 0.0;
- }
- for (iW = -setup->saGaussHeight;iW < setup->saGaussHeight + 1; iW++) {
- w = exp(-iW*iW/2/setup->saGaussSigma/setup->saGaussSigma);
- for (iY = MAX(0, -iW); iY < MIN(calData->ny, calData->ny - iW); iY++) {
- setup->rowSum[iY] += w*setup->rowOffsets[iY + iW]*setup->rowGood[iY + iW];
- setup->rowWeight[iY] += w*setup->rowGood[iY + iW];
- }
- }
- for (iY = 0; iY < calData->ny; iY++) {
- if (setup->rowWeight[iY] != 0.0) {
- setup->rowOffsets[iY] = setup->rowSum[iY]/setup->rowWeight[iY];
- }
- }
- }
- for (iY = 0; iY < calData->ny ; iY++) {
- for (iX = 0; iX < calData->nx; iX++) {
- iPixel = calData->nx*iY + iX;
- calData->data[iPixel] -= setup->rowOffsets[iY];
- }
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCompensateNonlinearity(amdmsCALIBRATION_SETUP *setup, amdmsDATA *calData)
-{
- int nPixels;
- int iPixel;
-
- if ((setup == NULL) || (calData == NULL)) {
- return amdmsFAILURE;
- }
- if ((setup->corrFlag & amdmsNONLINEARITY_CORRECTION) == 0) {
- return amdmsSUCCESS;
- }
- nPixels = calData->nx*calData->ny;
- for (iPixel = 0; iPixel < nPixels; iPixel++) {
- calData->data[iPixel] = calData->data[iPixel]/(setup->nlmDataA0.data[iPixel] - setup->nlmDataA1.data[iPixel]*calData->data[iPixel]);
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCompensateFlatfield(amdmsCALIBRATION_SETUP *setup, amdmsDATA *calData)
-{
- int nPixels;
- int iPixel;
-
- if ((setup == NULL) || (calData == NULL)) {
- return amdmsFAILURE;
- }
- if ((setup->corrFlag & amdmsFLATFIELD_CORRECTION) == 0) {
- return amdmsSUCCESS;
- }
- nPixels = calData->nx*calData->ny;
- for (iPixel = 0; iPixel < nPixels; iPixel++) {
- calData->data[iPixel] /= setup->ffmData.data[iPixel];
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCompensateBadPixel(amdmsCALIBRATION_SETUP *setup, amdmsDATA *calData)
-{
- int nPixels;
- int iPixel;
- int hPixel;
- int iX, iY;
- int hX, hY;
- float w;
-
- if ((setup == NULL) || (calData == NULL)) {
- return amdmsFAILURE;
- }
- if ((setup->corrFlag & amdmsBAD_PIXEL_CORRECTION) == 0) {
- return amdmsSUCCESS;
- }
- nPixels = calData->nx*calData->ny;
- for (iY = 0; iY < calData->ny ; iY++) {
- for (iX = 0; iX < calData->nx; iX++) {
- iPixel = calData->nx*iY + iX;
- if (setup->bpmData.data[iPixel] == amdmsGOOD_PIXEL) continue;
- w = 0.0;
- calData->data[iPixel] = 0.0;
- for (hX = -setup->bpiRadius + 1; hX < setup->bpiRadius; hX++){
- if (iX + hX < 0) continue;
- if (iX + hX >= calData->nx) continue;
- for (hY = -setup->bpiRadius + 1; hY < setup->bpiRadius; hY++) {
- if (iY + hY < 0) continue;
- if (iY + hY >= calData->ny) continue;
- hPixel = iPixel + calData->nx*hY + hX;
- if (setup->bpmData.data[hPixel] == amdmsBAD_PIXEL) continue; /* ignore bad pixels */
- calData->data[iPixel] += calData->data[hPixel]*setup->bpiWeights[setup->bpiRadius*ABS(hY) + ABS(hX)];
- w += setup->bpiWeights[setup->bpiRadius*ABS(hY) + ABS(hX)];
- }
- }
- calData->data[iPixel] /= w;
- }
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCalibrateData(amdmsCALIBRATION_SETUP *setup, amdmsDATA *rawData, amdmsDATA *calData)
-{
- int nPixels;
-
- if ((setup == NULL) || (rawData == NULL) || (calData == NULL)) {
- return amdmsFAILURE;
- }
- nPixels = rawData->nx*rawData->ny;
- if (amdmsAllocateData(calData, rawData->nx, rawData->ny) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- /* copy raw data into calibrated data */
- amdmsCopyData(calData, rawData);
- if (setup->corrFlag == amdmsNO_CORRECTION) {
- /* no calibration requested */
- return amdmsSUCCESS;
- }
- if (amdmsCompensatePixelBias(setup, calData) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsCompensateEBias(setup, calData) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsCompensateGlobalBias(setup, calData) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsCompensateFNoise(setup, calData) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsCompensateNonlinearity(setup, calData) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsCompensateFlatfield(setup, calData) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsCompensateBadPixel(setup, calData) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- return amdmsSUCCESS;
-}
-
-amdmsBOOL amdmsIsPixelValid(amdmsCALIBRATION_SETUP *setup, int iImage, int iPixel)
-{
- if (setup->bpmData.data[iPixel] == amdmsBAD_PIXEL) {
- return amdmsFALSE;
- }
- if (iImage < (int)(setup->pemDataFI.data[iPixel])) {
- return amdmsTRUE;
- }
- if (iImage >= (int)(setup->pemDataLI.data[iPixel])) {
- return amdmsTRUE;
- }
- return amdmsFALSE;
-}
-
-amdmsBOOL amdmsIsPixelAffectedByPE(amdmsCALIBRATION_SETUP *setup, int iImage, int iPixel)
-{
- if (iImage >= (int)(setup->pemDataLI.data[iPixel])) {
- return amdmsFALSE;
- }
- if (iImage < (int)(setup->pemDataFI.data[iPixel])) {
- return amdmsFALSE;
- }
- return amdmsTRUE;
-}
-
-amdmsCOMPL amdmsCalcStat(amdmsCALIBRATION_SETUP *setup,
- amdmsDATA *data,
- int iImage, int x, int y, int width, int height,
- amdmsPIXEL *mean, amdmsPIXEL *var)
-{
- double m = 0.0; /* sum or average value */
- double v = 0.0; /* variance */
- int n = 0; /* number of values */
- int nx = data->nx; /* width of the data array */
- amdmsPIXEL imgNr = (amdmsPIXEL)iImage; /* the image number as a pixel value */
- int iX;
- int iY;
- amdmsPIXEL *datPtr = NULL; /* pointer into the data array */
- amdmsPIXEL *bpmPtr = NULL; /* pointer into the bad pixel map */
- amdmsPIXEL *fiPtr = NULL; /* pointer to the first image number array of the particle event map */
- amdmsPIXEL *liPtr = NULL; /* pointer to the last image number array of the particle event map */
- /* first calculate the mean value */
- for (iY = 0; iY < height; iY++) {
- int offset = nx*(y + iY) + x;
- datPtr = data->data + offset;
- bpmPtr = setup->bpmData.data + offset;
- fiPtr = setup->pemDataFI.data + offset;
- liPtr = setup->pemDataLI.data + offset;
- for (iX = 0; iX < width; iX++) {
- if ((*bpmPtr == amdmsGOOD_PIXEL) &&
- ((*liPtr <= imgNr) || (*fiPtr > imgNr))) {
- m += *datPtr;
- n++;
- }
- datPtr++;
- bpmPtr++;
- fiPtr++;
- liPtr++;
- }
- }
- if (n == 0) {
- m = 0.0;
- } else {
- m = m/(double)n;
- }
- if (mean != NULL) {
- *mean = (amdmsPIXEL)m;
- }
- if (var == NULL) {
- /* variance is not requested */
- return amdmsSUCCESS;
- }
- /* and now calculate the variance */
- if (n == 0) {
- *var = 1.0;
- return amdmsSUCCESS;
- }
- for (iY = 0; iY < height; iY++) {
- int offset = nx*(y + iY) + x;
- datPtr = data->data + offset;
- bpmPtr = setup->bpmData.data + offset;
- fiPtr = setup->pemDataFI.data + offset;
- liPtr = setup->pemDataLI.data + offset;
- for (iX = 0; iX < width; iX++) {
- if ((*bpmPtr == amdmsGOOD_PIXEL) &&
- ((*liPtr <= imgNr) || (*fiPtr > imgNr))) {
- v += (*datPtr - m)*(*datPtr - m);
- n++;
- }
- datPtr++;
- bpmPtr++;
- fiPtr++;
- liPtr++;
- }
- }
- v = v/(double)(n - 1);
- *var = (amdmsPIXEL)v;
- return amdmsSUCCESS;
-}
-
-/*
-amdmsCOMPL amdmsCalcStat(amdmsCALIBRATION_SETUP *setup, amdmsDATA *data, int iImage, int x, int y, int width, int height, amdmsPIXEL *mean, amdmsPIXEL *var)
-{
- int iX;
- int iY;
- int iPixel;
- int goodPixels;
- double m;
- double v;
- amdmsPIXEL *bpm = NULL;
- amdmsPIXEL *pemFI = NULL;
- amdmsPIXEL *pemLI = NULL;
-
- amdmsDebug(__FILE__, __LINE__, "amdmsCalcStat(.., .., %d, %d, %d, %d, %d, .., ..)",
- iImage, x, y, width, height);
- if ((setup == NULL) || (data == NULL)) {
- return amdmsFAILURE;
- }
- m = 0.0;
- goodPixels = 0;
- bpm = setup->bpmData.data;
- pemFI = setup->pemDataFI.data;
- pemLI = setup->pemDataLI.data;
- for (iY = y; iY < (y + height); iY++) {
- iPixel = data->nx*iY + x;
- for (iX = 0; iX < width; iX++) {
- if (bpm[iPixel] != amdmsGOOD_PIXEL) continue;
- if ((iImage >= (int)(pemFI[iPixel])) && (iImage < (int)(pemLI[iPixel]))) continue;
- m += data->data[iPixel];
- goodPixels++;
- iPixel++;
- }
- }
- if (goodPixels == 0) {
- m = 0.0;
- } else {
- m = m/goodPixels;
- }
- if (mean != NULL) {
- *mean = (amdmsPIXEL)m;
- }
- if (var == NULL) {
- return amdmsSUCCESS;
- }
- if (goodPixels == 0) {
- *var = 1.0;
- }
- v = 0.0;
- for (iY = y; iY < (y + height); iY++) {
- iPixel = data->nx*iY + x;
- for (iX = x; iX < (x + width); iX++) {
- if (bpm[iPixel] != amdmsGOOD_PIXEL) continue;
- if ((iImage >= (int)(pemFI[iPixel])) && (iImage < (int)(pemLI[iPixel]))) continue;
- v += (data->data[iPixel] - m)*(data->data[iPixel] - m);
- iPixel++;
- }
- }
- v = v/(goodPixels - 1);
- *var = (amdmsPIXEL)v;
- return amdmsSUCCESS;
-}
-*/
-
-amdmsCOMPL amdmsCalcStatBox(amdmsCALIBRATION_SETUP *setup, amdmsDATA *data, int iImage,
- int xLimit, int yLimit, int widthLimit, int heightLimit,
- int xCenter, int yCenter, int innerSize, int outerSize,
- amdmsPIXEL *mean, amdmsPIXEL *var)
-{
- int iX;
- int iY;
- int iPixel;
- int goodPixels;
- int oLeft, oRight, oBottom, oTop;
- int iLeft, iRight, iBottom, iTop;
- double m;
- double v;
- amdmsPIXEL *bpm = NULL;
- amdmsPIXEL *pemFI = NULL;
- amdmsPIXEL *pemLI = NULL;
-
- /*
- amdmsDebug(__FILE__, __LINE__, "amdmsCalcStatBox(.., .., %d, %d, %d, %d, %d,, %d, %d, %d, %d .., ..)",
- iImage, xLimit, yLimit, widthLimit, heightLimit, xCenter, yCenter, innerSize, outerSize);
- */
- if ((setup == NULL) || (data == NULL)) {
- return amdmsFAILURE;
- }
- oLeft = MAX(xLimit, xCenter - outerSize);
- oRight = MIN(xLimit + widthLimit - 1, xCenter + outerSize);
- oBottom = MAX(yLimit, yCenter - outerSize);
- oTop = MIN(yLimit + heightLimit - 1, yCenter + outerSize);
-
- iLeft = MAX(xLimit, xCenter - innerSize);
- iRight = MIN(xLimit + widthLimit - 1, xCenter + innerSize);
- iBottom = MAX(yLimit, yCenter - innerSize);
- iTop = MIN(yLimit + heightLimit - 1, yCenter + innerSize);
-
- m = 0.0;
- goodPixels = 0;
- bpm = setup->bpmData.data;
- pemFI = setup->pemDataFI.data;
- pemLI = setup->pemDataLI.data;
- for (iX = oLeft; iX <= oRight; iX++) {
- for (iY = oBottom; iY <= oTop; iY++) {
- if ((iX >= iLeft) && (iX <= iRight) && (iY >= iBottom) && (iY <= iTop)) continue;
- iPixel = data->nx*iY + iX;
- if (!amdmsIsPixelValid(setup, iImage, iPixel)) continue;
- m += data->data[iPixel];
- goodPixels++;
- }
- }
- m = m/goodPixels;
- if (mean != NULL) {
- *mean = (amdmsPIXEL)m;
- }
- if (var == NULL) {
- /* variance is not requested */
- return amdmsSUCCESS;
- }
- v = 0.0;
- for (iX = oLeft; iX <= oRight; iX++) {
- for (iY = oBottom; iY <= oTop; iY++) {
- if ((iX >= iLeft) && (iX <= iRight) && (iY >= iBottom) && (iY <= iTop)) continue;
- iPixel = data->nx*iY + iX;
- if (!amdmsIsPixelValid(setup, iImage, iPixel)) continue;
- v += (data->data[iPixel] - m)*(data->data[iPixel] - m);
- }
- }
- v = v/(goodPixels - 1);
- *var = (amdmsPIXEL)v;
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsSmoothData(amdmsCALIBRATION_SETUP *calib, amdmsDATA *src, amdmsDATA *dst)
-{
- int nPixels;
- int iPixel;
- int hPixel;
- int iX, iY;
- int hX, hY;
- float w;
-
- /* copy raw data into calibrated dataCheck arguments */
- if ((calib == NULL) || (src == NULL) || (dst == NULL)) {
- return amdmsFAILURE;
- }
- if ((calib->corrFlag & amdmsBAD_PIXEL_CORRECTION) == 0) {
- return amdmsSUCCESS;
- }
- nPixels = src->nx*src->ny;
- for (iY = 0; iY < src->ny ; iY++) {
- for (iX = 0; iX < src->nx; iX++) {
- iPixel = src->nx*iY + iX;
- if (calib->bpmData.data[iPixel] == amdmsGOOD_PIXEL) continue;
- w = 0.0;
- dst->data[iPixel] = 0.0;
- for (hX = -calib->bpiRadius + 1; hX < calib->bpiRadius; hX++){
- if (iX + hX < 0) continue;
- if (iX + hX >= src->nx) continue;
- for (hY = -calib->bpiRadius + 1; hY < calib->bpiRadius; hY++) {
- if (iY + hY < 0) continue;
- if (iY + hY >= src->ny) continue;
- hPixel = iPixel + src->nx*hY + hX;
- if (calib->bpmData.data[hPixel] == amdmsBAD_PIXEL) continue; /* ignore bad pixels */
- dst->data[iPixel] += src->data[hPixel]*calib->bpiWeights[calib->bpiRadius*ABS(hY) + ABS(hX)];
- w += calib->bpiWeights[calib->bpiRadius*ABS(hY) + ABS(hX)];
- }
- }
- dst->data[iPixel] /= w;
- }
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCleanUpFlatfield(amdmsCALIBRATION_SETUP *calib, amdmsSTRIPE_SETUP *stripes, amdmsDATA *mean, amdmsDATA *var)
-{
- int x, width;
- int iX, iY;
- int iVS;
- int idx;
- amdmsPIXEL *cuData = NULL;
- amdmsPIXEL m0, a;
- amdmsPIXEL m1;
- amdmsPIXEL m2;
- amdmsPIXEL f;
-
- cuData = (amdmsPIXEL*)calloc((size_t)(calib->detNX), sizeof(amdmsPIXEL));
- if (cuData == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (cuData)!");
- return amdmsFAILURE;
- }
- /* compensate for vertical ramp */
- for (iX = 0; iX < mean->nx; iX++) {
- amdmsCalcStat(calib, mean, 0, iX, amdmsCU_ROW - amdmsCU_NROWS, 1, 2*amdmsCU_NROWS, &m1, NULL);
- amdmsCalcStat(calib, mean, 0, iX, mean->ny - amdmsCU_ROW - amdmsCU_NROWS, 1, 2*amdmsCU_NROWS, &m2, NULL);
- if ((m1 == 0.0) && (m2 == 0.0)) {
- cuData[iX] = 0.0;
- continue;
- }
- m0 = 0.5*(m1 + m2);
- cuData[iX] = m0;
- a = (m2 - m1)/(float)(mean->ny - 2*amdmsCU_ROW);
- for (iY = 0; iY < mean->ny; iY++) {
- idx = mean->nx*iY + iX;
- f = m0/(m1 + a*(float)(iY - amdmsCU_ROW));
- mean->data[idx] *= f;
- if (var == NULL) continue;
- var->data[idx] *= f*f;
- }
- }
- /* compensate for horizontal profile */
- if (stripes == NULL) {
- x = 0;
- width = mean->nx;
- m0 = 0.0;
- for (iX = x; iX < x + width; iX++) {
- m0 += cuData[iX];
- }
- m0 /= (float)width;
- for (iX = x; iX < x + width; iX++) {
- f = m0/cuData[iX];
- for (iY = 0; iY < mean->ny; iY++) {
- idx = mean->nx*iY + iX;
- mean->data[idx] *= f;
- if (var == NULL) continue;
- var->data[idx] *= f*f;
- }
- }
- } else {
- for (iVS = 0; iVS < stripes->nVStripes; iVS++) {
- x = stripes->vStripes[iVS].pos;
- width = stripes->vStripes[iVS].size;
- if (stripes->vStripes[iVS].flags == amdmsUSE_NOTHING) {
- continue;
- }
- m0 = 0.0;
- for (iX = x; iX < x + width; iX++) {
- m0 += cuData[iX];
- }
- m0 /= (float)width;
- for (iX = x; iX < x + width; iX++) {
- f = m0/cuData[iX];
- for (iY = 0; iY < mean->ny; iY++) {
- idx = mean->nx*iY + iX;
- mean->data[idx] *= f;
- if (var == NULL) continue;
- var->data[idx] *= f*f;
- }
- }
- }
- }
- free(cuData);
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCleanUpFlatfieldSmooth(amdmsCALIBRATION_SETUP *calib, amdmsSTRIPE_SETUP *stripes, amdmsDATA *mean, amdmsDATA *var)
-{
- int x, width;
- int iX, iY;
- int iVS;
- int idx;
- double *lowerProfile = NULL;
- double *upperProfile = NULL;
- double *smoothProfile = NULL;
- amdmsPIXEL m0, a;
- amdmsPIXEL m1;
- amdmsPIXEL m2;
- amdmsPIXEL f;
-
- lowerProfile = (double*)calloc((size_t)(mean->nx), sizeof(double));
- if (lowerProfile == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (lowerProfile)!");
- return amdmsFAILURE;
- }
- upperProfile = (double*)calloc((size_t)(mean->nx), sizeof(double));
- if (upperProfile == NULL) {
- free(lowerProfile);
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (upperProfile)!");
- return amdmsFAILURE;
- }
- smoothProfile = (double*)calloc((size_t)(mean->nx), sizeof(double));
- if (smoothProfile == NULL) {
- free(lowerProfile);
- free(upperProfile);
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (smoothProfile)!");
- return amdmsFAILURE;
- }
- /* calculate a profile on the lower and upper side of the detector */
- for (iX = 0; iX < mean->nx; iX++) {
- amdmsCalcStat(calib, mean, 0, iX, amdmsCU_ROW - amdmsCU_NROWS, 1, 2*amdmsCU_NROWS, &m1, NULL);
- lowerProfile[iX] = m1;
- amdmsCalcStat(calib, mean, 0, iX, mean->ny - amdmsCU_ROW - amdmsCU_NROWS, 1, 2*amdmsCU_NROWS, &m2, NULL);
- upperProfile[iX] = m2;
- }
- if (amdmsSmoothDataByFiniteDiff1(lowerProfile, smoothProfile, 20.0, mean->nx) == amdmsSUCCESS) {
- memcpy(lowerProfile, smoothProfile, mean->nx*sizeof(double));
- }
- if (amdmsSmoothDataByFiniteDiff1(upperProfile, smoothProfile, 20.0, mean->nx) == amdmsSUCCESS) {
- memcpy(upperProfile, smoothProfile, mean->nx*sizeof(double));
- }
- /* calculate the center profile */
- for (iX = 0; iX < mean->nx; iX++) {
- smoothProfile[iX] = 0.5*(lowerProfile[iX] + upperProfile[iX]);
- }
- /* compensate for vertical ramp */
- for (iX = 0; iX < mean->nx; iX++) {
- m1 = lowerProfile[iX];
- m2 = upperProfile[iX];
- m0 = smoothProfile[iX];
- /* amdmsDebug(__FILE__, __LINE__, " vertical ramp at %d => %.1f - %.1f - %.1f", iX, m2, m0, m1); */
- if ((m1 == 0.0) && (m2 == 0.0)) {
- continue;
- }
- a = (m2 - m1)/(float)(mean->ny - 2*amdmsCU_ROW);
- for (iY = 0; iY < mean->ny; iY++) {
- idx = mean->nx*iY + iX;
- f = m0/(m1 + a*(float)(iY - amdmsCU_ROW));
- mean->data[idx] *= f;
- if (var == NULL) continue;
- var->data[idx] *= f*f;
- }
- }
- /* compensate for horizontal profile */
- if (stripes == NULL) {
- x = 0;
- width = mean->nx;
- m0 = 0.0;
- for (iX = x; iX < x + width; iX++) {
- m0 += smoothProfile[iX];
- }
- m0 /= (float)width;
- for (iX = x; iX < x + width; iX++) {
- f = m0/smoothProfile[iX];
- for (iY = 0; iY < mean->ny; iY++) {
- idx = mean->nx*iY + iX;
- mean->data[idx] *= f;
- if (var == NULL) continue;
- var->data[idx] *= f*f;
- }
- }
- } else {
- for (iVS = 0; iVS < stripes->nVStripes; iVS++) {
- if (stripes->vStripes[iVS].flags == amdmsUSE_NOTHING) {
- continue;
- }
- x = stripes->vStripes[iVS].pos;
- width = stripes->vStripes[iVS].size;
- m0 = 0.0;
- for (iX = x; iX < x + width; iX++) {
- m0 += smoothProfile[iX];
- }
- m0 /= (float)width;
- amdmsDebug(__FILE__, __LINE__, " stripe mean = %f", m0);
- for (iX = x; iX < x + width; iX++) {
- f = m0/smoothProfile[iX];
- for (iY = 0; iY < mean->ny; iY++) {
- idx = mean->nx*iY + iX;
- mean->data[idx] *= f;
- if (var == NULL) continue;
- var->data[idx] *= f*f;
- }
- }
- }
- }
- free(lowerProfile);
- free(upperProfile);
- free(smoothProfile);
- return amdmsSUCCESS;
-}
diff --git a/amber/amdmsCommon.c b/amber/amdmsCommon.c
deleted file mode 100644
index 913d200..0000000
--- a/amber/amdmsCommon.c
+++ /dev/null
@@ -1,274 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include <unistd.h>
-#include <time.h>
-#include <sys/time.h>
-
-#include "amdms.h"
-
-/* The function gettimeofday() has a different prototype under SUN and HP: */
-/* HP : int gettimeofday(struct timeval *, struct timezone *); */
-/* SUN: int gettimeofday(struct timeval); */
-/* but the second one is not use in out code. */
-/* We define the macro vlt_gettimeofday(). */
-/* This is correctly mapped depending on the architerture */
-/* The function is defined (along with is own data structures) in sys/time.h */
-/* that is included here, although not POSIX. */
-/* We have also taken into account that timeval and timezone could have been */
-/* already defined because of the inclusion of <sys/time.h> or of the RTAP */
-/* portability include file crPortable.h */
-
-#ifdef HP_COMP /* don't use HP/IBM/DEC timezone parameter */
-#if !defined(crTIMEVAL_TIMEZONE_DEFINED)
-struct timeval {
- unsigned long tv_sec; /* seconds */
- long tv_usec; /* and microseconds */
-};
-struct timezone {
- int tz_minuteswest; /* minutes west of Greenwich */
- int tz_dsttime; /* type of dst correction */
-};
-#endif
-
-int gettimeofday(struct timeval *tp, struct timezone *tzp);
-#define vlt_gettimeofday(tp) gettimeofday((tp),NULL)
-#else
-#ifdef SUN_COMP /* SUN has no timezone parameter */
-#if !defined(_SYS_TIME_H) || !defined(crTIMEVAL_TIMEZONE_DEFINED)
-struct timeval {
- long tv_sec; /* seconds */
- long tv_usec; /* and microseconds */
-};
-#endif
-int gettimeofday(struct timeval *tp);
-#define vlt_gettimeofday(tp) gettimeofday(tp)
-#endif
-#ifdef LINUX /* SUN has no timezone parameter */
-#if !defined(_SYS_TIME_H)
-struct timeval {
- long tv_sec; /* seconds */
- long tv_usec; /* and microseconds */
-};
-struct timezone {
- int tz_minuteswest; /* minutes west of Greenwich */
- int tz_dsttime; /* type of dst correction */
-};
-#endif
-int gettimeofday(struct timeval *tp, struct timezone *tzp);
-#define vlt_gettimeofday(tp) gettimeofday((tp),NULL)
-#endif
-#endif
-
-/* AMBER specific definitions */
-
-amdmsEVENT amdmsLastEvent = {"", amdmsDEBUG, NULL, -1, ""};
-int amdmsOnlyMessage = 0;
-static int supressFlag = 0;
-static amdmsSEVERITY severityLevel = amdmsERROR;
-
-static void amdmsGetTimeStamp(char *timeStamp);
-
-void amdmsSupressLogMessages(int flag)
-{
- supressFlag = flag;
-}
-
-void amdmsShowOnlyMessage(int flag)
-{
- amdmsOnlyMessage = flag;
-}
-
-void amdmsSetSeverityLevel(amdmsSEVERITY level)
-{
- severityLevel = level;
-}
-
-void amdmsGetTimeStamp(char *timeStamp)
-{
- struct timeval tv;
- struct tm *brokenTime;
- char strTime[32];
-
- timeStamp[0] = '\0';
- gettimeofday(&tv, NULL);
- brokenTime = localtime((const time_t *)&tv.tv_sec);
- strftime(strTime, 24, "%Y-%m-%d %H:%M:%S", brokenTime);
- sprintf(timeStamp, "%s.%6.6ld", strTime, tv.tv_usec);
-}
-
-void amdmsFatal(char *file, int line, char *format, ...)
-{
- va_list va_parList;
-
- if (severityLevel > amdmsFATAL) {
- return;
- }
- amdmsGetTimeStamp(amdmsLastEvent.timeStamp);
- amdmsLastEvent.severity = amdmsFATAL;
- amdmsLastEvent.locFile = file;
- amdmsLastEvent.locLine = line;
- va_start(va_parList, format);
- vsprintf(amdmsLastEvent.text, format, va_parList);
- va_end(va_parList);
- if (supressFlag) {
- return;
- }
- if (amdmsOnlyMessage) {
- fprintf(stdout, "FATAL: %s\n",
- amdmsLastEvent.text);
- } else {
- fprintf(stdout, "FATAL: %s %s:%d %s\n",
- amdmsLastEvent.timeStamp,
- amdmsLastEvent.locFile,
- amdmsLastEvent.locLine,
- amdmsLastEvent.text);
- }
-}
-
-void amdmsError(char *file, int line, char *format, ...)
-{
- va_list va_parList;
-
- if (severityLevel > amdmsERROR) {
- return;
- }
- amdmsGetTimeStamp(amdmsLastEvent.timeStamp);
- amdmsLastEvent.severity = amdmsERROR;
- amdmsLastEvent.locFile = file;
- amdmsLastEvent.locLine = line;
- va_start(va_parList, format);
- vsprintf(amdmsLastEvent.text, format, va_parList);
- va_end(va_parList);
- if (supressFlag) {
- return;
- }
- if (amdmsOnlyMessage) {
- fprintf(stdout, "ERROR: %s\n",
- amdmsLastEvent.text);
- } else {
- fprintf(stdout, "ERROR: %s %s:%d %s\n",
- amdmsLastEvent.timeStamp,
- amdmsLastEvent.locFile,
- amdmsLastEvent.locLine,
- amdmsLastEvent.text);
- }
-}
-
-void amdmsWarning(char *file, int line, char *format, ...)
-{
- va_list va_parList;
-
- if (severityLevel > amdmsWARNING) {
- return;
- }
- amdmsGetTimeStamp(amdmsLastEvent.timeStamp);
- amdmsLastEvent.severity = amdmsWARNING;
- amdmsLastEvent.locFile = file;
- amdmsLastEvent.locLine = line;
- va_start(va_parList, format);
- vsprintf(amdmsLastEvent.text, format, va_parList);
- va_end(va_parList);
- if (supressFlag) {
- return;
- }
- if (amdmsOnlyMessage) {
- fprintf(stdout, "WARNING: %s\n",
- amdmsLastEvent.text);
- } else {
- fprintf(stdout, "WARNING: %s %s:%d %s\n",
- amdmsLastEvent.timeStamp,
- amdmsLastEvent.locFile,
- amdmsLastEvent.locLine,
- amdmsLastEvent.text);
- }
-}
-
-void amdmsNotice(char *file, int line, char *format, ...)
-{
- va_list va_parList;
-
- if (severityLevel > amdmsNOTICE) {
- return;
- }
- amdmsGetTimeStamp(amdmsLastEvent.timeStamp);
- amdmsLastEvent.severity = amdmsNOTICE;
- amdmsLastEvent.locFile = file;
- amdmsLastEvent.locLine = line;
- va_start(va_parList, format);
- vsprintf(amdmsLastEvent.text, format, va_parList);
- va_end(va_parList);
- if (supressFlag) {
- return;
- }
- if (amdmsOnlyMessage) {
- fprintf(stdout, "NOTICE: %s\n",
- amdmsLastEvent.text);
- } else {
- fprintf(stdout, "NOTICE: %s %s:%d %s\n",
- amdmsLastEvent.timeStamp,
- amdmsLastEvent.locFile,
- amdmsLastEvent.locLine,
- amdmsLastEvent.text);
- }
-}
-
-void amdmsInfo(char *file, int line, char *format, ...)
-{
- va_list va_parList;
-
- if (severityLevel > amdmsINFO) {
- return;
- }
- amdmsGetTimeStamp(amdmsLastEvent.timeStamp);
- amdmsLastEvent.severity = amdmsINFO;
- amdmsLastEvent.locFile = file;
- amdmsLastEvent.locLine = line;
- va_start(va_parList, format);
- vsprintf(amdmsLastEvent.text, format, va_parList);
- va_end(va_parList);
- if (supressFlag) {
- return;
- }
- if (amdmsOnlyMessage) {
- fprintf(stdout, "INFO: %s\n",
- amdmsLastEvent.text);
- } else {
- fprintf(stdout, "INFO: %s %s:%d %s\n",
- amdmsLastEvent.timeStamp,
- amdmsLastEvent.locFile,
- amdmsLastEvent.locLine,
- amdmsLastEvent.text);
- }
-}
-
-void amdmsDebug(char *file, int line, char *format, ...)
-{
- va_list va_parList;
-
- if (severityLevel > amdmsDEBUG) {
- return;
- }
- amdmsGetTimeStamp(amdmsLastEvent.timeStamp);
- amdmsLastEvent.severity = amdmsDEBUG;
- amdmsLastEvent.locFile = file;
- amdmsLastEvent.locLine = line;
- va_start(va_parList, format);
- vsprintf(amdmsLastEvent.text, format, va_parList);
- va_end(va_parList);
- if (supressFlag) {
- return;
- }
- if (amdmsOnlyMessage) {
- fprintf(stdout, "DEBUG: %s\n",
- amdmsLastEvent.text);
- } else {
- fprintf(stdout, "DEBUG: %s %s:%d %s\n",
- amdmsLastEvent.timeStamp,
- amdmsLastEvent.locFile,
- amdmsLastEvent.locLine,
- amdmsLastEvent.text);
- }
-}
-
diff --git a/amber/amdmsFit.c b/amber/amdmsFit.c
deleted file mode 100644
index bd0f259..0000000
--- a/amber/amdmsFit.c
+++ /dev/null
@@ -1,2749 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-
-#include "amdmsFit.h"
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846 /* pi */
-#endif /* M_PI */
-
-#define TOL 1.0e-5 /* Default value for single precision and variables scaled to order unity. */
-
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-
-static double sqrarg;
-#define SQR(a) ((sqrarg=(a)) == 0.0 ? 0.0 : sqrarg*sqrarg)
-
-static double maxarg1,maxarg2;
-#define FMAX(a,b) (maxarg1=(a),maxarg2=(b),(maxarg1) > (maxarg2) ? (maxarg1) : (maxarg2))
-
-static int iminarg1,iminarg2;
-#define IMIN(a,b) (iminarg1=(a),iminarg2=(b),(iminarg1) < (iminarg2) ? (iminarg1) : (iminarg2))
-
-#define SIGN(a,b) ((b) >= 0.0 ? fabs(a) : -fabs(a))
-
-static amdmsCOMPL amdmsCalcQuality(amdmsFIT_ENV *env, int n, double *x, double *y, double *ye);
-
-static amdmsCOMPL amdmsFitLine(void *henv, int n, double *x, double *y, double *ye);
-static double amdmsEvalLine(void *henv, double x);
-
-static amdmsCOMPL amdmsFitExp(void *env, int n, double *x, double *y, double *ye);
-static double amdmsEvalExp(void *env, double x);
-
-static amdmsCOMPL amdmsFitLog(void *henv, int n, double *x, double *y, double *ye);
-static double amdmsEvalLog(void *henv, double x);
-
-static double amdmsCalcPythag(double a, double b);
-static amdmsCOMPL amdmsDecompose(amdmsFIT_LINEAR_ENV *env, int m, int n);
-static void amdmsSolveLinear(amdmsFIT_LINEAR_ENV *env, int m, int n);
-static void amdmsCalcCovarianceLinear(amdmsFIT_LINEAR_ENV *env);
-static amdmsCOMPL amdmsFitSVDLinear(amdmsFIT_LINEAR_ENV *env, int n, double *x, double *y, double *ye);
-static amdmsCOMPL amdmsAllocSpaceLinear(amdmsFIT_LINEAR_ENV *env, int nCs, int nDPs);
-static double amdmsEvalLinear(void *henv, double x);
-
-static void amdmsPolynomialBaseFunc(double x, int np, double *p);
-static void amdmsRayBaseFunc(double x, int np, double *p);
-
-static void amdmsExpandCovariance(double **covar, int ma, int ia[], int mfit);
-static void amdmsGaussJordan(amdmsFIT_NONLINEAR_ENV *env,
- double **a, int n, double **b, int m);
-static void amdmsEvaluate(amdmsFIT_NONLINEAR_ENV *env,
- int ndata, double x[], double y[], double sig[],
- double a[], double **alpha, double beta[]);
-static void amdmsLevenbergMarquardt(amdmsFIT_NONLINEAR_ENV *env,
- int ndata, double *x, double *y, double *ye);
-static amdmsCOMPL amdmsAllocSpaceNonLinear(amdmsFIT_NONLINEAR_ENV *env, int nCs);
-static amdmsCOMPL amdmsFitNonLinear(void *henv, int n, double *x, double *y, double *ye);
-static double amdmsEvalNonLinear(void *henv, double x);
-
-static void amdmsNonLinearPixelInit(void *henv, int n, double *x, double *y, double *ye);
-static void amdmsNonLinearPixelBaseFunc(double x, int na, double *a, double *y, double *dyda);
-
-static void amdmsElectronicBiasInit(void *henv, int n, double *x, double *y, double *ye);
-static void amdmsElectronicBiasBaseFunc(double x, int na, double *a, double *y, double *dyda);
-
-static void amdmsConversionFactorInit(void *henv, int n, double *x, double *y, double *ye);
-static void amdmsConversionFactorBaseFunc(double x, int na, double *a, double *y, double *dyda);
-
-static amdmsCOMPL amdmsFindDataSaturation(amdmsFIT_DATA_ENV *env);
-static double amdmsTryDataFit(amdmsFIT_DATA_ENV *env);
-static amdmsCOMPL amdmsAllocSpaceData(amdmsFIT_DATA_ENV *env, int nDPs);
-static double amdmsEvalData(void *henv, double x);
-
-static amdmsCOMPL amdmsFindSmoothDataOutliers(amdmsFIT_SMOOTH_DATA_ENV *env);
-static amdmsCOMPL amdmsFindSmoothDataSaturation(amdmsFIT_SMOOTH_DATA_ENV *env);
-static amdmsCOMPL amdmsAllocSpaceSmoothData(amdmsFIT_SMOOTH_DATA_ENV *env, int nDPs);
-static amdmsCOMPL amdmsFitSmoothData(void *henv, int n, double *x, double *y, double *ye);
-static double amdmsEvalSmoothData(void *henv, double x);
-
-amdmsCOMPL amdmsCalcQuality(amdmsFIT_ENV *env, int n, double *x, double *y, double *ye)
-{
- int i;
- double minY = 0.0;
- double maxY = 0.0;
- double val = 0.0;
- double tmp = 0.0;
-
- if ((env == NULL) || (env->eval == NULL) || (x == NULL) || (y == NULL)) {
- return amdmsFAILURE;
- }
- env->chi2 = 0.0;
- env->absDist2 = 0.0;
- env->relDist2 = 0.0;
- for (i = 0; i < n; i++) {
- val = env->eval(env, x[i]);
- tmp = y[i] - val;
- if (i == 0) {
- minY = val;
- maxY = val;
- } else {
- minY = MIN(minY, val);
- maxY = MAX(maxY, val);
- }
- env->absDist2 += tmp*tmp;
- if (ye != NULL) {
- tmp /= ye[i];
- }
- env->chi2 += tmp*tmp;
- }
- env->chi2 /= (double)n;
- env->absDist2 /= (double)n;
- if ((maxY - minY) > 0.001) {
- env->relDist2 = env->absDist2/(maxY - minY)/(maxY - minY);
- } else {
- env->relDist2 = env->absDist2;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsFitLine(void *henv, int n, double *x, double *y, double *ye)
-{
- amdmsFIT_ENV *env = (amdmsFIT_ENV*)henv;
- int i;
- double sx = 0.0;
- double sxx = 0.0;
- double sy = 0.0;
- double syy = 0.0;
- double sxy = 0.0;
- double ssxx = 0.0;
- double ssyy = 0.0;
- double ssxy = 0.0;
- double xq = 0.0;
- double yq = 0.0;
- double s = 0.0;
-
- if (env == NULL) {
- return amdmsFAILURE;
- }
- for (i = 0; i < n; i++) {
- /* amdmsInfo(__FILE__, __LINE__, " x=%.4e, y=%.4e", x[i], y[i]); */
- sx += x[i];
- sxx += x[i]*x[i];
- sy += y[i];
- syy += y[i]*y[i];
- sxy += x[i]*y[i];
- }
- xq = sx/(double)n;
- yq = sy/(double)n;
- ssxx = sxx - (double)n*xq*xq;
- ssyy = syy - (double)n*yq*yq;
- ssxy = sxy - (double)n*xq*yq;
- if (ssxx == 0.0) {
- amdmsWarning(__FILE__, __LINE__, "ssxx == 0.0");
- return amdmsFAILURE;
- }
- env->a[1] = ssxy/ssxx;
- env->a[0] = yq - env->a[1]*xq;
- s = sqrt((ssyy - ssxy*ssxy/ssxx)/(double)(n - 2));
- env->ae[0] = s*sqrt(1/(double)n + xq*xq/ssxx);
- env->ae[1] = s/sqrt(ssxx);
- /* amdmsInfo(__FILE__, __LINE__, "y=%.4e + %.4e*x", env->a[0], env->a[1]); */
- return amdmsSUCCESS;
-}
-
-double amdmsEvalLine(void *henv, double x)
-{
- amdmsFIT_ENV *env = (amdmsFIT_ENV*)henv;
-
- if (env == NULL) {
- return 0.0;
- } else {
- return (env->a[0] + env->a[1]*x);
- }
-}
-
-amdmsCOMPL amdmsFitExp(void *henv, int n, double *x, double *y, double *ye)
-{
- amdmsFIT_ENV *env = (amdmsFIT_ENV*)henv;
- int i;
- double sy = 0.0;
- double sxy = 0.0;
- double syy = 0.0;
- double sxxy = 0.0;
- double sxyy = 0.0;
-
- if (env == NULL) {
- return amdmsFAILURE;
- }
- for (i = 0; i < n; i++) {
- sy += y[i];
- sxy += x[i]*y[i];
- syy += y[i]*log(y[i]);
- sxxy += x[i]*x[i]*y[i];
- sxyy += x[i]*y[i]*log(y[i]);
- }
- env->a[0] = (sxxy*syy - sxy*sxyy)/(sy*sxxy - sxy*sxy);
- env->a[1] = (sy*sxyy - sxy*syy)/(sy*sxxy - sxy*sxy);
- env->a[0] = exp(env->a[0]);
- env->ae[0] = 0.0;
- env->ae[0] = 0.0;
- return amdmsSUCCESS;
-}
-
-double amdmsEvalExp(void *henv, double x)
-{
- amdmsFIT_ENV *env = (amdmsFIT_ENV*)henv;
-
- if (env == NULL) {
- return 0.0;
- } else {
- return (env->a[0]*exp(env->a[1]*x));
- }
-}
-
-amdmsCOMPL amdmsFitLog(void *henv, int n, double *x, double *y, double *ye)
-{
- amdmsFIT_ENV *env = (amdmsFIT_ENV*)henv;
- int i;
- double sx = 0.0;
- double sxx = 0.0;
- double sy = 0.0;
- double syy = 0.0;
- double sxy = 0.0;
- double ssxx = 0.0;
- double ssyy = 0.0;
- double ssxy = 0.0;
- double xq = 0.0;
- double yq = 0.0;
- double s = 0.0;
-
- if (env == NULL) {
- return amdmsFAILURE;
- }
- for (i = 0; i < n; i++) {
- sx += log(x[i]);
- sxx += log(x[i])*log(x[i]);
- sy += y[i];
- syy += y[i]*y[i];
- sxy += log(x[i])*y[i];
- }
- xq = sx/(double)n;
- yq = sy/(double)n;
- ssxx = sxx - (double)n*xq*xq;
- ssyy = syy - (double)n*yq*yq;
- ssxy = sxy - (double)n*xq*yq;
- env->a[1] = (n*sxy - sx*sy)/(n*sxx - sx*sx);
- env->a[0] = (sy - env->a[1]*sx)/n;
- s = 0.0;
- env->ae[0] = 0.0;
- env->ae[0] = 0.0;
- return amdmsSUCCESS;
-}
-
-double amdmsEvalLog(void *henv, double x)
-{
- amdmsFIT_ENV *env = (amdmsFIT_ENV*)henv;
-
- if (env == NULL) {
- return 0.0;
- } else {
- return (env->a[0] + env->a[1]*log(x));
- }
-}
-
-/*
- Computes (a^2 + b^2)^1/2 without destructive underflow or overflow.
-*/
-double amdmsCalcPythag(double a, double b)
-{
- double absa,absb;
-
- absa=fabs(a);
- absb=fabs(b);
- if (absa > absb) {
- return absa*sqrt(1.0+SQR(absb/absa));
- } else {
- return (absb == 0.0 ? 0.0 : absb*sqrt(1.0+SQR(absa/absb)));
- }
-}
-
-/*
- Given a matrix a[1..m][1..n], this routine computes its singular value decomposition,
- A = U * W * V T . The matrix U replaces a on output. The diagonal matrix of singular
- values W is output as a vector w[1..n]. The matrix V (not the transpose V T )is
- output as v[1..n][1..n].
-*/
-amdmsCOMPL amdmsDecompose(amdmsFIT_LINEAR_ENV *env, int m, int n)
-{
- int flag,i,its,j,jj,k,l,nm;
- double anorm,c,f,g,h,s,scale,x,y,z, rv1[amdmsMAX_COEFF + 1];
-
- g=scale=anorm=0.0; /* Householder reduction to bidiagonal form. */
- l = 0;
- nm = 0;
- for (i=1;i<=n;i++) {
- l=i+1;
- rv1[i]=scale*g;
- g=s=scale=0.0;
- if (i <= m) {
- for (k=i;k<=m;k++) {
- scale += fabs(env->matU[k][i]);
- }
- if (scale) {
- for (k=i;k<=m;k++) {
- env->matU[k][i] /= scale;
- s += env->matU[k][i]*env->matU[k][i];
- }
- f=env->matU[i][i];
- g = -SIGN(sqrt(s),f);
- h=f*g-s;
- env->matU[i][i]=f-g;
- for (j=l;j<=n;j++) {
- for (s=0.0,k=i;k<=m;k++) {
- s += env->matU[k][i]*env->matU[k][j];
- }
- f=s/h;
- for (k=i;k<=m;k++) {
- env->matU[k][j] += f*env->matU[k][i];
- }
- }
- for (k=i;k<=m;k++) {
- env->matU[k][i] *= scale;
- }
- }
- }
- env->vecW[i]=scale *g;
- g=s=scale=0.0;
- if (i <= m && i != n) {
- for (k=l;k<=n;k++) {
- scale += fabs(env->matU[i][k]);
- }
- if (scale) {
- for (k=l;k<=n;k++) {
- env->matU[i][k] /= scale;
- s += env->matU[i][k]*env->matU[i][k];
- }
- f=env->matU[i][l];
- g = -SIGN(sqrt(s),f);
- h=f*g-s; env->matU[i][l]=f-g;
- for (k=l;k<=n;k++) {
- rv1[k]=env->matU[i][k]/h;
- }
- for (j=l;j<=m;j++) {
- for (s=0.0,k=l;k<=n;k++) {
- s += env->matU[j][k]*env->matU[i][k];
- }
- for (k=l;k<=n;k++) {
- env->matU[j][k] += s*rv1[k];
- }
- }
- for (k=l;k<=n;k++) {
- env->matU[i][k] *= scale;
- }
- }
- }
- anorm=FMAX(anorm,(fabs(env->vecW[i])+fabs(rv1[i])));
- }
- for (i=n;i>=1;i--) {
- /* Accumulation of right-hand transformations. */
- if (i < n) {
- if (g) {
- for (j=l;j<=n;j++) {
- /* Double division to avoid possible underflow. */
- env->matV[j][i]=(env->matU[i][j]/env->matU[i][l])/g;
- }
- for (j=l;j<=n;j++) {
- for (s=0.0,k=l;k<=n;k++) {
- s += env->matU[i][k]*env->matV[k][j];
- }
- for (k=l;k<=n;k++) {
- env->matV[k][j] += s*env->matV[k][i];
- }
- }
- }
- for (j=l;j<=n;j++) {
- env->matV[i][j]=env->matV[j][i]=0.0;
- }
- }
- env->matV[i][i]=1.0;
- g=rv1[i];
- l=i;
- }
- for (i=IMIN(m,n);i>=1;i--) {
- /* Accumulation of left-hand transformations. */
- l=i+1;
- g=env->vecW[i];
- for (j=l;j<=n;j++) {
- env->matU[i][j]=0.0;
- }
- if (g) {
- g=1.0/g;
- for (j=l;j<=n;j++) {
- for (s=0.0,k=l;k<=m;k++) {
- s += env->matU[k][i]*env->matU[k][j];
- }
- f=(s/env->matU[i][i])*g;
- for (k=i;k<=m;k++) {
- env->matU[k][j] += f*env->matU[k][i];
- }
- }
- for (j=i;j<=m;j++) {
- env->matU[j][i] *= g;
- }
- } else {
- for (j=i;j<=m;j++) {
- env->matU[j][i]=0.0;
- }
- }
- ++env->matU[i][i];
- }
- for (k=n;k>=1;k--) {
- /* Diagonalization of the bidiagonal form:
- Loop over singular values,and over allowed iterations.*/
- for (its=1;its<=30;its++) {
- flag=1;
- for (l=k;l>=1;l--) {
- /* Test for splitting. */
- nm=l-1; /* Note that rv1[1] is always zero. */
- if ((double)(fabs(rv1[l])+anorm) == anorm) {
- flag=0;
- break;
- }
- if ((double)(fabs(env->vecW[nm])+anorm) == anorm) {
- break;
- }
- }
- if (flag) {
- c=0.0; /* Cancellation of rv1[l],if l > 1 */
- s=1.0;
- for (i=l;i<=k;i++) {
- f=s*rv1[i];
- rv1[i]=c*rv1[i];
- if ((double)(fabs(f)+anorm) == anorm) {
- break;
- }
- g=env->vecW[i];
- h=amdmsCalcPythag(f,g);
- env->vecW[i]=h;
- h=1.0/h;
- c=g*h;
- s = -f*h;
- for (j=1;j<=m;j++) {
- y=env->matU[j][nm];
- z=env->matU[j][i];
- env->matU[j][nm]=y*c+z*s;
- env->matU[j][i]=z*c-y*s;
- }
- }
- }
- z=env->vecW[k];
- if (l == k) {
- /* Convergence. */
- if (z < 0.0) {
- /* Singular value is made nonnegative. */
- env->vecW[k] = -z;
- for (j=1;j<=n;j++) {
- env->matV[j][k] = -env->matV[j][k];
- }
- }
- break;
- }
- if (its == 30) {
- amdmsError(__FILE__, __LINE__, "no convergence in 30 svdcmp iterations");
- return amdmsFAILURE;
- }
- x=env->vecW[l]; /* Shift from bottom 2-by-2 minor. */
- nm=k-1;
- y=env->vecW[nm];
- g=rv1[nm];
- h=rv1[k];
- f=((y-z)*(y+z)+(g-h)*(g+h))/(2.0*h*y);
- g=amdmsCalcPythag(f,1.0);
- f=((x-z)*(x+z)+h*((y/(f+SIGN(g,f)))-h))/x;
- c=s=1.0; /* Next QR transformation: */
- for (j=l;j<=nm;j++) {
- i=j+1;
- g=rv1[i];
- y=env->vecW[i];
- h=s*g;
- g=c*g;
- z=amdmsCalcPythag(f,h);
- rv1[j]=z;
- c=f/z;
- s=h/z;
- f=x*c+g*s;
- g = g*c-x*s;
- h=y*s;
- y *=c;
- for (jj=1;jj<=n;jj++) {
- x=env->matV[jj][j];
- z=env->matV[jj][i];
- env->matV[jj][j]=x*c+z*s;
- env->matV[jj][i]=z*c-x*s;
- }
- z=amdmsCalcPythag(f,h);
- env->vecW[j]=z; /* Rotation can be arbitrary if z =0 */
- if (z) {
- z=1.0/z;
- c=f*z;
- s=h*z;
- }
- f=c*g+s*y;
- x=c*y-s*g;
- for (jj=1;jj<=m;jj++) {
- y=env->matU[jj][j];
- z=env->matU[jj][i];
- env->matU[jj][j]=y*c+z*s;
- env->matU[jj][i]=z*c-y*s;
- }
- }
- rv1[l]=0.0;
- rv1[k]=f;
- env->vecW[k]=x;
- }
- }
- return amdmsSUCCESS;
-}
-
-/*
- Solves A * X = B for a vector X where A is specified by
- the arrays u[1..m][1..n],w[1..n], v[1..n][1..n] as returned by svdcmp.
- m and n are the dimensions of a and will be equal for square matrices.
- b[1..m] is the input right-hand side. x[1..n] is the output solution vector.
- No input quantities are destroyed, so the routine may be called sequentially with
- different b's.
-*/
-void amdmsSolveLinear(amdmsFIT_LINEAR_ENV *env, int m, int n)
-{
- int jj, j, i;
- double s, tmp[amdmsMAX_COEFF + 1];
-
- for (j = 1; j <= n; j++) {
- /* Calculate U T B */
- s=0.0;
- if (env->vecW[j]) {
- /* Nonzero result only if wj is nonzero. */
- for (i = 1; i <= m; i++) {
- s += env->matU[i][j]*env->vecB[i];
- }
- s /= env->vecW[j]; /* This is the divide by wj . */
- }
- tmp[j]=s;
- }
- for (j = 1; j <= n; j++) {
- /* Matrix multiply by V to get answer. */
- s=0.0;
- for (jj = 1; jj <= n; jj++) {
- s += env->matV[j][jj]*tmp[jj];
- }
- env->env.a[j]=s;
- }
-}
-
-/*
- To evaluate the covariance matrix cvm[1..ma][1..ma] of the fit for ma parameters
- obtained by svdfit, call this routine with matrices v[1..ma][1..ma] w[1..ma] as
- returned from svdfit.
-*/
-void amdmsCalcCovarianceLinear(amdmsFIT_LINEAR_ENV *env)
-{
- int k,j,i;
- double sum, wti[amdmsMAX_COEFF + 1];
-
- for (i = 1; i <= env->env.nCoefficients; i++) {
- wti[i]=0.0;
- if (env->vecW[i]) {
- wti[i]=1.0/(env->vecW[i]*env->vecW[i]);
- }
- }
- for (i = 1; i <= env->env.nCoefficients; i++) {
- /* Sum contributions to covariance matrix (15.4.20). */
- for (j = 1; j <= i; j++) {
- for (sum = 0.0, k = 1; k <= env->env.nCoefficients; k++) {
- sum += env->matV[i][k]*env->matV[j][k]*wti[k];
- }
- env->matCvm[j][i] = env->matCvm[i][j] = sum;
- }
- }
-}
-
-/*
- Given a set of data points x[1..ndata], y[1..ndata] with individual standard deviations
- sig[1..ndata], use chi^2 minimization to determine the coeffcients a[1..ma] of the
- fitting function y = SUM(ai * afunci(x)). Here we solve the fitting equations using
- singular value decomposition of the ndata by ma matrix as in 2.6. Arrays u[1..ndata][1..ma],
- v[1..ma][1..ma], and w[1..ma] provide workspace on input; on output they define the
- singular value decomposition, and can be used to obtain the covariance matrix.
- The program returns values for the ma fit parameters a, and chi^2, chisq The user supplies
- a routine funcs(x,afunc,ma) that returns the ma basis functions evaluated at x = x in
- the array afunc[1..ma].
- Reference: Numerical recipes in C: chapter 15.4, page 678
-*/
-amdmsCOMPL amdmsFitSVDLinear(amdmsFIT_LINEAR_ENV *env, int n, double *x, double *y, double *ye)
-{
- int j, i;
- double wmax, tmp, thresh, afunc[amdmsMAX_COEFF + 1];
-
- for (i = 1; i <= n; i++) {
- /* Accumulate coeffcients of the fitting matrix. */
- env->base(x[i], env->env.nCoefficients, afunc);
- tmp = 1.0/ye[i];
- for (j = 1; j <= env->env.nCoefficients; j++) {
- env->matU[i][j]=afunc[j]*tmp;
- }
- env->vecB[i]=y[i]*tmp;
- }
- if (amdmsDecompose(env, n, env->env.nCoefficients) != amdmsSUCCESS) {
- /* Singular value decomposition. */
- return amdmsFAILURE;
- }
- wmax=0.0; /* Edit the singular values,given TOL from the #define statement, between here ... */
- for (j = 1; j <= env->env.nCoefficients; j++) {
- if (env->vecW[j] > wmax) {
- wmax=env->vecW[j];
- }
- }
- thresh=TOL*wmax;
- for (j = 1; j <= env->env.nCoefficients; j++) {
- if (env->vecW[j] < thresh) {
- env->vecW[j]=0.0; /* ...and here. */
- }
- }
- amdmsSolveLinear(env, n, env->env.nCoefficients);
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsAllocSpaceLinear(amdmsFIT_LINEAR_ENV *env, int nCs, int nDPs)
-{
- int i;
- double *m;
- int coeffFlag;
- int dataFlag;
-
- if (env == NULL) {
- return amdmsFAILURE;
- }
- coeffFlag = (env->env.nCoefficients < nCs);
- dataFlag = (env->env.nDataPoints < nDPs);
- env->env.nCoefficients = nCs;
- env->env.nDataPoints = nDPs;
- /* allocate matrix U */
- if (dataFlag || coeffFlag || (env->matU == NULL)) {
- if (env->matU != NULL) {
- free(env->matU[0]);
- free(env->matU);
- env->matU = NULL;
- }
- m = (double *)calloc((size_t)(nDPs + 1)*(nCs + 1), sizeof(double));
- if (m == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (m)");
- return amdmsFAILURE;
- }
- env->matU = (double **)calloc((size_t)nDPs + 1, sizeof(double*));
- if (env->matU == NULL) {
- free(m);
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (matU)");
- return amdmsFAILURE;
- }
- for (i = 0; i <= nDPs; i++) {
- env->matU[i] = m + i*(nCs + 1);
- }
- }
- /* allocate matrix V */
- if (coeffFlag || (env->matV == NULL)) {
- if (env->matV != NULL) {
- free(env->matV[0]);
- free(env->matV);
- env->matV = NULL;
- }
- m = (double *)calloc((size_t)(nCs + 1)*(nCs + 1), sizeof(double));
- if (m == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (m)");
- return amdmsFAILURE;
- }
- env->matV = (double **)calloc((size_t)nCs + 1, sizeof(double*));
- if (env->matV == NULL) {
- free(m);
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (matV)");
- return amdmsFAILURE;
- }
- for (i = 0; i <= nCs; i++) {
- env->matV[i] = m + i*(nCs + 1);
- }
- }
- /* allocate vector W */
- if (coeffFlag || (env->vecW == NULL)) {
- if (env->vecW != NULL) {
- free(env->vecW);
- env->vecW = NULL;
- }
- env->vecW = (double *)calloc((size_t)nCs + 1, sizeof(double));
- if (env->vecW == NULL) {
- return amdmsFAILURE;
- }
- }
- /* allocate vector B */
- if (dataFlag || (env->vecB == NULL)) {
- if (env->vecB != NULL) {
- free(env->vecB);
- env->vecB = NULL;
- }
- env->vecB = (double *)calloc((size_t)nDPs + 1, sizeof(double));
- if (env->vecB == NULL) {
- return amdmsFAILURE;
- }
- }
- /* allocate matrix CVM */
- if (coeffFlag || (env->matCvm == NULL)) {
- if (env->matCvm != NULL) {
- free(env->matCvm[0]);
- free(env->matCvm);
- env->matCvm = NULL;
- }
- m = (double *)calloc((size_t)(nCs + 1)*(nCs + 1), sizeof(double));
- if (m == NULL) {
- return amdmsFAILURE;
- }
- env->matCvm = (double **)calloc((size_t)nCs + 1, sizeof(double*));
- if (env->matCvm == NULL) {
- free(m);
- return amdmsFAILURE;
- }
- for (i = 0; i <= nCs; i++) {
- env->matCvm[i] = m + i*(nCs + 1);
- }
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsFitLinear(void *henv, int n, double *x, double *y, double *ye)
-{
- amdmsFIT_LINEAR_ENV *env = (amdmsFIT_LINEAR_ENV*)henv;
- int i;
- int retVal;
-
- if (env == NULL) {
- return amdmsFAILURE;
- }
- /* amdmsDebug(__FILE__, __LINE__, "amdmsFitLinear(.., %d, .., .., ..)", n); */
- if (amdmsAllocSpaceLinear(env, env->env.nCoefficients, n) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- for (i = 0; i <= env->env.nCoefficients; i++) {
- env->env.a[i] = 0.0;
- env->env.ae[i] = 0.0;
- }
- retVal = amdmsFitSVDLinear(env, n, x - 1, y - 1, ye - 1);
- if (!retVal) {
- amdmsInfo(__FILE__, __LINE__, " no fit possible!!!");
- return 0;
- } else {
- amdmsCalcCovarianceLinear(env);
- for (i = 0; i < env->env.nCoefficients; i++) {
- env->env.a[i] = env->env.a[i + 1];
- env->env.ae[i] = sqrt(env->matCvm[i + 1][i + 1]);
- }
- amdmsCalcQuality(&(env->env), n, x, y, ye);
- }
- /*
- amdmsInfo(__FILE__, __LINE__, " fitted parameters:");
- for (i = 0; i < env->env.nCoefficients; i++) {
- amdmsInfo(__FILE__, __LINE__, " a%d = %.4e [%.4e]", i, a[i], ae[i]);
- }
- amdmsInfo(__FILE__, __LINE__, " chi^2 = %12.4f", env->env.chi2);
- amdmsInfo(__FILE__, __LINE__, " absDist^2 = %12.8f", env->env.absDist2);
- amdmsInfo(__FILE__, __LINE__, " relDist^2 = %12.8f", env->env.relDist2);
- amdmsInfo(__FILE__, __LINE__, " covariance matrix:");
- for (i = 1; i <= env->env.nCoefficients; i++) {
- for (j = 1; j <= env->env.nCoefficients; j++) {
- amdmsInfo(__FILE__, __LINE__, " a%d:a%d = %12.4f", i - 1, j - 1, env->matCvm[i][j]);
- }
- }
- */
- return 1;
-}
-
-double amdmsEvalLinear(void *henv, double x)
-{
- amdmsFIT_LINEAR_ENV *env = (amdmsFIT_LINEAR_ENV*)henv;
- int i;
- double y = 0;
- double afunc[amdmsMAX_COEFF + 1];
-
- if (env == NULL) {
- return 0.0;
- }
- env->base(x, env->env.nCoefficients, afunc);
- for (i = 0; i < env->env.nCoefficients; i++) {
- y += env->env.a[i]*afunc[i + 1];
- }
- return y;
-}
-
-void amdmsPolynomialBaseFunc(double x, int np, double *p)
-{
- int i;
-
- p[1] = 1.0;
- for (i = 2; i <= np; i++) {
- p[i] = p[i - 1]*x;
- }
-}
-
-void amdmsRayBaseFunc(double x, int np, double *p)
-{
- p[1] = x;
-}
-
-#define SWAP(a,b) {temp=(a);(a)=(b);(b)=temp;}
-
-void amdmsExpandCovariance(double **covar, int ma, int ia[], int mfit)
-/*
- * Expand in storage the covariance matrix covar so as to take into account
- * parameters that are being held fixed.
- * (For the latter,return zero covariances.)
- */
-{
- int i,j,k;
- double temp;
-
- for (i = mfit + 1; i <= ma; i++) {
- for (j = 1; j <= i; j++) {
- covar[i][j]=covar[j][i]=0.0;
- }
- }
- k=mfit;
- for (j = ma; j >= 1; j--) {
- if (ia[j]) {
- for (i = 1; i <= ma; i++) {
- SWAP(covar[i][k],covar[i][j]);
- }
- for (i = 1; i <= ma; i++) {
- SWAP(covar[k][i],covar[j][i]);
- }
- k--;
- }
- }
-}
-
-void amdmsGaussJordan(amdmsFIT_NONLINEAR_ENV *env, double **a, int n, double **b, int m)
-/*
- * Linear equation solution by Gauss-Jordan elimination, equation (2.1.1) above.
- * a[1..n][1..n] is the input matrix. b[1..n][1..m] is input containing
- * the m right-hand side vectors. On output, a is replaced by its matrix
- * inverse, and b is replaced by the corresponding set of solution vectors.
- */
-{
- int i,icol = 1,irow = 1,j,k,l,ll;
- double big,dum,pivinv,temp;
-
- /* The integer arrays ipiv, indxr,andindxc are used for bookkeeping on the pivoting. */
- for (j = 1; j <= n; j++) {
- env->ivecIpiv[j]=0;
- }
- for (i = 1; i <= n; i++) {
- /* This is the main loop over the columns to be reduced. */
- big=0.0;
- for (j = 1; j <= n; j++) {
- /* This is the outer loop of the search for a pivot element. */
- if (env->ivecIpiv[j] != 1) {
- for (k = 1; k <= n; k++) {
- if (env->ivecIpiv[k] == 0) {
- if (fabs(a[j][k]) >= big) {
- big=fabs(a[j][k]);
- irow=j; icol=k;
- }
- }
- }
- }
- }
- ++(env->ivecIpiv[icol]);
- /*
- * We now have the pivot element, so we interchange rows, if needed,
- * to put the pivot element on the diagonal. The columns are not
- * physically interchanged, only relabeled:
- * indxc[i], the column of the ith pivot element, is the ith column
- * that is reduced, while indxr[i] is the row in which that pivot
- * element was originally located. If indxr[i] != indxc[i] there is
- * an implied column interchange. With this form of bookkeeping,
- * the solution b's will end up in the correct order, and the inverse
- * matrix will be scrambled by columns.
- */
- if (irow != icol) {
- for (l=1;l<=n;l++) {
- SWAP(a[irow][l],a[icol][l]);
- }
- for (l=1;l<=m;l++) {
- SWAP(b[irow][l],b[icol][l]);
- }
- }
- /* We are now ready to divide the pivot row by the pivot element, located at irow and icol. */
- env->ivecIndxr[i]=irow;
- env->ivecIndxc[i]=icol;
- if (a[icol][icol] == 0.0) {
- amdmsError(__FILE__, __LINE__, "GaussJordan, Singular Matrix");
- return;
- }
- pivinv=1.0/a[icol][icol];
- a[icol][icol]=1.0;
- for (l=1;l<=n;l++) {
- a[icol][l] *= pivinv;
- }
- for (l = 1; l <= m; l++) {
- b[icol][l] *= pivinv;
- }
- for (ll = 1; ll <= n; ll++) {
- /* Next, we reduce the rows... */
- if (ll != icol) {
- /* ...except for the pivot one, of course. */
- dum=a[ll][icol];
- a[ll][icol]=0.0;
- for (l = 1 ; l <= n; l++) {
- a[ll][l] -= a[icol][l]*dum;
- }
- for (l = 1; l <= m; l++) {
- b[ll][l] -= b[icol][l]*dum;
- }
- }
- }
- }
- /*
- * This is the end of the main loop over columns of the reduction. It only
- * remains to unscramble the solution in view of the column interchanges.
- * We do this by interchanging pairs of columns in the reverse order that
- * the permutation was built up.
- */
- for (l = n ; l >= 1; l--) {
- if (env->ivecIndxr[l] != env->ivecIndxc[l]) {
- for (k = 1; k <= n; k++) {
- SWAP(a[k][env->ivecIndxr[l]],a[k][env->ivecIndxc[l]]);
- }
- }
- }
- /* And we are done. */
-}
-
-void amdmsEvaluate(amdmsFIT_NONLINEAR_ENV *env, int ndata, double x[], double y[], double sig[],
- double a[], double **alpha, double beta[])
-/*
- * Used by mrqmin to evaluate the linearize fitting matrix alpha and
- * vector beta as in (15.5.8), and calculate chi^2.
- */
-{
- int ma = env->env.nCoefficients;
- int *ia = env->ivecIa;
- int i,j,k,l,m,mfit=0;
- double ymod,wt,sig2i,dy;
-
- for (j = 1; j <= ma; j++) {
- if (ia[j]) {
- mfit++;
- }
- }
- for (j = 1; j <= mfit; j++) {
- /* Initialize (symmetric) alpha beta */
- for (k = 1; k <= j; k++) {
- alpha[j][k]=0.0;
- }
- beta[j]=0.0;
- }
- env->env.chi2 = 0.0;
- for (i = 1; i <= ndata; i++) {
- /* Summation loop over all data. */
- env->base(x[i], ma, a, &ymod, env->vecDyda);
- sig2i=1.0/(sig[i]*sig[i]);
- dy=y[i]-ymod;
- for (j = 0, l = 1; l <= ma; l++) {
- if (ia[l]) {
- wt=env->vecDyda[l]*sig2i;
- for (j++, k = 0, m = 1; m <= l; m++) {
- if (ia[m]) {
- alpha[j][++k] += wt*env->vecDyda[m];
- }
- }
- beta[j] += dy*wt;
- }
- }
- env->env.chi2 += dy*dy*sig2i; /* And find chi^2. */
- }
- for (j = 2; j <= mfit; j++) {
- /* Fill in the symmetric side. */
- for (k = 1; k < j; k++) {
- alpha[k][j]=alpha[j][k];
- }
- }
-}
-
-void amdmsLevenbergMarquardt(amdmsFIT_NONLINEAR_ENV *env,
- int ndata, double *x, double *y, double *ye)
-/*
- * Levenberg-Marquardt method, attempting to reduce the value chi^2 of a fit
- * between a set of data points x[1..ndata], y[1..ndata] with individual
- * standard deviations ye[1..ndata], and a nonlinear function dependent on
- * ma coeffcients a[1..ma].
- * The input array ia[1..ma] indicates by nonzero entries those components
- * of a that should be fitted for, and by zero entries those components that
- * should be held fixed at their input values.
- * The program returns current best-fit values for the parameters a[1..ma],
- * and chi^2 = chisq. The arrays covar[1..ma][1..ma], alpha[1..ma][1..ma]
- * are used as working space during most iterations.
- * Supply a routine funcs(x,a,yfit,dyda,ma) that evaluates the fitting function
- * yfit, and its derivatives dyda[1..ma] with respect to the fitting
- * parameters a at x.
- * On the first call provide an initial guess for the parameters a, and set
- * alamda < 0 for initialization (which then sets alamda=.001). If a step
- * succeeds chisq becomes smaller an alamda decreases by a factor of 10.
- * If a step fails alamda grows by a factor of 10. You must call this routine
- * repeatedly until convergence is achieved. Then, make one final call with
- * alamda=0 so that covar[1..ma][1..ma] returns the covariance matrix,
- * and alpha the curvature matrix. (Parameters held fixed will return zero
- * covariances.)
- */
-{
- int j,k,l;
- int ma = env->env.nCoefficients;
- int *ia = env->ivecIa;
-
- if (env->alamda < 0.0) {
- /* Initialization. */
- for (env->mfit=0,j=1;j<=ma;j++)
- if (ia[j]) {
- env->mfit++;
- }
- env->alamda=0.001;
- amdmsEvaluate(env, ndata, x, y, ye, env->env.a, env->matAlpha, env->vecBeta);
- env->ochi2 = env->env.chi2;
- for (j=1;j<=ma;j++) {
- env->vecAtry[j]=env->env.a[j];
- }
- }
- for (j=1;j<=env->mfit;j++) {
- /* Alter linearized fitting matrix, by augmenting diagonal elements. */
- for (k=1;k<=env->mfit;k++) {
- env->matCvm[j][k]=env->matAlpha[j][k];
- }
- env->matCvm[j][j]=env->matAlpha[j][j]*(1.0+env->alamda);
- env->matOneda[j][1]=env->vecBeta[j];
- }
- amdmsGaussJordan(env, env->matCvm,env->mfit,env->matOneda,1); /* Matrix solution. */
- for (j=1;j<=env->mfit;j++) {
- env->vecDa[j]=env->matOneda[j][1];
- }
- if (env->alamda == 0.0) {
- /* Once converged,evaluate covariance matrix. */
- amdmsExpandCovariance(env->matCvm,ma,ia,env->mfit);
- amdmsExpandCovariance(env->matAlpha,ma,ia,env->mfit);/* Spread out alpha to its full size too. */
- return;
- }
- for (j=0,l=1;l<=ma;l++) {
- /* Did the trial succeed? */
- if (ia[l]) {
- env->vecAtry[l]=env->env.a[l]+env->vecDa[++j];
- }
- }
- amdmsEvaluate(env, ndata, x, y, ye, env->vecAtry, env->matCvm, env->vecDa);
- if (env->env.chi2 < env->ochi2) {
- /* Success, accept the new solution. */
- env->alamda *= 0.1;
- env->ochi2 = env->env.chi2;
- for (j=1;j<=env->mfit;j++) {
- for (k=1;k<=env->mfit;k++) {
- env->matAlpha[j][k]=env->matCvm[j][k];
- }
- env->vecBeta[j]=env->vecDa[j];
- }
- for (l=1;l<=ma;l++) {
- env->env.a[l]=env->vecAtry[l];
- }
- } else {
- /* Failure, increase alamda an return. */
- env->alamda *= 10.0;
- env->env.chi2 = env->ochi2;
- }
-}
-
-amdmsCOMPL amdmsAllocSpaceNonLinear(amdmsFIT_NONLINEAR_ENV *env, int nCs)
-{
- int i;
- double *m;
- int coeffFlag;
-
- if (env == NULL) {
- return amdmsFAILURE;
- }
- coeffFlag = (env->env.nCoefficients < nCs);
- env->env.nCoefficients = nCs;
- /* allocate vector indxc */
- if (coeffFlag || (env->ivecIndxc == NULL)) {
- env->ivecIndxc = (int *)realloc(env->ivecIndxc, (nCs + 1)*sizeof(int));
- if (env->ivecIndxc == NULL) {
- return amdmsFAILURE;
- }
- }
- /* allocate vector indxr */
- if (coeffFlag || (env->ivecIndxr == NULL)){
- env->ivecIndxr = (int *)realloc(env->ivecIndxr, (nCs + 1)*sizeof(int));
- if (env->ivecIndxr == NULL) {
- return amdmsFAILURE;
- }
- }
- /* allocate vector ipiv */
- if (coeffFlag || (env->ivecIpiv == NULL)){
- env->ivecIpiv = (int *)realloc(env->ivecIpiv, (nCs + 1)*sizeof(int));
- if (env->ivecIpiv == NULL) {
- return amdmsFAILURE;
- }
- }
- /* allocate vector dyda */
- if (coeffFlag || (env->vecDyda == NULL)){
- env->vecDyda = (double *)realloc(env->vecDyda, (nCs + 1)*sizeof(double));
- if (env->vecDyda == NULL) {
- return amdmsFAILURE;
- }
- }
- /* allocate vector vecAtry */
- if (coeffFlag || (env->vecAtry == NULL)){
- env->vecAtry = (double *)realloc(env->vecAtry, (nCs + 1)*sizeof(double));
- if (env->vecAtry == NULL) {
- return amdmsFAILURE;
- }
- }
- /* allocate vector */
- if (coeffFlag || (env->vecBeta == NULL)){
- env->vecBeta = (double *)realloc(env->vecBeta, (nCs + 1)*sizeof(double));
- if (env->vecBeta == NULL) {
- return amdmsFAILURE;
- }
- }
- /* allocate vector */
- if (coeffFlag || (env->vecDa == NULL)){
- env->vecDa = (double *)realloc(env->vecDa, (nCs + 1)*sizeof(double));
- if (env->vecDa == NULL) {
- return amdmsFAILURE;
- }
- }
- /* allocate matrix V */
- if (coeffFlag || (env->matOneda == NULL)) {
- if (env->matOneda != NULL) {
- free(env->matOneda[0]);
- free(env->matOneda);
- env->matOneda = NULL;
- }
- m = (double *)calloc((size_t)(nCs + 1)*(nCs + 1), sizeof(double));
- if (m == NULL) {
- return amdmsFAILURE;
- }
- env->matOneda = (double **)calloc((size_t)(nCs + 1), sizeof(double*));
- if (env->matOneda == NULL) {
- free(m);
- return amdmsFAILURE;
- }
- for (i = 0; i <= nCs; i++) {
- env->matOneda[i] = m + i*(nCs + 1);
- }
- }
- /* allocate vector ia */
- if (coeffFlag || (env->ivecIa == NULL)){
- env->ivecIa = (int *)realloc(env->ivecIa, (nCs + 1)*sizeof(int));
- if (env->ivecIa == NULL) {
- return amdmsFAILURE;
- }
- }
- /* allocate matrix CVM */
- if (coeffFlag || (env->matCvm == NULL)) {
- if (env->matCvm != NULL) {
- free(env->matCvm[0]);
- free(env->matCvm);
- env->matCvm = NULL;
- }
- m = (double *)calloc((size_t)(nCs + 1)*(nCs + 1), sizeof(double));
- if (m == NULL) {
- return amdmsFAILURE;
- }
- env->matCvm = (double **)calloc((size_t)(nCs + 1), sizeof(double*));
- if (env->matCvm == NULL) {
- free(m);
- return amdmsFAILURE;
- }
- for (i = 0; i <= nCs; i++) {
- env->matCvm[i] = m + i*(nCs + 1);
- }
- }
- /* allocate matrix Alpha */
- if (coeffFlag || (env->matAlpha == NULL)) {
- if (env->matAlpha != NULL) {
- free(env->matAlpha[0]);
- free(env->matAlpha);
- env->matAlpha = NULL;
- }
- m = (double *)calloc(((size_t)nCs + 1)*(nCs + 1), sizeof(double));
- if (m == NULL) {
- return amdmsFAILURE;
- }
- env->matAlpha = (double **)calloc((size_t)(nCs + 1), sizeof(double*));
- if (env->matAlpha == NULL) {
- free(m);
- return amdmsFAILURE;
- }
- for (i = 0; i <= nCs; i++) {
- env->matAlpha[i] = m + i*(nCs + 1);
- }
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsFitNonLinear(void *henv, int n, double *x, double *y, double *ye)
-{
- amdmsFIT_NONLINEAR_ENV *env = (amdmsFIT_NONLINEAR_ENV*)henv;
- int i, j;
- double oldChisq;
- double oldAlamda;
- int iIter;
-
- /* amdmsDebug(__FILE__, __LINE__, "amdmsFitNonLinear(.., %d, .., .., ..)", n); */
- if (amdmsAllocSpaceNonLinear(env, env->env.nCoefficients) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- for (i = 0; i <= env->env.nCoefficients; i++) {
- env->ivecIndxc[i] = 0;
- env->ivecIndxr[i] = 0;
- env->ivecIpiv[i] = 0;
- env->vecDyda[i] = 0.0;
- env->vecAtry[i] = 0.0;
- env->vecBeta[i] = 0.0;
- env->vecDa[i] = 0.0;
- env->ivecIa[i] = 1;
- for (j = 0; j <= env->env.nCoefficients; j++) {
- env->matOneda[i][j] = 0.0;
- env->matCvm[i][j] = 0.0;
- env->matAlpha[i][j] = 0.0;
- }
- }
- for (i = 0; i <= env->env.nCoefficients; i++) {
- env->env.ae[i] = 0.0;
- }
- env->ochi2 = 0.0;
- env->mfit = 0;
- env->alamda = -1.0;
- iIter = 0;
- env->init(henv, n, x, y, ye);
- amdmsLevenbergMarquardt(env, n, x - 1, y - 1, ye - 1);
- iIter++;
- /* amdmsInfo(__FILE__, __LINE__, "Iteration %d:", iIter); */
- /* amdmsInfo(__FILE__, __LINE__, " chi^2 = %12.4f\", env->env.chi2);*/
- oldChisq = env->env.chi2;
- oldAlamda = env->alamda;
- do {
- amdmsLevenbergMarquardt(env, n, x - 1, y - 1, ye - 1);
- iIter++;
- /* amdmsInfo(__FILE__, __LINE__, "Iteration %d:", iIter); */
- /* amdmsInfo(__FILE__, __LINE__, " chi^2 = %12.4f", env->env.chi2); */
- if (env->env.chi2 >= oldChisq) {
- oldChisq = env->env.chi2;
- continue;
- } else if (env->env.chi2 >= 0.999*oldChisq) {
- break;
- } else {
- oldChisq = env->env.chi2;
- }
- } while (iIter < 100);
- env->alamda = 0.0;
- amdmsLevenbergMarquardt(env, n, x - 1, y - 1, ye - 1);
- /* amdmsInfo(__FILE__, __LINE__, "Iteration %d:", iIter); */
- /* amdmsInfo(__FILE__, __LINE__, " chi^2 = %12.4f", env->env.chi2); */
- for (i = 0; i < env->env.nCoefficients; i++) {
- env->env.a[i] = env->env.a[i + 1];
- env->env.ae[i] = sqrt(env->matCvm[i + 1][i + 1]);
- }
- amdmsCalcQuality(henv, n, x, y, ye);
- /*
- amdmsInfo(__FILE__, __LINE__, " fitted parameters:");
- for (i = 0; i < env->env.nCoefficients; i++) {
- amdmsInfo(__FILE__, __LINE__, " a%d = %.4e [%.4e]", i, a[i], ae[i]);
- }
- amdmsInfo(__FILE__, __LINE__, " chi^2 = %12.4f", env->env.chi2);
- amdmsInfo(__FILE__, __LINE__, " absDist^2 = %12.8f", env->env.absDist2);
- amdmsInfo(__FILE__, __LINE__, " relDist^2 = %12.8f", env->env.relDist2);
- amdmsInfo(__FILE__, __LINE__, " covariance matrix:");
- for (i = 1; i <= env->env.nCoefficients; i++) {
- for (j = 1; j <= env->env.nCoefficients; j++) {
- amdmsInfo(__FILE__, __LINE__, " a%d:a%d = %12.4f", i - 1, j - 1, env->matCvm[i][j]);
- }
- }
- */
- return amdmsSUCCESS;
-}
-
-double amdmsEvalNonLinear(void *henv, double x)
-{
- amdmsFIT_NONLINEAR_ENV *env = (amdmsFIT_NONLINEAR_ENV*)henv;
- double y = 0;
- double afunc[amdmsMAX_COEFF + 1];
-
- if (env == NULL) {
- return 0.0;
- }
- env->base(x, env->env.nCoefficients, env->env.a - 1, &y, afunc);
- return y;
-}
-
-void amdmsNonLinearPixelInit(void *henv, int n, double *x, double *y, double *ye)
-{
- amdmsFIT_NONLINEAR_ENV *env = (amdmsFIT_NONLINEAR_ENV*)henv;
- env->env.a[1] = 1.0;
- env->env.a[2] = 0.0001;
-}
-
-void amdmsNonLinearPixelBaseFunc(double x, int na, double *a, double *y, double *dyda)
-{
- *y = a[1]*x/(1 + a[2]*x);
- dyda[1] = x/(1 + a[2]*x);
- dyda[2] = (1 + a[2]*x - a[1]*x*x)/(1 + a[2]*x)/(1 + a[2]*x);
-}
-
-void amdmsGeneralExpInit(void *henv, int n, double *x, double *y, double *ye)
-{
- amdmsFIT_NONLINEAR_ENV *env = (amdmsFIT_NONLINEAR_ENV*)henv;
- env->env.a[1] = 1.0;
- env->env.a[2] = 1.0;
- env->env.a[3] = 1.0;
-}
-
-void amdmsGeneralExpBaseFunc(double x, int na, double *a, double *y, double *dyda)
-{
- *y = a[1] + a[2]*exp(a[3]*x);
- dyda[1] = 1.0;
- dyda[2] = exp(a[3]*x);
- dyda[3] = a[2]*x*exp(a[3]*x);
-}
-
-#define amdmsEBFIT_NCOEFF 3
-
-void amdmsElectronicBiasInit(void *henv, int n, double *x, double *y, double *ye)
-{
- amdmsFIT_NONLINEAR_ENV *env = (amdmsFIT_NONLINEAR_ENV*)henv;
- env->env.a[1] = 1.0;
- env->env.a[2] = 1.0;
- env->env.a[3] = -1.0;
-}
-
-void amdmsElectronicBiasBaseFunc(double x, int na, double *a, double *y, double *dyda)
-{
- *y = a[1] + a[2]*exp(a[3]*x);
- dyda[1] = 1.0;
- dyda[2] = exp(a[3]*x);
- dyda[3] = a[2]*x*exp(a[3]*x);
-}
-
-/*
-void amdmsElectronicBiasInit(void *henv, int n, double *x, double *y, double *ye)
-{
- amdmsFIT_NONLINEAR_ENV *env = (amdmsFIT_NONLINEAR_ENV*)henv;
- env->env.a[1] = 1.0;
- env->env.a[2] = 1.0;
- env->env.a[3] = -1.0;
- env->env.a[4] = 1.0;
- env->env.a[5] = 0.5;
- env->env.a[6] = -1.0;
-}
-
-void amdmsElectronicBiasBaseFunc(double x, int na, double *a, double *y, double *dyda)
-{
- *y = a[1] + a[2]*exp(a[3]*x) + a[4]*pow(x, a[5])*exp(a[6]*x);
- dyda[1] = 1.0;
- dyda[2] = exp(a[3]*x);
- dyda[3] = a[2]*x*exp(a[3]*x);
- dyda[4] = pow(x, a[5])*exp(a[6]*x);
- dyda[5] = a[4]*pow(x, a[5])*exp(a[6]*x)*log(x);
- dyda[6] = x*a[4]*pow(x, a[5])*exp(a[6]*x);
-}
-*/
-
-/*
-void amdmsElectronicBiasInit(void *henv, int n, double *x, double *y, double *ye)
-{
- amdmsFIT_NONLINEAR_ENV *env = (amdmsFIT_NONLINEAR_ENV*)henv;
- env->env.a[1] = 1.0;
- env->env.a[2] = -1.0;
- env->env.a[3] = 1.0;
- env->env.a[4] = 1.0;
- env->env.a[5] = 1.0;
- env->env.a[6] = -1.0;
-}
-
-void amdmsElectronicBiasBaseFunc(double x, int na, double *a, double *y, double *dyda)
-{
- double fa, fb;
-
- fa = a[1] + a[2]*x + a[3]*x*x;
- fb = a[4] + a[5]*x + a[6]*x*x;
- *y = fa/fb;
- dyda[1] = 1.0/fb;
- dyda[2] = x/fb;
- dyda[3] = x*x/fb;
- dyda[4] = -fa/fb/fb;
- dyda[5] = -fa*x/fb/fb;
- dyda[6] = -fa*x*x/fb/fb;
-}
-*/
-
-#define amdmsCFFIT_NCOEFF 3
-
-/* NDU = a + g*VDU + c*g^2*VDU^2 */
-/* a[1] = a */
-/* a[2] = g */
-/* a[3] = c */
-void amdmsConversionFactorInit(void *henv, int n, double *x, double *y, double *ye)
-{
- amdmsFIT_NONLINEAR_ENV *env = (amdmsFIT_NONLINEAR_ENV*)henv;
- env->env.a[1] = 0.0;
- env->env.a[2] = 4.0;
- env->env.a[3] = 0.001;
-}
-
-void amdmsConversionFactorBaseFunc(double x, int na, double *a, double *y, double *dyda)
-{
- *y = a[1] + a[2]*x + a[3]*a[2]*a[2]*x*x;
- dyda[1] = 1.0;
- dyda[2] = x + 2*a[2]*a[1]*x*x;
- dyda[3] = a[2]*a[2]*x*x;
-}
-
-amdmsCOMPL amdmsFindDataSaturation(amdmsFIT_DATA_ENV *env)
-{
- int iPoint;
- int i;
- int clusterPoint;
- int clusterSize;
- double boxX;
- double boxY;
- double hminX;
- double hmaxX;
- double hminY;
- double hmaxY;
- double minX;
- double maxX;
- double minY;
- double maxY;
- int bestClusterDP;
- int bestClusterSize;
- int bestClusterFlags[100];
-
- if (!env->satFlag) {
- return amdmsSUCCESS;
- }
- env->firstDP = env->env.nDataPoints - 1;
- env->lastDP = 0;
- for (iPoint = 0; iPoint < env->env.nDataPoints; iPoint++) {
- if (env->useFlags[iPoint]) {
- env->firstDP = MIN(env->firstDP, iPoint);
- env->lastDP = MAX(env->lastDP, iPoint);
- }
- }
- if (env->firstDP == (env->env.nDataPoints - 1)) {
- /* all use flags are false */
- return amdmsFAILURE;
- }
- /* calculate the minima and maxima of x and y */
- minX = env->valX[env->firstDP];
- maxX = env->valX[env->firstDP];
- minY = env->valY[env->firstDP];
- maxY = env->valY[env->firstDP];
- for (iPoint = env->firstDP + 1; iPoint <= env->lastDP; iPoint++) {
- if (env->useFlags[iPoint]) {
- minX = MIN(minX, env->valX[iPoint]);
- maxX = MAX(maxX, env->valX[iPoint]);
- minY = MIN(minY, env->valY[iPoint]);
- maxY = MAX(maxY, env->valY[iPoint]);
- }
- }
- /* try to find a cluster of points which are close together */
- boxX = env->satWidth*(maxX - minX);
- boxY = env->satHeight*(maxY - minY);
- /* amdmsDebug(__FILE__, __LINE__, "# saturation characteristics:"); */
- /* amdmsDebug(__FILE__, __LINE__, "# x = [%12.4f .. %12.4f] y = [%12.4f .. %12.4f]", minX, maxX, minY, maxY); */
- /* amdmsDebug(__FILE__, __LINE__, "# box = %12.4f, %12.4f", boxX, boxY); */
- bestClusterDP = -1;
- bestClusterSize = 1;
- for (clusterPoint = env->lastDP; clusterPoint >= (env->lastDP - 1); clusterPoint--) {
- for (iPoint = env->firstDP; iPoint <= env->lastDP; iPoint++) {
- env->useFlags[iPoint] = 1; /* set use flags to true for all valid data points */
- }
- env->useFlags[clusterPoint] = 0;
- clusterSize = 1;
- /* now try to find more points of the cluster */
- for (iPoint = env->lastDP; iPoint >= env->firstDP; iPoint--) {
- if (env->useFlags[iPoint] == 0) continue;
- /* set current point as candidate */
- env->useFlags[iPoint] = 0;
- /* now calculate the box of all candidate points */
- hminX = env->valX[clusterPoint];
- hmaxX = env->valX[clusterPoint];
- hminY = env->valY[clusterPoint];
- hmaxY = env->valY[clusterPoint];
- for (i = env->firstDP; i <= env->lastDP; i++) {
- if (env->useFlags[i] == 0) {
- hminX = MIN(hminX, env->valX[i]);
- hmaxX = MAX(hmaxX, env->valX[i]);
- hminY = MIN(hminY, env->valY[i]);
- hmaxY = MAX(hmaxY, env->valY[i]);
- }
- }
- if (((hmaxX - hminX) > boxX) || ((hmaxY - hminY) > boxY)) {
- /* candidate point is outside of the allowed box around the cluster */
- env->useFlags[iPoint] = 1;
- } else {
- clusterSize++;
- }
- }
- /* delete all singular points except the cluster point */
- for (iPoint = env->firstDP + 1; iPoint < env->lastDP; iPoint++) {
- if (iPoint == clusterPoint) continue;
- if (!env->useFlags[iPoint] && env->useFlags[iPoint - 1] && env->useFlags[iPoint + 1]) {
- env->useFlags[iPoint] = 1;
- clusterSize--;
- }
- }
- if (clusterSize > 1) {
- /* at least two data points are close together */
- /* look if there is a data point who's neighbours are in the cluster */
- for (iPoint = env->firstDP + 1; iPoint < env->lastDP; iPoint++) {
- if (env->useFlags[iPoint] && !env->useFlags[iPoint - 1] && !env->useFlags[iPoint + 1]) {
- env->useFlags[iPoint] = 0;
- clusterSize++;
- }
- }
- /* clear all points after the found cluster */
- for (iPoint = env->lastDP; iPoint >= env->firstDP; iPoint--) {
- if (env->useFlags[iPoint] == 0) break;
- env->useFlags[iPoint] = 0;
- clusterSize++;
- }
- if (clusterSize > bestClusterSize) {
- bestClusterDP = clusterPoint;
- bestClusterSize = clusterSize;
- for (iPoint = env->firstDP; iPoint <= env->lastDP; iPoint++) {
- /* copy only the new flags */
- bestClusterFlags[iPoint] = env->useFlags[iPoint];
- }
- }
- /* amdmsDebug(__FILE__, __LINE__, "# cluster found, contains the following datapoints:"); */
- for (iPoint = 0; iPoint < env->env.nDataPoints; iPoint++) {
- if (env->useFlags[iPoint] == 0) {
- /* amdmsDebug(__FILE__, __LINE__, "# %2d %12.4f %12.4f", iPoint, valX[iPoint], valY[iPoint]); */
- }
- }
- }
- }
- if (bestClusterDP != -1) {
- for (iPoint = env->firstDP; iPoint <= env->lastDP; iPoint++) {
- /* copy only the new flags */
- if (bestClusterFlags[iPoint]) {
- env->satDP = iPoint; /* set satDP to the last valid data point */
- }
- env->useFlags[iPoint] = bestClusterFlags[iPoint];
- }
- }
- return amdmsSUCCESS;
-}
-
-double amdmsTryDataFit(amdmsFIT_DATA_ENV *env)
-{
- int nDP;
- int iPoint;
- /* int iCoeff; */
-
- /* copy used data points into arrays */
- nDP = 0;
- for (iPoint = 0; iPoint < env->env.nDataPoints; iPoint++) {
- if (env->useFlags[iPoint]) {
- env->usedX[nDP] = env->valX[iPoint];
- env->usedY[nDP] = env->valY[iPoint];
- if (env->valYErr == NULL) {
- env->usedYErr[nDP] = 1.0;
- } else {
- env->usedYErr[nDP] = env->valYErr[iPoint];
- }
- nDP++;
- }
- }
- if (amdmsDoFit(env->fit, nDP, env->usedX, env->usedY, env->usedYErr) != amdmsSUCCESS) {
- return 0.0;
- }
- /*
- amdmsDebug(__FILE__, __LINE__, "#********************************");
- amdmsDebug(__FILE__, __LINE__, "# fit with %d data points:", nDP);
- for (iPoint = 0; iPoint < env->env.nDataPoints; iPoint++) {
- if (env->useFlags[iPoint]) {
- amdmsDebug(__FILE__, __LINE__, " %d", iPoint);
- }
- }
- for (iCoeff = 0; iCoeff < env->fit->nCoefficients; iCoeff++) {
- amdmsDebug(__FILE__, __LINE__, "# a%d = %.4e, stdev a%d = %.4e", iCoeff, env->fit->a[iCoeff], iCoeff, env->fit->ae[iCoeff]);
- }
- amdmsDebug(__FILE__, __LINE__, "# chi^2 = %.4e absDist^2 = %.4e relDist^2 = %.4e",
- env->fit->chi2, env->fit->absDist2, env->fit->relDist2);
- */
- return env->fit->relDist2;
-}
-
-amdmsCOMPL amdmsAllocSpaceData(amdmsFIT_DATA_ENV *env, int nDPs)
-{
- int i;
-
- if (env == NULL) {
- return amdmsFAILURE;
- }
- if (env->env.nDataPoints == nDPs) {
- return amdmsSUCCESS;
- }
- env->env.nDataPoints = nDPs;
- /* allocate vector usedX */
- env->usedX = (double *)realloc(env->usedX, (nDPs + 1)*sizeof(double));
- if (env->usedX == NULL) {
- return amdmsFAILURE;
- }
- /* allocate vector usedY */
- env->usedY = (double *)realloc(env->usedY, (nDPs + 1)*sizeof(double));
- if (env->usedY == NULL) {
- return amdmsFAILURE;
- }
- /* allocate vector usedYErr */
- env->usedYErr = (double *)realloc(env->usedYErr, (nDPs + 1)*sizeof(double));
- if (env->usedYErr == NULL) {
- return amdmsFAILURE;
- }
- /* allocate vector useFlags */
- env->useFlags = (int *)realloc(env->useFlags, (nDPs + 1)*sizeof(int));
- if (env->useFlags == NULL) {
- return amdmsFAILURE;
- }
- for (i = 0; i < nDPs; i++) {
- env->usedX[i] = 0.0;
- env->usedY[i] = 0.0;
- env->usedYErr[i] = 0.0;
- env->useFlags[i] = 0;
- }
- return amdmsSUCCESS;
-}
-
-#define amdmsMIN_DATAPOINTS 4
-
-amdmsCOMPL amdmsFitData(void *henv, int n, double *x, double *y, double *ye)
-{
- amdmsFIT_DATA_ENV *env = (amdmsFIT_DATA_ENV*)henv;
- int iPoint;
- int nDP;
- double refQuality;
- int currDP;
- double currQuality;
- int foundDP;
- double foundQuality;
- int nDelCounter;
-
- if (amdmsAllocSpaceData(env, n) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- env->env.nDataPoints = n;
- env->valX = x;
- env->valY = y;
- env->valYErr = ye;
- for (iPoint = 0; iPoint < env->env.nDataPoints; iPoint++) {
- env->useFlags[iPoint] = 1;
- }
- env->satDP = -1;
- if (amdmsFindDataSaturation(env) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- nDP = 0;
- env->firstDP = env->env.nDataPoints - 1;
- env->lastDP = 0;
- for (iPoint = 0; iPoint < env->env.nDataPoints; iPoint++) {
- if (env->useFlags[iPoint]) {
- env->firstDP = MIN(env->firstDP, iPoint);
- env->lastDP = MAX(env->lastDP, iPoint);
- nDP++;
- }
- }
- refQuality = amdmsTryDataFit(env); /* use all data points */
- /* first descard data points from the end */
- nDelCounter = env->nDelEnd;
- while ((nDP > amdmsMIN_DATAPOINTS) && (nDelCounter > 0)) {
- /* test if we can improve the quality by discarding the last point */
- env->useFlags[env->lastDP] = 0; /* do not use the last data point */
- currQuality = amdmsTryDataFit(env);
- if (currQuality < (1.0 - env->minStep)*refQuality) {
- /* we can improve the qualitiy of the fit */
- env->lastDP--;
- refQuality = currQuality;
- nDP--;
- nDelCounter--;
- } else {
- /* no improvement possible */
- env->useFlags[env->lastDP] = 1; /* use last data point and finish */
- break;
- }
- }
- /* then discard data points from the beginning */
- nDelCounter = env->nDelStart;
- while ((nDP > amdmsMIN_DATAPOINTS) && (nDelCounter > 0)) {
- /* test if we can improve the quality by discarding the first point */
- env->useFlags[env->firstDP] = 0; /* do not use the first data point */
- currQuality = amdmsTryDataFit(env);
- if (currQuality < (1.0 - env->minStep)*refQuality) {
- /* we can improve the qualitiy of the fit */
- env->firstDP++;
- refQuality = currQuality;
- nDP--;
- nDelCounter--;
- } else {
- /* no improvement possible */
- env->useFlags[env->firstDP] = 1; /* use current data point */
- break;
- }
- }
- /* test if we can improve the quality by discarding one data point including the first and the last point */
- nDelCounter = env->nDelMiddle;
- while ((nDP > amdmsMIN_DATAPOINTS) && (nDelCounter > 0)) {
- foundDP = -1;
- foundQuality = refQuality;
- for (currDP = env->firstDP; currDP <= env->lastDP; currDP++) {
- if (env->useFlags[currDP] == 0) continue;
- env->useFlags[currDP] = 0; /* do not use current data point */
- currQuality = amdmsTryDataFit(env);
- if (currQuality < (1.0 - env->minStep)*refQuality) {
- foundDP = currDP;
- foundQuality = currQuality;
- }
- env->useFlags[currDP] = 1; /* use current data point again */
- }
- if (foundDP != -1) {
- /* we have a possible invalid data point found! */
- env->useFlags[foundDP] = 0;
- refQuality = foundQuality;
- nDP--;
- nDelCounter--;
- } else {
- /* no improvement possible */
- break;
- }
- }
- /* do the real fit */
- amdmsTryDataFit(env);
- return amdmsSUCCESS;
-}
-
-double amdmsEvalData(void *henv, double x)
-{
- amdmsFIT_DATA_ENV *env = (amdmsFIT_DATA_ENV*)henv;
-
- if (env == NULL) {
- return 0.0;
- } else {
- return amdmsEvalFit(env->fit, x);
- }
-}
-
-amdmsCOMPL amdmsFindSmoothDataOutliers(amdmsFIT_SMOOTH_DATA_ENV *env)
-{
- int i;
- double limit;
-
- /* amdmsDebug(__FILE__, __LINE__, "# FindOutliers():"); */
- env->avgSlope = 0.0;
- env->avgSlopeDifference = 0.0;
- if (env->env.env.nDataPoints < 5) {
- /* not enough data points, we need at least five values */
- return amdmsFAILURE;
- }
- /* calculate all slopes of a polyline as angles [-PI .. +PI] */
- /* amdmsDebug(__FILE__, __LINE__, "# Slopes:"); */
- for (i = 0; i < env->env.env.nDataPoints - 1; i++) {
- double dx = env->env.valX[i + 1] - env->env.valX[i];
- double dy = env->env.valY[i + 1] - env->env.valY[i];
- env->slopes[i] = atan2(dy, dx);
- /* amdmsDebug(__FILE__, __LINE__, "# %3d = %12.4f", i, env->slopes[i]); */
- env->avgSlope += env->slopes[i];
- }
- env->avgSlope /= (double)(env->env.env.nDataPoints - 1);
- /* amdmsDebug(__FILE__, __LINE__, "# avg = %12.4f", avgSlope); */
- /* calculate slope difference */
- /* amdmsDebug(__FILE__, __LINE__, "# Slope differences:"); */
- for (i = 1; i < env->env.env.nDataPoints - 1; i++) {
- env->slopeDifferences[i] = env->slopes[i] - env->slopes[i - 1];
- /* amdmsDebug(__FILE__, __LINE__, "# %3d = %12.4f", i, env->slopeDifferences[i]); */
- env->avgSlopeDifference += fabs(env->slopeDifferences[i]);
- }
- env->avgSlopeDifference = fabs(env->avgSlopeDifference/(double)(env->env.env.nDataPoints - 2)); /* average slope difference */
- /* amdmsDebug(__FILE__, __LINE__, "# avg = %12.4f", env->avgSlopeDifference); */
- limit = env->avgSlopeDifference*env->slopeLimit;
- /* test special case #1: first data point, assume that all other data points are correct */
- if (fabs(env->slopeDifferences[1]) > limit) {
- /* amdmsDebug(__FILE__, __LINE__, "# outlier found %d", 0); */
- env->env.useFlags[0] = 0;
- }
- /* test special case #2: last data point, assume that all other data points are correct */
- if (fabs(env->slopeDifferences[env->env.env.nDataPoints - 2]) > limit) {
- /* amdmsDebug(__FILE__, __LINE__, "# outlier found %d", nDataPoints - 1); */
- env->env.useFlags[env->env.env.nDataPoints - 1] = 0;
- }
- /* test all intermediate cases */
- for (i = 2; i < env->env.env.nDataPoints - 2; i++) {
- if (fabs(env->slopeDifferences[i]) <= limit) continue;
- if (fabs(env->slopeDifferences[i + 1]) <= limit) continue;
- /* amdmsDebug(__FILE__, __LINE__, "# outlier found %d", i); */
- env->env.useFlags[i] = 0;
- i++;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsFindSmoothDataSaturation(amdmsFIT_SMOOTH_DATA_ENV *env)
-{
- int i;
- int lowerSlopeCount = 0;
- double lowerSlope = 0.0;
- int upperSlopeCount = 0;
- double upperSlope = 0.0;
- double limit;
- int satFound = 0;
- int belowFlag = 0;
-
- /* amdmsDebug(__FILE__, __LINE__, "# FindSaturation():"); */
- /* step #1: test if two dominant slopes are present */
- for (i = 0; i < env->env.env.nDataPoints - 1; i++) {
- if (env->env.useFlags[i] == 0) continue; /* skip outliers */
- if (env->slopes[i] < env->avgSlope) {
- lowerSlopeCount++;
- lowerSlope += env->slopes[i];
- } else {
- upperSlopeCount++;
- upperSlope += env->slopes[i];
- }
- }
- lowerSlope /= (double)lowerSlopeCount;
- upperSlope /= (double)upperSlopeCount;
- if (fabs(lowerSlope - upperSlope) < 10.0/180.0*M_PI) {
- /* difference between the two slopes is less than 10 degrees -> no saturation present */
- return amdmsSUCCESS;
- }
- /* step #2: adjust slope limit */
- limit = 0.5*(lowerSlope + upperSlope);
- /* step #3: find the direction of the saturation limit (below of above the limit) */
- for (i = 0; i < env->env.env.nDataPoints; i++) {
- if (env->env.useFlags[i] == 0) continue; /* skip outliers */
- if (env->slopes[i] > limit) {
- belowFlag = 1;
- } else {
- belowFlag = 0;
- }
- break;
- }
- /* amdmsDebug(__FILE__, __LINE__, "# saturation limit %.4f", limit); */
- /* step #4: mark data points */
- for (i = 0; i < env->env.env.nDataPoints - 1; i++) {
- if (env->env.useFlags[i] == 0) continue; /* skip outliers */
- if ((belowFlag && (env->slopes[i] < limit)) || (!belowFlag && (env->slopes[i] > limit))) {
- /* amdmsDebug(__FILE__, __LINE__, "# saturation found %d", i); */
- env->env.useFlags[i] = 0;
- satFound = 1;
- }
- }
- if (satFound && (env->env.useFlags[env->env.env.nDataPoints - 1] != 0)) {
- /* amdmsDebug(__FILE__, __LINE__, "# saturation found %d", nDataPoints - 1); */
- env->env.useFlags[env->env.env.nDataPoints - 1] = 0;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsAllocSpaceSmoothData(amdmsFIT_SMOOTH_DATA_ENV *env, int nDPs)
-{
- if (env->env.env.nDataPoints == nDPs) {
- return amdmsSUCCESS;
- }
- if (amdmsAllocSpaceData(&(env->env), nDPs) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- /* allocate vector slopes */
- env->slopes = (double *)realloc(env->slopes, (nDPs + 1)*sizeof(double));
- if (env->slopes == NULL) {
- return amdmsFAILURE;
- }
- /* allocate vector slopeDifferences */
- env->slopeDifferences = (double *)realloc(env->slopeDifferences, (nDPs + 1)*sizeof(double));
- if (env->slopeDifferences == NULL) {
- return amdmsFAILURE;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsFitSmoothData(void *henv, int n, double *x, double *y, double *ye)
-{
- amdmsFIT_SMOOTH_DATA_ENV *env = (amdmsFIT_SMOOTH_DATA_ENV*)henv;
- int iPoint;
- int nDP;
- double refQuality;
- double currQuality;
- int nDelCounter;
-
- if (amdmsAllocSpaceSmoothData(env, n) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- env->env.env.nDataPoints = n;
- env->env.valX = x;
- env->env.valY = y;
- env->env.valYErr = ye;
- for (iPoint = 0; iPoint < env->env.env.nDataPoints; iPoint++) {
- env->env.useFlags[iPoint] = 1;
- }
- env->env.satDP = -1;
- if (amdmsFindSmoothDataOutliers(env) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsFindSmoothDataSaturation(env) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- nDP = 0;
- env->env.firstDP = env->env.env.nDataPoints - 1;
- env->env.lastDP = 0;
- for (iPoint = 0; iPoint < env->env.env.nDataPoints; iPoint++) {
- if (env->env.useFlags[iPoint]) {
- env->env.firstDP = MIN(env->env.firstDP, iPoint);
- env->env.lastDP = MAX(env->env.lastDP, iPoint);
- nDP++;
- }
- }
- refQuality = amdmsTryDataFit(&(env->env)); /* use all data points */
- /* first descard data points from the end */
- nDelCounter = env->env.nDelEnd;
- while ((nDP > amdmsMIN_DATAPOINTS) && (nDelCounter > 0)) {
- while (env->env.useFlags[env->env.lastDP] == 0) {
- env->env.lastDP--;
- }
- /* test if we can improve the quality by discarding the last point */
- env->env.useFlags[env->env.lastDP] = 0; /* do not use the last data point */
- currQuality = amdmsTryDataFit(&(env->env));
- if (currQuality < (1.0 - env->env.minStep)*refQuality) {
- /* we can improve the qualitiy of the fit */
- /* amdmsDebug(__FILE__, __LINE__, "# discard %d", env->env.lastDP); */
- env->env.lastDP--;
- refQuality = currQuality;
- nDP--;
- nDelCounter--;
- } else {
- /* no improvement possible */
- env->env.useFlags[env->env.lastDP] = 1; /* use last data point and finish */
- break;
- }
- }
- /* then discard data points from the beginning */
- nDelCounter = env->env.nDelStart;
- while ((nDP > amdmsMIN_DATAPOINTS) && (nDelCounter > 0)) {
- while (env->env.useFlags[env->env.firstDP] == 0) {
- env->env.firstDP++;
- }
- /* test if we can improve the quality by discarding the first point */
- env->env.useFlags[env->env.firstDP] = 0; /* do not use the first data point */
- currQuality = amdmsTryDataFit(&(env->env));
- if (currQuality < (1.0 - env->env.minStep)*refQuality) {
- /* we can improve the qualitiy of the fit */
- /* amdmsDebug(__FILE__, __LINE__, "# discard %d", firstDP); */
- env->env.firstDP++;
- refQuality = currQuality;
- nDP--;
- nDelCounter--;
- } else {
- /* no improvement possible */
- env->env.useFlags[env->env.firstDP] = 1; /* use current data point */
- break;
- }
- }
- /* do the real fit */
- amdmsTryDataFit(&(env->env));
- return amdmsSUCCESS;
-}
-
-double amdmsEvalSmoothData(void *henv, double x)
-{
- amdmsFIT_SMOOTH_DATA_ENV *env = (amdmsFIT_SMOOTH_DATA_ENV*)henv;
-
- if (env == NULL) {
- return 0.0;
- } else {
- return amdmsEvalData(&(env->env), x);
- }
-}
-
-amdmsCOMPL amdmsCreateFit(amdmsFIT_ENV **env,
- amdmsFIT_FUNC func,
- amdmsFIT_EVAL eval,
- int nCoefficients)
-{
- amdmsFIT_ENV *henv = NULL;
- int i;
-
- if (*env == NULL) {
- henv = (amdmsFIT_ENV*)calloc((size_t)1, sizeof(amdmsFIT_ENV));
- if (henv == NULL) {
- return amdmsFAILURE;
- }
- henv->allocated = 1;
- *env = henv;
- } else {
- henv = *env;
- henv->allocated = 0;
- }
- henv->func = func;
- henv->eval = eval;
- henv->nCoefficients = nCoefficients;
- henv->nDataPoints = 0;
- henv->chi2 = 0.0;
- henv->absDist2 = 0.0;
- henv->relDist2 = 0.0;
- henv->fitLowerLimit = 0.0;
- henv->fitUpperLimit = 0.0;
- for (i = 0; i < amdmsMAX_COEFF; i++) {
- henv->a[i] = 0.0;
- henv->ae[i] = 0.0;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsDestroyFit(amdmsFIT_ENV **env)
-{
- amdmsFIT_ENV *henv = NULL;
-
- if (env == NULL) {
- return amdmsFAILURE;
- }
- if (*env == NULL) {
- return amdmsSUCCESS;
- }
- henv = (amdmsFIT_ENV*)(*env);
- if (henv->allocated) {
- henv->allocated = 0;
- free(henv);
- *env = NULL;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCreateStraightLineFit(amdmsFIT_ENV **env)
-{
- return amdmsCreateFit(env, amdmsFitLine, amdmsEvalLine, 2);
-}
-
-amdmsCOMPL amdmsCreateExponentialFit(amdmsFIT_ENV **env)
-{
- return amdmsCreateFit(env, amdmsFitExp, amdmsEvalExp, 2);
-}
-
-amdmsCOMPL amdmsCreateLogarithmicFit(amdmsFIT_ENV **env)
-{
- return amdmsCreateFit(env, amdmsFitLog, amdmsEvalLog, 2);
-}
-
-amdmsCOMPL amdmsCreateLinearFit(amdmsFIT_LINEAR_ENV **env,
- amdmsFIT_LINEAR_BASE base,
- int nCoefficients)
-{
- amdmsFIT_ENV *henv = NULL;
- amdmsFIT_LINEAR_ENV *hhenv = NULL;
-
- /* allocate the structure if neccessary */
- if (*env == NULL) {
- hhenv = (amdmsFIT_LINEAR_ENV*)calloc((size_t)1, sizeof(amdmsFIT_LINEAR_ENV));
- if (hhenv == NULL) {
- return amdmsFAILURE;
- }
- henv = &(hhenv->env);
- /* call the initialization of a simple fit environment */
- if (amdmsCreateFit(&henv, amdmsFitLinear, amdmsEvalLinear, nCoefficients) != amdmsSUCCESS) {
- free(hhenv);
- return amdmsFAILURE;
- }
- hhenv->allocated = 1;
- *env = hhenv;
- } else {
- /* call the initialization of a simple fit environment */
- hhenv = *env;
- henv = &(hhenv->env);
- if (amdmsCreateFit(&henv, amdmsFitLinear, amdmsEvalLinear, nCoefficients) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- hhenv->allocated = 0;
- }
- /* initialize only the additional members */
- hhenv->base = base;
- hhenv->matU = NULL;
- hhenv->matV = NULL;
- hhenv->vecW = NULL;
- hhenv->vecB = NULL;
- hhenv->matCvm = NULL;
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsDestroyLinearFit(amdmsFIT_LINEAR_ENV **env)
-{
- amdmsFIT_LINEAR_ENV *henv = NULL;
- amdmsFIT_ENV *hhenv = NULL;
-
- if (env == NULL) {
- return amdmsFAILURE;
- }
- if (*env == NULL) {
- return amdmsSUCCESS;
- }
- henv = *env;
- if (henv->matU != NULL) {
- free(henv->matU[0]);
- free(henv->matU);
- henv->matU = NULL;
- }
- if (henv->matV != NULL) {
- free(henv->matV[0]);
- free(henv->matV);
- henv->matV = NULL;
- }
- if (henv->matCvm != NULL) {
- free(henv->matCvm[0]);
- free(henv->matCvm);
- henv->matCvm = NULL;
- }
- if (henv->vecW != NULL) {
- free(henv->vecW);
- henv->vecW = NULL;
- }
- if (henv->vecB != NULL) {
- free(henv->vecB);
- henv->vecB = NULL;
- }
- hhenv = &(henv->env);
- if (amdmsDestroyFit(&hhenv) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (henv->allocated) {
- henv->allocated = 0;
- free(henv);
- *env = NULL;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCreatePolynomialFit(amdmsFIT_LINEAR_ENV **env, int degree)
-{
- return amdmsCreateLinearFit(env, amdmsPolynomialBaseFunc, degree + 1);
-}
-
-amdmsCOMPL amdmsCreateRayFit(amdmsFIT_LINEAR_ENV **env)
-{
- return amdmsCreateLinearFit(env, amdmsRayBaseFunc, 1);
-}
-
-amdmsCOMPL amdmsCreateNonLinearFit(amdmsFIT_NONLINEAR_ENV **env,
- amdmsFIT_NONLINEAR_INIT init,
- amdmsFIT_NONLINEAR_BASE base,
- int nCoefficients)
-{
- amdmsFIT_ENV *henv = NULL;
- amdmsFIT_NONLINEAR_ENV *hhenv = NULL;
-
- /* allocate the structure if neccessary */
- if (*env == NULL) {
- hhenv = (amdmsFIT_NONLINEAR_ENV*)calloc((size_t)1, sizeof(amdmsFIT_NONLINEAR_ENV));
- if (hhenv == NULL) {
- return amdmsFAILURE;
- }
- henv = &(hhenv->env);
- /* call the initialization of a simple fit environment */
- if (amdmsCreateFit(&henv, amdmsFitNonLinear, amdmsEvalNonLinear, nCoefficients) != amdmsSUCCESS) {
- free(hhenv);
- return amdmsFAILURE;
- }
- hhenv->allocated = 1;
- *env = hhenv;
- } else {
- /* call the initialization of a simple fit environment */
- hhenv = *env;
- henv = &(hhenv->env);
- if (amdmsCreateFit(&henv, amdmsFitNonLinear, amdmsEvalNonLinear, nCoefficients) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- hhenv->allocated = 0;
- }
- /* initialize only the additional members */
- hhenv->init = init;
- hhenv->base = base;
- hhenv->ivecIndxc = NULL;
- hhenv->ivecIndxr = NULL;
- hhenv->ivecIpiv = NULL;
- hhenv->vecDyda = NULL;
- hhenv->ochi2 = 0.0;
- hhenv->vecAtry = NULL;
- hhenv->vecBeta = NULL;
- hhenv->vecDa = NULL;
- hhenv->matOneda = NULL;
- hhenv->mfit = 0;
- hhenv->ivecIa = NULL;
- hhenv->alamda = 0.0;
- hhenv->matCvm = NULL;
- hhenv->matAlpha = NULL;
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsDestroyNonLinearFit(amdmsFIT_NONLINEAR_ENV **env)
-{
- amdmsFIT_NONLINEAR_ENV *henv = NULL;
- amdmsFIT_ENV *hhenv = NULL;
-
- if (env == NULL) {
- return amdmsFAILURE;
- }
- if (*env == NULL) {
- return amdmsSUCCESS;
- }
- henv = *env;
- if (henv->matOneda != NULL) {
- free(henv->matOneda[0]);
- free(henv->matOneda);
- henv->matOneda = NULL;
- }
- if (henv->matCvm != NULL) {
- free(henv->matCvm[0]);
- free(henv->matCvm);
- henv->matCvm = NULL;
- }
- if (henv->matAlpha != NULL) {
- free(henv->matAlpha[0]);
- free(henv->matAlpha);
- henv->matAlpha = NULL;
- }
- if (henv->ivecIndxc != NULL) {
- free(henv->ivecIndxc);
- henv->ivecIndxc = NULL;
- }
- if (henv->ivecIndxr != NULL) {
- free(henv->ivecIndxr);
- henv->ivecIndxr = NULL;
- }
- if (henv->ivecIpiv != NULL) {
- free(henv->ivecIpiv);
- henv->ivecIpiv = NULL;
- }
- if (henv->vecDyda != NULL) {
- free(henv->vecDyda);
- henv->vecDyda = NULL;
- }
- if (henv->vecAtry != NULL) {
- free(henv->vecAtry);
- henv->vecAtry = NULL;
- }
- if (henv->vecBeta != NULL) {
- free(henv->vecBeta);
- henv->vecBeta = NULL;
- }
- if (henv->vecDa != NULL) {
- free(henv->vecDa);
- henv->vecDa = NULL;
- }
- if (henv->ivecIa != NULL) {
- free(henv->ivecIa);
- henv->ivecIa = NULL;
- }
- hhenv = &(henv->env);
- if (amdmsDestroyFit(&hhenv) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (henv->allocated) {
- henv->allocated = 0;
- free(henv);
- *env = NULL;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCreateNonLinearPixelFit(amdmsFIT_NONLINEAR_ENV **env)
-{
- return amdmsCreateNonLinearFit(env, amdmsNonLinearPixelInit, amdmsNonLinearPixelBaseFunc, 2);
-}
-
-amdmsCOMPL amdmsCreateElectronicBiasFit(amdmsFIT_NONLINEAR_ENV **env)
-{
- return amdmsCreateNonLinearFit(env, amdmsElectronicBiasInit, amdmsElectronicBiasBaseFunc, amdmsEBFIT_NCOEFF);
-}
-
-amdmsCOMPL amdmsCreateGeneralExpFit(amdmsFIT_NONLINEAR_ENV **env)
-{
- return amdmsCreateNonLinearFit(env, amdmsGeneralExpInit, amdmsGeneralExpBaseFunc, 3);
-}
-
-amdmsCOMPL amdmsCreateConversionFactorFit(amdmsFIT_NONLINEAR_ENV **env)
-{
- return amdmsCreateNonLinearFit(env, amdmsConversionFactorInit, amdmsConversionFactorBaseFunc, amdmsCFFIT_NCOEFF);
-}
-
-amdmsCOMPL amdmsCreateDataFit(amdmsFIT_DATA_ENV **env, amdmsFIT_ENV *fit)
-{
- amdmsFIT_ENV *henv = NULL;
- amdmsFIT_DATA_ENV *hhenv;
-
- /* allocate the structure if neccessary */
- if (*env == NULL) {
- hhenv = (amdmsFIT_DATA_ENV*)calloc((size_t)1, sizeof(amdmsFIT_DATA_ENV));
- if (hhenv == NULL) {
- return amdmsFAILURE;
- }
- henv = &(hhenv->env);
- /* call the initialization of a simple fit environment */
- if (amdmsCreateFit(&henv, amdmsFitData, amdmsEvalData, fit->nCoefficients) != amdmsSUCCESS) {
- free(hhenv);
- return amdmsFAILURE;
- }
- hhenv->allocated = 1;
- *env = hhenv;
- } else {
- /* call the initialization of a simple fit environment */
- hhenv = *env;
- henv = &(hhenv->env);
- if (amdmsCreateFit(&henv, amdmsFitData, amdmsEvalData, fit->nCoefficients) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- hhenv = *env;
- hhenv->allocated = 0;
- }
- hhenv = *env;
- hhenv->fit = fit;
- hhenv->valX = NULL;
- hhenv->valY = NULL;
- hhenv->valYErr = NULL;
- hhenv->useFlags = NULL;
- hhenv->usedX = NULL;
- hhenv->usedY = NULL;
- hhenv->usedYErr = NULL;
- hhenv->satFlag = 0;
- hhenv->satWidth = 0.0;
- hhenv->satHeight = 0.0;
- hhenv->satDP = 0;
- hhenv->firstDP = 0;
- hhenv->lastDP = 0;
- hhenv->nDelStart = 0;
- hhenv->nDelMiddle = 1;
- hhenv->nDelEnd = 0;
- hhenv->minStep = 0.2;
- hhenv->maxRelDist = 0.01;
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsDestroyDataFit(amdmsFIT_DATA_ENV **env)
-{
- amdmsFIT_DATA_ENV *henv = NULL;
- amdmsFIT_ENV *hhenv = NULL;
-
- if (env == NULL) {
- return amdmsFAILURE;
- }
- if (*env == NULL) {
- return amdmsSUCCESS;
- }
- henv = *env;
- if (henv->useFlags != NULL) {
- free(henv->useFlags);
- henv->useFlags = NULL;
- }
- if (henv->usedX != NULL) {
- free(henv->usedX);
- henv->usedX = NULL;
- }
- if (henv->usedY != NULL) {
- free(henv->usedY);
- henv->usedY = NULL;
- }
- if (henv->usedYErr != NULL) {
- free(henv->usedYErr);
- henv->usedYErr = NULL;
- }
- hhenv = &(henv->env);
- if (amdmsDestroyFit(&hhenv) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (henv->allocated) {
- henv->allocated = 0;
- free(henv);
- *env = NULL;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCreateSmoothDataFit(amdmsFIT_SMOOTH_DATA_ENV **env, amdmsFIT_ENV *fit)
-{
- amdmsFIT_DATA_ENV *henv = NULL;
- amdmsFIT_SMOOTH_DATA_ENV *hhenv;
-
- /* allocate the structure if neccessary */
- if (*env == NULL) {
- hhenv = (amdmsFIT_SMOOTH_DATA_ENV*)calloc((size_t)1, sizeof(amdmsFIT_SMOOTH_DATA_ENV));
- if (hhenv == NULL) {
- return amdmsFAILURE;
- }
- henv = &(hhenv->env);
- /* call the initialization of a simple fit environment */
- if (amdmsCreateDataFit(&henv, fit) != amdmsSUCCESS) {
- free(hhenv);
- return amdmsFAILURE;
- }
- *env = hhenv;
- hhenv->allocated = 1;
- } else {
- /* call the initialization of a simple fit environment */
- hhenv = *env;
- henv = &(hhenv->env);
- if (amdmsCreateDataFit(&henv, fit) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- hhenv = *env;
- hhenv->allocated = 0;
- }
- hhenv = *env;
- hhenv->env.env.func = amdmsFitSmoothData;
- hhenv->env.env.eval = amdmsEvalSmoothData;
- hhenv->slopeLimit = 5.0; /* 5 times the average slope */
- hhenv->slopes = NULL;
- hhenv->slopeDifferences = NULL;
- hhenv->avgSlope = 0.0;
- hhenv->avgSlopeDifference = 0.0;
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsDestroySmoothDataFit(amdmsFIT_SMOOTH_DATA_ENV **env)
-{
- amdmsFIT_SMOOTH_DATA_ENV *henv = NULL;
- amdmsFIT_DATA_ENV *hhenv = NULL;
-
- if (env == NULL) {
- return amdmsFAILURE;
- }
- if (*env == NULL) {
- return amdmsSUCCESS;
- }
- henv = *env;
- if (henv->slopes != NULL) {
- free(henv->slopes);
- henv->slopes = NULL;
- }
- if (henv->slopeDifferences != NULL) {
- free(henv->slopeDifferences);
- henv->slopeDifferences = NULL;
- }
- hhenv = &(henv->env);
- if (amdmsDestroyDataFit(&hhenv) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (henv->allocated) {
- henv->allocated = 0;
- free(henv);
- *env = NULL;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsDoFit(amdmsFIT_ENV *env, int n, double *x, double *y, double *ye)
-{
- if (env == NULL) {
- return amdmsFAILURE;
- }
- if (env->func == NULL) {
- return amdmsFAILURE;
- }
- if (env->func(env, n, x, y, ye) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- return amdmsCalcQuality(env, n, x, y, ye);
-}
-
-double amdmsEvalFit(amdmsFIT_ENV *env, double x)
-{
- if (env == NULL) {
- return 0.0;
- }
- if (env->eval == NULL) {
- return 0.0;
- }
- return env->eval(env, x);
-}
-
-amdmsCOMPL amdmsCalcFitLimits(amdmsFIT_ENV *env, int n, double *x, double *y, double *ye, double relLimit)
-{
- int i;
- int lowerLimitFlag = 0;
- double val = 0.0;
- double tmp = 0.0;
- double limit = 0.0;
-
- if ((env == NULL) || (env->eval == NULL) || (x == NULL) || (y == NULL)) {
- return amdmsFAILURE;
- }
- for (i = 0; i < n; i++) {
- val = env->eval(env, x[i]);
- tmp = fabs(y[i] - val);
- if (y[i] != 0.0) {
- limit = y[i]*relLimit;
- if (ye != NULL) {
- limit = MAX(limit, ye[i]);
- }
- if (tmp <= limit) {
- env->fitUpperLimit = x[i];
- if (!lowerLimitFlag)
- {
- env->fitLowerLimit = x[i];
- lowerLimitFlag = 1;
- }
- }
- } else {
- limit = ye[i];
- if (ye != NULL) {
- limit = MAX(limit, ye[i]);
- }
- if (tmp <= limit) {
- env->fitUpperLimit = x[i];
- if (!lowerLimitFlag) {
- env->fitLowerLimit = x[i];
- lowerLimitFlag = 1;
- }
- }
- }
- }
- return amdmsSUCCESS;
-}
-
-/* Graphic Gems IV, ed. Paul S. Heckbert,
- IV.1 Smoothing and Interpolation with Finite Differences, page 241
-*/
-amdmsCOMPL amdmsSmoothDataByFiniteDiff1(double *y, double *z, double lambda, int m)
- /* Smoothing and interpolation with first differences.
- Input: data(y): vector from 0 to m - 1.
- Input: smoothing parameter (lambda, length (m).
- Output: smoothed vector (z): vector from 0 to m - 1.
- */
-{
- int i;
- int i1;
- double *c = NULL;
- double *d = NULL;
-
- c = (double*)calloc((size_t)m, sizeof(double));
- if (c == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (c)");
- return amdmsFAILURE;
- }
- d = (double*)calloc((size_t)m, sizeof(double));
- if (d == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (d)");
- free(c);
- return amdmsFAILURE;
- }
- d[0] = 1.0 + lambda;
- c[0] = -lambda/d[0];
- z[0] = y[0];
- for (i = 1; i < m - 1; i++) {
- i1 = i - 1;
- d[i] = 1.0 + 2*lambda - c[i1]*c[i1]*d[i1];
- c[i] = -lambda/d[i];
- z[i] = y[i] - c[i1]*z[i1];
- }
- d[m - 1] = 1.0 + lambda - c[m - 2]*c[m - 2]*d[m - 2];
- z[m - 1] = (y[m - 1] - c[m - 2]*z[m - 2])/d[m - 1];
- for (i = m - 2; 0 <= i; i--) {
- z[i] = z[i]/d[i] - c[i]*z[i + 1];
- }
- free(c);
- free(d);
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsSmoothDataByFiniteDiff1W(double *w, double *y, double *z, double lambda, int m)
- /* Smoothing and interpolation with first differences.
- Input: weights (w), data(y): vector from 0 to m - 1.
- Input: smoothing parameter (lambda, length (m).
- Output: smoothed vector (z): vector from 0 to m - 1.
- */
-{
- int i;
- int i1;
- double *c = NULL;
- double *d = NULL;
-
- c = (double*)calloc((size_t)m, sizeof(double));
- if (c == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (c)");
- return amdmsFAILURE;
- }
- d = (double*)calloc((size_t)m, sizeof(double));
- if (d == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (d)");
- free(c);
- return amdmsFAILURE;
- }
- d[0] = w[0] + lambda;
- c[0] = -lambda/d[0];
- z[0] = w[0]*y[0];
- for (i = 1; i < m - 1; i++) {
- i1 = i - 1;
- d[i] = w[i] + 2*lambda - c[i1]*c[i1]*d[i1];
- c[i] = -lambda/d[i];
- z[i] = w[i]*y[i] - c[i1]*z[i1];
- }
- d[m - 1] = w[m - 1] + lambda - c[m - 2]*c[m - 2]*d[m - 2];
- z[m - 1] = (w[m - 1]*y[m - 1] - c[m - 2]*z[m - 2])/d[m - 1];
- for (i = m - 2; 0 <= i; i--) {
- z[i] = z[i]/d[i] - c[i]*z[i + 1];
- }
- free(c);
- free(d);
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsSmoothDataByFiniteDiff2(double *y, double *z, double lambda, int m)
- /* Smoothing and interpolation with second differences.
- Input: data(y): vector from 0 to m - 1.
- Input: smoothing parameter (lambda, length (m).
- Output: smoothed vector (z): vector from 0 to m - 1.
- */
-{
- int i;
- int i1;
- int i2;
- double *c = NULL;
- double *d = NULL;
- double *e = NULL;
-
- c = (double*)calloc((size_t)m, sizeof(double));
- if (c == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (c)");
- return amdmsFAILURE;
- }
- d = (double*)calloc((size_t)m, sizeof(double));
- if (d == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (d)");
- free(c);
- return amdmsFAILURE;
- }
- e = (double*)calloc((size_t)m, sizeof(double));
- if (e == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (e)");
- free(c);
- free(d);
- return amdmsFAILURE;
- }
- d[0] = 1.0 + lambda;
- c[0] = -2*lambda/d[0];
- e[0] = lambda/d[0];
- z[0] = y[0];
- d[1] = 1.0 + 5*lambda - d[0]*c[0]*c[0];
- c[1] = (-4*lambda - d[0]*c[0]*e[0])/d[1];
- e[1] = lambda/d[1];
- z[1] = y[1] - c[0]*z[0];
- for (i = 2; i < m - 2; i++) {
- i1 = i - 1;
- i2 = i - 2;
- d[i] = 1.0 + 6*lambda - c[i1]*c[i1]*d[i1] - e[i2]*e[i2]*d[i2];
- c[i] = (-4*lambda - d[i1]*c[i1]*e[i1])/d[i];
- e[i] = lambda/d[i];
- z[i] = y[i] - c[i1]*z[i1] - e[i2]*z[i2];
- }
- i1 = m - 3;
- i2 = m - 4;
- d[m - 2] = 1.0 + 5*lambda - c[i1]*c[i1]*d[i1] - e[i2]*e[i2]*d[i2];
- c[m - 2] = (-2*lambda - d[i1]*c[i1]*e[i1])/d[m - 2];
- z[m - 2] = y[m - 2] - c[i1]*z[i1] - e[i2]*z[i2];
- i1 = m - 2;
- i2 = m - 3;
- d[m - 1] = 1.0 + lambda - c[i1]*c[i1]*d[i1] - e[i2]*e[i2]*d[i2];
- z[m - 1] = (y[m - 1] - c[i1]*z[i1] - e[i2]*z[i2])/d[m - 1];
- z[m - 2] = z[m - 2]/d[m - 2] - c[m - 2]*z[m - 1];
- for (i = m - 3; 0 <= i; i--) {
- z[i] = z[i]/d[i] - c[i]/z[i + 1] - e[i]*z[i + 2];
- }
- free(c);
- free(d);
- free(e);
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsSmoothDataByFiniteDiff2W(double *w, double *y, double *z, double lambda, int m)
- /* Smoothing and interpolation with second differences.
- Input: weights (w), data(y): vector from 0 to m - 1.
- Input: smoothing parameter (lambda, length (m).
- Output: smoothed vector (z): vector from 0 to m - 1.
- */
-{
- int i;
- int i1;
- int i2;
- double *c = NULL;
- double *d = NULL;
- double *e = NULL;
-
- c = (double*)calloc((size_t)m, sizeof(double));
- if (c == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (c)");
- return amdmsFAILURE;
- }
- d = (double*)calloc((size_t)m, sizeof(double));
- if (d == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (d)");
- free(c);
- return amdmsFAILURE;
- }
- e = (double*)calloc((size_t)m, sizeof(double));
- if (e == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (e)");
- free(c);
- free(d);
- return amdmsFAILURE;
- }
- d[0] = w[0] + lambda;
- c[0] = -2*lambda/d[0];
- e[0] = lambda/d[0];
- z[0] = w[0]*y[0];
- d[1] = w[1] + 5*lambda - d[0]*c[0]*c[0];
- c[1] = (-4*lambda - d[0]*c[0]*e[0])/d[1];
- e[1] = lambda/d[1];
- z[1] = w[1]*y[1] - c[0]*z[0];
- for (i = 2; i < m - 2; i++) {
- i1 = i - 1;
- i2 = i - 2;
- d[i] = w[i] + 6*lambda - c[i1]*c[i1]*d[i1] - e[i2]*e[i2]*d[i2];
- c[i] = (-4*lambda - d[i1]*c[i1]*e[i1])/d[i];
- e[i] = lambda/d[i];
- z[i] = w[i]*y[i] - c[i1]*z[i1] - e[i2]*z[i2];
- }
- i1 = m - 3;
- i2 = m - 4;
- d[m - 2] = w[m - 2] + 5*lambda - c[i1]*c[i1]*d[i1] - e[i2]*e[i2]*d[i2];
- c[m - 2] = (-2*lambda - d[i1]*c[i1]*e[i1])/d[m - 2];
- z[m - 2] = w[m - 2]*y[m - 2] - c[i1]*z[i1] - e[i2]*z[i2];
- i1 = m - 2;
- i2 = m - 3;
- d[m - 1] = w[m - 1] + lambda - c[i1]*c[i1]*d[i1] - e[i2]*e[i2]*d[i2];
- z[m - 1] = (w[m - 1]*y[m - 1] - c[i1]*z[i1] - e[i2]*z[i2])/d[m - 1];
- z[m - 2] = z[m - 2]/d[m - 2] - c[m - 2]*z[m - 1];
- for (i = m - 3; 0 <= i; i--) {
- z[i] = z[i]/d[i] - c[i]*z[i + 1] - e[i]*z[i + 2];
- }
- free(c);
- free(d);
- free(e);
- return amdmsSUCCESS;
-}
diff --git a/amber/amdmsFit.h b/amber/amdmsFit.h
deleted file mode 100644
index 04ca036..0000000
--- a/amber/amdmsFit.h
+++ /dev/null
@@ -1,202 +0,0 @@
-#ifndef amdmsFit_H
-#define amdmsFit_H
-
-#include "amdms.h"
-
-#define amdmsMAX_COEFF 32
-
-
-typedef amdmsCOMPL (*amdmsFIT_FUNC)(void *env, int n, double *x, double *y, double *ye);
-typedef double (*amdmsFIT_EVAL)(void *env, double x);
-typedef void (*amdmsFIT_LINEAR_BASE)(double x, int np, double *p);
-typedef void (*amdmsFIT_NONLINEAR_BASE)(double x, int na, double *a, double *y, double *dyda);
-typedef void (*amdmsFIT_NONLINEAR_INIT)(void *henv, int n, double *x, double *y, double *ye);
-
-
-/******************************************************************************/
-/* environment for a simple fit */
-/******************************************************************************/
-typedef struct {
- amdmsFIT_FUNC func; /* do a fit */
- amdmsFIT_EVAL eval; /* evaluate the fit function */
- int nCoefficients; /* number of coefficients */
- int nDataPoints; /* number of data points */
- double chi2; /* chi squared */
- double absDist2; /* sum of absolute squared distances */
- double relDist2; /* sum of relative squared distances */
- double fitLowerLimit; /* lower limit for fit with given quality */
- double fitUpperLimit; /* upper limit for fit with given quality */
- double a[amdmsMAX_COEFF]; /* vector of all coefficients */
- double ae[amdmsMAX_COEFF]; /* vector of all coefficient errors */
- int allocated; /* flag if structure is allocated */
-} amdmsFIT_ENV;
-/******************************************************************************/
-
-
-/**********************************************************************/
-/* environment for a linear model fit */
-/**********************************************************************/
-typedef struct {
- amdmsFIT_ENV env; /* environment for a simple fit */
- amdmsFIT_LINEAR_BASE base; /* base function for linear model */
- double **matU; /* ??? */
- double **matV; /* ??? */
- double *vecW; /* ??? */
- double *vecB; /* ??? */
- double **matCvm; /* ??? */
- int allocated; /* flag if structure is allocated */
-} amdmsFIT_LINEAR_ENV;
-/**********************************************************************/
-
-
-/***************************************************************************/
-/* environment for a nonlinear model fit */
-/***************************************************************************/
-typedef struct {
- amdmsFIT_ENV env; /* environment for a simple fit */
- amdmsFIT_NONLINEAR_INIT init; /* initializer function */
- amdmsFIT_NONLINEAR_BASE base; /* base function for nonlinear model */
- int *ivecIndxc; /* ??? */
- int *ivecIndxr; /* ??? */
- int *ivecIpiv; /* ??? */
- double *vecDyda; /* ??? */
- double ochi2; /* ??? */
- double *vecAtry; /* ??? */
- double *vecBeta; /* ??? */
- double *vecDa; /* ??? */
- double **matOneda; /* ??? */
- int mfit; /* ??? */
- int *ivecIa; /* ??? */
- double alamda; /* ??? */
- double **matCvm; /* ??? */
- double **matAlpha; /* ??? */
- int allocated; /* flag if structure is allocated */
-} amdmsFIT_NONLINEAR_ENV;
-/***************************************************************************/
-
-
-/*****************************************************************************/
-/* environment for a fit process which recognizes outliers and saturation */
-/*****************************************************************************/
-typedef struct {
- amdmsFIT_ENV env; /* environment for a simple fit */
- amdmsFIT_ENV *fit; /* fit environment of real fit model */
- double *valX; /* vector with x values */
- double *valY; /* vector with y values */
- double *valYErr; /* vector with stderr (y) values */
- int *useFlags; /* flags if values are used */
- double *usedX; /* used x values */
- double *usedY; /* used y values */
- double *usedYErr; /* used stderr (y) values */
- int satFlag; /* flag if saturation should be recognized */
- double satWidth; /* relative width of saturation box */
- double satHeight; /* relative height of saturation box */
- int satDP; /* index of first data point at saturation level */
- int firstDP; /* index of first used data point */
- int lastDP; /* index of last used data point */
- int nDelStart; /* number of possible outliers from beginning */
- int nDelMiddle; /* number of possible outliers in the middle */
- int nDelEnd; /* number of possible outliers at end */
- double minStep; /* minimal required enhancement */
- double maxRelDist; /* maximum allowed relative distance */
- int allocated; /* flag if structure is allocated */
-} amdmsFIT_DATA_ENV;
-/*****************************************************************************/
-
-
-/***************************************************************************/
-/* environment for a fit process which recognizes outliers of smooth data */
-/***************************************************************************/
-typedef struct {
- amdmsFIT_DATA_ENV env; /* environment for a data fit */
- double slopeLimit; /* limit for outlier detection */
- double *slopes; /* all slopes */
- double *slopeDifferences; /* all slope differences */
- double avgSlope; /* average slope */
- double avgSlopeDifference; /* average slope difference */
- int allocated; /* flag if structure is allocated */
-} amdmsFIT_SMOOTH_DATA_ENV;
-/***************************************************************************/
-
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- amdmsCOMPL amdmsCreateFit(amdmsFIT_ENV **env,
- amdmsFIT_FUNC func,
- amdmsFIT_EVAL eval,
- int nCoefficients);
- amdmsCOMPL amdmsDestroyFit(amdmsFIT_ENV **env);
-
- amdmsCOMPL amdmsCreateLinearFit(amdmsFIT_LINEAR_ENV **env,
- amdmsFIT_LINEAR_BASE base,
- int nCoefficients);
- amdmsCOMPL amdmsDestroyLinearFit(amdmsFIT_LINEAR_ENV **env);
-
- amdmsCOMPL amdmsCreateNonLinearFit(amdmsFIT_NONLINEAR_ENV **env,
- amdmsFIT_NONLINEAR_INIT init,
- amdmsFIT_NONLINEAR_BASE base,
- int nCoefficients);
- amdmsCOMPL amdmsDestroyNonLinearFit(amdmsFIT_NONLINEAR_ENV **env);
-
- amdmsCOMPL amdmsCreateDataFit(amdmsFIT_DATA_ENV **env,
- amdmsFIT_ENV *fit);
- amdmsCOMPL amdmsDestroyDataFit(amdmsFIT_DATA_ENV **env);
-
- amdmsCOMPL amdmsCreateSmoothDataFit(amdmsFIT_SMOOTH_DATA_ENV **env,
- amdmsFIT_ENV *fit);
- amdmsCOMPL amdmsDestroySmoothDataFit(amdmsFIT_SMOOTH_DATA_ENV **env);
-
- amdmsCOMPL amdmsCreateStraightLineFit(amdmsFIT_ENV **env);
- amdmsCOMPL amdmsCreateExponentialFit(amdmsFIT_ENV **env);
- amdmsCOMPL amdmsCreateLogarithmicFit(amdmsFIT_ENV **env);
- amdmsCOMPL amdmsCreatePolynomialFit(amdmsFIT_LINEAR_ENV **env,
- int degree);
- amdmsCOMPL amdmsCreateRayFit(amdmsFIT_LINEAR_ENV **env);
- amdmsCOMPL amdmsCreateNonLinearPixelFit(amdmsFIT_NONLINEAR_ENV **env);
- amdmsCOMPL amdmsCreateGeneralExpFit(amdmsFIT_NONLINEAR_ENV **env);
- amdmsCOMPL amdmsCreateElectronicBiasFit(amdmsFIT_NONLINEAR_ENV **env);
- amdmsCOMPL amdmsCreateConversionFactorFit(amdmsFIT_NONLINEAR_ENV **env);
-
- amdmsCOMPL amdmsDoFit(amdmsFIT_ENV *env,
- int n,
- double *x,
- double *y,
- double *ye);
-
- amdmsCOMPL amdmsCalcFitLimits(amdmsFIT_ENV *env,
- int n,
- double *x,
- double *y,
- double *ye,
- double relLimit);
-
- double amdmsEvalFit(amdmsFIT_ENV *env,
- double x);
-
- amdmsCOMPL amdmsSmoothDataByFiniteDiff1(double *y,
- double *z,
- double lambda,
- int m);
- amdmsCOMPL amdmsSmoothDataByFiniteDiff1W(double *w,
- double *y,
- double *z,
- double lambda,
- int m);
- amdmsCOMPL amdmsSmoothDataByFiniteDiff2(double *y,
- double *z,
- double lambda,
- int m);
- amdmsCOMPL amdmsSmoothDataByFiniteDiff2W(double *w,
- double *y,
- double *z,
- double lambda,
- int m);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !amdmsFit_H */
diff --git a/amber/amdmsFits.c b/amber/amdmsFits.c
deleted file mode 100644
index 0c98370..0000000
--- a/amber/amdmsFits.c
+++ /dev/null
@@ -1,769 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <memory.h>
-#include <math.h>
-
-#include "amdmsFits.h"
-
-#define MIN(x,y) ((x) < (y) ? (x) : (y))
-#define MAX(x,y) ((x) > (y) ? (x) : (y))
-
-static void amdmsInitFits(amdmsFITS *file);
-static void amdmsFreeFits(amdmsFITS *file);
-
-static char *gDoNotCopyKeywords[] =
-{
- "SIMPLE",
- "BITPIX",
- "NAXIS",
- "NAXIS1",
- "NAXIS2",
- "NAXIS3",
- "NAXIS4",
- "EXTEND",
- "COMMENT",
- NULL
-};
-
-void amdmsReportFitsError(amdmsFITS *file, int status, int line, char *info)
-{
- int hstatus = 0;
- char errtext[256] = "";
- int hdunum = -1;
- char value[82] = "???";
-
- fits_get_errstatus(status, errtext);
- if (file->fits != NULL) {
- fits_get_hdu_num(file->fits, &hdunum);
- fits_read_key(file->fits, TSTRING, "EXTNAME", &value, NULL, &hstatus);
- }
- amdmsError(__FILE__, line,
- "cfitsio, fitsfile = %s:%s(%d), status = %d, errtext = %s::%s",
- file->fileName, value, hdunum, status, errtext, info);
-}
-
-void amdmsInitFits(amdmsFITS *file)
-{
- int iRow;
- int iCol;
- int iReg;
- int iTel;
- int iTrain;
- int i;
- amdmsIMAGING_DETECTOR *det;
- amdmsIMAGING_DATA *dat;
-
- /* initialize global FITS file members */
- file->fits = NULL;
- file->flags.content = amdmsUNKNOWN_CONTENT;
- file->flags.format = amdmsUNKNOWN_FORMAT;
- file->flags.type = amdmsUNKNOWN_TYPE;
- file->isNew = amdmsFALSE;
- file->currStateFile = amdmsUNDEFINED_STATE;
- file->currStateHDU = amdmsUNDEFINED_STATE;
- file->bitpix = 0;
- file->nAxis = 0;
- file->nTel = 0;
- file->nCols = 0;
- file->nRows = 0;
- for (iRow = 0; iRow < amdmsMAX_ROWS; iRow++) {
- for (iCol = 0; iCol < amdmsMAX_COLS; iCol++) {
- file->regions[iCol][iRow].x = 0;
- file->regions[iCol][iRow].y = 0;
- file->regions[iCol][iRow].width = 0;
- file->regions[iCol][iRow].height = 0;
- file->regions[iCol][iRow].offset = 0;
- file->regions[iCol][iRow].size = 0;
- }
- }
- file->nx = 0;
- file->ny = 0;
- file->nImages = 0;
- file->nReads = 1;
- file->nPixels = 0;
- file->exptime = 0.0;
- file->fileName = NULL;
- file->tableExt = NULL;
- file->rowIndex = NULL;
- file->hdrTable = NULL;
- file->hdrKeys = NULL;
- file->indexColType = TDOUBLE;
- file->indexColName = "INDEX";
- file->regionColType = TFLOAT;
- file->regionColName = "DATA";
- file->outNCols = 0;
- for (iCol = 0; iCol < amdmsMAX_BTBL_COLS; iCol++) {
- file->outColType[iCol] = NULL;
- file->outColForm[iCol] = NULL;
- file->outColUnit[iCol] = NULL;
- }
- /* IMAGING_DETECTOR binary table */
- det = &(file->detector);
- det->nDetectFlag = amdmsFALSE;
- det->nDetect = 0;
- det->nRegionFlag = amdmsFALSE;
- det->nRegion = 0;
- det->maxCoefFlag = amdmsFALSE;
- det->maxCoef = 0;
- det->numDimFlag = amdmsFALSE;
- det->numDim = 0;
- det->maxTelFlag = amdmsFALSE;
- det->maxTel = 0;
- det->regionFlag = amdmsFALSE;
- det->regionColNr = -1;
- det->detectorFlag = amdmsFALSE;
- det->detectorColNr = -1;
- det->portsFlag = amdmsFALSE;
- det->portsColNr = -1;
- det->correlationFlag = amdmsFALSE;
- det->correlationColNr = -1;
- det->regNameFlag = amdmsFALSE;
- det->regNameColNr = -1;
- det->cornerFlag = amdmsFALSE;
- det->cornerColNr = -1;
- det->gainFlag = amdmsFALSE;
- det->gainColNr = -1;
- det->nAxisFlag = amdmsFALSE;
- det->nAxisColNr = -1;
- det->CRValFlag = amdmsFALSE;
- det->CRValColNr = -1;
- det->CRPixFlag = amdmsFALSE;
- det->CRPixColNr = -1;
- det->cTypeFlag = amdmsFALSE;
- det->cTypeColNr = -1;
- det->CDFlag = amdmsFALSE;
- det->CDColNr = -1;
- det->DMPFlag = amdmsFALSE;
- det->DMPColNr = -1;
- det->DMCFlag = amdmsFALSE;
- det->DMCColNr = -1;
- for (iReg = 0; iReg < amdmsMAX_REGIONS; iReg++) {
- det->region[iReg] = 0;
- det->detector[iReg] = 0;
- for (iTel = 0; iTel < amdmsMAX_TELS; iTel++) {
- det->ports[iReg][iTel] = 0;
- }
- det->correlation[iReg] = 0;
- det->regName[iReg][0] = '\0';
- det->corner[iReg][0] = 0;
- det->corner[iReg][1] = 0;
- det->gain[iReg] = 0.0;
- det->nAxis[iReg][0] = 0;
- det->nAxis[iReg][1] = 0;
- det->CRVal[iReg][0] = 0.0;
- det->CRVal[iReg][1] = 0.0;
- det->CRPix[iReg][0] = 0.0;
- det->CRPix[iReg][1] = 0.0;
- det->cType[iReg][0] = '\0';
- det->CD[iReg][0] = 0.0;
- det->CD[iReg][1] = 0.0;
- det->CD[iReg][2] = 0.0;
- det->CD[iReg][3] = 0.0;
- for (i = 0; i < 256; i++) {
- det->DMP[iReg][i] = 0;
- det->DMC[iReg][i] = 0.0;
- }
- }
- /* IMAGING_DATA binary table */
- dat = &(file->data);
- dat->maxInsFlag = amdmsFALSE;
- dat->maxIns = 0;
- dat->maxStepFlag = amdmsFALSE;
- dat->maxStep = 0;
- dat->frameFlag = amdmsFALSE;
- dat->frameColNr = -1;
- dat->frame = 0;
- dat->timeFlag = amdmsFALSE;
- dat->timeColNr = -1;
- dat->time = 0.0;
- dat->exptimeFlag = amdmsFALSE;
- dat->exptimeColNr = -1;
- dat->exptime = 0.0;
- dat->optTrainFlag = amdmsFALSE;
- dat->optTrainColNr = -1;
- dat->insTrainFlag = amdmsFALSE;
- dat->insTrainColNr = -1;
- dat->referenceFlag = amdmsFALSE;
- dat->referenceColNr = -1;
- dat->reference = 0;
- dat->opdFlag = amdmsFALSE;
- dat->opdColNr = -1;
- dat->localOpdFlag = amdmsFALSE;
- dat->localOpdColNr = -1;
- dat->offsetFlag = amdmsFALSE;
- dat->offsetColNr = -1;
- dat->offset[0] = 0.0;
- dat->offset[1] = 0.0;
- dat->rotationFlag = amdmsFALSE;
- dat->rotationColNr = -1;
- dat->rotation = 0.0;
- dat->steppingPhaseFlag = amdmsFALSE;
- dat->steppingPhaseColNr = -1;
- dat->steppingPhase = 0;
- dat->targetFlag = amdmsFALSE;
- dat->tarTypFlag = amdmsFALSE;
- dat->dataFlag = amdmsFALSE;
- for (iReg = 0; iReg < amdmsMAX_REGIONS; iReg++) {
- dat->targetColNr[iReg] = -1;
- dat->target[iReg] = 0;
- dat->tarTypColNr[iReg] = -1;
- dat->tarTyp[iReg][0] = '\0';
- dat->dataColNr[iReg] = -1;
- dat->data[iReg] = NULL;
- }
- for (iTel = 0; iTel < amdmsMAX_TELS; iTel++) {
- dat->optTrain[iTel] = 0;
- dat->opd[iTel] = 0.0;
- dat->localOpd[iTel] = 0.0;
- }
- for (iTrain = 0; iTrain < amdmsMAX_TRAINS; iTrain++) {
- dat->insTrain[iTrain] = 0;
- }
-}
-
-void amdmsFreeFits(amdmsFITS *file)
-{
- int iCol;
- int iReg;
-
- if (file == NULL) {
- return;
- }
- /* free all allocated memory */
- if (file->rowIndex != NULL) {
- free(file->rowIndex);
- file->rowIndex = NULL;
- }
- for (iCol = 0; iCol < amdmsMAX_BTBL_COLS; iCol++) {
- if (file->outColType[iCol] != NULL) {
- free(file->outColType[iCol]);
- file->outColType[iCol] = NULL;
- }
- if (file->outColForm[iCol] != NULL) {
- free(file->outColForm[iCol]);
- file->outColForm[iCol] = NULL;
- }
- if (file->outColUnit[iCol] != NULL) {
- free(file->outColUnit[iCol]);
- file->outColUnit[iCol] = NULL;
- }
- }
- for (iReg = 0; iReg < amdmsMAX_REGIONS; iReg++) {
- if (file->data.data[iReg] != NULL) {
- free(file->data.data[iReg]);
- file->data.data[iReg] = NULL;
- }
- }
-}
-
-amdmsCOMPL amdmsCreateFitsFile(amdmsFITS **file, char *fileName)
-{
- amdmsFITS *hfile = NULL;
- int status = 0;
-
- amdmsDebug(__FILE__, __LINE__, "amdmsCreateFitsFile(.., %s)", fileName);
- if (*file == NULL) {
- hfile = (amdmsFITS*)calloc(1L, sizeof(amdmsFITS));
- if (hfile == NULL) {
- return amdmsFAILURE;
- }
- hfile->allocated = amdmsTRUE;
- *file = hfile;
- } else {
- hfile = *file;
- hfile->allocated = amdmsFALSE;
- }
- amdmsInitFits(hfile);
- if (fileName == NULL) {
- amdmsError(__FILE__, __LINE__, "fileName == NULL!");
- return amdmsFAILURE;
- }
- amdmsDebug(__FILE__, __LINE__, "fileName = %s", fileName);
- /*
- switch (hfile->currStateFile) {
- case amdmsFILE_OPENED_STATE:
- amdmsError(__FILE__, __LINE__, "file %s is already open!", this->fileName);
- return amdmsFAILURE;
- case amdmsFILE_CREATED_STATE:
- amdmsError(__FILE__, __LINE__, "file %s is already created!", this->fileName);
- return amdmsFAILURE;
- default:
- }
- */
- hfile->fileName = fileName;
- remove(fileName);
- if (fits_create_file(&(hfile->fits), fileName, &status) != 0) {
- amdmsReportFitsError(hfile, status, __LINE__, fileName);
- return amdmsFAILURE;
- }
- hfile->isNew = amdmsTRUE;
- hfile->currStateFile = amdmsFILE_CREATED_STATE;
- hfile->currStateHDU = amdmsUNDEFINED_STATE;
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsOpenFitsFile(amdmsFITS **file, char *fileName)
-{
- amdmsFITS *hfile = NULL;
- int status = 0;
- int hdutype;
-
- amdmsDebug(__FILE__, __LINE__, "amdmsOpenFitsFile(.., %s)", fileName);
- if (*file == NULL) {
- hfile = (amdmsFITS*)calloc((size_t)1, sizeof(amdmsFITS));
- if (hfile == NULL) {
- return amdmsFAILURE;
- }
- hfile->allocated = amdmsTRUE;
- *file = hfile;
- } else {
- hfile = *file;
- hfile->allocated = amdmsFALSE;
- }
- amdmsInitFits(hfile);
- if (fileName == NULL) {
- amdmsError(__FILE__, __LINE__, "fileName == NULL!");
- return amdmsFAILURE;
- }
- amdmsDebug(__FILE__, __LINE__, "fileName = %s", fileName);
- /*
- switch (currStateFile) {
- case amdmsFILE_OPENED_STATE:
- amdmsError(__FILE__, __LINE__, "file %s is already open!", this->fileName);
- return amdmsFAILURE;
- case amdmsFILE_CREATED_STATE:
- amdmsError(__FILE__, __LINE__, "file %s is already created!", this->fileName);
- return amdmsFAILURE;
- default:
- }
- */
- hfile->fileName = fileName;
- if (fits_open_file(&(hfile->fits), fileName, READONLY, &status) != 0) {
- amdmsReportFitsError(hfile, status, __LINE__, fileName);
- return amdmsFAILURE;
- }
- hfile->isNew = amdmsFALSE;
- if(fits_movabs_hdu(hfile->fits, 1, &hdutype, &status) != 0) {
- amdmsReportFitsError(hfile, status,__LINE__, NULL);
- return amdmsFAILURE;
- }
- hfile->currStateFile = amdmsFILE_OPENED_STATE;
- hfile->currStateHDU = amdmsUNDEFINED_STATE;
- /* read some information from the primary HDU */
- hfile->exptime = 0.0;
- amdmsReadKeywordFloat(hfile, "EXPTIME", &(hfile->exptime), NULL);
- amdmsReadImagingDetectorFromHeader(hfile);
- return amdmsReadImagingDetectorFromTable(*file);
-}
-
-amdmsCOMPL amdmsCloseFitsFile(amdmsFITS **file)
-{
- int status = 0;
-
- amdmsDebug(__FILE__, __LINE__, "amdmsCloseFitsFile(%s)", (*file)->fileName);
- switch ((*file)->currStateFile) {
- case amdmsFILE_OPENED_STATE:
- case amdmsFILE_CREATED_STATE:
- if (fits_close_file((*file)->fits, &status) != 0) {
- amdmsReportFitsError(*file, status, __LINE__, (*file)->fileName);
- return amdmsFAILURE;
- }
- (*file)->isNew = 0;
- (*file)->fits = NULL;
- (*file)->currStateFile = amdmsUNDEFINED_STATE;
- (*file)->currStateHDU = amdmsUNDEFINED_STATE;
- amdmsFreeFits(*file);
- if ((*file)->allocated) {
- free(*file);
- *file = NULL;
- }
- return amdmsSUCCESS;
- default:
- amdmsError(__FILE__, __LINE__, "no file open or created!");
- return amdmsFAILURE;
- }
-}
-
-amdmsCOMPL amdmsDeleteFitsFile(amdmsFITS **file)
-{
- int status = 0;
-
- /* amdmsVB(amdmsVERBOSE_DEBUG_CALL, ("amdmsFITS::DeleteFile()\n")); */
- switch ((*file)->currStateFile) {
- case amdmsFILE_OPENED_STATE:
- case amdmsFILE_CREATED_STATE:
- if (fits_delete_file((*file)->fits, &status) != 0) {
- amdmsReportFitsError(*file, status, __LINE__, (*file)->fileName);
- return amdmsFAILURE;
- }
- (*file)->isNew = 0;
- (*file)->fits = NULL;
- (*file)->currStateFile = amdmsUNDEFINED_STATE;
- (*file)->currStateHDU = amdmsUNDEFINED_STATE;
- amdmsFreeFits(*file);
- if ((*file)->allocated) {
- free(*file);
- *file = NULL;
- }
- return amdmsSUCCESS;
- default:
- amdmsError(__FILE__, __LINE__, "no file open or created!");
- return amdmsFAILURE;
- }
-}
-
-amdmsCOMPL amdmsMoveToExtension(amdmsFITS *file, char* extName, int hduType, amdmsBOOL force)
-{
- int status = 0;
- int nHdus;
- int iHdu;
- int currHduType;
- char value[82] = "";
-
- if (file == NULL) {
- return amdmsFAILURE;
- }
- amdmsDebug(__FILE__, __LINE__, "amdmsMoveToExtension(.., %s, %d, %d)", extName, hduType, force);
- if ((file->currStateFile != amdmsFILE_OPENED_STATE) && (file->currStateFile != amdmsFILE_CREATED_STATE)) {
- amdmsError(__FILE__, __LINE__, "amdmsMoveToExtension(%s, %d), no open file!", extName, hduType);
- return amdmsFAILURE;
- }
- if (extName == NULL) {
- if(fits_movabs_hdu(file->fits, 1, &hduType, &status) != 0) {
- amdmsReportFitsError(file, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- return amdmsSUCCESS;
- }
- fits_get_num_hdus(file->fits, &nHdus, &status);
- /* ???
- if (nHdus < 1) {
- return amdmsFAILURE;
- }
- */
- for (iHdu = 1; iHdu <= nHdus; iHdu++) {
- status = 0;
- if(fits_movabs_hdu(file->fits, iHdu, &currHduType, &status) != 0) {
- amdmsReportFitsError(file, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- if (hduType != currHduType) {
- continue;
- }
- if (fits_read_key(file->fits, TSTRING, "EXTNAME", &value, NULL, &status) == 0) {
- amdmsDebug(__FILE__, __LINE__, " HDU %d is extension %s", iHdu, value);
- if (strcmp(value, extName) == 0) {
- return amdmsSUCCESS;
- }
- } else if ((status != KEY_NO_EXIST) && (status != 0)) {
- amdmsReportFitsError(file, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- }
- if (force) {
- amdmsReportFitsError(file, status, __LINE__, "Extension does not exists.");
- return amdmsFAILURE;
- } else {
- /* go at least to the primary HDU */
- status = 0;
- if(fits_movabs_hdu(file->fits, 1, &hduType, &status) != 0) {
- amdmsReportFitsError(file, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- return amdmsFAILURE;
- }
-}
-
-amdmsCOMPL amdmsMoveToHDU(amdmsFITS *file, int hduNum)
-{
- int status = 0;
- int currHduType;
-
- if (file == NULL) {
- return amdmsFAILURE;
- }
- amdmsDebug(__FILE__, __LINE__, "amdmsMoveToHDU(%s, %d) called", file->fileName, hduNum);
- if ((file->currStateFile != amdmsFILE_OPENED_STATE) && (file->currStateFile != amdmsFILE_CREATED_STATE)) {
- amdmsError(__FILE__, __LINE__,
- "amdmsMoveToHDU(%s, %d), no open file!\n", file->fileName, hduNum);
- return amdmsFAILURE;
- }
- if(fits_movabs_hdu(file->fits, hduNum, &currHduType, &status) != 0) {
- amdmsReportFitsError(file, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsMoveToLastHDU(amdmsFITS *file)
-{
- int status = 0;
- int nHdus;
- int currHduType;
-
- if (file == NULL) {
- return amdmsFAILURE;
- }
- amdmsDebug(__FILE__, __LINE__, "amdmsMoveToLastHDU()");
- if ((file->currStateFile != amdmsFILE_OPENED_STATE) && (file->currStateFile != amdmsFILE_CREATED_STATE)) {
- amdmsError(__FILE__, __LINE__, "no open file!");
- return amdmsFAILURE;
- }
- if (fits_movabs_hdu(file->fits, 1, &currHduType, &status) != 0) {
- amdmsReportFitsError(file, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- if (fits_get_num_hdus(file->fits, &nHdus, &status) != 0) {
- amdmsReportFitsError(file, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- amdmsDebug(__FILE__, __LINE__, "fits_get_num_hdus -> %d", nHdus);
- if (nHdus == 0) {
- nHdus = 1;
- }
- if (fits_movabs_hdu(file->fits, nHdus, &currHduType, &status) != 0) {
- amdmsReportFitsError(file, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCopyHeader(amdmsFITS *dst, amdmsFITS *src)
-{
- int status = 0;
- int hduType;
- int oldSrcHdu = 1;
- int oldDstHdu = 1;
- int srcKeyCount;
- int iKey;
- int i;
- int found;
- char keyName[256];
- char keyValue[256];
- char card[256];
-
- if ((dst == NULL) || (dst->currStateFile != amdmsFILE_CREATED_STATE)) {
- amdmsError(__FILE__, __LINE__, "amdmsCopyHeader(.., ..): no destination FITS file!");
- return amdmsFAILURE;
- }
- if ((src == NULL) || (src->currStateFile != amdmsFILE_OPENED_STATE)) {
- amdmsWarning(__FILE__, __LINE__, "amdmsCopyHeader(.., ..): no source FITS file!");
- return amdmsFAILURE;
- }
- amdmsDebug(__FILE__, __LINE__, "amdmsCopyHeader(%s, %s)", dst->fileName, src->fileName);
- if (dst->currStateHDU == amdmsUNDEFINED_STATE) {
- /* cannot Copy header without an image */
- amdmsDebug(__FILE__, __LINE__, "amdmsCopyHeader(.., ..), waiting for image");
- dst->hdrTable = src;
- return amdmsSUCCESS;
- }
- fits_get_hdu_num(dst->fits, &oldDstHdu);
- fits_get_hdu_num(src->fits, &oldSrcHdu);
- if (fits_movabs_hdu(dst->fits, 1, &hduType, &status) != 0) {
- amdmsReportFitsError(dst, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- if (fits_movabs_hdu(src->fits, 1, &hduType, &status) != 0) {
- amdmsReportFitsError(src, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- if (fits_get_hdrspace(src->fits, &srcKeyCount, NULL, &status) != 0) {
- amdmsReportFitsError(src, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- for (iKey = 1; iKey <= srcKeyCount; iKey++) {
- if (fits_read_keyn(src->fits, iKey, keyName, keyValue, NULL, &status) != 0) {
- amdmsReportFitsError(src, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- found = 0;
- for (i = 0; gDoNotCopyKeywords[i] != NULL; i++) {
- if (strcmp(gDoNotCopyKeywords[i], keyName) == 0) {
- found = 1;
- break;
- }
- }
- if (!found) {
- if (fits_read_record(src->fits, iKey, card, &status) != 0) {
- amdmsReportFitsError(src, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- if (fits_update_card(dst->fits, keyName, card, &status) != 0) {
- amdmsReportFitsError(dst, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- }
- }
-/* hier werden auch keywords kopiert, die erhalten bleiben sollten!
- if (fits_copy_header(src->fits, dst->fits, &status) != 0) {
- amdmsReportFitsError(dst, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
-*/
- if (fits_movabs_hdu(dst->fits, oldDstHdu, &hduType, &status) != 0) {
- amdmsReportFitsError(dst, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- if (fits_movabs_hdu(src->fits, oldSrcHdu, &hduType, &status) != 0) {
- amdmsReportFitsError(src, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- dst->hdrTable = NULL;
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCopyExtension(amdmsFITS *dst, amdmsFITS *src, char *extName, amdmsBOOL force)
-{
- int status = 0;
-
- if (dst->currStateFile != amdmsFILE_CREATED_STATE) {
- amdmsError(__FILE__, __LINE__, "no destination file!");
- return amdmsFAILURE;
- }
- if ((src == NULL) || (src->currStateFile != amdmsFILE_OPENED_STATE)) {
- amdmsError(__FILE__, __LINE__, "no source file!");
- return amdmsFAILURE;
- }
- amdmsDebug(__FILE__, __LINE__, "amdmsCopyExtension(%s, %s, %s, %s, %d)",
- dst->fileName, src->fileName, extName, force);
- if (amdmsMoveToExtension(src, extName, BINARY_TBL, force) != amdmsSUCCESS) {
- if (force) {
- amdmsError(__FILE__, __LINE__, "extension %s not found!", extName);
- }
- return amdmsFAILURE;
- }
- amdmsDebug(__FILE__, __LINE__, "copy extension!");
- if (fits_copy_hdu(src->fits, dst->fits, 0, &status) != 0) {
- amdmsReportFitsError(dst, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- return amdmsSUCCESS;
-}
-
-void amdmsSetRegion(amdmsFITS *file, int col, int row, int x, int y, int width, int height)
-{
- amdmsDebug(__FILE__, __LINE__,
- "amdmsSetRegion(%s, %d, %d, %d, %d, %d, %d)",
- file->fileName, col, row, x, y, width, height);
- amdmsSetRow(file, row, y, height);
- amdmsSetCol(file, col, x, width);
-}
-
-void amdmsSetCol(amdmsFITS *file, int col, int x, int width)
-{
- int iRow;
-
- if (col >= file->nCols) {
- file->nCols = col + 1;
- }
- for (iRow = 0; iRow < amdmsMAX_ROWS; iRow++) {
- file->regions[col][iRow].x = x;
- file->regions[col][iRow].width = width;
- }
- amdmsRecalcRegions(file);
-}
-
-void amdmsSetRow(amdmsFITS *file, int row, int y, int height)
-{
- int iCol;
-
- if (row >= file->nRows) {
- file->nRows = row + 1;
- }
- for (iCol = 0; iCol < amdmsMAX_COLS; iCol++) {
- file->regions[iCol][row].y = y;
- file->regions[iCol][row].height = height;
- }
- amdmsRecalcRegions(file);
-}
-
-void amdmsSetRegions(amdmsFITS *dst, amdmsFITS *src)
-{
- int iRow;
- int iCol;
-
- dst->nRows = 0;
- dst->nCols = 0;
- for (iRow = 0; iRow < src->nRows; iRow++) {
- for (iCol = 0; iCol < src->nCols; iCol++) {
- amdmsSetRegion(dst, iCol, iRow,
- src->regions[iCol][iRow].x,
- src->regions[iCol][iRow].y,
- src->regions[iCol][iRow].width,
- src->regions[iCol][iRow].height);
- }
- }
-}
-
-void amdmsRecalcRegions(amdmsFITS *file)
-{
- int iRow;
- int iCol;
- int offset;
-
- file->nx = 0;
- for (iCol = 0; iCol < file->nCols; iCol++) {
- file->nx += file->regions[iCol][0].width;
- }
- file->ny = 0;
- for (iRow = 0; iRow < file->nRows; iRow++) {
- file->ny += file->regions[0][iRow].height;
- }
- file->nPixels = file->nx*file->ny;
- offset = 0;
- for (iRow = 0; iRow < file->nRows; iRow++) {
- for (iCol = 0; iCol < file->nCols; iCol++) {
- file->regions[iCol][iRow].size = file->regions[iCol][iRow].width*file->regions[iCol][iRow].height;
- file->regions[iCol][iRow].offset = offset;
- offset += file->regions[iCol][iRow].size;
- }
- }
-}
-
-amdmsCOMPL amdmsAdjustDataFilterSetup(amdmsDATA_FILTER_SETUP *setup, amdmsFITS *file)
-{
- if ((setup == NULL) || (file == NULL)) {
- return amdmsFAILURE;
- }
- if ((file->currStateFile != amdmsFILE_OPENED_STATE)
- ||
- ((file->currStateHDU != amdmsCUBE_OPENED_STATE)
- &&
- (file->currStateHDU != amdmsTABLE_OPENED_STATE))) {
- return amdmsFAILURE;
- }
- /* update images of interest */
- if (setup->ioiFlag) {
- setup->ioiFrom = MAX(setup->ioiFrom, 0);
- setup->ioiFrom = MIN(setup->ioiFrom, file->nImages - 1);
- setup->ioiTo = MAX(setup->ioiTo, setup->ioiFrom);
- setup->ioiTo = MIN(setup->ioiTo, file->nImages - 1);
- } else {
- setup->ioiFrom = 0;
- setup->ioiTo = file->nImages - 1;
- }
- /* update area of interest */
- if (setup->aoiFlag) {
- setup->aoiWidth = MIN(setup->aoiWidth, file->nx);
- setup->aoiHeight = MIN(setup->aoiHeight, file->ny);
- setup->aoiX = MAX(setup->aoiX, 0);
- setup->aoiX = MIN(setup->aoiX, file->nx - setup->aoiWidth);
- setup->aoiY = MAX(setup->aoiY, 0);
- setup->aoiY = MIN(setup->aoiY, file->ny - setup->aoiHeight);
- } else {
- setup->aoiX = 0;
- setup->aoiY = 0;
- setup->aoiWidth = file->nx;
- setup->aoiHeight = file->ny;
- }
- /* update pixel of interest */
- if (setup->poiFlag) {
- setup->poiX = MAX(setup->poiX, 0);
- setup->poiX = MIN(setup->poiX, file->nx - 1);
- setup->poiY = MAX(setup->poiY, 0);
- setup->poiY = MIN(setup->poiY, file->ny - 1);
- }
- return amdmsSUCCESS;
-}
-
diff --git a/amber/amdmsFits.h b/amber/amdmsFits.h
deleted file mode 100644
index 6d6bc51..0000000
--- a/amber/amdmsFits.h
+++ /dev/null
@@ -1,429 +0,0 @@
-#ifndef amdmsFits_H
-#define amdmsFits_H
-
-#include "fitsio.h"
-#include "amdms.h"
-
-
-typedef enum {
- amdmsUNDEFINED_STATE,
- amdmsERROR_STATE,
- amdmsFILE_OPENED_STATE,
- amdmsFILE_CREATED_STATE,
- amdmsCUBE_OPENED_STATE,
- amdmsCUBE_CREATED_STATE,
- amdmsTABLE_OPENED_STATE,
- amdmsTABLE_CREATED_STATE
-} amdmsFITS_STATE;
-
-
-typedef struct _amdmsKEYWORD {
- struct _amdmsKEYWORD *next;
- char name[80];
- char comment[80];
- int type;
- int decimals;
- long longValue;
- double doubleValue;
- char stringValue[80];
-} amdmsKEYWORD;
-
-typedef struct {
- /* IMAGING_DETECTOR binary table */
- /* HDU keywords */
- /* number of detectors */
- amdmsBOOL nDetectFlag;
- int nDetect;
- /* number of regions/subwindows */
- amdmsBOOL nRegionFlag;
- int nRegion;
- /* number of coefficients for DMP and DMC (max 256) */
- amdmsBOOL maxCoefFlag;
- int maxCoef;
- /* number of detector array dimensions (2) */
- amdmsBOOL numDimFlag;
- int numDim;
- /* maximum numbers of telescopes (3) */
- amdmsBOOL maxTelFlag;
- int maxTel;
- /* binary table contents */
- /* region/subwindow number */
- amdmsBOOL regionFlag;
- int regionColNr;
- int region[amdmsMAX_REGIONS];
- /* detector number */
- amdmsBOOL detectorFlag;
- int detectorColNr;
- int detector[amdmsMAX_REGIONS];
- /* port number */
- amdmsBOOL portsFlag;
- int portsColNr;
- int ports[amdmsMAX_REGIONS][amdmsMAX_TELS];
- /* correlation */
- amdmsBOOL correlationFlag;
- int correlationColNr;
- int correlation[amdmsMAX_REGIONS];
- /* region name (-> IMAGING DATA binary table column name) */
- amdmsBOOL regNameFlag;
- int regNameColNr;
- char regName[amdmsMAX_REGIONS][amdmsMAX_COLNAME_LEN];
- /* coordinate of lower left corner (0,0 is lower left corner of detector) */
- amdmsBOOL cornerFlag;
- int cornerColNr;
- int corner[amdmsMAX_REGIONS][2];
- /* gain value (conversion factor 4.2 e-/DU) */
- amdmsBOOL gainFlag;
- int gainColNr;
- double gain[amdmsMAX_REGIONS];
- /* region/subwindow size */
- amdmsBOOL nAxisFlag;
- int nAxisColNr;
- int nAxis[amdmsMAX_REGIONS][2];
- /* ??? */
- amdmsBOOL CRValFlag;
- int CRValColNr;
- double CRVal[amdmsMAX_REGIONS][2];
- /* ??? */
- amdmsBOOL CRPixFlag;
- int CRPixColNr;
- double CRPix[amdmsMAX_REGIONS][2];
- /* ??? */
- amdmsBOOL cTypeFlag;
- int cTypeColNr;
- char cType[amdmsMAX_REGIONS][amdmsMAX_COLNAME_LEN];
- /* ??? */
- amdmsBOOL CDFlag;
- int CDColNr;
- double CD[amdmsMAX_REGIONS][4];
- /* ??? */
- amdmsBOOL DMPFlag;
- int DMPColNr;
- int DMP[amdmsMAX_REGIONS][256];
- /* ??? */
- amdmsBOOL DMCFlag;
- int DMCColNr;
- double DMC[amdmsMAX_REGIONS][256];
-} amdmsIMAGING_DETECTOR;
-
-typedef struct {
- /* IMAGING_DATA binary table */
- /* HDU keywords */
- /* number of instrument trains */
- amdmsBOOL maxInsFlag;
- int maxIns;
- /* number of observation steps */
- amdmsBOOL maxStepFlag;
- int maxStep;
- /* binary table contents */
- /* frame number */
- amdmsBOOL frameFlag;
- int frameColNr;
- int frame;
- /* observation time */
- amdmsBOOL timeFlag;
- int timeColNr;
- double time;
- /* exposure time */
- amdmsBOOL exptimeFlag;
- int exptimeColNr;
- float exptime;
- /* optical train */
- amdmsBOOL optTrainFlag;
- int optTrainColNr;
- short optTrain[amdmsMAX_TELS];
- /* instrument train */
- amdmsBOOL insTrainFlag;
- int insTrainColNr;
- short insTrain[amdmsMAX_TRAINS];
- /* ??? */
- amdmsBOOL referenceFlag;
- int referenceColNr;
- short reference;
- /* ??? */
- amdmsBOOL opdFlag;
- int opdColNr;
- double opd[amdmsMAX_TELS];
- /* ??? */
- amdmsBOOL localOpdFlag;
- int localOpdColNr;
- double localOpd[amdmsMAX_TELS];
- /* ??? */
- amdmsBOOL offsetFlag;
- int offsetColNr;
- float offset[2];
- /* ??? */
- amdmsBOOL rotationFlag;
- int rotationColNr;
- float rotation;
- /* ??? */
- amdmsBOOL steppingPhaseFlag;
- int steppingPhaseColNr;
- short steppingPhase;
- /* ??? */
- amdmsBOOL targetFlag;
- int targetColNr[amdmsMAX_REGIONS];
- short target[amdmsMAX_REGIONS];
- /* ??? */
- amdmsBOOL tarTypFlag;
- int tarTypColNr[amdmsMAX_REGIONS];
- char tarTyp[amdmsMAX_REGIONS][amdmsMAX_TARTYP_LEN];
- /* camera data for each subwindow */
- amdmsBOOL dataFlag;
- int dataColNr[amdmsMAX_REGIONS];
- float *data[amdmsMAX_REGIONS];
-} amdmsIMAGING_DATA;
-
-typedef struct _amdmsFITS {
- fitsfile *fits;
- amdmsFITS_FLAGS flags;
- amdmsBOOL isNew;
- amdmsFITS_STATE currStateFile;
- amdmsFITS_STATE currStateHDU;
- /* information about images and cubes */
- int bitpix;
- int nAxis;
- /* number of telescopes (1 = calibration full frame) */
- int nTel;
- /* number of subwindow columns (1 = calibration frame) */
- int nCols;
- /* number of subwindow rows (1 = calibration frame) */
- int nRows;
- /* region definition */
- amdmsREGION regions[amdmsMAX_COLS][amdmsMAX_ROWS];
- /* horizontal size of glued image */
- int nx;
- /* vertical size of glued image */
- int ny;
- /* number of images (input and output) */
- int nImages;
- /* number of reads per image (1) */
- int nReads;
- /* number of pixels per read (nx*ny) */
- int nPixels;
- /* exposure time (EXPTIME from primary HDU) */
- float exptime;
- char *fileName;
- char *tableExt;
- int *rowIndex;
- /* index column type (TDOUBLE of TINT) */
- int indexColType;
- /* name of the index/first column */
- char *indexColName;
- /* region/subwindow column data type (TFLOAT or TBYTE) */
- int regionColType;
- /* generic region/subwindow columd name (DATA) */
- char *regionColName;
- /* column type, form and unit for new binary tables */
- int outNCols;
- char *outColType[amdmsMAX_BTBL_COLS];
- char *outColForm[amdmsMAX_BTBL_COLS];
- char *outColUnit[amdmsMAX_BTBL_COLS];
- struct _amdmsFITS *hdrTable;
- amdmsKEYWORD *hdrKeys;
- amdmsIMAGING_DETECTOR detector;
- amdmsIMAGING_DATA data;
- amdmsBOOL allocated;
-} amdmsFITS;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- amdmsCOMPL amdmsCreateFitsFile(amdmsFITS **file,
- char *fileName);
- amdmsCOMPL amdmsOpenFitsFile(amdmsFITS **file,
- char *fileName);
- amdmsCOMPL amdmsCloseFitsFile(amdmsFITS **file);
- amdmsCOMPL amdmsDeleteFitsFile(amdmsFITS **file);
-
- void amdmsSetRegion(amdmsFITS *file,
- int col,
- int row,
- int x,
- int y,
- int width,
- int height);
- void amdmsSetCol(amdmsFITS *file,
- int col,
- int x,
- int width);
- void amdmsSetRow(amdmsFITS *file,
- int row,
- int y,
- int height);
- void amdmsRecalcRegions(amdmsFITS *file);
- void amdmsSetRegions(amdmsFITS *dst,
- amdmsFITS *src);
-
- amdmsCOMPL amdmsAdjustDataFilterSetup(amdmsDATA_FILTER_SETUP *setup,
- amdmsFITS *file);
-
- amdmsCOMPL amdmsMoveToExtension(amdmsFITS *file,
- char* extName,
- int hduType,
- amdmsBOOL force);
- amdmsCOMPL amdmsMoveToHDU(amdmsFITS *file,
- int hduNum);
- amdmsCOMPL amdmsMoveToLastHDU(amdmsFITS *file);
- amdmsCOMPL amdmsCopyHeader(amdmsFITS *dst,
- amdmsFITS *src);
- amdmsCOMPL amdmsCopyExtension(amdmsFITS *dst,
- amdmsFITS *src,
- char *extName,
- amdmsBOOL force);
-
- amdmsBOOL amdmsReadKeywordInt(amdmsFITS *file,
- char *name,
- int *value,
- char *comment);
- amdmsBOOL amdmsReadKeywordLong(amdmsFITS *file,
- char *name,
- long *value,
- char *comment);
- amdmsBOOL amdmsReadKeywordFloat(amdmsFITS *file,
- char *name,
- float *value,
- char *comment);
- amdmsBOOL amdmsReadKeywordDouble(amdmsFITS *file,
- char *name,
- double *value,
- char *comment);
- amdmsBOOL amdmsReadKeywordString(amdmsFITS *file,
- char *name,
- char *value,
- char *comment);
- amdmsCOMPL amdmsUpdateKeywordInt(amdmsFITS *file,
- char *name,
- int value,
- char *comment);
- amdmsCOMPL amdmsUpdateKeywordLong(amdmsFITS *file,
- char *name,
- long value,
- char *comment);
- amdmsCOMPL amdmsUpdateKeywordFloat(amdmsFITS *file,
- char *name,
- float value,
- int decimals,
- char *comment);
- amdmsCOMPL amdmsUpdateKeywordDouble(amdmsFITS *file,
- char *name,
- double value,
- int decimals,
- char *comment);
- amdmsCOMPL amdmsUpdateKeywordString(amdmsFITS *file,
- char *name,
- char *value,
- char *comment);
- amdmsKEYWORD *amdmsAppendKeyword(amdmsFITS *file,
- char *name,
- int type,
- char *comment);
- amdmsCOMPL amdmsUpdateKeywords(amdmsFITS *file);
-
- amdmsCOMPL amdmsCreateSimpleData(amdmsFITS *file,
- amdmsFITS_FLAGS flags,
- int nx,
- int ny,
- int nImages,
- int nReads);
- amdmsCOMPL amdmsCreateData(amdmsFITS *file,
- amdmsFITS_FLAGS flags,
- int nImages,
- int nReads);
- amdmsCOMPL amdmsOpenData(amdmsFITS *file,
- amdmsFITS_FLAGS flags,
- int nReads);
- amdmsCOMPL amdmsReadData(amdmsFITS *file,
- amdmsDATA *data,
- int iImage,
- int iRead);
- amdmsCOMPL amdmsWriteData(amdmsFITS *file,
- amdmsDATA *data,
- int iImage,
- int iRead);
- amdmsCOMPL amdmsReadImagingDetectorFromTable(amdmsFITS *file);
- amdmsCOMPL amdmsReadImagingDetectorFromHeader(amdmsFITS *file);
- amdmsCOMPL amdmsCreateImagingDetectorTable(amdmsFITS *file);
-
- amdmsCOMPL amdmsCreateTable(amdmsFITS *file,
- char *extName,
- int indexColType,
- int regionColType,
- int nReads);
- amdmsCOMPL amdmsOpenTable(amdmsFITS *file,
- char *extName,
- int nReads);
- amdmsCOMPL amdmsReadRow(amdmsFITS *file,
- amdmsDATA *data,
- int iImage,
- int iRead);
- amdmsCOMPL amdmsWriteRow(amdmsFITS *file,
- amdmsDATA *data,
- int iImage,
- int iRead);
- amdmsCOMPL amdmsAddColumn(amdmsFITS *file,
- int colType,
- int nEls,
- char *colName,
- int colNameExt,
- char *colUnit);
- amdmsBOOL amdmsGetColumnIndex(amdmsFITS *file,
- char *name,
- int *index);
- amdmsCOMPL amdmsReadElements(amdmsFITS *file,
- int dataType,
- int iCol,
- long iRow,
- long nEls,
- void *values);
- amdmsCOMPL amdmsWriteElementLong(amdmsFITS *file,
- int iCol,
- long iRow,
- long value,
- long offset);
- /* amdmsCOMPL amdmsWriteElementFloat(amdmsFITS *file, int iCol, int iRow, float value, int offset); */
- amdmsCOMPL amdmsWriteElementDouble(amdmsFITS *file,
- int iCol,
- long iRow,
- double value,
- long offset);
- amdmsCOMPL amdmsWriteElementString(amdmsFITS *file,
- int iCol,
- long iRow,
- char *value,
- long offset);
- amdmsCOMPL amdmsWriteElements(amdmsFITS *file,
- int dataType,
- int iCol,
- long iRow,
- long nEls,
- void *values);
-
- amdmsCOMPL amdmsCreateImageCube(amdmsFITS *file,
- char *extName,
- int imageType,
- int nImages,
- int nReads);
- amdmsCOMPL amdmsCreateEmptyImageCube(amdmsFITS *file);
- amdmsCOMPL amdmsOpenImageCube(amdmsFITS *file,
- char *extName,
- int nReads);
- amdmsCOMPL amdmsReadImage(amdmsFITS *file,
- amdmsDATA *data,
- int iImage,
- int iRead);
- amdmsCOMPL amdmsWriteImage(amdmsFITS *file,
- amdmsDATA *data,
- int iImage,
- int iRead);
-
- void amdmsReportFitsError(amdmsFITS *file,
- int status,
- int line,
- char *info);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !amdmsFits_H */
diff --git a/amber/amdmsFitsCube.c b/amber/amdmsFitsCube.c
deleted file mode 100644
index d5f01d3..0000000
--- a/amber/amdmsFitsCube.c
+++ /dev/null
@@ -1,185 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <memory.h>
-#include <math.h>
-
-#include "amdmsFits.h"
-
-amdmsCOMPL amdmsCreateImageCube(amdmsFITS *file, char *extName, int imageType, int nImages, int nReads)
-{
- int status = 0;
- long naxes[3];
-
- amdmsDebug(__FILE__, __LINE__,
- "amdmsCreateImageCube(%s, %s, %d, %d, %d)",
- file->fileName, extName, imageType, nImages, nReads);
- if (file->currStateFile != amdmsFILE_CREATED_STATE) {
- /* amdmsVBF(amdmsVERBOSE_ERROR, (stderr, "ERROR: amdmsFITS::CreateImageCube(%s, ..), no open file!\n", extName)); */
- return amdmsFAILURE;
- }
- file->nImages = nImages;
- file->nReads = nReads;
- naxes[0] = file->nx;
- naxes[1] = file->ny;
- naxes[2] = nImages*nReads;
- if ((file->nx == 0) || (file->ny == 0) || (nImages == 0)) {
- /* dummy image */
- file->nAxis = 0;
- if (fits_create_img(file->fits, imageType, 0, naxes, &status)) {
- amdmsReportFitsError(file, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- } else if (naxes[2] == 1) {
- /* no cube, only one image! */
- file->nAxis = 2;
- if (fits_create_img(file->fits, imageType, 2, naxes, &status)) {
- amdmsReportFitsError(file, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- } else {
- /* cube, several images! */
- file->nAxis = 3;
- if (fits_create_img(file->fits, imageType, 3, naxes, &status)) {
- amdmsReportFitsError(file, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- }
- file->currStateHDU = amdmsCUBE_CREATED_STATE;
- if (file->hdrTable != NULL) {
- amdmsCopyHeader(file, file->hdrTable);
- }
- return amdmsUpdateKeywords(file);
-}
-
-amdmsCOMPL amdmsCreateEmptyImageCube(amdmsFITS *file)
-{
- int status = 0;
- long naxes[3] = {0, 0, 0};
-
- /* amdmsVB(amdmsVERBOSE_DEBUG_CALL, ("amdmsFITS::CreateImageCube(%s, %d, %d, %d)\n", extName, imageType, nImages, nReads)); */
- if (file->currStateFile != amdmsFILE_CREATED_STATE) {
- /* amdmsVBF(amdmsVERBOSE_ERROR, (stderr, "ERROR: amdmsFITS::CreateImageCube(%s, ..), no open file!\n", extName)); */
- return amdmsFAILURE;
- }
- if (fits_create_img(file->fits, SHORT_IMG, 0, naxes, &status)) {
- amdmsReportFitsError(file, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- file->currStateHDU = amdmsCUBE_CREATED_STATE;
- if (file->hdrTable != NULL) {
- amdmsCopyHeader(file, file->hdrTable);
- }
- return amdmsUpdateKeywords(file);
-}
-
-amdmsCOMPL amdmsOpenImageCube(amdmsFITS *file, char *extName, int nReads)
-{
- int status = 0;
- long axis[3];
-
- amdmsDebug(__FILE__, __LINE__,
- "amdmsOpenImageCube(%s, %s, %d)", file->fileName, extName, nReads);
- if (file->currStateFile != amdmsFILE_OPENED_STATE) {
- amdmsError(__FILE__, __LINE__,
- "amdmsOpenImageCube(%s, %s, %d), no open file!", file->fileName, extName, nReads);
- return amdmsFAILURE;
- }
- file->tableExt = extName;
- file->nReads = nReads;
- /* currently no named image header unit is supported!
- if (amdmsMoveToExtension(file, extName, IMAGE_HDU, amdmsFALSE) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- */
- /* it is mandatory that the primary header unit exists */
- if (amdmsMoveToHDU(file, 1) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (fits_get_img_param(file->fits, 3, &(file->bitpix), &(file->nAxis), axis, &status)) {
- amdmsReportFitsError(file, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- if (file->nAxis == 0) {
- amdmsError(__FILE__, __LINE__,
- "amdmsOpenImageCube(%s, %s, %d), no images in extension!",
- file->fileName, extName, nReads);
- return amdmsFAILURE;
- }
- switch (file->nAxis) {
- case 2:
- file->nx = axis[0];
- file->ny = axis[1];
- file->nImages = 1;
- file->nCols = 1;
- file->nRows = 1;
- amdmsSetRegion(file, 0, 0, 0, 0, file->nx, file->ny);
- break;
- case 3:
- file->nx = axis[0];
- file->ny = axis[1];
- file->nImages = axis[2];
- if (axis[2] == 1) {
- file->nAxis = 2;
- }
- file->nCols = 1;
- file->nRows = 1;
- amdmsSetRegion(file, 0, 0, 0, 0, file->nx, file->ny);
- break;
- default:
- amdmsError(__FILE__, __LINE__,
- "amdmsOpenImageCube(%s, %s, %d), wrong dimension: %d!",
- file->fileName, extName, nReads, file->nAxis);
- file->nCols = 0;
- file->nRows = 0;
- return 0;
- }
- file->currStateHDU = amdmsCUBE_OPENED_STATE;
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsReadImage(amdmsFITS *file, amdmsDATA *data, int iImage, int iRead)
-{
- int status = 0;
- long imgOffset = 1 + (iImage*file->nReads + iRead)*file->nPixels;
-
- amdmsDebug(__FILE__, __LINE__, "amdmsReadImage(%s, .., %d, %d)", file->fileName, iImage, iRead);
- amdmsDebug(__FILE__, __LINE__,
- " nx = %d, ny = %d, nImages = %d, nReads = %d => imgOffset = %d",
- file->nx, file->ny, file->nImages, file->nReads, imgOffset);
- if (file->currStateHDU != amdmsCUBE_OPENED_STATE) {
- /* amdmsVBF(amdmsVERBOSE_ERROR, (stderr, "ERROR: amdmsFITS::ReadImage(, %d, %d), no open cube!\n", iImage, iRead)); */
- return amdmsFAILURE;
- }
- if (amdmsAllocateData(data, file->nx, file->ny) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- data->index = iImage*file->nReads + iRead;
- if (fits_read_img(file->fits, TFLOAT, imgOffset, file->nPixels, NULL, data->data, NULL, &status)) {
- amdmsReportFitsError(file, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsWriteImage(amdmsFITS *file, amdmsDATA *data, int iImage, int iRead)
-{
- int status = 0;
- long imgOffset = 1 + (iImage*file->nReads + iRead)*file->nPixels;
-
- amdmsDebug(__FILE__, __LINE__,
- "amdmsWriteImage(%s, .., %d, %d), imgOffset = %ld",
- file->fileName, iImage, iRead,
- imgOffset);
- /* amdmsVB(amdmsVERBOSE_DEBUG_CALL, ("amdmsFITS::WriteImage(, %d, %d)\n", iImage, iRead)); */
- if (file->currStateHDU != amdmsCUBE_CREATED_STATE) {
- /* amdmsVBF(amdmsVERBOSE_ERROR, (stderr, "ERROR: amdmsFITS::WriteImage(, %d, %d), no open cube!\n", iImage, iRead)); */
- return amdmsFAILURE;
- }
- if (fits_write_img(file->fits, TFLOAT, imgOffset, (long)(file->nPixels), data->data, &status)) {
- amdmsReportFitsError(file, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- return amdmsSUCCESS;
-}
-
diff --git a/amber/amdmsFitsData.c b/amber/amdmsFitsData.c
deleted file mode 100644
index b2d71b1..0000000
--- a/amber/amdmsFitsData.c
+++ /dev/null
@@ -1,676 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <memory.h>
-#include <math.h>
-
-#include "amdmsFits.h"
-
-#define amdmsIMAGING_DETECTOR_EXT "IMAGING_DETECTOR"
-#define amdmsIMAGING_DATA_EXT "IMAGING_DATA"
-#define amdmsAMBER_WAVE_EXT "AMBER_WAVEDATA"
-#define amdmsPIXEL_STAT_EXT "PIXEL_STAT"
-#define amdmsPIXEL_BIAS_EXT "PIXEL_BIAS"
-#define amdmsBAD_PIXEL_EXT "BAD_PIXEL"
-#define amdmsFLATFIELD_EXT "FLATFIELD"
-#define amdmsFLATFIELD_FIT_EXT "FLATFIELD_FIT"
-#define amdmsCONVERSION_FACTOR_EXT "CONVERSION_FACTOR"
-#define amdmsREADOUT_NOISE_EXT "READOUT_NOISE"
-#define amdmsPHOTON_NOISE_EXT "PHOTON_NOISE"
-#define amdmsNONLINEARITY_EXT "NONLINEARITY"
-#define amdmsNONLINEARITY_FIT_EXT "NONLINEARITY_FIT"
-#define amdmsPTC_EXT "PTC"
-#define amdmsFFT_EXT "FFT"
-#define amdmsFUZZY_EXT "FUZZY"
-#define amdmsPARTICLE_EVENT_EXT "PARTICLE_EVENT"
-#define amdmsELECTRONIC_BIAS_EXT "ELECTRONIC_EVENT"
-#define amdmsDARK_CURRENT_EXT "DARK_CURRENT"
-#define amdmsHISTOGRAM_EXT "HISTOGRAM"
-
-amdmsCOMPL amdmsCreateSimpleData(amdmsFITS *file, amdmsFITS_FLAGS flags, int nx, int ny, int nImages, int nReads)
-{
- file->nTel = 1;
- file->nRows = 0;
- file->nCols = 0;
- file->nx = 0;
- file->ny = 0;
- file->nImages = 0;
- amdmsSetRegion(file, 0, 0, 0, 0, nx, ny);
- return amdmsCreateData(file, flags, nImages, nReads);
-}
-
-amdmsCOMPL amdmsCreateData(amdmsFITS *file, amdmsFITS_FLAGS flags, int nImages, int nReads)
-{
- int idxType;
- int dataType;
- char *extName;
-
- amdmsDebug(__FILE__, __LINE__, "amdmsCreateData(%s, (%d, %d, %d), %d, %d)",
- file->fileName, flags.content, flags.format, flags.type, nImages, nReads);
- switch (flags.content) {
- case amdmsIMAGING_DATA_CONTENT: idxType = TDOUBLE; break;
- case amdmsPIXEL_STAT_CONTENT: idxType = TINT; break;
- case amdmsPIXEL_BIAS_CONTENT: idxType = TINT; break;
- case amdmsBAD_PIXEL_CONTENT: idxType = TINT; break;
- case amdmsFLATFIELD_CONTENT: idxType = TINT; break;
- case amdmsFLATFIELD_FIT_CONTENT: idxType = TINT; break;
- case amdmsCONVERSION_FACTOR_CONTENT: idxType = TINT; break;
- case amdmsFFT_CONTENT: idxType = TDOUBLE; break;
- case amdmsREADOUT_NOISE_CONTENT: idxType = TINT; break;
- case amdmsPHOTON_NOISE_CONTENT: idxType = TINT; break;
- case amdmsNONLINEARITY_CONTENT: idxType = TINT; break;
- case amdmsNONLINEARITY_FIT_CONTENT: idxType = TINT; break;
- case amdmsPTC_CONTENT: idxType = TINT; break;
- case amdmsFUZZY_CONTENT: idxType = TINT; break;
- case amdmsPARTICLE_EVENT_CONTENT: idxType = TINT; break;
- case amdmsELECTRONIC_BIAS_CONTENT: idxType = TINT; break;
- case amdmsDARK_CURRENT_CONTENT: idxType = TINT; break;
- case amdmsHISTOGRAM_CONTENT: idxType = TINT; break;
- default:
- return amdmsFAILURE;
- }
- switch (flags.format) {
- case amdmsTABLE_FORMAT:
- switch (flags.type) {
- case amdmsBYTE_TYPE: dataType = TBYTE; break;
- case amdmsSHORT_TYPE: dataType = TSHORT; break;
- case amdmsINT_TYPE: dataType = TINT; break;
- case amdmsLONG_TYPE: dataType = TLONG; break;
- case amdmsFLOAT_TYPE: dataType = TFLOAT; break;
- case amdmsDOUBLE_TYPE: dataType = TDOUBLE; break;
- default:
- return amdmsFAILURE;
- }
- break;
- case amdmsCUBE_FORMAT:
- switch (flags.type) {
- case amdmsBYTE_TYPE: dataType = BYTE_IMG; break;
- case amdmsSHORT_TYPE: dataType = SHORT_IMG; break;
- case amdmsINT_TYPE: dataType = LONG_IMG; break;
- case amdmsLONG_TYPE: dataType = LONG_IMG; break;
- case amdmsFLOAT_TYPE: dataType = FLOAT_IMG; break;
- case amdmsDOUBLE_TYPE: dataType = DOUBLE_IMG; break;
- default:
- return amdmsFAILURE;
- }
- break;
- default:
- return amdmsFAILURE;
- }
- switch (flags.content) {
- case amdmsIMAGING_DATA_CONTENT: extName = amdmsIMAGING_DATA_EXT; break;
- case amdmsPIXEL_STAT_CONTENT: extName = amdmsPIXEL_STAT_EXT; break;
- case amdmsPIXEL_BIAS_CONTENT: extName = amdmsPIXEL_BIAS_EXT; break;
- case amdmsBAD_PIXEL_CONTENT: extName = amdmsBAD_PIXEL_EXT; break;
- case amdmsFLATFIELD_CONTENT: extName = amdmsFLATFIELD_EXT; break;
- case amdmsFLATFIELD_FIT_CONTENT: extName = amdmsFLATFIELD_FIT_EXT; break;
- case amdmsCONVERSION_FACTOR_CONTENT: extName = amdmsCONVERSION_FACTOR_EXT; break;
- case amdmsFFT_CONTENT: extName = amdmsFFT_EXT; break;
- case amdmsREADOUT_NOISE_CONTENT: extName = amdmsREADOUT_NOISE_EXT; break;
- case amdmsPHOTON_NOISE_CONTENT: extName = amdmsPHOTON_NOISE_EXT; break;
- case amdmsNONLINEARITY_CONTENT: extName = amdmsNONLINEARITY_EXT; break;
- case amdmsNONLINEARITY_FIT_CONTENT: extName = amdmsNONLINEARITY_FIT_EXT; break;
- case amdmsPTC_CONTENT: extName = amdmsPTC_EXT; break;
- case amdmsFUZZY_CONTENT: extName = amdmsFUZZY_EXT; break;
- case amdmsPARTICLE_EVENT_CONTENT: extName = amdmsPARTICLE_EVENT_EXT; break;
- case amdmsELECTRONIC_BIAS_CONTENT: extName = amdmsELECTRONIC_BIAS_EXT; break;
- case amdmsDARK_CURRENT_CONTENT: extName = amdmsDARK_CURRENT_EXT; break;
- case amdmsHISTOGRAM_CONTENT: extName = amdmsHISTOGRAM_EXT; break;
- default:
- return amdmsFAILURE;
- }
- switch (flags.format) {
- case amdmsTABLE_FORMAT:
- file->flags = flags;
- return amdmsCreateTable(file, extName, idxType, dataType, nReads);
- case amdmsCUBE_FORMAT:
- file->flags = flags;
- return amdmsCreateImageCube(file, extName, dataType, nImages, nReads);
- default:
- return amdmsFAILURE;
- }
-}
-
-amdmsCOMPL amdmsOpenData(amdmsFITS *file, amdmsFITS_FLAGS flags, int nReads)
-{
- char *extName;
-
- amdmsDebug(__FILE__, __LINE__, "amdmsOpenData(%s, (%d, %d, %d), %d)",
- file->fileName, flags.content, flags.format, flags.type, nReads);
- switch (flags.content) {
- case amdmsIMAGING_DATA_CONTENT: extName = amdmsIMAGING_DATA_EXT; break;
- case amdmsPIXEL_STAT_CONTENT: extName = amdmsPIXEL_STAT_EXT; break;
- case amdmsPIXEL_BIAS_CONTENT: extName = amdmsPIXEL_BIAS_EXT; break;
- case amdmsBAD_PIXEL_CONTENT: extName = amdmsBAD_PIXEL_EXT; break;
- case amdmsFLATFIELD_CONTENT: extName = amdmsFLATFIELD_EXT; break;
- case amdmsFLATFIELD_FIT_CONTENT: extName = amdmsFLATFIELD_FIT_EXT; break;
- case amdmsCONVERSION_FACTOR_CONTENT: extName = amdmsCONVERSION_FACTOR_EXT; break;
- case amdmsFFT_CONTENT: extName = amdmsFFT_EXT; break;
- case amdmsREADOUT_NOISE_CONTENT: extName = amdmsREADOUT_NOISE_EXT; break;
- case amdmsPHOTON_NOISE_CONTENT: extName = amdmsPHOTON_NOISE_EXT; break;
- case amdmsNONLINEARITY_CONTENT: extName = amdmsNONLINEARITY_EXT; break;
- case amdmsNONLINEARITY_FIT_CONTENT: extName = amdmsNONLINEARITY_FIT_EXT; break;
- case amdmsPTC_CONTENT: extName = amdmsPTC_EXT; break;
- case amdmsFUZZY_CONTENT: extName = amdmsFUZZY_EXT; break;
- case amdmsPARTICLE_EVENT_CONTENT: extName = amdmsPARTICLE_EVENT_EXT; break;
- case amdmsELECTRONIC_BIAS_CONTENT: extName = amdmsELECTRONIC_BIAS_EXT; break;
- case amdmsDARK_CURRENT_CONTENT: extName = amdmsDARK_CURRENT_EXT; break;
- case amdmsHISTOGRAM_CONTENT: extName = amdmsHISTOGRAM_EXT; break;
- default:
- return amdmsFAILURE;
- }
- switch (flags.format) {
- case amdmsTABLE_FORMAT:
- file->flags = flags;
- return amdmsOpenTable(file, extName, nReads);
- case amdmsCUBE_FORMAT:
- file->flags = flags;
- return amdmsOpenImageCube(file, extName, nReads);
- default:
- return amdmsFAILURE;
- }
-}
-
-amdmsCOMPL amdmsReadData(amdmsFITS *file, amdmsDATA *data, int iImage, int iRead)
-{
- switch (file->currStateHDU) {
- case amdmsTABLE_OPENED_STATE:
- return amdmsReadRow(file, data, iImage, iRead);
- case amdmsCUBE_OPENED_STATE:
- return amdmsReadImage(file, data, iImage, iRead);
- default:
- /* amdmsVBF(amdmsVERBOSE_ERROR, (stderr, "ERROR: amdmsFITS::ReadData(..), no table or cube opened!\n")); */
- return amdmsFAILURE;
- }
-}
-
-amdmsCOMPL amdmsWriteData(amdmsFITS *file, amdmsDATA *data, int iImage, int iRead)
-{
- switch (file->currStateHDU) {
- case amdmsTABLE_CREATED_STATE:
- return amdmsWriteRow(file, data, iImage, iRead);
- case amdmsCUBE_CREATED_STATE:
- return amdmsWriteImage(file, data, iImage, iRead);
- default:
- /* amdmsVBF(amdmsVERBOSE_ERROR, (stderr, "ERROR: amdmsFITS::WriteData(..), no table or cube created!\n")); */
- return amdmsFAILURE;
- }
-}
-
-amdmsCOMPL amdmsReadImagingDetectorFromTable(amdmsFITS *file)
-{
- int iRow;
- int iCol;
- long iReg;
- int iTel;
- long nRs;
- int status = 0;
- amdmsCOMPL retVal = amdmsSUCCESS;
- amdmsIMAGING_DETECTOR *det;
- char *str;
-
- amdmsDebug(__FILE__, __LINE__,
- "amdmsReadImagingDetectorFromTable(%s), try to read the IMAGING_DETECTOR",
- file->fileName);
- /* it is optional that the extension with the subwindow setup exists */
- if (amdmsMoveToExtension(file, amdmsIMAGING_DETECTOR_EXT, BINARY_TBL, amdmsFALSE) != amdmsSUCCESS) {
- amdmsDebug(__FILE__, __LINE__,
- "amdmsReadImagingDetectorFromTable(%s), IMAGING_DETECTOR binary table not found!",
- file->fileName);
- return amdmsSUCCESS;
- }
- /* read IMAGING_DETECTOR binary table */
- /* read keywords from current HDU */
- det = &(file->detector);
- det->nDetectFlag = amdmsReadKeywordInt(file, "NDETECT", &(det->nDetect), NULL);
- det->nRegionFlag = amdmsReadKeywordInt(file, "NREGION", &(det->nRegion), NULL);
- det->maxCoefFlag = amdmsReadKeywordInt(file, "MAX_COEF", &(det->maxCoef), NULL);
- det->numDimFlag = amdmsReadKeywordInt(file, "NUM_DIM", &(det->numDim), NULL);
- det->maxTelFlag = amdmsReadKeywordInt(file, "MAXTEL", &(det->maxTel), NULL);
- /* request column indices */
- det->regionFlag = amdmsGetColumnIndex(file, "REGION", &(det->regionColNr));
- det->detectorFlag = amdmsGetColumnIndex(file, "DETECTOR", &(det->detectorColNr));
- det->portsFlag = amdmsGetColumnIndex(file, "PORTS", &(det->portsColNr));
- det->correlationFlag = amdmsGetColumnIndex(file, "CORRELATION", &(det->correlationColNr));
- det->regNameFlag = amdmsGetColumnIndex(file, "REGNAME", &(det->regNameColNr));
- det->cornerFlag = amdmsGetColumnIndex(file, "CORNER", &(det->cornerColNr));
- det->gainFlag = amdmsGetColumnIndex(file, "GAIN", &(det->gainColNr));
- det->nAxisFlag = amdmsGetColumnIndex(file, "NAXIS", &(det->nAxisColNr));
- if (!det->nAxisFlag) {
- det->nAxisFlag = amdmsGetColumnIndex(file, "NAXES", &(det->nAxisColNr));
- }
- det->CRValFlag = amdmsGetColumnIndex(file, "CRVAL", &(det->CRValColNr));
- det->CRPixFlag = amdmsGetColumnIndex(file, "CRPIX", &(det->CRPixColNr));
- det->cTypeFlag = amdmsGetColumnIndex(file, "CTYPE", &(det->cTypeColNr));
- det->CDFlag = amdmsGetColumnIndex(file, "CD", &(det->CDColNr));
- det->DMPFlag = amdmsGetColumnIndex(file, "DMP", &(det->DMPColNr));
- det->DMCFlag = amdmsGetColumnIndex(file, "DMC", &(det->DMCColNr));
- /* request number of regions */
- if (fits_get_num_rows(file->fits, &nRs, &status ) != 0) {
- amdmsReportFitsError(file, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- if (file->nCols*file->nRows != nRs) {
- switch (nRs) {
- case 1: file->nCols = 1; file->nRows = 1; break;
- case 3: file->nCols = 1; file->nRows = 1; break;
- case 4: file->nCols = 4; file->nRows = 1; break;
- case 5: file->nCols = 5; file->nRows = 1; break;
- case 8: file->nCols = 4; file->nRows = 2; break;
- case 10: file->nCols = 5; file->nRows = 2; break;
- case 12: file->nCols = 4; file->nRows = 3; break;
- case 15: file->nCols = 5; file->nRows = 3; break;
- default:
- file->nCols = 0;
- file->nRows = 0;
- }
- }
- amdmsDebug(__FILE__, __LINE__,
- "amdmsReadImagingDetectorFromTable(%s), reading IMAGING_DETECTOR binary table",
- file->fileName);
- for (iRow = 0; iRow < file->nRows; iRow++) {
- for (iCol = 0; iCol < file->nCols; iCol++) {
- iReg = (long)(iRow*file->nCols + iCol);
- amdmsDebug(__FILE__, __LINE__,
- " iRow = %d, rCol = %d, iReg = %2d", iRow, iCol, iReg + 1);
- if (det->regionFlag && (retVal == amdmsSUCCESS)) {
- retVal = amdmsReadElements(file,
- TINT, det->regionColNr, iReg + 1, 1L,
- &(det->region[iReg]));
- if (retVal == amdmsSUCCESS) {
- amdmsDebug(__FILE__, __LINE__, " region = %d", det->region[iReg]);
- }
- }
- if (det->detectorFlag && (retVal == amdmsSUCCESS)) {
- retVal = amdmsReadElements(file,
- TINT, det->detectorColNr, iReg + 1, 1L,
- &(det->detector[iReg]));
- if (retVal == amdmsSUCCESS) {
- amdmsDebug(__FILE__, __LINE__,
- " detector = %d", det->detector[iReg]);
- }
- }
- if (det->portsFlag && (retVal == amdmsSUCCESS)) {
- retVal = amdmsReadElements(file,
- TINT, det->portsColNr, iReg + 1, (long)(det->maxTel),
- &(det->ports[iReg]));
- if (retVal == amdmsSUCCESS) {
- for (iTel = 0; iTel < det->maxTel; iTel++) {
- amdmsDebug(__FILE__, __LINE__,
- " ports[%d] = %d", iTel, det->ports[iReg][iTel]);
- }
- }
- }
- if (det->correlationFlag && (retVal == amdmsSUCCESS)) {
- retVal = amdmsReadElements(file,
- TINT, det->correlationColNr, iReg + 1, 1L,
- &(det->correlation[iReg]));
- if (retVal == amdmsSUCCESS) {
- amdmsDebug(__FILE__, __LINE__,
- " correlation = %d", det->correlation[iReg]);
- }
- }
- if (det->regNameFlag && (retVal == amdmsSUCCESS)) {
- str = det->regName[iReg];
- retVal = amdmsReadElements(file,
- TSTRING, det->regNameColNr, iReg + 1, 1L,
- &str);
- if (retVal == amdmsSUCCESS) {
- if ((det->regName[iReg][0] == '\0') || (det->regName[iReg][0] == ' ')) {
- sprintf(det->regName[iReg], "DATA%ld", iReg + 1);
- }
- amdmsDebug(__FILE__, __LINE__,
- " regName = <%s>", det->regName[iReg]);
- }
- }
- if (det->cornerFlag && (retVal == amdmsSUCCESS)) {
- retVal = amdmsReadElements(file,
- TINT, det->cornerColNr, iReg + 1, 2L,
- &(det->corner[iReg]));
- if (retVal == amdmsSUCCESS) {
- amdmsDebug(__FILE__, __LINE__,
- " corner = %d, %d",
- det->corner[iReg][0], det->corner[iReg][1]);
- }
- }
- if (det->gainFlag && (retVal == amdmsSUCCESS)) {
- retVal = amdmsReadElements(file,
- TDOUBLE, det->gainColNr, iReg + 1, 1L,
- &(det->gain[iReg]));
- if (retVal == amdmsSUCCESS) {
- amdmsDebug(__FILE__, __LINE__, " gain = %f", det->gain[iReg]);
- }
- }
- if (det->nAxisFlag && (retVal == amdmsSUCCESS)) {
- retVal = amdmsReadElements(file,
- TINT, det->nAxisColNr, iReg + 1, 2L,
- &(det->nAxis[iReg]));
- if (retVal == amdmsSUCCESS) {
- amdmsDebug(__FILE__, __LINE__,
- " nAxis = %d, %d", det->nAxis[iReg][0], det->nAxis[iReg][1]);
- }
- }
- if (det->CRValFlag && (retVal == amdmsSUCCESS)) {
- retVal = amdmsReadElements(file,
- TDOUBLE, det->CRValColNr, iReg + 1, 2L,
- &(det->CRVal[iReg]));
- if (retVal == amdmsSUCCESS) {
- amdmsDebug(__FILE__, __LINE__,
- " CRVal = %f, %f", det->CRVal[iReg][0], det->CRVal[iReg][1]);
- }
- }
- if (det->CRPixFlag && (retVal == amdmsSUCCESS)) {
- retVal = amdmsReadElements(file,
- TDOUBLE, det->CRPixColNr, iReg + 1, 2L,
- &(det->CRPix[iReg]));
- if (retVal == amdmsSUCCESS) {
- amdmsDebug(__FILE__, __LINE__,
- " CRPix = %f, %f", det->CRPix[iReg][0], det->CRPix[iReg][1]);
- }
- }
- if (det->cTypeFlag && (retVal == amdmsSUCCESS)) {
- str = det->cType[iReg];
- retVal = amdmsReadElements(file,
- TSTRING, det->cTypeColNr, iReg + 1, 1L,
- &str);
- if (retVal == amdmsSUCCESS) {
- amdmsDebug(__FILE__, __LINE__, " cType = %s", det->cType[iReg]);
- }
- }
- if (det->CDFlag && (retVal == amdmsSUCCESS)) {
- retVal = amdmsReadElements(file,
- TDOUBLE, det->CDColNr, iReg + 1, 4L,
- &(det->CD[iReg]));
- if (retVal == amdmsSUCCESS) {
- amdmsDebug(__FILE__, __LINE__,
- " CD = %f, %f, %f, %f\n",
- det->CD[iReg][0], det->CD[iReg][1], det->CD[iReg][2], det->CD[iReg][3]);
- }
- }
- if (det->DMPFlag && (retVal == amdmsSUCCESS)) {
- retVal = amdmsReadElements(file,
- TINT, det->DMPColNr,
- iReg + 1, (long)(det->numDim*det->numDim*det->maxCoef),
- &(det->DMP[iReg]));
- }
- if (det->DMCFlag && (retVal == amdmsSUCCESS)) {
- retVal = amdmsReadElements(file,
- TDOUBLE, det->DMCColNr,
- iReg + 1, (long)(det->numDim*det->maxCoef),
- &(det->DMC[iReg]));
- }
- if (retVal != amdmsSUCCESS) {
- return 0;
- }
- if (det->cornerFlag && det->nAxisFlag) {
- amdmsSetRegion(file, iCol, iRow,
- det->corner[iReg][0], det->corner[iReg][1],
- det->nAxis[iReg][0], det->nAxis[iReg][1]);
- }
- }
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsReadImagingDetectorFromHeader(amdmsFITS *file)
-{
- int iRow;
- int iCol;
- int iReg;
- int i;
- amdmsBOOL ok = amdmsTRUE;
- int nRow;
- int nTel;
- int colLeft0;
- int colLeft1;
- int colLeft2;
- int colLeft3;
- int colLeft4;
- int colWidth0;
- int colWidth1;
- int colWidth2;
- int colWidth3;
- int colWidth4;
- int rowTop0;
- int rowTop1;
- int rowTop2;
- int rowHeight0;
- int rowHeight1;
- int rowHeight2;
- long ports1[5] = {0, 1, 0, 1, 0};
- long ports2[5] = {0, 0, 2, 2, 0};
- long ports3[5] = {0, 0, 0, 3, 3};
- long corrs[5] = {0, 1, 1, 2, 1};
- amdmsIMAGING_DETECTOR *det;
-
- /* it is mandatory that the primary header unit exists */
- if (amdmsMoveToHDU(file, 1) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- /* read all neccessary keywords from the primary header unit */
- ok = ok && amdmsReadKeywordInt(file, "HIERARCH ESO DET NROW", &nRow, NULL);
- ok = ok && amdmsReadKeywordInt(file, "HIERARCH ESO DET NTEL", &nTel, NULL);
- ok = ok && amdmsReadKeywordInt(file, "HIERARCH ESO DET WIN AMSC0", &colLeft0, NULL);
- ok = ok && amdmsReadKeywordInt(file, "HIERARCH ESO DET WIN AMSC1", &colLeft1, NULL);
- ok = ok && amdmsReadKeywordInt(file, "HIERARCH ESO DET WIN AMSC2", &colLeft2, NULL);
- ok = ok && amdmsReadKeywordInt(file, "HIERARCH ESO DET WIN AMSC3", &colLeft3, NULL);
- ok = ok && amdmsReadKeywordInt(file, "HIERARCH ESO DET WIN AMSC4", &colLeft4, NULL);
- ok = ok && amdmsReadKeywordInt(file, "HIERARCH ESO DET WIN AMNC0", &colWidth0, NULL);
- ok = ok && amdmsReadKeywordInt(file, "HIERARCH ESO DET WIN AMNC1", &colWidth1, NULL);
- ok = ok && amdmsReadKeywordInt(file, "HIERARCH ESO DET WIN AMNC2", &colWidth2, NULL);
- ok = ok && amdmsReadKeywordInt(file, "HIERARCH ESO DET WIN AMNC3", &colWidth3, NULL);
- ok = ok && amdmsReadKeywordInt(file, "HIERARCH ESO DET WIN AMNC4", &colWidth4, NULL);
- ok = ok && amdmsReadKeywordInt(file, "HIERARCH ESO DET WIN AMSR0", &rowTop0, NULL);
- ok = ok && amdmsReadKeywordInt(file, "HIERARCH ESO DET WIN AMSR1", &rowTop1, NULL);
- ok = ok && amdmsReadKeywordInt(file, "HIERARCH ESO DET WIN AMSR2", &rowTop2, NULL);
- ok = ok && amdmsReadKeywordInt(file, "HIERARCH ESO DET WIN AMNR0", &rowHeight0, NULL);
- ok = ok && amdmsReadKeywordInt(file, "HIERARCH ESO DET WIN AMNR1", &rowHeight1, NULL);
- ok = ok && amdmsReadKeywordInt(file, "HIERARCH ESO DET WIN AMNR2", &rowHeight2, NULL);
- if (!ok) {
- /* we need all keywords! */
- return amdmsFAILURE;
- }
- det = &(file->detector);
- /* initialize default values */
- det->nDetectFlag = amdmsTRUE;
- det->nDetect = 1; /* we have only one detector for AMBER */
- det->nRegionFlag = amdmsTRUE;
- file->nTel = nTel;
- file->nCols = 0;
- file->nRows = nRow;
- switch (nTel) {
- case 1:
- file->nCols = 1;
- amdmsSetCol(file, 0, colLeft0, colWidth0);
- break;
- case 2:
- file->nCols = 4;
- amdmsSetCol(file, 0, colLeft0, colWidth0);
- amdmsSetCol(file, 1, colLeft1, colWidth1);
- amdmsSetCol(file, 2, colLeft2, colWidth2);
- amdmsSetCol(file, 3, colLeft3, colWidth3);
- break;
- case 3:
- file->nCols = 5;
- amdmsSetCol(file, 0, colLeft0, colWidth0);
- amdmsSetCol(file, 1, colLeft1, colWidth1);
- amdmsSetCol(file, 2, colLeft2, colWidth2);
- amdmsSetCol(file, 3, colLeft3, colWidth3);
- amdmsSetCol(file, 4, colLeft4, colWidth4);
- break;
- default:
- file->nCols = 0;
- }
- if (nRow >= 1) {
- amdmsSetRow(file, 0, rowTop0, rowHeight0);
- }
- if (nRow >= 2) {
- amdmsSetRow(file, 1, rowTop1, rowHeight1);
- }
- if (nRow >= 3) {
- amdmsSetRow(file, 2, rowTop2, rowHeight2);
- }
- det->nRegion = file->nCols*file->nRows;
- det->maxCoefFlag = amdmsTRUE;
- det->maxCoef = 0;
- det->numDimFlag = amdmsTRUE;
- det->numDim = 2;
- det->maxTelFlag = amdmsTRUE;
- det->maxTel = 3;
- det->regionFlag = amdmsTRUE;
- det->detectorFlag = amdmsTRUE;
- det->portsFlag = amdmsTRUE;
- det->correlationFlag = amdmsTRUE;
- det->cornerFlag = amdmsTRUE;
- det->gainFlag = amdmsTRUE;
- det->nAxisFlag = amdmsTRUE;
- det->CRValFlag = amdmsTRUE;
- det->CRPixFlag = amdmsTRUE;
- det->cTypeFlag = amdmsTRUE;
- det->CDFlag = amdmsFALSE;
- det->DMPFlag = amdmsFALSE;
- det->DMCFlag = amdmsFALSE;
- for (iRow = 0; iRow < file->nRows; iRow++) {
- for (iCol = 0; iCol < file->nCols; iCol++) {
- iReg = iRow*file->nCols + iCol;
- det->region[iReg] = iReg + 1;
- det->detector[iReg] = 1;
- if (nTel == 1) {
- det->ports[iReg][0] = 1;
- det->ports[iReg][1] = 1;
- det->ports[iReg][2] = 1;
- det->correlation[iReg] = 1;
- } else {
- det->ports[iReg][0] = ports1[iCol];
- det->ports[iReg][1] = ports2[iCol];
- det->ports[iReg][2] = ports3[iCol];
- det->correlation[iReg] = corrs[iCol];
- }
- sprintf(det->regName[iReg], "%s%d", file->regionColName, iReg + 1);
- det->corner[iReg][0] = (short)(file->regions[iCol][iRow].x);
- det->corner[iReg][1] = (short)(file->regions[iCol][iRow].y);
- det->gain[iReg] = 4.2;
- det->nAxis[iReg][0] = (short)(file->regions[iCol][iRow].width);
- det->nAxis[iReg][1] = (short)(file->regions[iCol][iRow].height);
- det->CRVal[iReg][0] = 1.0;
- det->CRVal[iReg][1] = 1.0;
- det->CRPix[iReg][0] = 1.0;
- det->CRPix[iReg][1] = 1.0;
- strcpy(det->cType[iReg], "PIXEL");
- for (i = 0; i < 4; i++) {
- det->CD[iReg][i] = 0.0;
- }
- for (i = 0; i < 256; i++) {
- det->DMP[iReg][i] = 0.0;
- det->DMC[iReg][i] = 0.0;
- }
- }
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCreateImagingDetectorTable(amdmsFITS *file)
-{
- int status = 0;
- int iCol;
- int iRow;
- long iReg;
- long ports1[5] = {0, 1, 0, 1, 0};
- long ports2[5] = {0, 0, 2, 2, 0};
- long ports3[5] = {0, 0, 0, 3, 3};
- long corrs[5] = {0, 1, 1, 2, 1};
- char regName[32];
- amdmsIMAGING_DETECTOR *det;
-
- if (file->currStateFile != amdmsFILE_CREATED_STATE) {
- /* amdmsVBF(amdmsVERBOSE_ERROR, (stderr, "ERROR: amdmsFITS::createRegionTable(), no open file!\n")); */
- return amdmsFAILURE;
- }
- det = &(file->detector);
- file->tableExt = amdmsIMAGING_DETECTOR_EXT;
- file->outNCols = 0;
- if (amdmsAddColumn(file, TSHORT, 1, "REGION", -1, NULL) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsAddColumn(file, TSHORT, 1, "DETECTOR", -1, NULL) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsAddColumn(file, TSHORT, 3, "PORTS", -1, NULL) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsAddColumn(file, TSHORT, 3, "CORRELATION", -1, NULL) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsAddColumn(file, TSTRING, 16, "REGNAME", -1, NULL) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsAddColumn(file, TSHORT, 2, "CORNER", -1, NULL) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsAddColumn(file, TFLOAT, 1, "GAIN", -1, "e-/ADU") != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsAddColumn(file, TSHORT, 2, "NAXES", -1, NULL) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsAddColumn(file, TDOUBLE, 2, "CRVAL", -1, NULL) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsAddColumn(file, TDOUBLE, 2, "CRVPIX", -1, NULL) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsAddColumn(file, TSTRING, 8, "CTYPE", -1, NULL) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsMoveToLastHDU(file) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (fits_create_tbl(file->fits, BINARY_TBL, 0L, file->outNCols, file->outColType, file->outColForm, file->outColUnit, file->tableExt, &status) != 0 ) {
- amdmsReportFitsError(file, status, __LINE__, file->tableExt);
- return amdmsFAILURE;
- }
- if (amdmsMoveToLastHDU(file) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- file->currStateHDU = amdmsTABLE_CREATED_STATE;
- amdmsUpdateKeywordLong(file, "REVISION", 1L, NULL);
- amdmsUpdateKeywordString(file, "ORIGIN", "ESO-PARANAL", NULL);
- amdmsUpdateKeywordString(file, "INSTRUME", "AMBER", NULL);
- /* amdmsUpdateKeyword(file, "MJD-OBS", ExpStartTimeMJD(), NULL); */
- /* amdmsUpdateKeyword(file, "DATE-OBS", ExpStartTime(), NULL); */
- /* icmdGetUTC(utc, 4); */
- /* amdmsUpdateKeyword(file, "DATE", utc, NULL); */
- /* amdmsUpdateKeyword(file, "HIERARCH ESO DET DID", dicID, NULL); */
- /* amdmsUpdateKeyword(file, "HIERARCH ESO DET ID", dcsVersion, NULL); */
- amdmsUpdateKeywordLong(file, "NDETECT", 1L, NULL);
- amdmsUpdateKeywordLong(file, "NREGION", (long)(file->nCols*file->nRows), NULL);
- amdmsUpdateKeywordLong(file, "MAX_COEF", 0L, NULL);
- amdmsUpdateKeywordLong(file, "NUM_DIM", 2L, NULL);
- amdmsUpdateKeywordLong(file, "MAXTEL", 3L, NULL);
- amdmsUpdateKeywords(file);
- for (iRow = 0; iRow < file->nRows; iRow++) {
- for (iCol = 0; iCol < file->nCols; iCol++) {
- iReg = (long)(iRow*file->nCols + iCol + 1);
- amdmsWriteElementLong(file, 1, iReg, iReg, 0L);
- amdmsWriteElementLong(file, 2, iReg, 1L, 0L);
- amdmsWriteElementLong(file, 3, iReg, ports1[iCol], 0L);
- amdmsWriteElementLong(file, 3, iReg, ports2[iCol], 1L);
- amdmsWriteElementLong(file, 3, iReg, ports3[iCol], 2L);
- amdmsWriteElementLong(file, 4, iReg, corrs[iCol], 0L);
- sprintf(regName, "%s%ld", file->regionColName, iReg);
- amdmsWriteElementString(file, 5, iReg, regName, 0L);
- amdmsWriteElementLong(file, 6, iReg, (long)file->regions[iCol][iRow].x, 0L);
- amdmsWriteElementLong(file, 6, iReg, (long)file->regions[iCol][iRow].y, 1L);
- amdmsWriteElementDouble(file, 7, iReg, 1.0, 0L);
- amdmsWriteElementLong(file, 8, iReg, (long)file->regions[iCol][iRow].width, 0L);
- amdmsWriteElementLong(file, 8, iReg, (long)file->regions[iCol][iRow].height, 1L);
- amdmsWriteElementDouble(file, 9, iReg, 1.0, 0L);
- amdmsWriteElementDouble(file, 9, iReg, 1.0, 1L);
- amdmsWriteElementDouble(file, 10, iReg, 1.0, 0L);
- amdmsWriteElementDouble(file, 10, iReg, 1.0, 1L);
- amdmsWriteElementString(file, 11, iReg, "PIXEL", 0L);
- }
- }
- return amdmsSUCCESS;
-}
-
diff --git a/amber/amdmsFitsKeyword.c b/amber/amdmsFitsKeyword.c
deleted file mode 100644
index ffef341..0000000
--- a/amber/amdmsFitsKeyword.c
+++ /dev/null
@@ -1,272 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <memory.h>
-#include <math.h>
-
-#include "amdmsFits.h"
-
-amdmsBOOL amdmsReadKeywordInt(amdmsFITS *file, char *name, int *value, char *comment)
-{
- int status = 0;
-
- if (file == NULL) {
- return amdmsFALSE;
- }
- if (file->currStateFile != amdmsFILE_OPENED_STATE) {
- amdmsError(__FILE__, __LINE__,
- "amdmsReadKeywordInt(%s, %s, .., ..), no open file!", file->fileName, name);
- return amdmsFALSE;
- }
- if (fits_read_key(file->fits, TINT, name, value, comment, &status) != 0) {
- if (status != VALUE_UNDEFINED && status != KEY_NO_EXIST) {
- amdmsReportFitsError(file, status, __LINE__, name);
- }
- amdmsDebug(__FILE__, __LINE__,
- "amdmsReadKeywordInt(%s, %s, .., ..): keyword not found", file->fileName, name);
- return amdmsFALSE;
- }
- amdmsDebug(__FILE__, __LINE__,
- "amdmsReadKeywordInt(%s, %s, .., ..) = %d", file->fileName, name, *value);
- return amdmsTRUE;
-}
-
-amdmsBOOL amdmsReadKeywordLong(amdmsFITS *file, char *name, long *value, char *comment)
-{
- int status = 0;
-
- if (file == NULL) {
- return amdmsFALSE;
- }
- if (file->currStateFile != amdmsFILE_OPENED_STATE) {
- amdmsError(__FILE__, __LINE__,
- "amdmsReadKeywordLong(%s, %s, .., ..), no open file!", file->fileName, name);
- return amdmsFALSE;
- }
- if (fits_read_key_lng(file->fits, name, value, comment, &status) != 0) {
- if (status != VALUE_UNDEFINED && status != KEY_NO_EXIST) {
- amdmsReportFitsError(file, status, __LINE__, name);
- }
- amdmsDebug(__FILE__, __LINE__,
- "amdmsReadKeywordLong(%s, %s, .., ..): keyword not found", file->fileName, name);
- return amdmsFALSE;
- }
- amdmsDebug(__FILE__, __LINE__,
- "amdmsReadKeywordLong(%s, %s, .., ..) = %d", file->fileName, name, *value);
- return amdmsTRUE;
-}
-
-amdmsBOOL amdmsReadKeywordFloat(amdmsFITS *file, char *name, float *value, char *comment)
-{
- int status = 0;
-
- if (file == NULL) {
- return amdmsFALSE;
- }
- if (file->currStateFile != amdmsFILE_OPENED_STATE) {
- amdmsError(__FILE__, __LINE__,
- "amdmsReadKeywordFloat(%s, %s, .., ..), no open file!", file->fileName, name);
- return amdmsFALSE;
- }
- if (fits_read_key_flt(file->fits, name, value, comment, &status) != 0) {
- if (status != VALUE_UNDEFINED && status != KEY_NO_EXIST) {
- amdmsReportFitsError(file, status, __LINE__, name);
- }
- amdmsDebug(__FILE__, __LINE__,
- "amdmsReadKeywordFloat(%s, %s, .., ..): keyword not found", file->fileName, name);
- return amdmsFALSE;
- }
- amdmsDebug(__FILE__, __LINE__,
- "amdmsReadKeywordFloat(%s, %s, .., ..) = %f", file->fileName, name, *value);
- return amdmsTRUE;
-}
-
-amdmsBOOL amdmsReadKeywordDouble(amdmsFITS *file, char *name, double *value, char *comment)
-{
- int status = 0;
-
- if (file == NULL) {
- return amdmsFALSE;
- }
- if (file->currStateFile != amdmsFILE_OPENED_STATE) {
- amdmsError(__FILE__, __LINE__,
- "amdmsReadKeywordDouble(%s, %S, .., ..), no open file!", file->fileName, name);
- return amdmsFALSE;
- }
- if (fits_read_key_dbl(file->fits, name, value, comment, &status) != 0) {
- if (status != VALUE_UNDEFINED && status != KEY_NO_EXIST) {
- amdmsReportFitsError(file, status, __LINE__, name);
- }
- amdmsDebug(__FILE__, __LINE__,
- "amdmsReadKeywordDouble(%s, %S, .., ..): keyword not found", file->fileName, name);
- return amdmsFALSE;
- }
- amdmsDebug(__FILE__, __LINE__,
- "amdmsReadKeywordDouble(%s, %s, .., ..) = %f", file->fileName, name, *value);
- return amdmsTRUE;
-}
-
-amdmsBOOL amdmsReadKeywordString(amdmsFITS *file, char *name, char *value, char *comment)
-{
- int status = 0;
-
- if (file == NULL) {
- return amdmsFALSE;
- }
- if (file->currStateFile != amdmsFILE_OPENED_STATE) {
- amdmsError(__FILE__, __LINE__,
- "amdmsReadKeywordString(%s, %S, .., ..), no open file!", file->fileName, name);
- return amdmsFALSE;
- }
- if (fits_read_key_str(file->fits, name, value, comment, &status) != 0) {
- if (status != VALUE_UNDEFINED && status != KEY_NO_EXIST) {
- amdmsReportFitsError(file, status, __LINE__, name);
- }
- amdmsDebug(__FILE__, __LINE__,
- "amdmsReadKeywordString(%s, %S, .., ..): keyword not found", file->fileName, name);
- return amdmsFALSE;
- }
- amdmsDebug(__FILE__, __LINE__,
- "amdmsReadKeywordString(%s, %s, .., ..) = %s", file->fileName, name, value);
- return amdmsTRUE;
-}
-
-amdmsKEYWORD *amdmsAppendKeyword(amdmsFITS *file, char *name, int type, char *comment)
-{
- amdmsKEYWORD *kwd;
- amdmsKEYWORD *hkwd;
-
- kwd = (amdmsKEYWORD *)calloc(1L, sizeof(amdmsKEYWORD));
- if (kwd == NULL) {
- return NULL;
- }
- kwd->next = NULL;
- if (file->hdrKeys == NULL) {
- file->hdrKeys = kwd;
- } else {
- hkwd = file->hdrKeys;
- while (hkwd->next != NULL) {
- hkwd = hkwd->next;
- }
- hkwd->next = kwd;
- }
- strcpy(kwd->name, name);
- kwd->type = type;
- if (comment != NULL) {
- strcpy(kwd->comment, comment);
- } else {
- kwd->comment[0] = '\0';
- }
- return kwd;
-}
-
-amdmsCOMPL amdmsUpdateKeywordInt(amdmsFITS *file, char *name, int value, char *comment)
-{
- amdmsKEYWORD *kwd;
-
- kwd = amdmsAppendKeyword(file, name, TINT, comment);
- if (kwd == NULL) {
- return amdmsFAILURE;
- }
- kwd->longValue = (long)value;
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsUpdateKeywordLong(amdmsFITS *file, char *name, long value, char *comment)
-{
- amdmsKEYWORD *kwd;
-
- kwd = amdmsAppendKeyword(file, name, TLONG, comment);
- if (kwd == NULL) {
- return amdmsFAILURE;
- }
- kwd->longValue = value;
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsUpdateKeywordFloat(amdmsFITS *file, char *name, float value, int decimals, char *comment)
-{
- amdmsKEYWORD *kwd;
-
- kwd = amdmsAppendKeyword(file, name, TFLOAT, comment);
- if (kwd == NULL) {
- return amdmsFAILURE;
- }
- kwd->decimals = decimals;
- kwd->doubleValue = (double)value;
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsUpdateKeywordDouble(amdmsFITS *file, char *name, double value, int decimals, char *comment)
-{
- amdmsKEYWORD *kwd;
-
- kwd = amdmsAppendKeyword(file, name, TDOUBLE, comment);
- if (kwd == NULL) {
- return amdmsFAILURE;
- }
- kwd->decimals = decimals;
- kwd->doubleValue = value;
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsUpdateKeywordString(amdmsFITS *file, char *name, char *value, char *comment)
-{
- amdmsKEYWORD *kwd;
-
- kwd = amdmsAppendKeyword(file, name, TSTRING, comment);
- if (kwd == NULL) {
- return amdmsFAILURE;
- }
- strcpy(kwd->stringValue, value);
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsUpdateKeywords(amdmsFITS *file)
-{
- int status = 0;
- amdmsKEYWORD *kwd;
-
- amdmsDebug(__FILE__, __LINE__, "ENTER amdmsUpdateKeywords(%s)", file->fileName);
- if (file->currStateFile != amdmsFILE_CREATED_STATE) {
- /* amdmsVBF(amdmsVERBOSE_ERROR, (stderr, "ERROR: amdmsFITS::UpdateKeywords(), no open file!\n")); */
- return amdmsFAILURE;
- }
- while (file->hdrKeys != NULL) {
- kwd = file->hdrKeys;
- amdmsDebug(__FILE__, __LINE__, " updating %s", kwd->name);
- switch (kwd->type) {
- case TINT:
- case TLONG:
- if (fits_update_key_lng(file->fits, kwd->name, kwd->longValue, kwd->comment, &status) != 0) {
- amdmsReportFitsError(file, status, __LINE__, kwd->name);
- return amdmsFAILURE;
- }
- break;
- case TFLOAT:
- if (fits_update_key_flt(file->fits, kwd->name, (float)(kwd->doubleValue), kwd->decimals, kwd->comment, &status) != 0) {
- amdmsReportFitsError(file, status, __LINE__, kwd->name);
- return amdmsFAILURE;
- }
- break;
- case TDOUBLE:
- if (fits_update_key_dbl(file->fits, kwd->name, kwd->doubleValue, kwd->decimals, kwd->comment, &status) != 0) {
- amdmsReportFitsError(file, status, __LINE__, kwd->name);
- return amdmsFAILURE;
- }
- break;
- case TSTRING:
- if (fits_update_key_str(file->fits, kwd->name, kwd->stringValue, kwd->comment, &status) != 0) {
- amdmsReportFitsError(file, status, __LINE__, kwd->name);
- return amdmsFAILURE;
- }
- break;
- default:;
- }
- file->hdrKeys = file->hdrKeys->next;
- free(kwd);
- }
- amdmsDebug(__FILE__, __LINE__, "LEAVE amdmsUpdateKeywords(%s)", file->fileName);
- return amdmsSUCCESS;
-}
-
diff --git a/amber/amdmsFitsTable.c b/amber/amdmsFitsTable.c
deleted file mode 100644
index 60b3bf1..0000000
--- a/amber/amdmsFitsTable.c
+++ /dev/null
@@ -1,511 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <memory.h>
-#include <math.h>
-
-#include "amdmsFits.h"
-
-amdmsBOOL amdmsGetColumnIndex(amdmsFITS *file, char *name, int *index)
-{
- int status = 0;
-
- *index = -1;
- if (fits_get_colnum(file->fits, CASEINSEN, name, index, &status) != 0) {
- amdmsDebug(__FILE__, __LINE__,
- "amdmsGetColumnIndex(%s, %s, ..) -> column not found!",
- file->fileName, name);
- if (status != COL_NOT_FOUND) {
- amdmsReportFitsError(file, status,__LINE__, NULL);
- }
- return amdmsFALSE;
- }
- amdmsDebug(__FILE__, __LINE__, "amdmsGetColumnIndex(%s, ..) -> %d", name, *index);
- return amdmsTRUE;
-}
-
-amdmsCOMPL amdmsReadElements(amdmsFITS *file, int dataType, int iCol, long iRow, long nEls, void *values)
-{
- int status = 0;
-
- if (fits_read_col(file->fits, dataType, iCol, iRow, 1L, nEls, NULL, values, NULL, &status) != 0) {
- amdmsError(__FILE__, __LINE__,
- "amdmsReadElements(%s, %d, %d, %d, %d, ...)",
- file->fileName, dataType, iCol, iRow, nEls);
- amdmsReportFitsError(file, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsWriteElementLong(amdmsFITS *file, int iCol, long iRow, long value, long offset)
-{
- int status = 0;
-
- if (fits_write_col(file->fits, TLONG, iCol, iRow, offset + 1, 1L, &value, &status) != 0)
- {
- amdmsReportFitsError(file, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- return amdmsSUCCESS;
-}
-
-/*
-amdmsCOMPL amdmsWriteElementFloat(amdmsFITS *file, int iCol, int iRow, float value, int offset)
-{
- int status = 0;
-
- if (fits_write_col(file->fits, TFLOAT, iCol, iRow, offset + 1, 1, &value, &status) != 0)
- {
- amdmsReportFitsError(file, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- return amdmsSUCCESS;
-}
-*/
-
-amdmsCOMPL amdmsWriteElementDouble(amdmsFITS *file, int iCol, long iRow, double value, long offset)
-{
- int status = 0;
-
- if (fits_write_col(file->fits, TDOUBLE, iCol, iRow, offset + 1, 1L, &value, &status) != 0)
- {
- amdmsReportFitsError(file, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsWriteElementString(amdmsFITS *file, int iCol, long iRow, char *value, long offset)
-{
- int status = 0;
-
- if (fits_write_col(file->fits, TSTRING, iCol, iRow, offset + 1, 1L, &value, &status) != 0)
- {
- amdmsReportFitsError(file, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsWriteElements(amdmsFITS *file, int dataType, int iCol, long iRow, long nEls, void *values)
-{
- int status = 0;
-
- amdmsDebug(__FILE__, __LINE__,
- "WriteElements(..., %d, %d, %d, %d, ...)", dataType, iCol, iRow, nEls);
- if (fits_write_col(file->fits, dataType, iCol, iRow, 1L, nEls, values, &status) != 0) {
- amdmsReportFitsError(file, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCreateTable(amdmsFITS *file, char *extName, int indexColType, int regionColType, int nReads)
-{
- int status = 0;
- int iCol;
- int iRow;
- int iReg;
-
- if (file->currStateFile != amdmsFILE_CREATED_STATE) {
- /* amdmsVBF(amdmsVERBOSE_ERROR, (stderr, "ERROR: amdmsFITS::createTable(%s, ..), no open file!\n", extName)); */
- return amdmsFAILURE;
- }
- /* amdmsVB(amdmsVERBOSE_DEBUG_CALL, ("amdmsFITS::createTable(%s, %d, %d, %d)\n", extName, indexColType, regionColType, nReads)); */
- if ((file->hdrTable != NULL) || (file->hdrKeys != NULL)) {
- if(amdmsCreateEmptyImageCube(file) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- }
- if (amdmsCreateImagingDetectorTable(file) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsMoveToLastHDU(file) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- file->tableExt = extName;
- file->indexColType = indexColType;
- file->regionColType = regionColType;
- file->outNCols = 0;
- if (amdmsAddColumn(file, indexColType, 1, file->indexColName, -1, NULL) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- for (iRow = 0; iRow < file->nRows; iRow++) {
- for (iCol = 0; iCol < file->nCols; iCol++) {
- iReg = iRow*file->nCols + iCol;
- if (file->data.data[iReg] != NULL) {
- free(file->data.data[iReg]);
- file->data.data[iReg] = NULL;
- }
- file->data.data[iReg] = (float*)calloc((size_t)(file->regions[iCol][iRow].size), sizeof(float));
- if (file->data.data[iReg] == NULL) {
- /* amdmsVBF(amdmsVERBOSE_OFF, (stderr, "FATAL: amdmsCreateTable(%s, ..), memory allocation failure (file->data.data[%d])!\n", extName, iReg)); */
- file->currStateFile = amdmsERROR_STATE;
- return amdmsFAILURE;
- }
- if (amdmsAddColumn(file, regionColType, file->regions[iCol][iRow].size, file->regionColName, iReg + 1, NULL) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- }
- }
- if (fits_create_tbl(file->fits, BINARY_TBL, 0, file->outNCols, file->outColType, file->outColForm, file->outColUnit, extName, &status) !=0 ) {
- amdmsReportFitsError(file, status, __LINE__, extName);
- return amdmsFAILURE;
- }
- if (amdmsMoveToLastHDU(file) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- file->currStateHDU = amdmsTABLE_CREATED_STATE;
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsOpenTable(amdmsFITS *file, char *extName, int nReads)
-{
- int status = 0;
- char name[32];
- long nRs;
- double *idxCol = NULL;
- int iImage;
- int iCol;
- int iRow;
- int iReg;
- int nReg = file->nRows*file->nCols;
- amdmsIMAGING_DETECTOR *det;
- amdmsIMAGING_DATA *dat;
-
- /* amdmsVB(amdmsVERBOSE_DEBUG_CALL, ("amdmsFITS::OpenTable(%s, %d)\n", extName, nReads)); */
- if (file->currStateFile != amdmsFILE_OPENED_STATE) {
- /* amdmsVBF(amdmsVERBOSE_ERROR, (stderr, "ERROR: amdmsFITS::OpenTable(%s, ..), no open file!\n", extName)); */
- return amdmsFAILURE;
- }
- file->tableExt = extName;
- file->nReads = nReads;
- /* it is mandatory that the requested extension exists */
- if (amdmsMoveToExtension(file, extName, BINARY_TBL, amdmsTRUE) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- det = &(file->detector);
- dat = &(file->data);
- /* read keywords from current HDU */
- dat->maxInsFlag = amdmsReadKeywordInt(file, "MAXINS", &(dat->maxIns), NULL);
- dat->maxStepFlag = amdmsReadKeywordInt(file, "MAXSTEP", &(dat->maxStep), NULL);
- /* request column indices */
- dat->frameFlag = amdmsGetColumnIndex(file, "FRAME", &(dat->frameColNr)); /* no standard column! */
- dat->timeFlag = amdmsGetColumnIndex(file, "TIME", &(dat->timeColNr));
- if (!dat->timeFlag) {
- dat->timeFlag = amdmsGetColumnIndex(file, "INDEX", &(dat->timeColNr));
- }
- dat->exptimeFlag = amdmsGetColumnIndex(file, "EXPTIME", &(dat->exptimeColNr)); /* no standard column! */
- dat->optTrainFlag = amdmsGetColumnIndex(file, "OPT_TRAIN", &(dat->optTrainColNr));
- dat->insTrainFlag = amdmsGetColumnIndex(file, "INS_TRAIN", &(dat->insTrainColNr));
- dat->referenceFlag = amdmsGetColumnIndex(file, "REFERENCE", &(dat->referenceColNr));
- dat->opdFlag = amdmsGetColumnIndex(file, "OPD", &(dat->opdColNr));
- dat->localOpdFlag = amdmsGetColumnIndex(file, "LOCALOPD", &(dat->localOpdColNr));
- dat->offsetFlag = amdmsGetColumnIndex(file, "OFFSET", &(dat->offsetColNr));
- dat->rotationFlag = amdmsGetColumnIndex(file, "ROTATION", &(dat->rotationColNr));
- dat->steppingPhaseFlag = amdmsGetColumnIndex(file, "STEPPING_PHASE", &(dat->steppingPhaseColNr));
- for (iReg = 0; iReg < nReg; iReg++) {
- dat->dataFlag = 0;
- sprintf(name, "TARGET%d", iReg + 1);
- dat->targetFlag = amdmsGetColumnIndex(file, name, &(dat->targetColNr[iReg]));
- sprintf(name, "TARTYP%d", iReg + 1);
- dat->tarTypFlag = amdmsGetColumnIndex(file, name, &(dat->tarTypColNr[iReg]));
- if ((det->regName[iReg][0] != '\0') && (det->regName[iReg][0] != ' ')) {
- dat->dataFlag = amdmsGetColumnIndex(file, det->regName[iReg], &(dat->dataColNr[iReg]));
- }
- if (!dat->dataFlag) {
- sprintf(name, "DATA%d", iReg + 1);
- dat->dataFlag = amdmsGetColumnIndex(file, name, &(dat->dataColNr[iReg]));
- }
- if (!dat->dataFlag) {
- sprintf(name, "Subwindow_%d", iReg + 1);
- dat->dataFlag = amdmsGetColumnIndex(file, name, &(dat->dataColNr[iReg]));
- }
- }
- if (fits_get_num_rows(file->fits, &nRs, &status ) != 0) {
- amdmsReportFitsError(file, status, __LINE__, NULL);
- return amdmsFAILURE;
- }
- file->nImages = nRs/nReads;
- if (file->rowIndex != NULL) {
- free(file->rowIndex);
- file->rowIndex = NULL;
- }
- file->rowIndex = (int*)calloc((size_t)(file->nImages), sizeof(int));
- if (file->rowIndex == NULL) {
- /* amdmsVBF(amdmsVERBOSE_OFF, (stderr, "FATAL: amdmsFITS::OpenTable(%s, %d), memory allocation failure (rowIndex)!\n", extName, nReads)); */
- file->currStateFile = amdmsERROR_STATE;
- return 0;
- }
- for (iImage = 0; iImage < file->nImages; iImage++) {
- file->rowIndex[iImage] = iImage*nReads + 1;
- }
- idxCol = (double*)calloc((size_t)(nRs), sizeof(double));
- if (idxCol == NULL) {
- /* amdmsVBF(amdmsVERBOSE_OFF, (stderr, "FATAL: amdmsFITS::OpenTable(%s, %d), memory allocation failure (idxCol)!\n", extName, nReads)); */
- file->currStateFile = amdmsERROR_STATE;
- return 0;
- }
- if (amdmsReadElements(file, TDOUBLE, dat->timeColNr, 1L, nRs, idxCol) != amdmsSUCCESS) {
- /* amdmsVBF(amdmsVERBOSE_ERROR, (stderr, "ERROR: amdmsFITS::OpenTable(%s, ..), reading index column!\n", extName)); */
- } else {
- iImage = 0;
- for (iRow = 0; iRow < nRs; iRow += nReads) {
- if (idxCol[iRow] != 0.0) {
- file->rowIndex[iImage++] = iRow + 1;
- }
- }
- file->nImages = iImage;
- }
- free(idxCol);
- idxCol = NULL;
- for (iRow = 0; iRow < file->nRows; iRow++) {
- for (iCol = 0; iCol < file->nCols; iCol++) {
- iReg = iRow*file->nCols + iCol;
- if (file->data.data[iReg] != NULL) {
- free(file->data.data[iReg]);
- file->data.data[iReg] = NULL;
- }
- file->data.data[iReg] = (float*)calloc((size_t)(file->regions[iCol][iRow].size), sizeof(float));
- if (file->data.data[iReg] == NULL) {
- /* amdmsVBF(amdmsVERBOSE_OFF, (stderr, "FATAL: amdmsCreateTable(%s, ..), memory allocation failure (file->data.data[%d])!\n", extName, iReg)); */
- file->currStateFile = amdmsERROR_STATE;
- return amdmsFAILURE;
- }
- }
- }
- file->currStateHDU = amdmsTABLE_OPENED_STATE;
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsReadRow(amdmsFITS *file, amdmsDATA *data, int iImage, int iRead)
-{
- int iCol;
- int iRow;
- long iIndex;
- int iReg;
- amdmsIMAGING_DETECTOR *det;
- amdmsIMAGING_DATA *dat;
- int xOff; /* x offset of the upper left corner in the source image */
- int yOff; /* y offset of the upper left corner in the source image */
- int y; /* relative y coordinate of a subwindow */
- int width; /* width of a subwindow */
- int height; /* height of a subwindow */
- amdmsPIXEL *srcData;
- char *str;
-
- /* amdmsVB(amdmsVERBOSE_DEBUG_CALL, ("amdmsFITS::ReadRow(,,%d, %d)\n", iImage, iRead)); */
- if (file->currStateHDU != amdmsTABLE_OPENED_STATE) {
- /* amdmsVBF(amdmsVERBOSE_ERROR, (stderr, "ERROR: amdmsFITS::ReadRow(,, %d, %d), no open table!\n", iImage, iRead)); */
- return amdmsFAILURE;
- }
- if (file->rowIndex == NULL) {
- iIndex = (long)(iImage*file->nReads + iRead + 1);
- } else {
- iIndex = (long)(file->rowIndex[iImage] + iRead);
- }
- if ((data->data == NULL) || (data->nx*data->ny < file->nPixels)) {
- if (data->data != NULL) {
- free(data->data);
- data->data = NULL;
- }
- data->data = (amdmsPIXEL*)calloc((size_t)(file->nPixels), sizeof(amdmsPIXEL));
- if (data->data == NULL) {
- return amdmsFAILURE;
- }
- }
- data->nx = file->nx;
- data->ny = file->ny;
- det = &(file->detector);
- dat = &(file->data);
- if (dat->frameFlag) {
- dat->frameFlag = amdmsReadElements(file, TINT, dat->frameColNr, iIndex, 1L, &(dat->frame));
- }
- if (dat->timeFlag) {
- dat->timeFlag = amdmsReadElements(file, TDOUBLE, dat->timeColNr, iIndex, 1L, &(dat->time));
- data->index = dat->time;
- }
- if (dat->exptimeFlag) {
- dat->exptimeFlag = amdmsReadElements(file, TFLOAT, dat->exptimeColNr, iIndex, 1L, &(dat->exptime));
- }
- if (dat->optTrainFlag) {
- dat->optTrainFlag = amdmsReadElements(file, TSHORT, dat->optTrainColNr, iIndex, (long)(det->maxTel), &(dat->optTrain));
- }
- if (dat->insTrainFlag) {
- dat->insTrainFlag = amdmsReadElements(file, TSHORT, dat->insTrainColNr, iIndex, (long)(dat->maxIns), &(dat->insTrain));
- }
- if (dat->referenceFlag) {
- dat->referenceFlag = amdmsReadElements(file, TSHORT, dat->referenceColNr, iIndex, 1L, &(dat->reference));
- }
- if (dat->opdFlag) {
- dat->opdFlag = amdmsReadElements(file, TDOUBLE, dat->opdColNr, iIndex, (long)(det->maxTel), &(dat->opd));
- }
- if (dat->localOpdFlag) {
- dat->localOpdFlag = amdmsReadElements(file, TDOUBLE, dat->localOpdColNr, iIndex, (long)(det->maxTel), &(dat->localOpd));
- }
- if (dat->offsetFlag) {
- dat->offsetFlag = amdmsReadElements(file, TFLOAT, dat->offsetColNr, iIndex, 2L, &(dat->offset));
- }
- if (dat->rotationFlag) {
- dat->rotationFlag = amdmsReadElements(file, TFLOAT, dat->rotationColNr, iIndex, 1L, &(dat->rotation));
- }
- if (dat->steppingPhaseFlag) {
- dat->steppingPhaseFlag = amdmsReadElements(file, TSHORT, dat->steppingPhaseColNr, iIndex, 1L, &(dat->steppingPhase));
- }
- for (iRow = 0; iRow < file->nRows; iRow++) {
- for (iCol = 0; iCol < file->nCols; iCol++) {
- iReg = iRow*file->nCols + iCol;
- if (dat->targetFlag) {
- dat->targetFlag = amdmsReadElements(file, TSHORT, dat->targetColNr[iReg], iIndex, 1L, &(dat->target[iReg]));
- }
- if (dat->tarTypFlag) {
- str = dat->tarTyp[iReg];
- dat->tarTypFlag = amdmsReadElements(file, TSTRING, dat->tarTypColNr[iReg], iIndex, 1L, &str);
- }
- if (dat->dataFlag) {
- dat->dataFlag = amdmsReadElements(file, TFLOAT, dat->dataColNr[iReg], iIndex, (long)(file->regions[iCol][iRow].size), dat->data[iReg]);
- }
- }
- }
- if ((file->nCols == 1) && (file->nRows == 1)) {
- memcpy(data->data, dat->data[0], file->nPixels*sizeof(amdmsPIXEL));
- } else {
- yOff = 0;
- for (iRow = 0; iRow < file->nRows; iRow++) {
- xOff = 0;
- height = file->regions[0][iRow].height;
- for (iCol = 0; iCol < file->nCols; iCol++) {
- iReg = iRow*file->nCols + iCol;
- width = file->regions[iCol][0].width;
- srcData = dat->data[iReg];
- for (y = 0; y < height; y++) {
- memcpy(data->data + (yOff + y)*file->nx + xOff, srcData, width*sizeof(amdmsPIXEL));
- srcData += width;
- }
- xOff += width;
- }
- yOff += height;
- }
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsWriteRow(amdmsFITS *file, amdmsDATA *data, int iImage, int iRead)
-{
- int iCol;
- int iRow;
- int iReg;
- long iIndex;
- int xOff; /* x offset of the upper left corner in the source image */
- int yOff; /* y offset of the upper left corner in the source image */
- int y; /* relative y coordinate of a subwindow */
- int width; /* width of a subwindow */
- int height; /* height of a subwindow */
- amdmsIMAGING_DATA *dat;
- amdmsPIXEL *dstData;
-
- /* amdmsVB(amdmsVERBOSE_DEBUG_CALL, ("amdmsFITS::WriteRow(,,%d, %d)\n", iImage, iRead)); */
- if (file->currStateHDU != amdmsTABLE_CREATED_STATE) {
- /* amdmsVBF(amdmsVERBOSE_ERROR, (stderr, "ERROR: amdmsFITS::WriteRow(,, %d, %d), no open table!\n", iImage, iRead)); */
- return amdmsFAILURE;
- }
- iIndex = (long)(iImage*file->nReads + iRead + 1);
- dat = &(file->data);
- if (amdmsWriteElements(file, TDOUBLE, 1, iIndex, 1L, &(data->index)) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if ((file->nCols == 1) && (file->nRows == 1)) {
- memcpy(dat->data[0], data->data, file->nPixels*sizeof(amdmsPIXEL));
- } else {
- yOff = 0;
- for (iRow = 0; iRow < file->nRows; iRow++) {
- xOff = 0;
- height = file->regions[0][iRow].height;
- for (iCol = 0; iCol < file->nCols; iCol++) {
- iReg = iRow*file->nCols + iCol;
- width = file->regions[iCol][0].width;
- dstData = dat->data[iReg];
- for (y = 0; y < height; y++) {
- memcpy(dstData, data->data + (yOff + y)*file->nx + xOff, width*sizeof(amdmsPIXEL));
- dstData += width;
- }
- xOff += width;
- }
- yOff += height;
- }
- }
- for (iRow = 0; iRow < file->nRows; iRow++) {
- for (iCol = 0; iCol < file->nCols; iCol++) {
- iReg = iRow*file->nCols + iCol;
- if (amdmsWriteElements(file, TFLOAT, iRow*file->nCols + iCol + 2, iIndex, (long)(file->regions[iCol][iRow].size), dat->data[iReg]) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- }
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsAddColumn(amdmsFITS *file, int colType, int nEls, char *colName, int colNameExt, char *colUnit)
-{
- int iCol = file->outNCols;
- char fch;
-
- if (iCol >= amdmsMAX_BTBL_COLS) {
- return amdmsFAILURE;
- }
- if (file->outColType[iCol] == NULL) {
- file->outColType[iCol] = (char*)calloc(32L, sizeof(char));
- if (file->outColType[iCol] == NULL) {
- /* amdmsVBF(amdmsVERBOSE_OFF, (stderr, "FATAL: amdmsFITS::formatCol(%d, %d, %d, %s, %d), memory allocation failure (outColType[iCol])!\n", iCol, colType, nEls, colName, colNameExt)); */
- file->currStateFile = amdmsERROR_STATE;
- return amdmsFAILURE;
- }
- }
- if (file->outColForm[iCol] == NULL) {
- file->outColForm[iCol] = (char*)calloc(32L, sizeof(char));
- if (file->outColForm[iCol] == NULL) {
- /* amdmsVBF(amdmsVERBOSE_OFF, (stderr, "FATAL: amdmsFITS::formatCol(%d, %d, %d, %s, %d), memory allocation failure (outColForm[iCol])!\n", iCol, colType, nEls, colName, colNameExt)); */
- file->currStateFile = amdmsERROR_STATE;
- return amdmsFAILURE;
- }
- }
- if (file->outColUnit[iCol] == NULL) {
- file->outColUnit[iCol] = (char*)calloc(32L, sizeof(char));
- if (file->outColUnit[iCol] == NULL) {
- /* amdmsVBF(amdmsVERBOSE_OFF, (stderr, "FATAL: amdmsFITS::formatCol(%d, %d, %d, %s, %d), memory allocation failure (outColUnit[iCol])!\n", iCol, colType, nEls, colName, colNameExt)); */
- file->currStateFile = amdmsERROR_STATE;
- return 0;
- }
- }
- if (colNameExt != -1) {
- sprintf(file->outColType[iCol], "%s%d", colName, colNameExt);
- } else {
- strcpy(file->outColType[iCol], colName);
- }
- switch (colType) {
- case TBYTE: fch = 'B'; break;
- case TSHORT: fch = 'I'; break;
- case TINT: fch = 'J'; break;
- case TLONG: fch = 'J'; break;
- case TFLOAT: fch = 'E'; break;
- case TDOUBLE: fch = 'D'; break;
- case TSTRING: fch = 'a'; break;
- default:
- return amdmsFAILURE;
- }
- if (nEls == 1) {
- file->outColForm[iCol][0] = fch;
- file->outColForm[iCol][1] = '\0';
- } else {
- sprintf(file->outColForm[iCol], "%d%c", nEls, fch);
- }
- if (colUnit != NULL) {
- strcpy(file->outColUnit[iCol], colUnit);
- }
- /* amdmsVB(amdmsVERBOSE_DEBUG, ("formatCol(%d, ..), outColType=%s, outColForm=%s, outColUnit=%s\n", iCol, outColType[iCol], outColForm[iCol], outColUnit[iCol])); */
- file->outNCols++;
- return amdmsSUCCESS;
-
-}
-
diff --git a/amber/amdmsPixelStatistics.c b/amber/amdmsPixelStatistics.c
deleted file mode 100644
index ec1e6c5..0000000
--- a/amber/amdmsPixelStatistics.c
+++ /dev/null
@@ -1,1450 +0,0 @@
-#include <math.h>
-
-#include "amdms.h"
-#include "amdmsFits.h"
-
-#define amdmsLOWER_PE 0.50
-#define amdmsUPPER_PE 1.30
-
-#define MIN(x,y) ((x) < (y) ? (x) : (y))
-#define MAX(x,y) ((x) > (y) ? (x) : (y))
-
-static amdmsCOMPL amdmsCalculateMeanVariance(amdmsALGO_STAT_ENV *env,
- amdmsFITS *file);
-static amdmsCOMPL amdmsCalculateElectronicBiasQ1(amdmsALGO_STAT_ENV *env);
-static amdmsCOMPL amdmsCalculateElectronicBiasQ4(amdmsALGO_STAT_ENV *env);
-static amdmsCOMPL amdmsCreatePixelStatMap(amdmsALGO_STAT_ENV *env,
- amdmsFITS *outfile,
- amdmsFITS_FLAGS flags);
-static amdmsCOMPL amdmsCreateElectronicBiasMap(amdmsALGO_STAT_ENV *env,
- amdmsFITS *outfile,
- amdmsFITS_FLAGS flags);
-static amdmsCOMPL amdmsCreateBadPixelMap(amdmsFITS *outfile,
- amdmsFITS_FLAGS flags,
- amdmsDATA *bpm);
-static amdmsCOMPL amdmsCreatePixelBiasMap(amdmsALGO_STAT_ENV *env,
- amdmsFITS *outfile,
- amdmsFITS_FLAGS flags);
-static amdmsCOMPL amdmsCreateParticleEventMap(amdmsALGO_STAT_ENV *env,
- amdmsFITS *outfile,
- amdmsFITS_FLAGS flags);
-static amdmsCOMPL amdmsCreateReadoutNoiseMap(amdmsALGO_STAT_ENV *env,
- amdmsFITS *outfile,
- amdmsFITS_FLAGS flags);
-static amdmsCOMPL amdmsCreatePhotonNoiseMap(amdmsALGO_STAT_ENV *env,
- amdmsFITS *outfile,
- amdmsFITS_FLAGS flags);
-
-static amdmsCOMPL amdmsDetectParticleEvents(amdmsPARTICLE_EVENT_SETUP *setup,
- amdmsDATA_FILTER_SETUP *filter,
- amdmsCALIBRATION_SETUP *calib,
- amdmsFITS *file,
- amdmsDATA *meanPixels,
- amdmsDATA *varPixels);
-static amdmsCOMPL amdmsFindPEs(amdmsPARTICLE_EVENT_SETUP *setup, amdmsDATA *var, int nValues);
-static void amdmsAnalyzePE(amdmsPARTICLE_EVENT_SETUP *setup, int iPE, amdmsPIXEL var);
-static void amdmsFindPEInterval(amdmsPARTICLE_EVENT_SETUP *setup, int iPE);
-static void amdmsVerifyPE(amdmsPARTICLE_EVENT_SETUP *setup, int iPE);
-static void amdmsRecalculateMeanVar(amdmsPARTICLE_EVENT_SETUP *setup,
- amdmsDATA_FILTER_SETUP *filter,
- int iPE,
- amdmsDATA *meanPixels,
- amdmsDATA *varPixels);
-static void amdmsCalcMeanVar(amdmsPARTICLE_EVENT_SETUP *setup,
- int iPE,
- int from,
- int to,
- amdmsPIXEL *mean,
- amdmsPIXEL *var);
-
-amdmsCOMPL amdmsCreateStatisticsAlgo(amdmsALGO_STAT_ENV **env)
-{
- amdmsALGO_ENV *henv = NULL;
- amdmsALGO_STAT_ENV *hhenv = NULL;
-
- /* allocate the structure if neccessary */
- if (*env == NULL) {
- hhenv = (amdmsALGO_STAT_ENV*)calloc(1L, sizeof(amdmsALGO_STAT_ENV));
- if (hhenv == NULL) {
- return amdmsFAILURE;
- }
- henv = &(hhenv->env);
- /* call the initialization of a simple algorithm environment */
- if (amdmsCreateAlgo(&henv) != amdmsSUCCESS) {
- free(hhenv);
- return amdmsFAILURE;
- }
- hhenv->allocated = 1;
- *env = hhenv;
- } else {
- /* call the initialization of a simple algorithm environment */
- hhenv = *env;
- henv = &(hhenv->env);
- if (amdmsCreateAlgo(&henv) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- hhenv->allocated = 0;
- }
- /* initialize only the additional members */
- hhenv->cf = 4.2;
- hhenv->ebNIter = 2;
- hhenv->ebLower = 10.0;
- hhenv->ebUpper = 10.0;
- hhenv->ebHFlag = amdmsTRUE;
- hhenv->ebVFlag = amdmsTRUE;
- hhenv->analyzeFlag = amdmsFALSE;
- hhenv->histoFlag = amdmsFALSE;
- hhenv->projMode = amdmsNO_PROJ;
- hhenv->histoData = NULL;
- amdmsInitData(&(hhenv->meanPixels));
- amdmsInitData(&(hhenv->varPixels));
- amdmsInitParticleEventSetup(&(hhenv->events));
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsDestroyStatisticsAlgo(amdmsALGO_STAT_ENV **env)
-{
- amdmsALGO_STAT_ENV *henv = NULL;
- amdmsALGO_ENV *hhenv = NULL;
-
- if (env == NULL) {
- return amdmsFAILURE;
- }
- if (*env == NULL) {
- return amdmsSUCCESS;
- }
- henv = *env;
- if (henv->histoData != NULL) {
- free(henv->histoData);
- henv->histoData = NULL;
- }
- amdmsFreeData(&(henv->meanPixels));
- amdmsFreeData(&(henv->varPixels));
- amdmsFreeParticleEventSetup(&(henv->events));
- hhenv = &(henv->env);
- amdmsDestroyAlgo(&hhenv);
- if (henv->allocated) {
- henv->allocated = amdmsFALSE;
- free(henv);
- *env = NULL;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsDoPixelStatistics(amdmsALGO_STAT_ENV *env)
-{
- amdmsCOMPL retVal = amdmsSUCCESS;
- amdmsFITS *infile = NULL;
- int iOutput;
- amdmsFITS *outfile = NULL;
- amdmsBOOL psmRequested = amdmsTRUE;
- amdmsBOOL ebmRequested = amdmsFALSE;
- amdmsBOOL pemRequested = amdmsFALSE;
-
- amdmsDebug(__FILE__, __LINE__, "amdmsDoPixelStatistics(...)");
- if (env->env.inFiles.nNames != 1) {
- /* no or too many filename(s) given but we need exactly one file */
- amdmsError(__FILE__, __LINE__, "wrong number of filenames given, exactly one input file is needed");
- return amdmsFAILURE;
- }
- if (amdmsReadAllMaps(&(env->env.calib)) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsOpenFitsFile(&infile, env->env.inFiles.names[0]) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsOpenData(infile, env->env.inFiles.flags[0], 1) != amdmsSUCCESS) {
- amdmsCloseFitsFile(&infile);
- return amdmsFAILURE;
- }
- for (iOutput = 0; iOutput < env->env.outFiles.nNames; iOutput++) {
- switch (env->env.outFiles.flags[iOutput].content) {
- case amdmsPIXEL_STAT_CONTENT:
- case amdmsPIXEL_BIAS_CONTENT:
- case amdmsREADOUT_NOISE_CONTENT:
- case amdmsPHOTON_NOISE_CONTENT:
- psmRequested = amdmsTRUE;
- break;
- case amdmsELECTRONIC_BIAS_CONTENT:
- case amdmsBAD_PIXEL_CONTENT:
- ebmRequested = amdmsTRUE;
- break;
- case amdmsPARTICLE_EVENT_CONTENT:
- pemRequested = amdmsTRUE;
- break;
- default:
- amdmsError(__FILE__, __LINE__,
- "unsupported file content (%d)",
- env->env.outFiles.flags[iOutput].content);
- }
- }
- if (psmRequested) {
- retVal = amdmsCalculateMeanVariance(env, infile);
- if (retVal != amdmsSUCCESS) {
- amdmsError(__FILE__, __LINE__, "could not calculate mean flux and temporal variance");
- }
- }
- if (pemRequested && (retVal == amdmsSUCCESS)) {
- retVal = amdmsDetectParticleEvents(&(env->events),
- &(env->env.filter),
- &(env->env.calib),
- infile,
- &(env->meanPixels),
- &(env->varPixels));
- if (retVal != amdmsSUCCESS) {
- amdmsError(__FILE__, __LINE__, "could not detect particle events");
- }
- }
- if (ebmRequested && (retVal == amdmsSUCCESS)) {
- if (env->env.q4Flag) {
- retVal = amdmsCalculateElectronicBiasQ4(env);
- } else {
- retVal = amdmsCalculateElectronicBiasQ1(env);
- }
- if (retVal != amdmsSUCCESS) {
- amdmsError(__FILE__, __LINE__, "could not calculate electronic bias");
- }
- }
- /* generate all outputs */
- for (iOutput = 0; (iOutput < env->env.outFiles.nNames) && (retVal == amdmsSUCCESS); iOutput++) {
- if (env->env.outFiles.flags[iOutput].format == amdmsTEXT_FORMAT) {
- FILE *fp = NULL;
- int i;
- fp = fopen(env->env.outFiles.names[iOutput], "w+");
- if (fp == NULL) {
- amdmsError(__FILE__, __LINE__, "could not create histogram file %s", env->env.outFiles.names[iOutput]);
- continue;
- }
- if (env->histoFlag) {
- for (i = 0; i < 65536; i++) {
- if (env->histoData[i] != 0) {
- fprintf(fp, "%d %d\n", i, env->histoData[i]);
- }
- }
- }
- fclose(fp);
- continue;
- }
- retVal = amdmsCreateFitsFile(&outfile, env->env.outFiles.names[iOutput]);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsCopyHeader(outfile, infile);
- if (retVal != amdmsSUCCESS) {
- amdmsCloseFitsFile(&outfile);
- break;
- }
- amdmsSetRegions(outfile, infile);
- switch (env->env.outFiles.flags[iOutput].content) {
- case amdmsPIXEL_STAT_CONTENT:
- retVal = amdmsCreatePixelStatMap(env, outfile, env->env.outFiles.flags[iOutput]);
- break;
- case amdmsELECTRONIC_BIAS_CONTENT:
- retVal = amdmsCreateElectronicBiasMap(env, outfile, env->env.outFiles.flags[iOutput]);
- break;
- case amdmsPIXEL_BIAS_CONTENT:
- retVal = amdmsCreatePixelBiasMap(env, outfile, env->env.outFiles.flags[iOutput]);
- break;
- case amdmsBAD_PIXEL_CONTENT:
- retVal = amdmsCreateBadPixelMap(outfile, env->env.outFiles.flags[iOutput], &(env->env.calib.bpmData));
- break;
- case amdmsPARTICLE_EVENT_CONTENT:
- retVal = amdmsCreateParticleEventMap(env, outfile, env->env.outFiles.flags[iOutput]);
- break;
- case amdmsREADOUT_NOISE_CONTENT:
- retVal = amdmsCreateReadoutNoiseMap(env, outfile, env->env.outFiles.flags[iOutput]);
- break;
- case amdmsPHOTON_NOISE_CONTENT:
- retVal = amdmsCreatePhotonNoiseMap(env, outfile, env->env.outFiles.flags[iOutput]);
- break;
- default:
- amdmsError(__FILE__, __LINE__,
- "unsupported file content (%d)",
- env->env.outFiles.flags[iOutput].content);
- retVal = amdmsFAILURE;
- }
- retVal = amdmsCloseFitsFile(&outfile);
- }
- amdmsCloseFitsFile(&infile);
- return retVal;
-}
-
-amdmsCOMPL amdmsCalculateMeanVariance(amdmsALGO_STAT_ENV *env, amdmsFITS *file)
-{
- int iPixel;
- int iImage;
- amdmsPIXEL nr;
- int iX, iY;
- amdmsDATA rawData;
- amdmsDATA calData;
- amdmsDATA countData;
- amdmsPIXEL *dp = NULL;
- amdmsPIXEL *fip = NULL;
- amdmsPIXEL *lip = NULL;
- amdmsPIXEL *mp = NULL;
- amdmsPIXEL *vp = NULL;
- amdmsPIXEL *cp = NULL;
- amdmsPIXEL mean, var;
- double n = 0.0;
- double sx = 0.0;
- double sxx = 0.0;
-
- /* check the validity of all arguments including the current state of the input file */
- if ((env == NULL) || (file == NULL)) {
- return amdmsFAILURE;
- }
- if ((file->currStateFile != amdmsFILE_OPENED_STATE)
- ||
- ((file->currStateHDU != amdmsCUBE_OPENED_STATE)
- &&
- (file->currStateHDU != amdmsTABLE_OPENED_STATE))) {
- return amdmsFAILURE;
- }
- /* initialize the temporary memory for raw and calibrated data */
- amdmsInitData(&rawData);
- amdmsInitData(&calData);
- amdmsInitData(&countData);
- /* adjust the data filter setup to the current input file */
- if (amdmsAdjustDataFilterSetup(&(env->env.filter), file) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (env->histoFlag) {
- env->histoData = (int*)calloc(65536, sizeof(int));
- if (env->histoData == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (histoData)");
- return amdmsFAILURE;
- }
- }
- /* allocate memory for the result */
- if (amdmsAllocateData(&(env->meanPixels), file->nx, file->ny) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsAllocateData(&(env->varPixels), file->nx, file->ny) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsAllocateData(&countData, file->nx, file->ny) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- /* initialize the result */
- mp = env->meanPixels.data;
- vp = env->varPixels.data;
- cp = countData.data;
- for (iPixel = 0; iPixel < file->nPixels; iPixel++) {
- *mp++ = 0.0;
- *vp++ = 0.0;
- *cp++ = 0.0;
- }
- /* the first pass is the mean pass */
- for (iImage = env->env.filter.ioiFrom; iImage <= env->env.filter.ioiTo; iImage++) {
- nr = (amdmsPIXEL)iImage;
- /* read one image into memory, the memory is also allocated */
- if (amdmsReadData(file, &rawData, iImage, 0) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- /* calibrate the raw data according to the setup, the memory is also allocated */
- if (amdmsCalibrateData(&(env->env.calib), &rawData, &calData) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (env->analyzeFlag && env->env.filter.aoiFlag) {
- amdmsCalcStat(&(env->env.calib), &calData, iImage,
- env->env.filter.aoiX, env->env.filter.aoiY,
- env->env.filter.aoiWidth, env->env.filter.aoiHeight,
- &mean, &var);
- sx += mean;
- sxx += mean*mean;
- amdmsInfo(__FILE__, __LINE__, " %4d %12.4f %12.4f",
- iImage, mean, var);
- }
- switch (env->projMode) {
- case amdmsHOROZONTAL_PROJ:
- amdmsInfo(__FILE__, __LINE__, "#image %4d horizontal projection", iImage);
- for (iY = 0; iY < env->env.filter.aoiHeight; iY++) {
- amdmsCalcStat(&(env->env.calib), &calData, iImage,
- env->env.filter.aoiX, env->env.filter.aoiY + iY, env->env.filter.aoiWidth, 1, &mean, &var);
- amdmsInfo(__FILE__, __LINE__, " %4d %12.4f %12.4f", env->env.filter.aoiY + iY, mean, var);
- }
- break;
- case amdmsVERTICAL_PROJ:
- amdmsInfo(__FILE__, __LINE__, "#image %4d vertical projection", iImage);
- for (iX = 0; iX < env->env.filter.aoiWidth; iX++) {
- amdmsCalcStat(&(env->env.calib), &calData, iImage,
- env->env.filter.aoiX + iX, env->env.filter.aoiY, 1, env->env.filter.aoiHeight, &mean, &var);
- amdmsInfo(__FILE__, __LINE__, " %4d %12.4f %12.4f\n", env->env.filter.aoiX + iX, mean, var);
- }
- break;
- default:;
- }
- dp = calData.data;
- mp = env->meanPixels.data;
- cp = countData.data;
- fip = env->env.calib.pemDataFI.data;
- lip = env->env.calib.pemDataLI.data;
- for (iPixel = 0; iPixel < file->nPixels; iPixel++) {
- if ((nr > *lip) || (nr < *fip)) {
- *mp += *dp;
- *cp += 1.0;
- }
- dp++;
- mp++;
- cp++;
- fip++;
- lip++;
- }
- if (env->histoFlag) {
- int v, x, y, width, height;
- if (env->env.filter.aoiFlag) {
- x = env->env.filter.aoiX;
- y = env->env.filter.aoiY;
- width = env->env.filter.aoiWidth;
- height = env->env.filter.aoiHeight;
- } else {
- x = 0;
- y = 0;
- width = calData.nx;
- height = calData.ny;
- }
- for (iX = x; iX < (x + width); iX++) {
- for (iY = y; iY < (y + height); iY++) {
- iPixel = calData.nx*iY + iX;
- if (env->env.calib.bpmData.data[iPixel] != amdmsGOOD_PIXEL) continue;
- if (amdmsIsPixelAffectedByPE(&(env->env.calib), iImage, iPixel)) continue;
- v = (int)calData.data[iPixel];
- if ((v >= 0) && (v < 65536)) env->histoData[v]++;
- }
- }
- }
- }
- for (iPixel = 0; iPixel < file->nPixels; iPixel++) {
- if (countData.data[iPixel] == 0.0) {
- env->meanPixels.data[iPixel] = 0.0;
- } else {
- env->meanPixels.data[iPixel] /= countData.data[iPixel];
- }
- }
- /* the second pass is the variance pass */
- if (env->env.outFiles.nNames != 0) {
- for (iImage = env->env.filter.ioiFrom; iImage <= env->env.filter.ioiTo; iImage++) {
- nr = (amdmsPIXEL)iImage;
- /* read one image into memory, the memory is also allocated */
- if (amdmsReadData(file, &rawData, iImage, 0) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- /* calibrate the raw data according to the setup, the memory is also allocated */
- if (amdmsCalibrateData(&(env->env.calib), &rawData, &calData) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- dp = calData.data;
- mp = env->meanPixels.data;
- vp = env->varPixels.data;
- fip = env->env.calib.pemDataFI.data;
- lip = env->env.calib.pemDataLI.data;
- for (iPixel = 0; iPixel < file->nPixels; iPixel++) {
- if ((nr > *lip) || (nr < *fip)) {
- *vp += (*dp - *mp)*(*dp - *mp);
- }
- dp++;
- mp++;
- vp++;
- fip++;
- lip++;
- }
- }
- for (iPixel = 0; iPixel < file->nPixels; iPixel++) {
- if (countData.data[iPixel] <= 1.0) {
- env->varPixels.data[iPixel] = 1.0;
- } else {
- env->varPixels.data[iPixel] /= countData.data[iPixel] - 1.0;
- }
- }
- }
- if (env->analyzeFlag && env->env.filter.aoiFlag) {
- n = (double)(env->env.filter.ioiTo - env->env.filter.ioiFrom + 1);
- mean = (amdmsPIXEL)(sx/n);
- var = (amdmsPIXEL)(1.0/(n - 1.0)*(sxx - sx*sx/n));
- amdmsInfo(__FILE__, __LINE__, "area stat = %12.4f, %12.4f",
- mean, var);
- }
- if (env->env.filter.aoiFlag) {
- amdmsCalcStat(&(env->env.calib), &(env->meanPixels), 0,
- env->env.filter.aoiX, env->env.filter.aoiY,
- env->env.filter.aoiWidth, env->env.filter.aoiHeight,
- &mean, &var);
- amdmsInfo(__FILE__, __LINE__, "mean stat = %12.4f, %12.4f",
- mean, var);
- amdmsCalcStat(&(env->env.calib), &(env->varPixels), 0,
- env->env.filter.aoiX, env->env.filter.aoiY,
- env->env.filter.aoiWidth, env->env.filter.aoiHeight,
- &mean, &var);
- amdmsInfo(__FILE__, __LINE__, "var stat = %12.4f, %12.4f",
- mean, var);
- }
- if (env->env.filter.poiFlag) {
- iPixel = env->env.filter.poiX + env->env.filter.poiY*env->meanPixels.ny;
- amdmsNotice(__FILE__, __LINE__, " stat at %d %d = %12.4f %14.4f",
- env->env.filter.poiX, env->env.filter.poiY,
- env->meanPixels.data[iPixel],
- env->varPixels.data[iPixel]);
- }
- amdmsFreeData(&rawData);
- amdmsFreeData(&calData);
- amdmsFreeData(&countData);
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCalculateElectronicBiasQ1(amdmsALGO_STAT_ENV *env)
-{
- amdmsDATA meanData;
- int iIter;
- int iX;
- int iY;
- int iPixel;
- amdmsPIXEL m;
- amdmsPIXEL v;
- amdmsPIXEL ll;
- amdmsPIXEL ul;
- int nGood;
- int nBad;
- amdmsDATA *ebmData = &(env->env.calib.ebmData);
- amdmsDATA *bpmData = &(env->env.calib.bpmData);
- double *y = NULL;
- double *z = NULL;
-
- amdmsInitData(&meanData);
- if (amdmsCopyData(&meanData, &(env->meanPixels)) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- /* initialize the electronic bias map */
- amdmsSetData(ebmData, 0.0);
- y = (double*)calloc((size_t)meanData.ny, sizeof(double));
- if (y == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (y)");
- return amdmsFAILURE;
- }
- z = (double*)calloc((size_t)meanData.ny, sizeof(double));
- if (z == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (z)");
- return amdmsFAILURE;
- }
- /* calculate the horizontal projection */
- if (env->ebHFlag) {
- for (iY = 0; iY < meanData.ny; iY++) {
- amdmsCalcStat(&(env->env.calib), &meanData, 0, 0, iY, meanData.nx, 1, &m, &v);
- ll = m - env->ebLower;
- ul = m + env->ebUpper;
- for (iIter = 0; iIter < env->ebNIter; iIter++) {
- do {
- nGood = 0;
- nBad = 0;
- for (iX = 0; iX < meanData.nx; iX++) {
- iPixel = iY*meanData.nx + iX;
- if (bpmData->data[iPixel] != amdmsBAD_PIXEL) {
- bpmData->data[iPixel] = amdmsGOOD_PIXEL;
- if ((meanData.data[iPixel] < ll) || (meanData.data[iPixel] > ul)) {
- bpmData->data[iPixel] = -1.0;
- } else {
- nGood++;
- }
- } else {
- nBad++;
- }
- }
- if ((nBad > meanData.nx/2) || (nGood > meanData.nx/2)) {
- break;
- } else {
- ll -= env->ebLower;
- ul += env->ebUpper;
- }
- } while (amdmsTRUE);
- amdmsCalcStat(&(env->env.calib), &meanData, 0, 0, iY, meanData.nx, 1, &m, &v);
- ll = m - env->ebLower;
- ul = m + env->ebUpper;
- }
- /* amdmsInfo(__FILE__, __LINE__, "EB(%f) = %f", (double)iY/(double)meanData.ny, m); */
- y[iY] = (double)m;
- }
- }
- /*
- if (amdmsSmoothDataByFiniteDiff1(y, z, 10.0, meanData.ny) != amdmsSUCCESS) {
- amdmsFreeData(&meanData);
- free(y);
- free(z);
- return amdmsFAILURE;
- }
- */
- for (iY = 0; iY < meanData.ny; iY++) {
- /* m = z[iY]; */
- m = y[iY];
- /* amdmsInfo(__FILE__, __LINE__, "EB(%f) = %f", (double)iY/(double)meanData.ny, m); */
- for (iX = 0; iX < meanData.nx; iX++) {
- iPixel = iY*meanData.nx + iX;
- if (bpmData->data[iPixel] == -1.0) {
- bpmData->data[iPixel] = amdmsBAD_PIXEL;
- }
- ebmData->data[iPixel] += m;
- meanData.data[iPixel] -= m;
- }
- }
- /* calculate the vertical projection */
- if (env->ebVFlag) {
- for (iX = 0; iX < meanData.nx; iX++) {
- amdmsCalcStat(&(env->env.calib), &meanData, 0, iX, 0, 1, meanData.ny, &m, &v);
- ll = m - env->ebLower;
- ul = m + env->ebUpper;
- for (iIter = 0; iIter < env->ebNIter; iIter++) {
- do {
- nGood = 0;
- nBad = 0;
- for (iY = 0; iY < meanData.ny; iY++) {
- iPixel = iY*meanData.nx + iX;
- if (bpmData->data[iPixel] != amdmsBAD_PIXEL) {
- bpmData->data[iPixel] = amdmsGOOD_PIXEL;
- if ((meanData.data[iPixel] < ll) || (meanData.data[iPixel] > ul)) {
- bpmData->data[iPixel] = -1.0;
- } else {
- nGood++;
- }
- } else {
- nBad++;
- }
- }
- if ((nBad > meanData.ny/2) || (nGood > meanData.ny/2)) {
- break;
- } else {
- ll -= env->ebLower;
- ul += env->ebUpper;
- }
- } while (amdmsTRUE);
- amdmsCalcStat(&(env->env.calib), &meanData, 0, iX, 0, 1, meanData.ny, &m, &v);
- ll = m - env->ebLower;
- ul = m + env->ebUpper;
- }
- for (iY = 0; iY < meanData.ny; iY++) {
- iPixel = iY*meanData.nx + iX;
- if (bpmData->data[iPixel] == -1.0) {
- bpmData->data[iPixel] = amdmsBAD_PIXEL;
- }
- ebmData->data[iPixel] += m;
- meanData.data[iPixel] -= m;
- }
- }
- }
- if (amdmsCopyData(&(env->meanPixels), &meanData) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- amdmsFreeData(&meanData);
- free(y);
- free(z);
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCalculateElectronicBiasQ4(amdmsALGO_STAT_ENV *env)
-{
- amdmsDATA meanData;
- int iIter;
- int iX;
- int iY;
- int iPixel;
- amdmsPIXEL m;
- amdmsPIXEL v;
- amdmsPIXEL ll;
- amdmsPIXEL ul;
- int nGood;
- int nBad;
- amdmsDATA *ebmData = &(env->env.calib.ebmData);
- amdmsDATA *bpmData = &(env->env.calib.bpmData);
- int nx1 = 0;
- int nx2 = 0;
- double *y1 = NULL;
- double *y2 = NULL;
- double *z = NULL;
-
- amdmsInitData(&meanData);
- if (amdmsCopyData(&meanData, &(env->meanPixels)) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- /* initialize the electronic bias map */
- amdmsSetData(ebmData, 0.0);
- nx1 = meanData.nx/2;
- nx2 = meanData.nx - nx1;
- y1 = (double*)calloc((size_t)meanData.ny, sizeof(double));
- if (y1 == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (y1)");
- return amdmsFAILURE;
- }
- y2 = (double*)calloc((size_t)meanData.ny, sizeof(double));
- if (y2 == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (y2)");
- return amdmsFAILURE;
- }
- z = (double*)calloc((size_t)meanData.ny, sizeof(double));
- if (z == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (z)");
- return amdmsFAILURE;
- }
- /* calculate the horizontal projection */
- if (env->ebHFlag) {
- for (iY = 0; iY < meanData.ny; iY++) {
- /* left quadrants */
- amdmsCalcStat(&(env->env.calib), &meanData, 0, 0, iY, nx1, 1, &m, &v);
- /* amdmsInfo(__FILE__, __LINE__, "EB(%d) = %f", iY, m); */
- ll = m - env->ebLower;
- ul = m + env->ebUpper;
- for (iIter = 0; iIter < env->ebNIter; iIter++) {
- do {
- nGood = 0;
- nBad = 0;
- for (iX = 0; iX < nx1; iX++) {
- iPixel = iY*meanData.nx + iX;
- if (bpmData->data[iPixel] != amdmsBAD_PIXEL) {
- bpmData->data[iPixel] = amdmsGOOD_PIXEL;
- if ((meanData.data[iPixel] < ll) || (meanData.data[iPixel] > ul)) {
- bpmData->data[iPixel] = -1.0;
- } else {
- nGood++;
- }
- } else {
- nBad++;
- }
- }
- if ((nBad > nx1/2) || (nGood > nx1/2)) {
- break;
- } else {
- ll -= env->ebLower;
- ul += env->ebUpper;
- }
- } while (amdmsTRUE);
- amdmsCalcStat(&(env->env.calib), &meanData, 0, 0, iY, nx1, 1, &m, &v);
- ll = m - env->ebLower;
- ul = m + env->ebUpper;
- }
- /* amdmsInfo(__FILE__, __LINE__, "EB(%f) = %f", (double)iY/(double)meanData.ny, m); */
- y1[iY] = (double)m;
- /* right quadrants */
- amdmsCalcStat(&(env->env.calib), &meanData, 0, nx1, iY, nx2, 1, &m, &v);
- ll = m - env->ebLower;
- ul = m + env->ebUpper;
- for (iIter = 0; iIter < env->ebNIter; iIter++) {
- do {
- nGood = 0;
- nBad = 0;
- for (iX = nx1; iX < nx1 + nx2; iX++) {
- iPixel = iY*meanData.nx + iX;
- if (bpmData->data[iPixel] != amdmsBAD_PIXEL) {
- bpmData->data[iPixel] = amdmsGOOD_PIXEL;
- if ((meanData.data[iPixel] < ll) || (meanData.data[iPixel] > ul)) {
- bpmData->data[iPixel] = -1.0;
- } else {
- nGood++;
- }
- } else {
- nBad++;
- }
- }
- if ((nBad > nx2/2) || (nGood > nx2/2)) {
- break;
- } else {
- ll -= env->ebLower;
- ul += env->ebUpper;
- }
- } while (amdmsTRUE);
- amdmsCalcStat(&(env->env.calib), &meanData, 0, nx1, iY, nx2, 1, &m, &v);
- ll = m - env->ebLower;
- ul = m + env->ebUpper;
- }
- /* amdmsInfo(__FILE__, __LINE__, "EB(%f) = %f", (double)iY/(double)meanData.ny, m); */
- y2[iY] = (double)m;
- }
- }
- /*
- if (amdmsSmoothDataByFiniteDiff1(y, z, 10.0, meanData.ny) != amdmsSUCCESS) {
- amdmsFreeData(&meanData);
- free(y);
- free(z);
- return amdmsFAILURE;
- }
- */
- for (iY = 0; iY < meanData.ny; iY++) {
- /* left quadrant */
- /* m = z[iY]; */
- m = y1[iY];
- /* amdmsInfo(__FILE__, __LINE__, "EB(%f) = %f", (double)iY/(double)meanData.ny, m); */
- for (iX = 0; iX < nx1; iX++) {
- iPixel = iY*meanData.nx + iX;
- if (bpmData->data[iPixel] == -1.0) {
- bpmData->data[iPixel] = amdmsBAD_PIXEL;
- }
- ebmData->data[iPixel] += m;
- meanData.data[iPixel] -= m;
- }
- /* right quadrant */
- /* m = z[iY]; */
- m = y2[iY];
- /* amdmsInfo(__FILE__, __LINE__, "EB(%f) = %f", (double)iY/(double)meanData.ny, m); */
- for (iX = nx1; iX < nx1 + nx2; iX++) {
- iPixel = iY*meanData.nx + iX;
- if (bpmData->data[iPixel] == -1.0) {
- bpmData->data[iPixel] = amdmsBAD_PIXEL;
- }
- ebmData->data[iPixel] += m;
- meanData.data[iPixel] -= m;
- }
- }
- /* calculate the vertical projection */
- if (env->ebVFlag) {
- for (iX = 0; iX < meanData.nx; iX++) {
- amdmsCalcStat(&(env->env.calib), &meanData, 0, iX, 0, 1, meanData.ny, &m, &v);
- ll = m - env->ebLower;
- ul = m + env->ebUpper;
- for (iIter = 0; iIter < env->ebNIter; iIter++) {
- do {
- nGood = 0;
- nBad = 0;
- for (iY = 0; iY < meanData.ny; iY++) {
- iPixel = iY*meanData.nx + iX;
- if (bpmData->data[iPixel] != amdmsBAD_PIXEL) {
- bpmData->data[iPixel] = amdmsGOOD_PIXEL;
- if ((meanData.data[iPixel] < ll) || (meanData.data[iPixel] > ul)) {
- bpmData->data[iPixel] = -1.0;
- } else {
- nGood++;
- }
- } else {
- nBad++;
- }
- }
- if ((nBad > meanData.ny/2) || (nGood > meanData.ny/2)) {
- break;
- } else {
- ll -= env->ebLower;
- ul += env->ebUpper;
- }
- } while (amdmsTRUE);
- amdmsCalcStat(&(env->env.calib), &meanData, 0, iX, 0, 1, meanData.ny, &m, &v);
- ll = m - env->ebLower;
- ul = m + env->ebUpper;
- }
- for (iY = 0; iY < meanData.ny; iY++) {
- iPixel = iY*meanData.nx + iX;
- if (bpmData->data[iPixel] == -1.0) {
- bpmData->data[iPixel] = amdmsBAD_PIXEL;
- }
- ebmData->data[iPixel] += m;
- meanData.data[iPixel] -= m;
- }
- }
- }
- if (amdmsCopyData(&(env->meanPixels), &meanData) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- amdmsFreeData(&meanData);
- free(y1);
- free(y2);
- free(z);
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCreatePixelStatMap(amdmsALGO_STAT_ENV *env, amdmsFITS *outfile, amdmsFITS_FLAGS flags)
-{
- if (amdmsCreateData(outfile, flags, amdmsPIXEL_STAT_NROWS, 1) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- env->meanPixels.index = 1.0;
- if (amdmsWriteData(outfile, &(env->meanPixels), amdmsPIXEL_STAT_MEAN_ROW, 0) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- env->varPixels.index = 2.0;
- if (amdmsWriteData(outfile, &(env->varPixels), amdmsPIXEL_STAT_VAR_ROW, 0) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCreateElectronicBiasMap(amdmsALGO_STAT_ENV *env, amdmsFITS *outfile, amdmsFITS_FLAGS flags)
-{
- if (amdmsCreateData(outfile, flags, amdmsELECTRONIC_BIAS_NROWS, 1) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- env->env.calib.ebmData.index = 1.0;
- if (amdmsWriteData(outfile, &(env->env.calib.ebmData), amdmsELECTRONIC_BIAS_ROW, 0) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCreateBadPixelMap(amdmsFITS *outfile, amdmsFITS_FLAGS flags, amdmsDATA *bpm)
-{
- int nPixels = bpm->nx*bpm->ny;
- int nGoodPixels = nPixels;
- int nBadPixels = 0;
- int iPixel;
-
- for (iPixel = 0; iPixel < nPixels; iPixel++) {
- if (bpm->data[iPixel] == amdmsBAD_PIXEL) {
- nGoodPixels--;
- nBadPixels++;
- }
- }
- if (amdmsUpdateKeywordString(outfile,
- "HIERARCH ESO DPR CATG", "CALIB",
- "Observation category")
- != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsUpdateKeywordString(outfile,
- "HIERARCH ESO DPR TECH", "INTERFEROMETRY",
- "Observation technique")
- != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsUpdateKeywordString(outfile,
- "HIERARCH ESO DPR TYPE", "BADPIX",
- "Observation type")
- != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsUpdateKeywordInt(outfile,
- "GOODPIX", nGoodPixels,
- "number of good pixels")
- != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsUpdateKeywordInt(outfile,
- "BADPIX", nBadPixels,
- "number of bad pixels")
- != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsCreateData(outfile, flags, amdmsBAD_PIXEL_NROWS, 1) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- bpm->index = 1.0;
- if (amdmsWriteData(outfile, bpm, amdmsBAD_PIXEL_ROW, 0) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCreatePixelBiasMap(amdmsALGO_STAT_ENV *env, amdmsFITS *outfile, amdmsFITS_FLAGS flags)
-{
- if (amdmsCreateData(outfile, flags, amdmsPIXEL_BIAS_NROWS, 1) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- env->meanPixels.index = 1.0;
- if (amdmsWriteData(outfile, &(env->meanPixels), amdmsPIXEL_BIAS_ROW, 0) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCreateParticleEventMap(amdmsALGO_STAT_ENV *env, amdmsFITS *outfile, amdmsFITS_FLAGS flags)
-{
- int iPE;
-
- if (amdmsUpdateKeywordInt(outfile,
- "NEVENTS", env->events.nSPE,
- "number of particle events")
- != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsCreateData(outfile, flags, amdmsPARTICLE_EVENT_NROWS, 1) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- amdmsSetData(&(env->env.calib.pemDataFI), -1.0);
- amdmsSetData(&(env->env.calib.pemDataLI), -1.0);
-
- for (iPE = 0; iPE < env->events.nPE; iPE++) {
- if (env->events.pes[iPE].isBad) continue;
- if (!env->events.pes[iPE].isPE) continue;
- env->env.calib.pemDataFI.data[env->events.pes[iPE].idx] = env->events.pes[iPE].start + env->env.filter.ioiFrom;
- env->env.calib.pemDataLI.data[env->events.pes[iPE].idx] = env->events.pes[iPE].end + env->env.filter.ioiFrom;
- }
- env->env.calib.pemDataFI.index = 1.0;
- env->env.calib.pemDataLI.index = 2.0;
- if (amdmsWriteData(outfile, &(env->env.calib.pemDataFI), amdmsPARTICLE_EVENT_FIRST_IMG_ROW, 0) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsWriteData(outfile, &(env->env.calib.pemDataLI), amdmsPARTICLE_EVENT_LAST_IMG_ROW, 0) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCreateReadoutNoiseMap(amdmsALGO_STAT_ENV *env, amdmsFITS *outfile, amdmsFITS_FLAGS flags)
-{
- int iPixel, nPixels;
- amdmsPIXEL mean;
- amdmsDATA ronData;
-
- amdmsInitData(&ronData);
- amdmsAllocateData(&ronData, env->varPixels.nx, env->varPixels.ny);
- nPixels = env->varPixels.nx*env->varPixels.ny;
- for (iPixel = 0; iPixel < nPixels; iPixel++) {
- ronData.data[iPixel] = env->cf*sqrt(env->varPixels.data[iPixel]);
- }
- if (env->env.filter.aoiFlag) {
- amdmsCalcStat(&(env->env.calib), &ronData, 0,
- env->env.filter.aoiX, env->env.filter.aoiY,
- env->env.filter.aoiWidth, env->env.filter.aoiHeight,
- &mean, NULL);
- amdmsUpdateKeywordDouble(outfile, "RON", mean, 2, "Readout Noise in [e-]");
- amdmsNotice(__FILE__, __LINE__, "RON: = %12.2f e-", mean);
- }
- if (amdmsCreateData(outfile, flags, amdmsREADOUT_NOISE_NROWS, 1) != amdmsSUCCESS) {
- amdmsFreeData(&ronData);
- return amdmsFAILURE;
- }
-
- /*env->meanPixels.index = 1.0; TLICHA: changed to next line after teleconf with MHEINIGER */
- ronData.index = 1.0;
- if (amdmsWriteData(outfile, &ronData, amdmsREADOUT_NOISE_ROW, 0) != amdmsSUCCESS) {
- amdmsFreeData(&ronData);
- return amdmsFAILURE;
- }
- amdmsFreeData(&ronData);
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCreatePhotonNoiseMap(amdmsALGO_STAT_ENV *env, amdmsFITS *outfile, amdmsFITS_FLAGS flags)
-{
- int iPixel, nPixels;
- amdmsPIXEL mean;
- amdmsDATA pnData;
-
- amdmsInitData(&pnData);
- amdmsAllocateData(&pnData, env->varPixels.nx, env->varPixels.ny);
- nPixels = env->varPixels.nx*env->varPixels.ny;
- for (iPixel = 0; iPixel < nPixels; iPixel++) {
- if (env->meanPixels.data[iPixel] > 0.0) {
- /*if (env->varPixels.data[iPixel] > 0.0) {*/
- pnData.data[iPixel] = sqrt(env->cf*env->varPixels.data[iPixel]/env->meanPixels.data[iPixel]);
- /*pnData.data[iPixel] = env->varPixels.data[iPixel]/env->meanPixels.data[iPixel];*/
- /*pnData.data[iPixel] = env->meanPixels.data[iPixel]/env->varPixels.data[iPixel];*/
- } else {
- pnData.data[iPixel] = 0.0;
- }
- }
- if (env->env.filter.aoiFlag) {
- amdmsCalcStat(&(env->env.calib), &pnData, 0,
- env->env.filter.aoiX, env->env.filter.aoiY,
- env->env.filter.aoiWidth, env->env.filter.aoiHeight,
- &mean, NULL);
- /*amdmsNotice(__FILE__, __LINE__, "PN: = %12.4f", mean);*/
- amdmsNotice(__FILE__, __LINE__, "CF: = %.4f", mean);
- }
- if (amdmsCreateData(outfile, flags, amdmsPHOTON_NOISE_NROWS, 1) != amdmsSUCCESS) {
- amdmsFreeData(&pnData);
- return amdmsFAILURE;
- }
-
- /*env->meanPixels.index = 1.0; TLICHA: changed to next line after teleconf with MHEINIGER */
- pnData.index = 1.0;
- if (amdmsWriteData(outfile, &pnData, amdmsPHOTON_NOISE_ROW, 0) != amdmsSUCCESS) {
- amdmsFreeData(&pnData);
- return amdmsFAILURE;
- }
- amdmsFreeData(&pnData);
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsInitParticleEventSetup(amdmsPARTICLE_EVENT_SETUP *setup)
-{
- if (setup == NULL) {
- return amdmsFAILURE;
- }
- setup->peFlag = amdmsFALSE; /* no detection requested */
- setup->peLimit = 0.0;
- setup->nPE = 0;
- setup->nSPE = 0;
- setup->nValues = 0;
- setup->pes = NULL;
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsFreeParticleEventSetup(amdmsPARTICLE_EVENT_SETUP *setup)
-{
- int i;
- if (setup == NULL) {
- return amdmsFAILURE;
- }
-
- if (setup->pes != NULL) {
- for(i=0; i<setup->nPE; i++){
- free(setup->pes[i].values);
- }
- }
- setup->peFlag = amdmsFALSE; /* no detection requested */
- setup->peLimit = 0.0;
- setup->nPE = 0;
- setup->nSPE = 0;
- if (setup->pes != NULL) {
- free(setup->pes);
- setup->pes = NULL;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsDetectParticleEvents(amdmsPARTICLE_EVENT_SETUP *setup,
- amdmsDATA_FILTER_SETUP *filter,
- amdmsCALIBRATION_SETUP *calib,
- amdmsFITS *file,
- amdmsDATA *meanPixels,
- amdmsDATA *varPixels)
-{
- int iImage;
- int iPE;
- amdmsDATA rawData;
- amdmsDATA calData;
-
- if (!setup->peFlag) {
- return amdmsSUCCESS;
- }
- /* try to mark all possible particle events */
- if (amdmsFindPEs(setup, varPixels, filter->ioiTo - filter->ioiFrom + 1) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- /* reload the data from all marked pixels */
- amdmsInitData(&rawData);
- amdmsInitData(&calData);
- for (iImage = filter->ioiFrom; iImage <= filter->ioiTo; iImage++) {
- if (amdmsReadData(file, &rawData, iImage, 0) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsCalibrateData(calib, &rawData, &calData) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- for (iPE = 0; iPE < setup->nPE; iPE++) {
- setup->pes[iPE].values[iImage - filter->ioiFrom] = calData.data[setup->pes[iPE].idx];
- }
- }
- amdmsFreeData(&rawData);
- amdmsFreeData(&calData);
- for (iPE = 0; iPE < setup->nPE; iPE++) {
- amdmsAnalyzePE(setup, iPE, varPixels->data[setup->pes[iPE].idx]);
- if (!setup->pes[iPE].isBad) {
- amdmsFindPEInterval(setup, iPE);
- }
- }
- for (iPE = 0; iPE < setup->nPE; iPE++) {
- if (setup->pes[iPE].isBad) continue;
- if (setup->pes[iPE].isPE) continue;
- amdmsVerifyPE(setup, iPE);
- }
- for (iPE = 0; iPE < setup->nPE; iPE++) {
- if (setup->pes[iPE].isBad) continue;
- if (!setup->pes[iPE].isPE) continue;
- if (setup->pes[iPE].isUpToDate) continue;
- amdmsRecalculateMeanVar(setup, filter, iPE, meanPixels, varPixels);
- }
- return 1;
-}
-
-amdmsCOMPL amdmsFindPEs(amdmsPARTICLE_EVENT_SETUP *setup, amdmsDATA *var, int nValues)
-{
- int nx, ny;
- int nPixels, iPixel;
- int i, j;
- int iX, iY;
- int count;
- int iPE;
- amdmsDATA flags;
-
- if (!setup->peFlag) {
- return amdmsSUCCESS;
- }
- nx = var->nx;
- ny = var->ny;
- nPixels = nx*ny;
- amdmsInitData(&flags);
- if (amdmsAllocateData(&flags, nx, ny) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- amdmsSetData(&flags, 0.0);
- setup->nPE = 0;
- setup->nValues = nValues;
- /* Markieren aller Pixel deren Varianz das Limit uebersteigt */
- for (iPixel = 0; iPixel < nPixels; iPixel++) {
- if (var->data[iPixel] >= setup->peLimit) {
- flags.data[iPixel] = 1.0;
- setup->nPE++;
- }
- }
- /* Es sollen aber nur die Pixel uebrig bleiben, bei denen auch einige Nachbarn
- * eine erhoehte Varianz besitzen */
- for (iPixel = 0; iPixel < nPixels; iPixel++) {
- if (flags.data[iPixel] == 0.0) continue;
- count = 0;
- iX = iPixel%nx;
- iY = iPixel/nx;
- for (i = iX - 1; i <= iX + 1; i++) {
- if (i < 0) continue;
- if (i >= nx) continue;
- for (j = iY - 1; j <= iY + 1; j++) {
- if (j < 0) continue;
- if (j >= ny) continue;
- if (flags.data[j*nx + i] != 0.0) count++;
- }
- }
- if (count == 1) {
- flags.data[iPixel] = 0.0;
- setup->nPE--;
- }
- }
- amdmsInfo(__FILE__, __LINE__, "%d pixels with possible PEs", setup->nPE);
- if (setup->nPE != 0) {
- setup->pes = (amdmsPARTICLE_EVENT*)calloc((size_t)(setup->nPE), sizeof(amdmsPARTICLE_EVENT));
- if (setup->pes == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (pes)");
- setup->nPE = 0;
- amdmsFreeData(&flags);
- return amdmsFAILURE;
- }
- iPE = 0;
- for (iPixel = 0; iPixel < nPixels; iPixel++) {
- if (flags.data[iPixel] == 0.0) continue;
- setup->pes[iPE].idx = iPixel;
- setup->pes[iPE].x = iPixel%nx;
- setup->pes[iPE].y = iPixel/nx;
- setup->pes[iPE].isBad = amdmsFALSE;
- setup->pes[iPE].isPE = amdmsFALSE;
- setup->pes[iPE].isUpToDate = amdmsFALSE;
- setup->pes[iPE].nextPE = iPE;
- setup->pes[iPE].prevPE = iPE;
- setup->pes[iPE].start = -1;
- setup->pes[iPE].end = -1;
- setup->pes[iPE].values = (amdmsPIXEL*)calloc((size_t)nValues, sizeof(amdmsPIXEL));
- if (setup->pes[iPE].values == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (pes[%d].values)", iPE);
- setup->nPE = 0;
- amdmsFreeData(&flags);
- return amdmsFAILURE;
- }
- iPE++;
- }
- }
- amdmsFreeData(&flags);
- return amdmsSUCCESS;
-}
-
-void amdmsAnalyzePE(amdmsPARTICLE_EVENT_SETUP *setup, int iPE, amdmsPIXEL var)
-{
- int iPixel;
- int start, split, end;
- amdmsPIXEL mean1, var1;
- amdmsPIXEL mean2, var2;
-
- iPixel = setup->pes[iPE].idx;
- start = 0;
- end = setup->nValues;
- split = end/2;
- /* 1. Versuch ist eine Halbierung der Daten um die echte Varianz herauszufinden */
- /* Als Test wird der Vergleich mit der globalen Varianz herangezogen */
- amdmsCalcMeanVar(setup, iPE, start, split, &mean1, &var1);
- amdmsCalcMeanVar(setup, iPE, split, end, &mean2, &var2);
- if ((var1 < amdmsLOWER_PE*var) && (var2 > amdmsUPPER_PE*var)) {
- /* das moegliche Ereignis liegt in der zweiten Haelfte der Daten, aber das muss */
- /* noch verifiziert werden indem der Aufteilungspunkt nach vorne verschoben wird. */
- split -= 20;
- amdmsCalcMeanVar(setup, iPE, start, split, &mean1, &var1);
- amdmsCalcMeanVar(setup, iPE, split, end, &mean2, &var2);
- if ((var1 < amdmsLOWER_PE*var) && (var2 > amdmsUPPER_PE*var)) {
- /* Die Lage des moeglichen Ereignisses in der zweiten Haelfte konnte */
- /* verifiziert werden! */
- setup->pes[iPE].start = split;
- setup->pes[iPE].end = end;
- setup->pes[iPE].mean = mean1;
- setup->pes[iPE].var = var1;
- } else {
- /* Die Lage des moeglichen Ereignisses konnte nicht verifiziert werden! */
- setup->pes[iPE].isBad = amdmsTRUE;
- }
- } else if ((var1 > amdmsUPPER_PE*var) && (var2 < amdmsLOWER_PE*var)) {
- /* das moegliche Ereignis liegt in der ersten Haelfte der Daten, aber das muss */
- /* noch verifiziert werden indem der Aufteilungspunkt nach hinten verschoben wird. */
- split += 20;
- amdmsCalcMeanVar(setup, iPE, start, split, &mean1, &var1);
- amdmsCalcMeanVar(setup, iPE, split, end, &mean2, &var2);
- if ((var1 > amdmsUPPER_PE*var) && (var2 < amdmsLOWER_PE*var)) {
- /* Die Lage des moeglichen Ereignisses in der ersten Haelfte konnte */
- /* verifiziert werden! */
- setup->pes[iPE].start = start;
- setup->pes[iPE].end = split;
- setup->pes[iPE].mean = mean2;
- setup->pes[iPE].var = var1;
- } else {
- /* Die Lage des moeglichen Ereignisses konnte nicht verifiziert werden! */
- setup->pes[iPE].isBad = amdmsTRUE;
- }
- } else {
- setup->pes[iPE].isBad = amdmsTRUE;
- }
- if (setup->pes[iPE].isBad) {
- amdmsDebug(__FILE__, __LINE__,
- "no PE at pixel(%d, %d): mean = (%.4g | %.4g), var = (%.4g | %.4g | %.4g)",
- setup->pes[iPE].x, setup->pes[iPE].y, mean1, mean2, var1, var, var2);
- } else {
- amdmsDebug(__FILE__, __LINE__,
- "possible PE at pixel(%d, %d): mean = (%.4g | %.4g), var = (%.4g > %.4g > %.4g)",
- setup->pes[iPE].x, setup->pes[iPE].y, mean1, mean2, var1, var, var2);
- }
-}
-
-void amdmsFindPEInterval(amdmsPARTICLE_EVENT_SETUP *setup, int iPE)
-{
- int iPixel;
- int i;
- float maxVal;
- int maxIdx;
-
- iPixel = setup->pes[iPE].idx;
- /* Es wird der Punkt mit der maximalen Intensitaet gesucht */
- maxVal = setup->pes[iPE].values[setup->pes[iPE].start];
- maxIdx = setup->pes[iPE].start;
- for (i = setup->pes[iPE].start + 1; i < setup->pes[iPE].end; i++) {
- if (setup->pes[iPE].values[i] > maxVal) {
- maxVal = setup->pes[iPE].values[i];
- maxIdx = i;
- }
- }
- amdmsDebug(__FILE__, __LINE__, " max intensity of %.4g at image number %d",
- maxVal, maxIdx);
- setup->pes[iPE].start = maxIdx;
- setup->pes[iPE].end = maxIdx;
- for (i = setup->pes[iPE].start; i >= 0; i--) {
- if (setup->pes[iPE].values[i] < setup->pes[iPE].mean) break;
- setup->pes[iPE].start = i;
- }
- for (i = setup->pes[iPE].end; i < setup->nValues; i++) {
- if (setup->pes[iPE].values[i] < setup->pes[iPE].mean) break;
- setup->pes[iPE].end = i;
- }
- amdmsDebug(__FILE__, __LINE__, " PE goes from %d to %d (%d images)",
- setup->pes[iPE].start, setup->pes[iPE].end,
- setup->pes[iPE].end - setup->pes[iPE].start + 1);
-}
-
-void amdmsVerifyPE(amdmsPARTICLE_EVENT_SETUP *setup, int iPE)
-{
- int i;
- int x1, y1, x2, y2;
-
- x1 = setup->pes[iPE].x;
- y1 = setup->pes[iPE].y;
- for (i = 0; i < setup->nPE; i++) {
- if (i == iPE) continue;
- if (setup->pes[i].isBad) continue;
- x2 = setup->pes[i].x;
- y2 = setup->pes[i].y;
- if (x2 - x1 > 1) continue;
- if (x1 - x2 > 1) continue;
- if (y2 - y1 > 1) continue;
- if (y1 - y2 > 1) continue;
- if (setup->pes[iPE].start > setup->pes[i].end) break;
- if (setup->pes[iPE].end < setup->pes[i].start) break;
- setup->pes[iPE].isPE = amdmsTRUE;
- setup->pes[i].isPE = amdmsTRUE;
- if (setup->pes[i].nextPE == i) {
- /* there is no old chain of pixels at i */
- setup->pes[i].nextPE = iPE;
- setup->pes[i].prevPE = iPE;
- setup->pes[iPE].nextPE = i;
- setup->pes[iPE].prevPE = i;
- } else {
- /* there is an old chain of pixels at i */
- setup->pes[iPE].nextPE = setup->pes[i].nextPE;
- setup->pes[i].nextPE = iPE;
- setup->pes[iPE].prevPE = i;
- setup->pes[setup->pes[iPE].nextPE].prevPE = iPE;
- }
- return;
- }
- setup->pes[iPE].isBad = amdmsTRUE;
- amdmsDebug(__FILE__, __LINE__, "possible PE at pixel(%d, %d) not verified", x1, y1);
-}
-
-void amdmsRecalculateMeanVar(amdmsPARTICLE_EVENT_SETUP *setup,
- amdmsDATA_FILTER_SETUP *filter,
- int iPE,
- amdmsDATA *meanPixels,
- amdmsDATA *varPixels)
-{
- int i, j, k;
- int x, y;
- int start, end;
- int count;
- int hcount;
- amdmsPIXEL mean, var;
- int minX, maxX, minY, maxY;
- int nx, ny;
- int iPixel;
-
- i = iPE;
- nx = meanPixels->nx;
- ny = meanPixels->ny;
- start = setup->pes[i].start;
- end = setup->pes[i].end;
- hcount = 1;
- minX = nx;
- maxX = -1;
- minY = ny;
- maxY = -1;
- for (j = setup->pes[i].nextPE; j != i; j = setup->pes[j].nextPE) {
- x = setup->pes[j].idx%nx;
- y = setup->pes[j].idx/nx;
- minX = MIN(minX, x);
- maxX = MAX(maxX, x);
- minY = MIN(minY, y);
- maxY = MAX(maxY, y);
- start = MIN(start, setup->pes[j].start);
- end = MAX(end, setup->pes[j].end);
- hcount++;
- }
- amdmsDebug(__FILE__, __LINE__, "detected PE between images %d and %d", start, end);
- for (j = iPE; hcount; j = setup->pes[j].nextPE) {
- iPixel = setup->pes[j].idx;
- setup->pes[j].start = start;
- setup->pes[j].end = end;
- count = 0;
- mean = 0.0;
- var = 0.0;
- for (k = 0; k < setup->nValues; k++) {
- if ((k >= start) && (k <= end)) continue;
- count++;
- mean += setup->pes[j].values[k];
- }
- mean /= (amdmsPIXEL)count;
- for (k = 0; k < setup->nValues; k++) {
- if ((k >= start) && (k <= end)) continue;
- var += (setup->pes[j].values[k] - mean)*(setup->pes[j].values[k] - mean);
- }
- var /= (amdmsPIXEL)(count - 1);
- amdmsDebug(__FILE__, __LINE__, " pixel at (%d, %d) has now mean = %.4g, var = %.4g (old values %.4g, %.4g)", iPixel%nx, iPixel/nx, mean, var, meanPixels->data[iPixel], varPixels->data[iPixel]);
- meanPixels->data[iPixel] = mean;
- varPixels->data[iPixel] = var;
- setup->pes[j].isUpToDate = 1;
- hcount--;
- }
- amdmsInfo(__FILE__, __LINE__, "#defPE %d %d %d %d %d %d",
- start + filter->ioiFrom, end + filter->ioiFrom,
- minX - 10, minY - 10, maxX - minX + 20, maxY - minY + 20);
- setup->nSPE++;
-}
-
-void amdmsCalcMeanVar(amdmsPARTICLE_EVENT_SETUP *setup,
- int iPE,
- int from,
- int to,
- amdmsPIXEL *mean,
- amdmsPIXEL *var)
-{
- int i;
-
- *mean = 0.0;
- for (i = from; i < to; i++) {
- *mean += setup->pes[iPE].values[i];
- }
- *mean /= (amdmsPIXEL)(to - from);
- *var = 0.0;
- for (i = from; i < to; i++) {
- *var += (setup->pes[iPE].values[i] - *mean)*(setup->pes[iPE].values[i] - *mean);
- }
- *var /= (amdmsPIXEL)(to - from - 1);
-}
-
diff --git a/amber/amdmsProperties.c b/amber/amdmsProperties.c
deleted file mode 100644
index 650be5a..0000000
--- a/amber/amdmsProperties.c
+++ /dev/null
@@ -1,1630 +0,0 @@
-#include <math.h>
-
-#include "amdms.h"
-#include "amdmsFit.h"
-#include "amdmsFits.h"
-
-
-#define ABS(x) ((x) > 0 ? (x) : -(x))
-#define MIN(x,y) ((x) < (y) ? (x) : (y))
-#define MAX(x,y) ((x) > (y) ? (x) : (y))
-
-static amdmsCOMPL amdmsLoadAllStatistics(amdmsALGO_PROPERTIES_ENV *env);
-static amdmsCOMPL amdmsFitPixel(amdmsALGO_PROPERTIES_ENV *env,
- int nPoints, double *x, double *y, double *ye,
- amdmsFIT_DATA_ENV *fit,
- int iPixel,
- amdmsDATA *fitValues);
-static void amdmsCheckFitValues(amdmsDATA *fitValues, int nValues, int iPixel);
-
-static amdmsCOMPL amdmsCalcDarkCurrent(amdmsALGO_PROPERTIES_ENV *env);
-static amdmsCOMPL amdmsCalcFlatfield(amdmsALGO_PROPERTIES_ENV *env);
-
-static amdmsCOMPL amdmsCalcConversionFactorAmberR(amdmsALGO_PROPERTIES_ENV *env,
- int rX, int rY, int rW, int rH);
-static amdmsCOMPL amdmsCalcConversionFactorGlobalLineR(amdmsALGO_PROPERTIES_ENV *env,
- int rX, int rY, int rW, int rH);
-static amdmsCOMPL amdmsCalcConversionFactorCentralLineR(amdmsALGO_PROPERTIES_ENV *env,
- int rX, int rY, int rW, int rH);
-static amdmsCOMPL amdmsCalcConversionFactorLocalPairs(amdmsALGO_PROPERTIES_ENV *env);
-static amdmsCOMPL amdmsCalcConversionFactor(amdmsALGO_PROPERTIES_ENV *env);
-
-static amdmsCOMPL amdmsCalcNonlinearity(amdmsALGO_PROPERTIES_ENV *env);
-static amdmsCOMPL amdmsCalcPhotonTransferCurve(amdmsALGO_PROPERTIES_ENV *env);
-static amdmsCOMPL amdmsCalcHistogramForArea(amdmsALGO_PROPERTIES_ENV *env,
- int aoiX, int aoiY,
- int aoiWidth, int aoiHeight,
- int *inCount, int *outCount);
-static amdmsCOMPL amdmsCalcHistogram(amdmsALGO_PROPERTIES_ENV *env);
-static amdmsCOMPL amdmsCreateDarkCurrentMap(amdmsALGO_PROPERTIES_ENV *env,
- amdmsFITS *outfile,
- amdmsFITS_FLAGS flags);
-static amdmsCOMPL amdmsCreateFlatfieldMap(amdmsALGO_PROPERTIES_ENV *env,
- amdmsFITS *outfile,
- amdmsFITS_FLAGS flags);
-static amdmsCOMPL amdmsCreateFlatfieldFitMap(amdmsALGO_PROPERTIES_ENV *env,
- amdmsFITS *outfile,
- amdmsFITS_FLAGS flags);
-static amdmsCOMPL amdmsCreateConversionFactorMap(amdmsALGO_PROPERTIES_ENV *env,
- amdmsFITS *outfile,
- amdmsFITS_FLAGS flags);
-static amdmsCOMPL amdmsCreateNonlinearityMap(amdmsALGO_PROPERTIES_ENV *env,
- amdmsFITS *outfile,
- amdmsFITS_FLAGS flags);
-static amdmsCOMPL amdmsCreateNonlinearityFitMap(amdmsALGO_PROPERTIES_ENV *env,
- amdmsFITS *outfile,
- amdmsFITS_FLAGS flags);
-static amdmsCOMPL amdmsCreatePhotonTransferCurveMap(amdmsALGO_PROPERTIES_ENV *env,
- amdmsFITS *outfile,
- amdmsFITS_FLAGS flags);
-static amdmsCOMPL amdmsCreateHistogramMap(amdmsALGO_PROPERTIES_ENV *env,
- amdmsFITS *outfile,
- amdmsFITS_FLAGS flags);
-
-amdmsCOMPL amdmsCreatePropertiesAlgo(amdmsALGO_PROPERTIES_ENV **env)
-{
- int i;
- amdmsALGO_ENV *henv = NULL;
- amdmsALGO_PROPERTIES_ENV *hhenv = NULL;
-
- /* allocate the structure if neccessary */
- if (*env == NULL) {
- hhenv = (amdmsALGO_PROPERTIES_ENV*)calloc(1L, sizeof(amdmsALGO_PROPERTIES_ENV));
- if (hhenv == NULL) {
- return amdmsFAILURE;
- }
- henv = &(hhenv->env);
- /* call the initialization of a simple algorithm environment */
- if (amdmsCreateAlgo(&henv) != amdmsSUCCESS) {
- free(hhenv);
- return amdmsFAILURE;
- }
- hhenv->allocated = 1;
- *env = hhenv;
- } else {
- /* call the initialization of a simple algorithm environment */
- hhenv = *env;
- henv = &(hhenv->env);
- if (amdmsCreateAlgo(&henv) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- hhenv->allocated = 0;
- }
- /* the default content is the pixel statistics */
- henv->inFiles.defFlags.content = amdmsPIXEL_STAT_CONTENT;
- /* initialize only the additional members */
- hhenv->nuicFlag = amdmsFALSE;
- hhenv->kADC = 8.55;
- hhenv->satFlag = amdmsFALSE;
- hhenv->satWidth = 0.0;
- hhenv->satHeight = 0.0;
- hhenv->nDelStart = 0;
- hhenv->nDelMiddle = 1;
- hhenv->nDelEnd = 0;
- hhenv->cfAlgo = amdmsCFA_CENTRAL_LINE;
- hhenv->hX.content = amdmsHC_EXPTIME;
- hhenv->hX.scale = amdmsHS_LINEAR;
- hhenv->hX.steps = 500;
- hhenv->hX.min = 0.0;
- hhenv->hX.max = 10.0;
- hhenv->hY.content = amdmsHC_MEAN;
- hhenv->hY.scale = amdmsHS_LINEAR;
- hhenv->hY.steps = 500;
- hhenv->hY.min = 0.0;
- hhenv->hY.max = 65536.0;
- hhenv->nInputs = 0;
- hhenv->exptimes = NULL;
- hhenv->meanPixels = NULL;
- hhenv->varPixels = NULL;
- for (i = 0; i < amdmsFLATFIELD_FIT_NROWS; i++) {
- amdmsInitData(&(hhenv->ffFit[i]));
- }
- for (i = 0; i < amdmsCONVERSION_FACTOR_FIT_NROWS; i++) {
- amdmsInitData(&(hhenv->cfFit[i]));
- }
- for (i = 0; i < amdmsNONLINEARITY_FIT_NROWS; i++) {
- amdmsInitData(&(hhenv->nlFit[i]));
- }
- for (i = 0; i < amdmsPTC_NROWS; i++) {
- amdmsInitData(&(hhenv->ptcFit[i]));
- }
- for (i = 0; i < amdmsDARK_CURRENT_NROWS; i++) {
- amdmsInitData(&(hhenv->dcFit[i]));
- }
- amdmsInitData(&(hhenv->cfmData));
- amdmsInitData(&(hhenv->histoData));
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsDestroyPropertiesAlgo(amdmsALGO_PROPERTIES_ENV **env)
-{
- int i;
- amdmsALGO_PROPERTIES_ENV *henv = NULL;
- amdmsALGO_ENV *hhenv = NULL;
-
- if (env == NULL) {
- return amdmsFAILURE;
- }
- if (*env == NULL) {
- return amdmsSUCCESS;
- }
- henv = *env;
- if (henv->exptimes != NULL) {
- free(henv->exptimes);
- henv->exptimes = NULL;
- }
- if (henv->meanPixels != NULL) {
- for (i = 0; i < henv->nInputs; i++) {
- amdmsFreeData(&(henv->meanPixels[i]));
- }
- free(henv->meanPixels);
- henv->meanPixels = NULL;
- }
- if (henv->varPixels != NULL) {
- for (i = 0; i < henv->nInputs; i++) {
- amdmsFreeData(&(henv->varPixels[i]));
- }
- free(henv->varPixels);
- henv->varPixels = NULL;
- }
- for (i = 0; i < amdmsFLATFIELD_FIT_NROWS; i++) {
- amdmsFreeData(&(henv->ffFit[i]));
- }
- for (i = 0; i < amdmsCONVERSION_FACTOR_FIT_NROWS; i++) {
- amdmsFreeData(&(henv->cfFit[i]));
- }
- for (i = 0; i < amdmsNONLINEARITY_FIT_NROWS; i++) {
- amdmsFreeData(&(henv->nlFit[i]));
- }
- for (i = 0; i < amdmsPTC_NROWS; i++) {
- amdmsFreeData(&(henv->ptcFit[i]));
- }
- for (i = 0; i < amdmsDARK_CURRENT_NROWS; i++) {
- amdmsFreeData(&(henv->dcFit[i]));
- }
- amdmsFreeData(&(henv->cfmData));
- amdmsFreeData(&(henv->histoData));
- hhenv = &(henv->env);
- amdmsDestroyAlgo(&hhenv);
- if (henv->allocated) {
- henv->allocated = amdmsFALSE;
- free(henv);
- *env = NULL;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsDoProperties(amdmsALGO_PROPERTIES_ENV *env)
-{
- amdmsCOMPL retVal = amdmsSUCCESS;
- amdmsFITS *infile = NULL;
- int iOutput;
- amdmsFITS *outfile = NULL;
- amdmsBOOL ffRequested = amdmsFALSE;
- amdmsBOOL cfRequested = amdmsFALSE;
- amdmsBOOL nlRequested = amdmsFALSE;
- amdmsBOOL ptcRequested = amdmsFALSE;
- amdmsBOOL dcRequested = amdmsFALSE;
- amdmsBOOL hRequested = amdmsFALSE;
-
- amdmsDebug(__FILE__, __LINE__, "amdmsDoProperties(...)");
- if (env == NULL) {
- amdmsError(__FILE__, __LINE__, "no valid environment given!");
- return amdmsFAILURE;
- }
- if (env->env.inFiles.nNames < 2) {
- /* no filename given but we need several files */
- amdmsError(__FILE__, __LINE__, "no filename given, several input files are needed");
- return amdmsFAILURE;
- }
- if (amdmsReadAllMaps(&(env->env.calib)) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsLoadAllStatistics(env) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- amdmsRecalcStripes(&(env->env.stripes), env->meanPixels[0].nx, env->meanPixels[0].ny);
- for (iOutput = 0; iOutput < env->env.outFiles.nNames; iOutput++) {
- switch (env->env.outFiles.flags[iOutput].content) {
- case amdmsFLATFIELD_CONTENT:
- case amdmsFLATFIELD_FIT_CONTENT:
- ffRequested = amdmsTRUE;
- break;
- case amdmsCONVERSION_FACTOR_CONTENT:
- cfRequested = amdmsTRUE;
- break;
- case amdmsNONLINEARITY_CONTENT:
- case amdmsNONLINEARITY_FIT_CONTENT:
- nlRequested = amdmsTRUE;
- break;
- case amdmsPTC_CONTENT:
- ptcRequested = amdmsTRUE;
- break;
- case amdmsDARK_CURRENT_CONTENT:
- dcRequested = amdmsTRUE;
- break;
- case amdmsHISTOGRAM_CONTENT:
- hRequested = amdmsTRUE;
- break;
- default:;
- }
- }
- if (cfRequested) {
- if (amdmsCalcConversionFactor(env) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- }
- if (ffRequested) {
- if (amdmsCalcFlatfield(env) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- }
- if (nlRequested) {
- if (amdmsCalcNonlinearity(env) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- }
- if (ptcRequested) {
- if (amdmsCalcPhotonTransferCurve(env) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- }
- if (dcRequested) {
- if (amdmsCalcDarkCurrent(env) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- }
- if (hRequested) {
- if (amdmsCalcHistogram(env) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- }
- /* generate all outputs */
- if (amdmsOpenFitsFile(&infile, env->env.inFiles.names[0]) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsOpenData(infile, env->env.inFiles.flags[0], 1) != amdmsSUCCESS) {
- amdmsCloseFitsFile(&infile);
- return amdmsFAILURE;
- }
- for (iOutput = 0; (iOutput < env->env.outFiles.nNames) && (retVal == amdmsSUCCESS); iOutput++) {
- retVal = amdmsCreateFitsFile(&outfile, env->env.outFiles.names[iOutput]);
- if (retVal != amdmsSUCCESS) break;
- retVal = amdmsCopyHeader(outfile, infile);
- if (retVal != amdmsSUCCESS) {
- amdmsCloseFitsFile(&outfile);
- break;
- }
- amdmsSetRegions(outfile, infile);
- switch (env->env.outFiles.flags[iOutput].content) {
- case amdmsFLATFIELD_CONTENT:
- retVal = amdmsCreateFlatfieldMap(env, outfile, env->env.outFiles.flags[iOutput]);
- break;
- case amdmsFLATFIELD_FIT_CONTENT:
- retVal = amdmsCreateFlatfieldFitMap(env, outfile, env->env.outFiles.flags[iOutput]);
- break;
- case amdmsCONVERSION_FACTOR_CONTENT:
- retVal = amdmsCreateConversionFactorMap(env, outfile, env->env.outFiles.flags[iOutput]);
- break;
- case amdmsNONLINEARITY_CONTENT:
- retVal = amdmsCreateNonlinearityMap(env, outfile, env->env.outFiles.flags[iOutput]);
- break;
- case amdmsNONLINEARITY_FIT_CONTENT:
- retVal = amdmsCreateNonlinearityFitMap(env, outfile, env->env.outFiles.flags[iOutput]);
- break;
- case amdmsPTC_CONTENT:
- retVal = amdmsCreatePhotonTransferCurveMap(env, outfile, env->env.outFiles.flags[iOutput]);
- break;
- case amdmsDARK_CURRENT_CONTENT:
- retVal = amdmsCreateDarkCurrentMap(env, outfile, env->env.outFiles.flags[iOutput]);
- break;
- case amdmsHISTOGRAM_CONTENT:
- retVal = amdmsCreateHistogramMap(env, outfile, env->env.outFiles.flags[iOutput]);
- break;
- default:
- amdmsError(__FILE__, __LINE__,
- "unsupported file content (%d)",
- env->env.outFiles.flags[iOutput].content);
- retVal = amdmsFAILURE;
- }
- retVal = amdmsCloseFitsFile(&outfile);
- }
- amdmsCloseFitsFile(&infile);
-
- return amdmsSUCCESS;
-}
-
-
-amdmsCOMPL amdmsLoadAllStatistics(amdmsALGO_PROPERTIES_ENV *env)
-{
- amdmsFITS *infile = NULL;
- int iInput;
- amdmsPIXEL meanMean;
- amdmsPIXEL meanVar;
- amdmsPIXEL varMean;
- amdmsPIXEL varVar;
-
- env->nInputs = env->env.inFiles.nNames;
- env->exptimes = (double*)calloc((size_t)(env->env.inFiles.nNames), sizeof(double));
- if (env->exptimes == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (exptimes)!");
- return amdmsFAILURE;
- }
- for (iInput = 0; iInput < env->env.inFiles.nNames; iInput++) {
- env->exptimes[iInput] = 0.0;
- }
- env->meanPixels = (amdmsDATA*)calloc((size_t)(env->env.inFiles.nNames), sizeof(amdmsDATA));
- if (env->meanPixels == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (meanPixels)!");
- return amdmsFAILURE;
- }
- for (iInput = 0; iInput < env->env.inFiles.nNames; iInput++) {
- amdmsInitData(&(env->meanPixels[iInput]));
- }
- env->varPixels = (amdmsDATA*)calloc((size_t)(env->env.inFiles.nNames), sizeof(amdmsDATA));
- if (env->varPixels == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (varPixels)!");
- return amdmsFAILURE;
- }
- for (iInput = 0; iInput < env->env.inFiles.nNames; iInput++) {
- amdmsInitData(&(env->varPixels[iInput]));
- }
- for (iInput = 0; iInput < env->env.inFiles.nNames; iInput++) {
- if (amdmsOpenFitsFile(&infile, env->env.inFiles.names[iInput]) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsOpenData(infile, env->env.inFiles.flags[iInput], 1) != amdmsSUCCESS) {
- amdmsCloseFitsFile(&infile);
- return amdmsFAILURE;
- }
- env->exptimes[iInput] = infile->exptime;
- if (amdmsReadData(infile, &(env->meanPixels[iInput]), amdmsPIXEL_STAT_MEAN_ROW, 0) != amdmsSUCCESS) {
- amdmsError(__FILE__, __LINE__,
- "could not load the mean flux data, file=%s",
- env->env.inFiles.names[iInput]);
- amdmsCloseFitsFile(&infile);
- return amdmsFAILURE;
- }
- if (amdmsReadData(infile, &(env->varPixels[iInput]), amdmsPIXEL_STAT_VAR_ROW, 0) != amdmsSUCCESS) {
- amdmsError(__FILE__, __LINE__,
- "could not load the flux variance data, file=%s",
- env->env.inFiles.names[iInput]);
- amdmsCloseFitsFile(&infile);
- return amdmsFAILURE;
- }
- if (env->nuicFlag) {
- if (amdmsCleanUpFlatfieldSmooth(&(env->env.calib), &(env->env.stripes), &(env->meanPixels[iInput]), &(env->varPixels[iInput])) != amdmsSUCCESS) {
- amdmsCloseFitsFile(&infile);
- return amdmsFAILURE;
- }
- }
- if (env->env.filter.aoiFlag) {
- amdmsCalcStat(&(env->env.calib),
- &(env->meanPixels[iInput]),
- 0,
- env->env.filter.aoiX,
- env->env.filter.aoiY,
- env->env.filter.aoiWidth,
- env->env.filter.aoiHeight,
- &meanMean,
- &meanVar);
- amdmsCalcStat(&(env->env.calib),
- &(env->varPixels[iInput]),
- 0,
- env->env.filter.aoiX,
- env->env.filter.aoiY,
- env->env.filter.aoiWidth,
- env->env.filter.aoiHeight,
- &varMean,
- &varVar);
- amdmsInfo(__FILE__, __LINE__,
- "AOI-STAT %8.4f %12.2f %12.2f",
- env->exptimes[iInput],
- meanMean,
- varMean);
- }
- if (amdmsCloseFitsFile(&infile) != amdmsSUCCESS) {
- amdmsError(__FILE__, __LINE__, "could not close FITS file %s", env->env.inFiles.names[iInput]);
- }
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCalcFlatfield(amdmsALGO_PROPERTIES_ENV *env)
-{
- amdmsFIT_LINEAR_ENV *fitRay = NULL;
- amdmsFIT_SMOOTH_DATA_ENV *fitSmooth = NULL;
- double *x = NULL;
- double *y = NULL;
- double *ye = NULL;
- int i;
- int iInput, nInputs;
- int iPixel, nPixels;
- int iHS;
- int iVS;
- int iX, iY;
- int sX, sY, sWidth, sHeight;
- amdmsPIXEL m, dummy;
-
- nInputs = env->env.inFiles.nNames;
- nPixels = env->meanPixels[0].nx*env->meanPixels[0].ny;
- /* create all fit environments */
- if (amdmsCreateRayFit(&fitRay) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsCreateSmoothDataFit(&fitSmooth, (amdmsFIT_ENV*)fitRay) != amdmsSUCCESS) {
- amdmsDestroyLinearFit(&fitRay);
- return amdmsFAILURE;
- }
- for (i = 0; i < amdmsFLATFIELD_FIT_NROWS; i++) {
- amdmsAllocateData(&(env->ffFit[i]), env->meanPixels[0].nx, env->meanPixels[0].ny);
- }
- /* set fit parameters */
- fitSmooth->env.satFlag = env->satFlag;
- fitSmooth->env.satWidth = env->satWidth;
- fitSmooth->env.satHeight = env->satHeight;
- fitSmooth->env.nDelStart = env->nDelStart;
- fitSmooth->env.nDelMiddle = env->nDelMiddle;
- fitSmooth->env.nDelEnd = env->nDelEnd;
- fitSmooth->env.minStep = 0.2;
- /* allocate memory for the temporary data points */
- x = (double*)calloc((size_t)nInputs, sizeof(double));
- if (x == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (x)!");
- amdmsDestroySmoothDataFit(&fitSmooth);
- amdmsDestroyLinearFit(&fitRay);
- return amdmsFAILURE;
- }
- y = (double*)calloc((size_t)nInputs, sizeof(double));
- if (y == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (y)!");
- free(x);
- amdmsDestroySmoothDataFit(&fitSmooth);
- amdmsDestroyLinearFit(&fitRay);
- return amdmsFAILURE;
- }
- ye = (double*)calloc((size_t)nInputs, sizeof(double));
- if (ye == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (ye)!");
- free(x);
- free(y);
- amdmsDestroySmoothDataFit(&fitSmooth);
- amdmsDestroyLinearFit(&fitRay);
- return amdmsFAILURE;
- }
- /* initialize the flatfield */
- amdmsSetData(&(env->env.calib.ffmData), 1.0);
- /* set the x values equal to the exposure times in ms */
- for (iInput = 0; iInput < nInputs; iInput++) {
- x[iInput] = 1000.0*env->exptimes[iInput];
- }
- /* iterate over all stripes */
- for (iHS = 0; iHS < env->env.stripes.nHStripes; iHS++) {
- /* skip unused horizontal stripes */
- if ((env->env.stripes.hStripes[iHS].flags & amdmsUSE_FLATFIELD) == 0) {
- continue;
- }
- sY = env->env.stripes.hStripes[iHS].pos;
- sHeight = env->env.stripes.hStripes[iHS].size;
- for (iVS = 0; iVS < env->env.stripes.nVStripes; iVS++) {
- /* skip unused vertical stripes */
- if ((env->env.stripes.vStripes[iVS].flags & amdmsUSE_FLATFIELD) == 0) {
- continue;
- }
- sX = env->env.stripes.vStripes[iVS].pos;
- sWidth = env->env.stripes.vStripes[iVS].size;
- amdmsDebug(__FILE__, __LINE__,
- " area (%d .. %d, %d .. %d)",
- sX, sX + sWidth - 1, sY, sY + sHeight - 1);
- for (iY = sY; iY < (sY + sHeight); iY++) {
- for (iX = sX; iX < (sX + sWidth); iX++) {
- iPixel = env->meanPixels[0].nx*iY + iX;
- if (env->env.calib.bpmData.data[iPixel] != amdmsGOOD_PIXEL) {
- continue;
- }
- for (iInput = 0; iInput < nInputs; iInput++) {
- y[iInput] = env->meanPixels[iInput].data[iPixel];
- ye[iInput] = sqrt(env->varPixels[iInput].data[iPixel]);
- if (ye[iInput] < fabs(0.1*y[iInput])) {
- ye[iInput] = 1.0;
- }
- }
- if (amdmsFitPixel(env, nInputs, x, y, ye, &(fitSmooth->env), iPixel, env->ffFit) != amdmsSUCCESS) {
- free(x);
- free(y);
- free(ye);
- amdmsDestroySmoothDataFit(&fitSmooth);
- amdmsDestroyLinearFit(&fitRay);
- return amdmsFAILURE;
- }
- amdmsCheckFitValues(env->ffFit, amdmsFLATFIELD_FIT_NROWS, iPixel);
- }
- }
- amdmsCalcStat(&(env->env.calib), &(env->ffFit[amdmsFIT_A0_ROW]), 0, sX, sY, sWidth, sHeight, &m, &dummy);
- for (iY = sY; iY < (sY + sHeight); iY++) {
- for (iX = sX; iX < (sX + sWidth); iX++) {
- iPixel = env->meanPixels[0].nx*iY + iX;
- if (env->env.calib.bpmData.data[iPixel] == amdmsGOOD_PIXEL) {
- env->env.calib.ffmData.data[iPixel] = env->ffFit[amdmsFIT_A0_ROW].data[iPixel]/m;
- }
- }
- }
- }
- }
- free(x);
- free(y);
- free(ye);
- amdmsDestroySmoothDataFit(&fitSmooth);
- amdmsDestroyLinearFit(&fitRay);
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCalcConversionFactorAmberR(amdmsALGO_PROPERTIES_ENV *env, int rX, int rY, int rW, int rH)
-{
- int iInput, nInputs;
- int iPixel, nPixels;
- amdmsFIT_LINEAR_ENV *fitRay = NULL;
- amdmsFIT_SMOOTH_DATA_ENV *fitSmooth = NULL;
- double *x = NULL;
- double *y = NULL;
- double *ye = NULL;
- int iX, iY;
-
- nInputs = env->env.inFiles.nNames;
- nPixels = env->meanPixels[0].nx*env->meanPixels[0].ny;
- /* create all fit environments */
- if (amdmsCreateRayFit(&fitRay) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsCreateSmoothDataFit(&fitSmooth, (amdmsFIT_ENV*)fitRay) != amdmsSUCCESS) {
- amdmsDestroyLinearFit(&fitRay);
- return amdmsFAILURE;
- }
- /* set fit parameters */
- fitSmooth->env.satFlag = env->satFlag;
- fitSmooth->env.satWidth = env->satWidth;
- fitSmooth->env.satHeight = env->satHeight;
- fitSmooth->env.nDelStart = env->nDelStart;
- fitSmooth->env.nDelMiddle = env->nDelMiddle;
- fitSmooth->env.nDelEnd = env->nDelEnd;
- fitSmooth->env.minStep = 0.2;
- /* allocate memory for the temporary data points */
- x = (double*)calloc((size_t)nInputs, sizeof(double));
- if (x == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (x)!");
- amdmsDestroySmoothDataFit(&fitSmooth);
- amdmsDestroyLinearFit(&fitRay);
- return amdmsFAILURE;
- }
- y = (double*)calloc((size_t)nInputs, sizeof(double));
- if (y == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (y)!");
- free(x);
- amdmsDestroySmoothDataFit(&fitSmooth);
- amdmsDestroyLinearFit(&fitRay);
- return amdmsFAILURE;
- }
- ye = (double*)calloc((size_t)nInputs, sizeof(double));
- if (ye == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (ye)!");
- free(x);
- free(y);
- amdmsDestroySmoothDataFit(&fitSmooth);
- amdmsDestroyLinearFit(&fitRay);
- return amdmsFAILURE;
- }
-
- for (iY = rY; iY < (rY + rH); iY++) {
- for (iX = rX; iX < (rX + rW); iX++) {
- iPixel = env->meanPixels[0].nx*iY + iX;
- if (env->env.calib.bpmData.data[iPixel] != amdmsGOOD_PIXEL) {
- continue;
- }
- for (iInput = 0; iInput < nInputs; iInput++) {
- x[iInput] = env->meanPixels[iInput].data[iPixel];
- y[iInput] = env->varPixels[iInput].data[iPixel];
- ye[iInput] = 1.0;
- }
- if (amdmsFitPixel(env, nInputs, x, y, ye, &(fitSmooth->env), iPixel, env->cfFit) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- amdmsCheckFitValues(env->cfFit, amdmsCONVERSION_FACTOR_FIT_NROWS, iPixel);
- if (env->cfFit[amdmsFIT_A0_ROW].data[iPixel] == 0.0) {
- env->cfmData.data[iPixel] = 1.0;
- } else {
- env->cfmData.data[iPixel] = 1.0/env->cfFit[amdmsFIT_A0_ROW].data[iPixel];
- }
- if (env->env.filter.poiFlag && (iPixel == (env->env.filter.poiX + env->env.filter.poiY*env->meanPixels[0].ny))) {
- amdmsInfo(__FILE__, __LINE__, "#conversion factor = %12.4f uV/e-",
- env->kADC/env->cfmData.data[iPixel]);
- amdmsInfo(__FILE__, __LINE__, "#conversion factor = %12.4f e-/DU",
- env->cfmData.data[iPixel]);
- }
- }
- }
- free(ye);
- free(y);
- free(x);
- amdmsDestroySmoothDataFit(&fitSmooth);
- amdmsDestroyLinearFit(&fitRay);
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCalcConversionFactorGlobalLineR(amdmsALGO_PROPERTIES_ENV *env, int rX, int rY, int rW, int rH)
-{
- int iInput, nInputs;
- int iPixel, nPixels;
- int iX, iY;
- int n = 0;
- double x, y;
- double sx = 0.0;
- double sxx = 0.0;
- double sy = 0.0;
- double syy = 0.0;
- double sxy = 0.0;
- double ssxx = 0.0;
- double ssyy = 0.0;
- double ssxy = 0.0;
- double xq = 0.0;
- double yq = 0.0;
- double offset, slope;
- amdmsPIXEL cf;
-
- nInputs = env->env.inFiles.nNames;
- nPixels = env->meanPixels[0].nx*env->meanPixels[0].ny;
- /* calculate the conversion factor but use only the central part of the region */
- for (iY = 0; iY < rH/2; iY++) {
- iPixel = env->meanPixels[0].nx*(rY + rH/4 + iY) + rX + rW/4;
- for (iX = 0; iX < rW/2; iX++) {
- if (env->env.calib.bpmData.data[iPixel] == amdmsGOOD_PIXEL) {
- for (iInput = 0; iInput < nInputs; iInput++) {
- x = env->meanPixels[iInput].data[iPixel];
- y = env->varPixels[iInput].data[iPixel];
- n++;
- sx += x;
- sxx += x*x;
- sy += y;
- syy += y*y;
- sxy += x*y;
- }
- }
- iPixel++;
- }
- }
- xq = sx/(double)n;
- yq = sy/(double)n;
- ssxx = sxx - (double)n*xq*xq;
- ssyy = syy - (double)n*yq*yq;
- ssxy = sxy - (double)n*xq*yq;
- if (ssxx == 0.0) {
- amdmsWarning(__FILE__, __LINE__, "ssxx == 0.0");
- return amdmsFAILURE;
- }
- slope = ssxy/ssxx;
- offset = yq - slope*xq;
- cf = 1.0/slope;
- amdmsSetDataR(&(env->cfmData), rX, rY, rW, rH, cf);
- amdmsInfo(__FILE__, __LINE__, "CF = %.4f + %.4f*I", offset, slope);
- amdmsInfo(__FILE__, __LINE__, "GAIN = %12.4f uV/e-", env->kADC/cf);
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCalcConversionFactorCentralLineR(amdmsALGO_PROPERTIES_ENV *env, int rX, int rY, int rW, int rH)
-{
- amdmsFIT_LINEAR_ENV *fitCF = NULL;
- amdmsFIT_SMOOTH_DATA_ENV *fitSmooth = NULL;
- int nPoints;
- double *x = NULL;
- double *y = NULL;
- double *ye = NULL;
- int iInput, nInputs;
- int iPixel, nPixels;
- int iHS, iVS;
- int sX, sY, sWidth, sHeight;
- int iX, iY;
- amdmsPIXEL m, v;
- double cfSum = 0.0;
- double cfCount = 0.0;
- double cfHSum = 0.0;
- double cfHCount = 0.0;
- amdmsPIXEL cf;
-
- nInputs = env->env.inFiles.nNames;
- nPixels = env->meanPixels[0].nx*env->meanPixels[0].ny;
- /* create all fit environments */
- if (amdmsCreatePolynomialFit(&fitCF, 1) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsCreateSmoothDataFit(&fitSmooth, (amdmsFIT_ENV*)fitCF) != amdmsSUCCESS) {
- amdmsDestroyLinearFit(&fitCF);
- return amdmsFAILURE;
- }
- /* set fit parameters */
- fitSmooth->env.satFlag = env->satFlag;
- fitSmooth->env.satWidth = env->satWidth;
- fitSmooth->env.satHeight = env->satHeight;
- fitSmooth->env.nDelStart = env->nDelStart;
- fitSmooth->env.nDelMiddle = env->nDelMiddle;
- fitSmooth->env.nDelEnd = env->nDelEnd;
- fitSmooth->env.minStep = 0.2;
- /* allocate memory for the temporary data points */
- x = (double*)calloc((size_t)(nInputs*env->env.stripes.nHStripes*env->env.stripes.nVStripes), sizeof(double));
- if (x == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (x)!");
- amdmsDestroySmoothDataFit(&fitSmooth);
- amdmsDestroyLinearFit(&fitCF);
- return amdmsFAILURE;
- }
- y = (double*)calloc((size_t)(nInputs*env->env.stripes.nHStripes*env->env.stripes.nVStripes), sizeof(double));
- if (y == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (y)!");
- free(x);
- amdmsDestroySmoothDataFit(&fitSmooth);
- amdmsDestroyLinearFit(&fitCF);
- return amdmsFAILURE;
- }
- ye = (double*)calloc((size_t)(nInputs*env->env.stripes.nHStripes*env->env.stripes.nVStripes), sizeof(double));
- if (ye == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (ye)!");
- free(x);
- free(y);
- amdmsDestroySmoothDataFit(&fitSmooth);
- amdmsDestroyLinearFit(&fitCF);
- return amdmsFAILURE;
- }
- nPoints = 0;
- /* First iterate over all input data */
- for (iInput = 0; iInput < nInputs; iInput++) {
- /* amdmsInfo(__FILE__, __LINE__, "input[%d]: exptime = %.3f", iInput, env->exptimes[iInput]); */
- /* iterate over all stripes */
- for (iHS = 0; iHS < env->env.stripes.nHStripes; iHS++) {
- /* skip unused horizontal stripes */
- if ((env->env.stripes.hStripes[iHS].flags & amdmsUSE_CONVERSION_FACTOR) == 0) {
- continue;
- }
- if (env->env.stripes.hStripes[iHS].pos >= rY + rH) {
- continue;
- }
- if (env->env.stripes.hStripes[iHS].pos + env->env.stripes.hStripes[iHS].size <= rY) {
- continue;
- }
- /* clip the horizontal stripe by the given region and use only the central part */
- sY = MAX(env->env.stripes.hStripes[iHS].pos, rY);
- sHeight = MIN(env->env.stripes.hStripes[iHS].pos + env->env.stripes.hStripes[iHS].size, rY + rH) - sY;
- sHeight /= 2;
- sY += sHeight/2;
- for (iVS = 0; iVS < env->env.stripes.nVStripes; iVS++) {
- /* skip unused vertical stripes */
- if ((env->env.stripes.vStripes[iVS].flags & amdmsUSE_CONVERSION_FACTOR) == 0) {
- continue;
- }
- if (env->env.stripes.vStripes[iVS].pos >= rX + rW) {
- continue;
- }
- if (env->env.stripes.vStripes[iVS].pos + env->env.stripes.vStripes[iVS].size <= rX) {
- continue;
- }
- /* clip the vertical stripe by the given region and use only the central part */
- sX = MAX(env->env.stripes.vStripes[iVS].pos, rX);
- sWidth = MIN(env->env.stripes.vStripes[iVS].pos + env->env.stripes.vStripes[iVS].size, rX + rW) - sX;
- sWidth /= 2;
- sX += sWidth/2;
- amdmsDebug(__FILE__, __LINE__,
- " area (%d .. %d, %d .. %d)",
- sX, sX + sWidth - 1, sY, sY + sHeight - 1);
- cfHSum = 0.0;
- cfHCount = 0.0;
- for (iY = sY; iY < (sY + sHeight); iY++) {
- for (iX = sX; iX < (sX + sWidth); iX++) {
- iPixel = env->meanPixels[0].nx*iY + iX;
- /* check if the pixel is a good pixel */
- if (env->env.calib.bpmData.data[iPixel] != amdmsGOOD_PIXEL) {
- continue;
- }
- m = env->meanPixels[iInput].data[iPixel];
- v = env->varPixels[iInput].data[iPixel];
- if (v == 0.0) {
- continue;
- }
- cfHSum += m/v;
- cfHCount += 1.0;
- cfSum += m/v;
- cfCount += 1.0;
- }
- }
- if (cfHCount != 0.0) {
- cf = cfHSum/cfHCount;
- amdmsCalcStat(&(env->env.calib), &(env->meanPixels[iInput]), 0, sX, sY, sWidth, sHeight, &m, NULL);
- amdmsCalcStat(&(env->env.calib), &(env->varPixels[iInput]), 0, sX, sY, sWidth, sHeight, &v, NULL);
- amdmsInfo(__FILE__, __LINE__,
- "input[%d]: exptime = %.3f, %.2f %.2f %.3f",
- iInput, env->exptimes[iInput], m, v, cf);
- x[nPoints] = v;
- y[nPoints] = m;
- ye[nPoints] = m/10.0;
- nPoints++;
- }
- }
- }
- }
- if (amdmsDoFit(&(fitSmooth->env.env), nPoints, x, y, ye) != amdmsSUCCESS) {
- free(x);
- free(y);
- free(ye);
- amdmsDestroySmoothDataFit(&fitSmooth);
- amdmsDestroyLinearFit(&fitCF);
- return amdmsFAILURE;
- }
- if (amdmsCalcFitLimits(&(fitSmooth->env.env), nPoints, x, y, ye, 0.01) != amdmsSUCCESS) {
- free(x);
- free(y);
- free(ye);
- amdmsDestroySmoothDataFit(&fitSmooth);
- amdmsDestroyLinearFit(&fitCF);
- return amdmsFAILURE;
- }
-
- if (cfCount != 0.0) {
- amdmsSetDataR(&env->cfmData, rX, rY, rW, rH, cf);
- amdmsInfo(__FILE__, __LINE__, "NDU = %.4g + %.4g*VDU [%d, %d, %d, %d]",
- fitSmooth->env.fit->a[0],
- fitSmooth->env.fit->a[1],
- rX, rY, rW, rH);
- amdmsInfo(__FILE__, __LINE__, "GAIN = %12.4f uV/e-", env->kADC/cf);
- free(x);
- free(y);
- free(ye);
- amdmsDestroySmoothDataFit(&fitSmooth);
- amdmsDestroyLinearFit(&fitCF);
- return amdmsSUCCESS;
- } else {
- free(x);
- free(y);
- free(ye);
- amdmsDestroySmoothDataFit(&fitSmooth);
- amdmsDestroyLinearFit(&fitCF);
- return amdmsFAILURE;
- }
-}
-
-amdmsCOMPL amdmsCalcConversionFactorLocalPairs(amdmsALGO_PROPERTIES_ENV *env)
-{
- int iInput, nInputs;
- int iPixel, nPixels;
- int iHS, iVS;
- int sX, sY, sWidth, sHeight;
- int iX, iY;
- amdmsPIXEL m;
- amdmsPIXEL m1, v1;
- amdmsPIXEL m2, v2;
- int iVSMin = -1;
- int iVSMax = -1;
- amdmsPIXEL mVSMin = 0.0;
- amdmsPIXEL mVSMax = 0.0;
- double cfSum = 0.0;
- double cfCount = 0.0;
- amdmsPIXEL cf;
- int nVS = 0;
- int vsWidth;
- int vsDelta;
- int vsX[amdmsMAX_STRIPES];
- int vsW[amdmsMAX_STRIPES];
-
- nInputs = env->env.inFiles.nNames;
- nPixels = env->meanPixels[0].nx*env->meanPixels[0].ny;
- if (amdmsAllocateData(&(env->cfmData), env->meanPixels[0].nx, env->meanPixels[0].ny) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- /* calculate the usable vertical stripes including a common width and appropriate x position */
- nVS = 0;
- vsWidth = 10000;
- for (iVS = 0; iVS < env->env.stripes.nVStripes; iVS++) {
- /* skip unused vertical stripes */
- if ((env->env.stripes.vStripes[iVS].flags & amdmsUSE_CONVERSION_FACTOR) == 0) {
- continue;
- }
- vsX[nVS] = env->env.stripes.vStripes[iVS].pos;
- vsW[nVS] = env->env.stripes.vStripes[iVS].size;
- if (vsW[nVS] < vsWidth) {
- vsWidth = vsW[nVS];
- }
- nVS++;
- }
- /* correct the x position of the vertical stripes for a common width */
- vsWidth = 40;
- for (iVS = 0; iVS < nVS; iVS++) {
- vsX[iVS] += (vsW[iVS] - vsWidth)/2;
- vsW[iVS] = vsWidth;
- }
- /* and now calculate the conversion factor for all pixels */
- /* First iterate over all input data */
- for (iInput = 0; iInput < nInputs; iInput++) {
- /* iterate over all stripes */
- for (iHS = 0; iHS < env->env.stripes.nHStripes; iHS++) {
- /* skip unused horizontal stripes */
- if ((env->env.stripes.hStripes[iHS].flags & amdmsUSE_CONVERSION_FACTOR) == 0) {
- continue;
- }
- /*
- sY = env->env.stripes.hStripes[iHS].pos;
- sHeight = env->env.stripes.hStripes[iHS].size;
- */
- sY = env->env.stripes.hStripes[iHS].pos + env->env.stripes.hStripes[iHS].size/4;
- sHeight = env->env.stripes.hStripes[iHS].size/2;
- /* calulate the vertical stripe with the highest and lowest mean value */
- for (iVS = 0; iVS < nVS; iVS++) {
- sX = vsX[iVS];
- sWidth = vsW[iVS];
- amdmsCalcStat(&(env->env.calib), &(env->meanPixels[iInput]), 0, sX, sY, sWidth, sHeight, &m, NULL);
- if (iVS == 0) {
- iVSMin = iVS;
- mVSMin = m;
- iVSMax = iVS;
- mVSMax = m;
- continue;
- }
- if (m < mVSMin) {
- iVSMin = iVS;
- mVSMin = m;
- }
- if (m > mVSMax) {
- iVSMax = iVS;
- mVSMax = m;
- }
- }
- if (iVSMin == iVSMax) {
- continue;
- }
- vsDelta = vsX[iVSMax] - vsX[iVSMin];
- amdmsCalcStat(&(env->env.calib), &(env->meanPixels[iInput]), 0,
- vsX[iVSMin], sY, vsW[iVSMin], sHeight,
- &mVSMin, NULL);
- amdmsCalcStat(&(env->env.calib), &(env->meanPixels[iInput]), 0,
- vsX[iVSMax], sY, vsW[iVSMax], sHeight,
- &mVSMax, NULL);
- amdmsInfo(__FILE__, __LINE__, " selected stripes: vsMin[%d] = %d (%.2f); vsMax[%d] = %d (%.2f); vsWidth = %d, vsDelta = %d",
- iVSMin, vsX[iVSMin], mVSMin,
- iVSMax, vsX[iVSMax], mVSMax,
- vsWidth, vsDelta);
- for (iY = sY; iY < (sY + sHeight); iY++) {
- for (iX = 0; iX < vsWidth; iX++) {
- iPixel = env->meanPixels[0].nx*iY + iX + vsX[iVSMin];
- /* check if both selected pixels are good pixels */
- if (env->env.calib.bpmData.data[iPixel] != amdmsGOOD_PIXEL) {
- continue;
- }
- if (env->env.calib.bpmData.data[iPixel + vsDelta] != amdmsGOOD_PIXEL) {
- continue;
- }
- m1 = env->meanPixels[iInput].data[iPixel];
- v1 = env->varPixels[iInput].data[iPixel];
- m2 = env->meanPixels[iInput].data[iPixel + vsDelta];
- v2 = env->varPixels[iInput].data[iPixel + vsDelta];
- if ((ABS(m1 - m2) < 200.0) || (ABS(v1 - v2) < 200.0)) {
- continue; /* difference not large enough */
- }
- if (m1 > m2) {
- cfSum += (m1 - m2)/(v1 - v2);
- } else {
- cfSum += (m2 - m1)/(v2 - v1);
- }
- cfCount += 1.0;
- }
- }
- }
- }
- if (cfCount != 0.0) {
- cf = cfSum/cfCount;
- amdmsSetData(&(env->cfmData), cf);
- amdmsInfo(__FILE__, __LINE__, "CF = %.2f/%.2f", cfSum, cfCount);
- amdmsInfo(__FILE__, __LINE__, "GAIN = %12.4f uV/e-", env->kADC/cf);
- return amdmsSUCCESS;
- } else {
- return amdmsFAILURE;
- }
-}
-
-amdmsCOMPL amdmsCalcConversionFactor(amdmsALGO_PROPERTIES_ENV *env)
-{
- int nInputs;
- int i;
- int iHS, iVS;
- int nx, ny;
- int sX, sY, sWidth, sHeight;
- amdmsPIXEL cf;
- amdmsCOMPL retVal = amdmsSUCCESS;
-
- nInputs = env->env.inFiles.nNames;
- nx = env->meanPixels[0].nx;
- ny = env->meanPixels[0].ny;
- for (i = 0; i < amdmsCONVERSION_FACTOR_FIT_NROWS; i++) {
- amdmsAllocateData(&(env->cfFit[i]), nx, ny);
- }
- amdmsAllocateData(&(env->cfmData), nx, ny);
- /* and now calculate the conversion factor for all pixels */
- if (env->cfAlgo == amdmsCFA_LOCAL_PAIRS) {
- retVal = amdmsCalcConversionFactorLocalPairs(env);
- } else if (env->cfAlgo == amdmsCFA_CENTRAL_LINE) {
- if (env->env.q4Flag) {
- retVal = amdmsCalcConversionFactorCentralLineR(env, 0, 0, nx/2, ny/2);
- retVal = retVal && amdmsCalcConversionFactorCentralLineR(env, nx/2, 0, nx/2, ny/2);
- retVal = retVal && amdmsCalcConversionFactorCentralLineR(env, 0, ny/2, nx/2, ny/2);
- retVal = retVal && amdmsCalcConversionFactorCentralLineR(env, nx/2, ny/2, nx/2, ny/2);
- } else {
- retVal = amdmsCalcConversionFactorCentralLineR(env, 0, 0, nx, ny);
- }
- }
- /* iterate over all stripes */
- for (iHS = 0; iHS < env->env.stripes.nHStripes; iHS++) {
- /* skip unused horizontal stripes */
- if ((env->env.stripes.hStripes[iHS].flags & amdmsUSE_CONVERSION_FACTOR) == 0) {
- continue;
- }
- sY = env->env.stripes.hStripes[iHS].pos;
- sHeight = env->env.stripes.hStripes[iHS].size;
- for (iVS = 0; iVS < env->env.stripes.nVStripes; iVS++) {
- /* skip unused vertical stripes */
- if ((env->env.stripes.vStripes[iVS].flags & amdmsUSE_CONVERSION_FACTOR) == 0) {
- continue;
- }
- sX = env->env.stripes.vStripes[iVS].pos;
- sWidth = env->env.stripes.vStripes[iVS].size;
- switch (env->cfAlgo) {
- case amdmsCFA_AMBER:
- retVal = amdmsCalcConversionFactorAmberR(env, sX, sY, sWidth, sHeight);
- break;
- case amdmsCFA_GLOBAL_LINE:
- retVal = amdmsCalcConversionFactorGlobalLineR(env, sX, sY, sWidth, sHeight);
- break;
- case amdmsCFA_CENTRAL_LINE:
- break;
- case amdmsCFA_LOCAL_PAIRS:
- break;
- default:
- return amdmsFAILURE;
- }
- if (retVal != amdmsSUCCESS) return amdmsFAILURE;
- amdmsCalcStat(&(env->env.calib),
- &(env->cfmData),
- 0, sX + sWidth/4, sY + sHeight/4, sWidth/2, sHeight/2,
- &cf, NULL);
- amdmsInfo(__FILE__, __LINE__, "GAIN = %12.4f e-/DU [%4d, %4d, %4d, %4d]",
- cf, sX + sWidth/4, sY + sHeight/4, sWidth/2, sHeight/2);
- }
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCalcNonlinearity(amdmsALGO_PROPERTIES_ENV *env)
-{
- return amdmsFAILURE;
-}
-
-amdmsCOMPL amdmsCalcPhotonTransferCurve(amdmsALGO_PROPERTIES_ENV *env)
-{
- return amdmsFAILURE;
-}
-
-amdmsCOMPL amdmsCalcDarkCurrent(amdmsALGO_PROPERTIES_ENV *env)
-{
- amdmsFIT_ENV *fitLine = NULL;
- /*amdmsFIT_SMOOTH_DATA_ENV *fitSmooth = NULL; */
- amdmsFIT_DATA_ENV *fitSmooth = NULL;
- double *x = NULL;
- double *y = NULL;
- double *ye = NULL;
- int i;
- int iInput, nInputs;
- int iPixel, nPixels;
-
- nInputs = env->env.inFiles.nNames;
- nPixels = env->meanPixels[0].nx*env->meanPixels[0].ny;
- /* create all fit environments */
- if (amdmsCreateStraightLineFit(&fitLine) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- /*if (amdmsCreateSmoothDataFit(&fitSmooth, fitLine) != amdmsSUCCESS) { */
- if (amdmsCreateDataFit(&fitSmooth, fitLine) != amdmsSUCCESS) {
- amdmsDestroyFit(&fitLine);
- return amdmsFAILURE;
- }
- for (i = 0; i < amdmsDARK_CURRENT_NROWS; i++) {
- amdmsAllocateData(&(env->dcFit[i]), env->meanPixels[0].nx, env->meanPixels[0].ny);
- }
- /* initialize the flatfield */
- amdmsSetData(&(env->dcFit[amdmsFIT_DATA_BIAS_ROW]), 0.0);
- amdmsSetData(&(env->dcFit[amdmsFIT_DATA_SATURATION_ROW]), 0.0);
- amdmsSetData(&(env->dcFit[amdmsFIT_CHI_SQR_ROW]), 0.0);
- amdmsSetData(&(env->dcFit[amdmsFIT_ABS_DIST_SQR_ROW]), 0.0);
- amdmsSetData(&(env->dcFit[amdmsFIT_REL_DIST_SQR_ROW]), 0.0);
- amdmsSetData(&(env->dcFit[amdmsFIT_LOWER_LIMIT_ROW]), 0.0);
- amdmsSetData(&(env->dcFit[amdmsFIT_UPPER_LIMIT_ROW]), 0.0);
- amdmsSetData(&(env->dcFit[amdmsFIT_A0_ROW]), 0.0);
- amdmsSetData(&(env->dcFit[amdmsFIT_A0_STDEV_ROW]), 0.0);
- amdmsSetData(&(env->dcFit[amdmsFIT_A1_ROW]), 0.0);
- amdmsSetData(&(env->dcFit[amdmsFIT_A1_STDEV_ROW]), 0.0);
- /* set fit parameters */
- /*
- fitSmooth->env.satFlag = env->satFlag;
- fitSmooth->env.satWidth = env->satWidth;
- fitSmooth->env.satHeight = env->satHeight;
- fitSmooth->env.nDelStart = env->nDelStart;
- fitSmooth->env.nDelMiddle = env->nDelMiddle;
- fitSmooth->env.nDelEnd = env->nDelEnd;
- fitSmooth->env.minStep = 0.2;
- */
- fitSmooth->satFlag = env->satFlag;
- fitSmooth->satWidth = env->satWidth;
- fitSmooth->satHeight = env->satHeight;
- fitSmooth->nDelStart = env->nDelStart;
- fitSmooth->nDelMiddle = env->nDelMiddle;
- fitSmooth->nDelEnd = env->nDelEnd;
- fitSmooth->minStep = 0.2;
- /* allocate memory for the temporary data points */
- x = (double*)calloc((size_t)nInputs, sizeof(double));
- if (x == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (x)!");
- amdmsDestroyDataFit(&fitSmooth);
- amdmsDestroyFit(&fitLine);
- return amdmsFAILURE;
- }
- y = (double*)calloc((size_t)nInputs, sizeof(double));
- if (y == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (y)!");
- free(x);
- amdmsDestroyDataFit(&fitSmooth);
- amdmsDestroyFit(&fitLine);
- return amdmsFAILURE;
- }
- ye = (double*)calloc((size_t)nInputs, sizeof(double));
- if (ye == NULL) {
- amdmsFatal(__FILE__, __LINE__, "memory allocation failure (ye)!");
- free(x);
- free(y);
- amdmsDestroyDataFit(&fitSmooth);
- amdmsDestroyFit(&fitLine);
- return amdmsFAILURE;
- }
- /* set the x values equal to the exposure times in ms */
- for (iInput = 0; iInput < nInputs; iInput++) {
- x[iInput] = env->exptimes[iInput];
- }
- for (iPixel = 0; iPixel < nPixels; iPixel++) {
- if (env->env.calib.bpmData.data[iPixel] != amdmsGOOD_PIXEL) {
- continue;
- }
- for (iInput = 0; iInput < nInputs; iInput++) {
- y[iInput] = env->meanPixels[iInput].data[iPixel];
- ye[iInput] = sqrt(env->varPixels[iInput].data[iPixel]);
- if (ye[iInput] < fabs(0.1*y[iInput])) {
- ye[iInput] = 1.0;
- }
- }
- /*if (amdmsFitPixel(env, nInputs, x, y, ye, &(fitSmooth->env), iPixel, env->dcFit) != amdmsSUCCESS) */
- if (amdmsFitPixel(env, nInputs, x, y, ye, fitSmooth, iPixel, env->dcFit) != amdmsSUCCESS) {
- free(x);
- free(y);
- free(ye);
- amdmsDestroyDataFit(&fitSmooth);
- amdmsDestroyFit(&fitLine);
- return amdmsFAILURE;
- }
- amdmsCheckFitValues(env->dcFit, amdmsDARK_CURRENT_NROWS, iPixel);
- }
- free(x);
- free(y);
- free(ye);
- amdmsDestroyDataFit(&fitSmooth);
- amdmsDestroyFit(&fitLine);
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCalcHistogramForArea(amdmsALGO_PROPERTIES_ENV *env, int aoiX, int aoiY, int aoiWidth, int aoiHeight, int *inCount, int *outCount)
-{
- int nx, ny, nz;
- int iPixel, nPixels;
- int i, j, k;
- double x, y;
- int ix, iy;
-
- nz = env->env.inFiles.nNames;
- nx = env->meanPixels[0].nx;
- ny = env->meanPixels[0].ny;
- nPixels = nx*ny;
- for (j = 0; j < aoiHeight; j++) {
- iPixel = (j + aoiY)*nx + aoiX;
- for (i = 0; i < aoiWidth; i++) {
- for (k = 0; k < nz; k++) {
- switch (env->hX.content) {
- case amdmsHC_EXPTIME:
- x = env->exptimes[k];
- break;
- case amdmsHC_MEAN:
- x = env->meanPixels[k].data[iPixel];
- break;
- case amdmsHC_VARIANCE:
- x = env->varPixels[k].data[iPixel];
- break;
- case amdmsHC_NOISE:
- x = sqrt(env->varPixels[k].data[iPixel]);
- break;
- default:
- return amdmsFAILURE;
- }
- if ((env->hX.min >= 0.0) && (x < 0.0)) x = 0.0;
- switch (env->hX.scale) {
- case amdmsHS_LINEAR:
- break;
- case amdmsHS_SQRT:
- x = sqrt(fabs(x));
- break;
- case amdmsHS_LOG:
- if (x > 0.0)
- x = log(x);
- else
- x = 0.0;
- break;
- default:
- return amdmsFAILURE;
- }
- ix = (int)((x - env->hX.min)/(env->hX.max - env->hX.min)*(double)(env->hX.steps));
- if (ix < 0) {
- (*outCount)++;
- continue;
- }
- if (ix >= env->hX.steps) {
- (*outCount)++;
- continue;
- }
- switch (env->hY.content) {
- case amdmsHC_EXPTIME:
- y = env->exptimes[k];
- break;
- case amdmsHC_MEAN:
- y = env->meanPixels[k].data[iPixel];
- break;
- case amdmsHC_VARIANCE:
- y = env->varPixels[k].data[iPixel];
- break;
- case amdmsHC_NOISE:
- y = sqrt(env->varPixels[k].data[iPixel]);
- break;
- default:
- return amdmsFAILURE;
- }
- if ((env->hY.min >= 0.0) && (y < 0.0)) y = 0.0;
- switch (env->hY.scale) {
- case amdmsHS_LINEAR:
- break;
- case amdmsHS_SQRT:
- y = sqrt(fabs(x));
- break;
- case amdmsHS_LOG:
- if (y > 0.0)
- y = log(y);
- else
- y = 0.0;
- break;
- default:
- return amdmsFAILURE;
- }
- iy = (int)((y - env->hY.min)/(env->hY.max - env->hY.min)*(double)(env->hY.steps));
- if (iy < 0) {
- (*outCount)++;
- continue;
- }
- if (iy >= env->hY.steps) {
- (*outCount)++;
- continue;
- }
- (*inCount)++;
- env->histoData.data[iy*env->hX.steps + ix] += 1.0;
- }
- iPixel++;
- }
- }
- return amdmsSUCCESS;
-}
-
-
-amdmsCOMPL amdmsCalcHistogram(amdmsALGO_PROPERTIES_ENV *env)
-{
- amdmsCOMPL retValue = amdmsSUCCESS;
- int inCount = 0;
- int outCount = 0;
- int iHS, iVS;
-
- amdmsAllocateData(&(env->histoData), env->hX.steps, env->hY.steps);
- amdmsSetData(&(env->histoData), 0.0);
- /* iterate over all pixels inside the area of interest */
- if (env->env.stripes.nHStripes == 0) {
- retValue = amdmsCalcHistogramForArea(env,
- env->env.filter.aoiX,
- env->env.filter.aoiY,
- env->env.filter.aoiWidth,
- env->env.filter.aoiHeight,
- &inCount,
- &outCount);
- } else {
- for (iHS = 0; iHS < env->env.stripes.nHStripes; iHS++) {
- /* skip unused horizontal stripes */
- if (env->env.stripes.hStripes[iHS].flags == 0) continue;
- for (iVS = 0; iVS < env->env.stripes.nVStripes; iVS++) {
- /* skip unused vertical stripes */
- if (env->env.stripes.vStripes[iVS].flags == 0) continue;
- retValue = retValue && amdmsCalcHistogramForArea(env,
- env->env.stripes.vStripes[iVS].pos,
- env->env.stripes.hStripes[iHS].pos,
- env->env.stripes.vStripes[iVS].size,
- env->env.stripes.hStripes[iHS].size,
- &inCount,
- &outCount);
- }
- }
- }
- amdmsInfo(__FILE__, __LINE__, "%d values outside, %d values inside histogram", outCount, inCount);
- return retValue;
-}
-
-amdmsCOMPL amdmsFitPixel(amdmsALGO_PROPERTIES_ENV *env,
- int nPoints, double *x, double *y, double *ye,
- amdmsFIT_DATA_ENV *fit,
- int iPixel,
- amdmsDATA *fitValues)
-{
- amdmsBOOL infoFlag = amdmsFALSE;
- int nCoeffs;
- int iCoeff;
- int iPoint;
-
- infoFlag = (env->env.filter.poiFlag && (iPixel == (env->env.filter.poiX + env->env.filter.poiY*env->meanPixels[0].nx)));
- nCoeffs = fit->env.nCoefficients;
- if (infoFlag) {
- amdmsInfo(__FILE__, __LINE__, "#********************************");
- amdmsInfo(__FILE__, __LINE__, "# model fitting for pixel %d, %d (%d)",
- iPixel%env->meanPixels[0].nx, iPixel/env->meanPixels[0].nx, iPixel);
- amdmsInfo(__FILE__, __LINE__, "#--------------------------------");
- amdmsInfo(__FILE__, __LINE__, "# data points (x, y):");
- for (iPoint = 0; iPoint < nPoints; iPoint++) {
- amdmsInfo(__FILE__, __LINE__, " %12.4f %12.4f %12.4f", x[iPoint], y[iPoint], ye[iPoint]);
- }
- }
-/* cpl_msg_info(cpl_func,"nPoints:%d, x:%g, y:%g, ye:%g",nPoints, x, y, ye); */
- if (amdmsDoFit(&(fit->env), nPoints, x, y, ye) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsCalcFitLimits(&(fit->env), nPoints, x, y, ye, 0.01) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- fitValues[amdmsFIT_DATA_BIAS_ROW].data[iPixel] = amdmsEvalFit(&(fit->env), x[0]);
- if(fit->satDP>=0){
- fitValues[amdmsFIT_DATA_SATURATION_ROW].data[iPixel] = amdmsEvalFit(&(fit->env), x[fit->satDP]);
- }
- fitValues[amdmsFIT_CHI_SQR_ROW].data[iPixel] = fit->env.chi2;
- fitValues[amdmsFIT_ABS_DIST_SQR_ROW].data[iPixel] = fit->env.absDist2;
- fitValues[amdmsFIT_REL_DIST_SQR_ROW].data[iPixel] = fit->env.relDist2;
- fitValues[amdmsFIT_LOWER_LIMIT_ROW].data[iPixel] = fit->env.fitLowerLimit;
- fitValues[amdmsFIT_UPPER_LIMIT_ROW].data[iPixel] = fit->env.fitUpperLimit;
- for (iCoeff = 0; iCoeff < nCoeffs; iCoeff++) {
- fitValues[amdmsFIT_A0_ROW + 2*iCoeff].data[iPixel] = fit->fit->a[iCoeff];
- fitValues[amdmsFIT_A0_STDEV_ROW + 2*iCoeff].data[iPixel] = fit->fit->ae[iCoeff];
- }
- if (infoFlag) {
- amdmsInfo(__FILE__, __LINE__, "#--------------------------------");
- amdmsInfo(__FILE__, __LINE__, "# model with %d coefficients:", nCoeffs);
- amdmsInfo(__FILE__, __LINE__, "# chi^2 = %12.4f",
- fitValues[amdmsFIT_CHI_SQR_ROW].data[iPixel]);
- amdmsInfo(__FILE__, __LINE__, "# absDist^2 = %12.8f",
- fitValues[amdmsFIT_ABS_DIST_SQR_ROW].data[iPixel]);
- amdmsInfo(__FILE__, __LINE__, "# relDist^2 = %12.8f",
- fitValues[amdmsFIT_REL_DIST_SQR_ROW].data[iPixel]);
- amdmsInfo(__FILE__, __LINE__, "# data bias = %12.4f",
- fitValues[amdmsFIT_DATA_BIAS_ROW].data[iPixel]);
- amdmsInfo(__FILE__, __LINE__, "# data saturation = %12.4f",
- fitValues[amdmsFIT_DATA_SATURATION_ROW].data[iPixel]);
- amdmsInfo(__FILE__, __LINE__, "# fit lower limit = %12.4f",
- fitValues[amdmsFIT_LOWER_LIMIT_ROW].data[iPixel]);
- amdmsInfo(__FILE__, __LINE__, "# fit upper limit = %12.4f",
- fitValues[amdmsFIT_UPPER_LIMIT_ROW].data[iPixel]);
- for (iCoeff = 0; iCoeff < nCoeffs; iCoeff++) {
- amdmsInfo(__FILE__, __LINE__, "# a%d = %.4e, stdev a%d = %.4e",
- iCoeff, fitValues[amdmsFIT_A0_ROW + 2*iCoeff].data[iPixel],
- iCoeff, fitValues[amdmsFIT_A0_STDEV_ROW + 2*iCoeff].data[iPixel]);
- }
- }
- return amdmsSUCCESS;
-}
-
-void amdmsCheckFitValues(amdmsDATA *fitValues, int nValues, int iPixel)
-{
- int iValue;
-
- for (iValue = 0; iValue < nValues; iValue++) {
- if (isnan(fitValues[iValue].data[iPixel])) {
- amdmsWarning(__FILE__, __LINE__, "fit value %d of pixel %d is NAN", iValue, iPixel);
- }
- if (isinf(fitValues[iValue].data[iPixel])) {
- amdmsWarning(__FILE__, __LINE__, "fit value %d of pixel %d is INF", iValue, iPixel);
- }
- }
-}
-
-amdmsCOMPL amdmsCreateFlatfieldMap(amdmsALGO_PROPERTIES_ENV *env,
- amdmsFITS *outfile,
- amdmsFITS_FLAGS flags)
-{
- if (amdmsUpdateKeywordString(outfile, "HIERARCH ESO DPR CATG", "CALIB", "Observation category") != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsUpdateKeywordString(outfile, "HIERARCH ESO DPR TECH", "INTERFEROMETRY", "Observation technique") != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsUpdateKeywordString(outfile, "HIERARCH ESO DPR TYPE", "FLATFIELD", "Observation type") != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsCreateData(outfile, flags, amdmsFLATFIELD_NROWS, 1) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- env->env.calib.ffmData.index = 1.0;
- if (amdmsWriteData(outfile, &(env->env.calib.ffmData), amdmsFLATFIELD_ROW, 0) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCreateFlatfieldFitMap(amdmsALGO_PROPERTIES_ENV *env,
- amdmsFITS *outfile,
- amdmsFITS_FLAGS flags)
-{
- int i;
-
- if (amdmsUpdateKeywordString(outfile, "HIERARCH ESO DPR CATG", "CALIB", "Observation category") != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsUpdateKeywordString(outfile, "HIERARCH ESO DPR TECH", "INTERFEROMETRY", "Observation technique") != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsUpdateKeywordString(outfile, "HIERARCH ESO DPR TYPE", "FLATFIELD", "Observation type") != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- if (amdmsCreateData(outfile, flags, amdmsFLATFIELD_FIT_NROWS, 1) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- for (i = 0; i < amdmsFLATFIELD_FIT_NROWS; i++) {
- env->ffFit[i].index = (double)(i + 1);
- if (amdmsWriteData(outfile, &(env->ffFit[i]), i, 0) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCreateConversionFactorMap(amdmsALGO_PROPERTIES_ENV *env,
- amdmsFITS *outfile,
- amdmsFITS_FLAGS flags)
-{
- amdmsPIXEL cf, dummy;
- int nx, ny;
-
- if (env->env.filter.aoiFlag) {
- amdmsCalcStat(&(env->env.calib), &(env->cfmData), 0,
- env->env.filter.aoiX,
- env->env.filter.aoiY,
- env->env.filter.aoiWidth,
- env->env.filter.aoiHeight,
- &cf, &dummy);
- amdmsUpdateKeywordDouble(outfile, "GAIN", cf, 5, "CF in [e-/ADU]");
- }
- if (env->env.q4Flag) {
- nx = env->cfmData.nx;
- ny = env->cfmData.ny;
- amdmsCalcStat(&(env->env.calib), &(env->cfmData), 0, 0, 0, nx/2, ny/2, &cf, &dummy);
- amdmsUpdateKeywordDouble(outfile, "GAIN1", cf, 5, "CF Q1 in [e-/ADU]");
- amdmsCalcStat(&(env->env.calib), &(env->cfmData), 0, nx/2, 0, nx/2, ny/2, &cf, &dummy);
- amdmsUpdateKeywordDouble(outfile, "GAIN2", cf, 5, "CF Q2 in [e-/ADU]");
- amdmsCalcStat(&(env->env.calib), &(env->cfmData), 0, 0, ny/2, nx/2, ny/2, &cf, &dummy);
- amdmsUpdateKeywordDouble(outfile, "GAIN3", cf, 5, "CF Q3 in [e-/ADU]");
- amdmsCalcStat(&(env->env.calib), &(env->cfmData), 0, nx/2, ny/2, nx/2, ny/2, &cf, &dummy);
- amdmsUpdateKeywordDouble(outfile, "GAIN4", cf, 5, "CF Q4 in [e-/ADU]");
- }
-
- if (amdmsCreateData(outfile, flags, amdmsCONVERSION_FACTOR_NROWS, 1) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- env->cfmData.index = 1.0;
- if (amdmsWriteData(outfile, &(env->cfmData), amdmsCONVERSION_FACTOR_ROW, 0) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCreateNonlinearityMap(amdmsALGO_PROPERTIES_ENV *env,
- amdmsFITS *outfile,
- amdmsFITS_FLAGS flags)
-{
- if (amdmsCreateData(outfile, flags, amdmsNONLINEARITY_NROWS, 1) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- env->env.calib.nlmDataLimit.index = 1.0;
- if (amdmsWriteData(outfile, &(env->env.calib.nlmDataLimit), amdmsNONLINEARITY_LIMIT_ROW, 0) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- env->env.calib.nlmDataA0.index = 2.0;
- if (amdmsWriteData(outfile, &(env->env.calib.nlmDataA0), amdmsNONLINEARITY_A0_ROW, 0) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- env->env.calib.nlmDataA1.index = 3.0;
- if (amdmsWriteData(outfile, &(env->env.calib.nlmDataA1), amdmsNONLINEARITY_A1_ROW, 0) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCreateNonlinearityFitMap(amdmsALGO_PROPERTIES_ENV *env,
- amdmsFITS *outfile,
- amdmsFITS_FLAGS flags)
-{
- int i;
-
- if (amdmsCreateData(outfile, flags, amdmsNONLINEARITY_FIT_NROWS, 1) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- for (i = 0; i < amdmsNONLINEARITY_FIT_NROWS; i++) {
- env->nlFit[i].index = (double)(i + 1);
- if (amdmsWriteData(outfile, &(env->nlFit[i]), i, 0) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCreatePhotonTransferCurveMap(amdmsALGO_PROPERTIES_ENV *env,
- amdmsFITS *outfile,
- amdmsFITS_FLAGS flags)
-{
- int i;
-
- if (amdmsCreateData(outfile, flags, amdmsPTC_NROWS, 1) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- for (i = 0; i < amdmsPTC_NROWS; i++) {
- env->ptcFit[i].index = (double)(i + 1);
- if (amdmsWriteData(outfile, &(env->ptcFit[i]), i, 0) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCreateDarkCurrentMap(amdmsALGO_PROPERTIES_ENV *env,
- amdmsFITS *outfile,
- amdmsFITS_FLAGS flags)
-{
- int i;
-
- if (amdmsCreateData(outfile, flags, amdmsDARK_CURRENT_NROWS, 1) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- for (i = 0; i < amdmsDARK_CURRENT_NROWS; i++) {
- env->dcFit[i].index = (double)(i + 1);
- if (amdmsWriteData(outfile, &(env->dcFit[i]), i, 0) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- }
- return amdmsSUCCESS;
-}
-
-amdmsCOMPL amdmsCreateHistogramMap(amdmsALGO_PROPERTIES_ENV *env,
- amdmsFITS *outfile,
- amdmsFITS_FLAGS flags)
-{
- if (amdmsCreateSimpleData(outfile, flags, env->hX.steps, env->hY.steps, amdmsHISTOGRAM_NROWS, 1) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- env->histoData.index = 1.0;
- if (amdmsWriteData(outfile, &(env->histoData), amdmsHISTOGRAM_ROW, 0) != amdmsSUCCESS) {
- return amdmsFAILURE;
- }
- return amdmsSUCCESS;
-}
-
diff --git a/amber/amdrs.h b/amber/amdrs.h
deleted file mode 100644
index 10f7654..0000000
--- a/amber/amdrs.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/*******************************************************************/
-/* VLTI AMBER DATA REDUCTION SOFTWARE (AMDRS) */
-/* */
-/* FILE: amdrs.h */
-/* */
-/* Contains definitions of constant parameters, types and */
-/* prototypes for all ANSI C functions. */
-/* */
-/* (tlicha 15-01-03) Initial Version */
-/* handling routines */
-/*******************************************************************/
-
-/******************************************************************************
-* Compiler directives
-******************************************************************************/
-
-/*
- Applicable documents:
- =====================
-
- [1]: LdV Data Processing algorithms
- VLT-SPE-ESO-15810-2112
-
- [2]: V. Coude du Foresto, S. Ridgway, J. M. Mariotti,
- 'Deriving object visibilities from interferograms obtained
- with a fiber stellar interferometer'
- Astron. & Astrophys., Suppl. Ser. 121, pp. 379-392 (1997)
-
- we changed heavily the interfaces from the document [1], especially
- the main data has now its own data structure, and all data inside
- is in double, not in long, as described in [1];
- */
-
-
-
-/* --------------------------------------------------------------- */
-/* COMPILER DIRECTIVES */
-/* --------------------------------------------------------------- */
-#ifndef _AMDRS_H
-#define _AMDRS_H
-
-/*
-#define SECURITY_MODE
-*/
-
-/* Compiler directive. If it is set, the program will run slower
- but more safe (dimension checks etc. are made.) Keep this
- flag set as long as you developing the code. */
-
-/* --------------------------------------------------------------- */
-/* INCLUDES */
-/* --------------------------------------------------------------- */
-
-#include <math.h>
-#include <time.h>
-/*#include "fftw.h" */ /* for FFTW library */
-
-#include "amberSupport.h"
-
-#include "fitsio.h" /* needed by amdlib.h */
-
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-
-
-
-/* --------------------------------------------------------------- */
-/* Set CPL Version 3.0 compliance */
-/* uncomment this line to be CPL 2.1 compatible. */
-/* --------------------------------------------------------------- */
-/* #define AMBER_CPL_2_1 */
-
-/* --------------------------------------------------------------- */
-/* DEBUG OUTPUT ON = 1 */
-/* --------------------------------------------------------------- */
-#define TL_DEBUG 1
-
-/* --------------------------------------------------------------- */
-/* AMBER INSTRUMENT */
-/* --------------------------------------------------------------- */
-#define AMBER_SUBWINDOW_X_MAX 16 /* width of a subwindow */
-#define AMBER_SUBWINDOW_Y_MAX 32 /* height of a subwindow */
-
-/* --------------------------------------------------------------- */
-/* MATHEMATICAL CONSTANTS */
-/* --------------------------------------------------------------- */
-/*#define PI 3.141592653589793238e+00*/
-/* value taken from MATHEMATICA, (c) Wolfram Research
- Why this high precision?
- Example: Phase k*z with k=2*pi/lambda, lambda = 1e-06 m and z = 1km
- We should get a Phase of zero, as a multiple of 1e-06 fits exactly inside 1km.
- (1) if we take pi = 3.141592654 --> Phase = 6.283185308000000e+09
- --> (cos(Phase),sin(Phase)) = (6.819186241461076e-01, 7.314280484385868e-01)
- (2) if we take pi = 3.141592653589793 --> Phase = 6.283185307179587e+09
- --> (cos(Phase),sin(Phase)) = (9.999999999993591e-01, 1.132200850406420e-06)
- The correct (cos,sin) pair would be (1,0) --> (2) is much better than (1) */
-#define TWO_PI 6.283185307179586476e+00
-
-/* --------------------------------------------------------------- */
-/* AMBER DRS CONSTANTS */
-/* --------------------------------------------------------------- */
-
-
-
-/* --------------------------------------------------------------- */
-/* OTHER CONSTANTS ... */
-/* --------------------------------------------------------------- */
-#define MEMORY_PROTOCOL_THRESHOLD 1000
-/* when writing an ASCII memory protocol, only increments whose absolute
- value is larger than this threshold (in units of BYTES) are written
- to the protocol */
-
-#define MAX_STRING_LENGTH 255
-/* the maximum length of a string used in the code */
-
-
-
-typedef struct
-{
- double time;
- double dl_offset;
- double mu1_squared;
- double mu2_squared;
-} scan_data;
-/* A 'scan_data' stores the informations related to 1 scan */
-
-
-
-/* Memory struct (contains all information on current memory usage) */
-/* ---------------------------------------------------------------- */
-typedef struct
-{
- long currently_allocated;
- /* currently used memory is stored in the global variable 'vndrs_memory.currently allocated' */
-
- long delta;
- /* when writing an ASCII memory usage protocol, not every allocation or free process
- is written to the protocol. Changes in total memory are added up in the
- variable "vndrs_memory.delta". Only if this value is larger than the treshold
- (defined above as a constant) the protocol is updated. */
-
- FILE *file_pointer;
- /* file pointer to the memory protocol file */
-
- /* COUNTERS THAT KEEP TRACK OF HOW MANY TIMES SPECIFIC ALLOCATION AND
- FREE ROUTINES HAVE BEEN CALLED */
- long calloc_vector_double_calls;
- long calloc_vector_complex_calls;
- long calloc_matrix_double_calls;
- long calloc_matrix_complex_calls;
- long calloc_full_scan_calls;
- long calloc_full_pow_calls;
- long calloc_batch_calls;
- long calloc_powbatch_calls;
-} memory_usage;
-
-/* Protocol struct (contains information on the runtime protocol) */
-/* -------------------------------------------------------------- */
-typedef struct
-{
- char mode[MAX_STRING_LENGTH];
- /* can be either 'NONE', 'SCREEN' or 'DISK' */
-
- FILE *file_pointer;
- /* file pointer to the runtime protocol */
-
- char text[MAX_STRING_LENGTH];
- /* the string that shall be written to the runtime protocol */
-} protocol;
-
-
-/* --------------------------------------------------------------- */
-/* GLOBAL VARIABLES */
-/* --------------------------------------------------------------- */
-
-/* time_t StartTime; */
-/* time_t EndTime; */
-
-/* time at start and end of program execution */
-
-/* memory_usage amdrs_memory; */
-/* struct that keeps track of the memory usage */
-
-/* protocol amdrs_protocol; */
-/* struct responsible for the runtime protocol */
-
-/* char DataPath[MAX_STRING_LENGTH]; */
-/* path used to store intermediate data */
-
-
-/* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
-/* && && */
-/* && FUNCTION PROTOTYPES (REQUIRED IN ANSI C) && */
-/* && && */
-/* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
-
-/* ------------------------------------------------------------------- */
-/* PROGRAM FLOW / RUNTIME PROTOCOL */
-/* ------------------------------------------------------------------- */
-/*void vndrs_initialization(char *protocol_mode, char *file_name); */
-/*void vndrs_exit(void); */
-/*void vndrs_start_runtime_protocol(char *protocol_mode, char *file_name); */
-/*void vndrs_runtime_protocol(void); */
-/*void vndrs_end_runtime_protocol(void);*/
-void amdrs_error_alert(void);
-
-
-/* --------------------------------------------------------------- */
-/* AMBER DRS INCLUDES */
-/* --------------------------------------------------------------- */
-
-/*#include "vndrs_IO.h"*/
-
-
-#endif
diff --git a/amber/esolibCalibVis.c b/amber/esolibCalibVis.c
deleted file mode 100644
index f444eca..0000000
--- a/amber/esolibCalibVis.c
+++ /dev/null
@@ -1,887 +0,0 @@
-/*
- * esolibCalibVis.c
- *
- * Created on: Oct 26, 2009
- * Author: agabasch
- */
-#include <math.h>
-#include "esolibCalibVis.h"
-#include <libgen.h>
-#include <string.h>
-#include "amdrs.h"
-#include "amber_dfs.h"
-#include "amber_qc.h"
-#include "config.h"
-#include "esolibamdlibOi.h"
-
-
-static cpl_error_code amber_CalibVis_calc_save(const char * recipename,
- cpl_frame * science_frame, cpl_frame * trf_frame,
- cpl_parameterlist * parlist, cpl_frameset * frameset);
-static cpl_error_code amber_check_consitency_trf_science(
- cpl_frame *science_frame, cpl_frame * trf_frame);
-
-
-static cpl_error_code get_common_channels(amdlibWAVELENGTH trf_wlen,
- amdlibWAVELENGTH science_wlen, int * trf_lmin, int * trf_lmax,
- int * science_lmin, int * science_lmax);
-
-
-
-cpl_error_code amber_CalibVis(const char * recipename, const char * filename,
- cpl_parameterlist *parlist, cpl_frameset * frameset)
-{
- cpl_frame * trf_frame;
- cpl_frame * science_frame;
- cpl_propertylist * plist=NULL;
- char * tag_needed=NULL;
-
- /*cpl_frameset_dump(frameset, NULL);
-exit(0);*/
- /* Extract the FILTER J,H,K */
- plist = cpl_propertylist_load(filename, 0);
- if (plist==NULL){
- cpl_msg_warning(cpl_func,"Error loading the header of %s",filename);
- /* Propagate error, if any */
- return cpl_error_set(cpl_func, cpl_error_get_code());
- }
- if (cpl_propertylist_has(plist, "ESO QC BAND") == 1){
- tag_needed=cpl_sprintf("AMBER_TRF_%s",
- cpl_propertylist_get_string(plist, "ESO QC BAND"));
- cpl_msg_info(cpl_func, "Searching for the transfer function tagged %s"
- , tag_needed);
- }
- else{
- cpl_propertylist_delete(plist);
- return cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
- "Can not determine the Band from the header! ");
- }
- cpl_propertylist_delete(plist);
-
-
- /*Find the right frame*/
-
- trf_frame=cpl_frameset_find(frameset,tag_needed);
- if (trf_frame == NULL) {
- cpl_free(tag_needed);
- cpl_msg_warning(cpl_func, "No Transfer function frame found in the SOF");
- /* Propagate error, if any */
- return cpl_error_set_message(cpl_func, CPL_ERROR_FILE_NOT_FOUND,
- "No transfer function file in the SOF! "
- "Visibilities can not be calibrated!");
-
- }
- cpl_free(tag_needed);
-
- science_frame = cpl_frameset_get_first(frameset);
- while(science_frame)
- {
- if(!strcmp(cpl_frame_get_filename(science_frame),filename))
- {
- break;
- }
- science_frame = cpl_frameset_get_next( frameset );
- }
- if (science_frame == NULL) {
- cpl_msg_error(cpl_func, "No science frame found in the SOF");
- /* Propagate error, if any */
- return cpl_error_set_message(cpl_func, CPL_ERROR_FILE_NOT_FOUND,
- "No science frame in the SOF!");
-
- }
-
- if (amber_check_consitency_trf_science(science_frame, trf_frame))
- {
- cpl_msg_error(cpl_func, "Mode of science frame and transfer function "
- "frame differ!! Aborting the visibility calibration!");
- return cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT,
- "Transfer function is of wrong instrument mode!");
- }
-
- amber_CalibVis_calc_save(recipename, science_frame, trf_frame, parlist,
- frameset);
-
- /* Propagate error, if any */
- return cpl_error_set(cpl_func, cpl_error_get_code());
-
-
-}
-
-static cpl_error_code amber_CalibVis_calc_save(const char * recipename,
- cpl_frame * science_frame, cpl_frame * trf_frame,
- cpl_parameterlist * parlist, cpl_frameset * frameset)
-{
- int iFrame=0;
- int iWave=0;
- int trf_lmin=0;
- int trf_lmax=0;
- int science_lmin=0;
- int science_lmax=0;
- int waveconsistency=0;
- int dummy_cp_phi_counter=0;
- int dummy_cp_phi_error_counter=0;
- int dummy_vis2_counter_b1=0.;
- int dummy_vis2_counter_b2=0.;
- int dummy_vis2_counter_b3=0.;
- cpl_propertylist * pHeader=NULL;
- cpl_propertylist * qclist=NULL;
- char * outname_calibrated=NULL;
- const char * outname_calibrated_paf=NULL;
-
- double dummy_vis2_b1=0.;
- double dummy_vis2_error_b1=0.;
- double dummy_vis2_b2=0.;
- double dummy_vis2_error_b2=0.;
- double dummy_vis2_b3=0.;
- double dummy_vis2_error_b3=0.;
- double dummy_cp_phi=0.;
- double dummy_cp_phi_error=0.;
-
- cpl_vector * trf_vis2_average_b1=NULL;
- cpl_vector * trf_vis2_average_error_b1=NULL;
- cpl_vector * trf_vis2_average_b2=NULL;
- cpl_vector * trf_vis2_average_error_b2=NULL;
- cpl_vector * trf_vis2_average_b3=NULL;
- cpl_vector * trf_vis2_average_error_b3=NULL;
- cpl_vector * trf_cpphi_average=NULL;
- cpl_vector * trf_cpphi_average_error=NULL;
-
-
- amdlibERROR_MSG errMsg;
- amdlibPHOTOMETRY science_photometry = {NULL};
- amdlibWAVELENGTH science_wave = {NULL};
- amdlibPISTON science_opd = {NULL};
- amdlibOI_TARGET science_target = {NULL};
- amdlibOI_ARRAY science_array = {NULL};
- amdlibVIS science_vis = {NULL};
- amdlibVIS2 science_vis2 = {NULL};
- amdlibVIS3 science_vis3 = {NULL};
- amdlibINS_CFG science_insCfg;
- amdlibSPECTRUM science_spectrum={NULL};
-
-
- amdlibPHOTOMETRY trf_photometry = {NULL};
- amdlibWAVELENGTH trf_wave = {NULL};
- amdlibPISTON trf_opd = {NULL};
- amdlibOI_TARGET trf_target = {NULL};
- amdlibOI_ARRAY trf_array = {NULL};
- amdlibVIS trf_vis = {NULL};
- amdlibVIS2 trf_vis2 = {NULL};
- amdlibVIS3 trf_vis3 = {NULL};
- amdlibINS_CFG trf_insCfg;
- amdlibSPECTRUM trf_spectrum={NULL};
-
- amdlibClearInsCfg(&science_insCfg);
-
- if (amdlibLoadOiFile(cpl_frame_get_filename(science_frame), &science_insCfg,
- &science_array, &science_target, &science_photometry, &science_vis,
- &science_vis2, &science_vis3, &science_wave, &science_opd,
- &science_spectrum, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load OI-FITS file '%s'",
- cpl_frame_get_filename(science_frame));
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
-
-
- amdlibClearInsCfg(&trf_insCfg);
-
- if (amdlibLoadOiFile(cpl_frame_get_filename(trf_frame), &trf_insCfg,
- &trf_array, &trf_target, &trf_photometry, &trf_vis, &trf_vis2,
- &trf_vis3, &trf_wave, &trf_opd,
- &trf_spectrum, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load OI-FITS file '%s'",
- cpl_frame_get_filename(trf_frame));
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
-
- /*Check if the wavelength agree or are shifted*/
- waveconsistency=1;
- if(trf_wave.nbWlen!=science_wave.nbWlen)
- {
- waveconsistency=0;
- }
-
- if(trf_wave.nbWlen==science_wave.nbWlen)
- {
- int i=0;
- for(i=0; i<trf_wave.nbWlen;i++)
- {
- if(trf_wave.wlen[i]!=science_wave.wlen[i])
- {
- waveconsistency=0;
- break;
- }
- }
- }
-
- if(!waveconsistency){
- cpl_msg_info(cpl_func,"Trying to find the wavelength values common "
- "to calibrator and science frame ...");
- get_common_channels(trf_wave, science_wave, &trf_lmin, &trf_lmax,
- &science_lmin, &science_lmax);
-
- pHeader = cpl_propertylist_load(cpl_frame_get_filename(science_frame), 0 );
- cpl_image_save(NULL,"_science_waveselected.fits", CPL_BPP_16_SIGNED,
- pHeader, CPL_IO_DEFAULT );
- cpl_propertylist_delete(pHeader);
-
- amdlibSaveOiFile_waveselected("_science_waveselected.fits", &science_insCfg, &science_array,
- &science_target, &science_photometry, &science_vis, &science_vis2,
- &science_vis3, &science_wave, &science_opd, &science_spectrum,
- errMsg,science_lmin,science_lmax);
-
-
- pHeader = cpl_propertylist_load(cpl_frame_get_filename(trf_frame), 0 );
- cpl_image_save(NULL,"_trf_waveselected.fits", CPL_BPP_16_SIGNED,
- pHeader, CPL_IO_DEFAULT );
- cpl_propertylist_delete(pHeader);
- amdlibSaveOiFile_waveselected("_trf_waveselected.fits", &trf_insCfg, &trf_array,
- &trf_target, &trf_photometry, &trf_vis, &trf_vis2,
- &trf_vis3, &trf_wave, &trf_opd, &trf_spectrum,
- errMsg,trf_lmin,trf_lmax);
- /*Free the memory*/
- amdlibReleaseOiArray(&science_array);
- amdlibReleaseOiTarget(&science_target);
- amdlibReleasePhotometry(&science_photometry);
- amdlibReleaseVis(&science_vis);
- amdlibReleaseVis2(&science_vis2);
- amdlibReleaseVis3(&science_vis3);
- amdlibReleaseWavelength(&science_wave);
- amdlibReleaseSpectrum(&science_spectrum);
- amdlibReleasePiston(&science_opd);
-
- amdlibReleaseOiArray(&trf_array);
- amdlibReleaseOiTarget(&trf_target);
- amdlibReleasePhotometry(&trf_photometry);
- amdlibReleaseVis(&trf_vis);
- amdlibReleaseVis2(&trf_vis2);
- amdlibReleaseVis3(&trf_vis3);
- amdlibReleaseWavelength(&trf_wave);
- amdlibReleaseSpectrum(&trf_spectrum);
- amdlibReleasePiston(&trf_opd);
-
-
- amdlibClearInsCfg(&science_insCfg);
-
- if (amdlibLoadOiFile("_science_waveselected.fits", &science_insCfg,
- &science_array, &science_target, &science_photometry, &science_vis,
- &science_vis2, &science_vis3, &science_wave, &science_opd,
- &science_spectrum, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load OI-FITS file _science_waveselected.fits");
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
-
-
- amdlibClearInsCfg(&trf_insCfg);
-
- if (amdlibLoadOiFile("_trf_waveselected.fits", &trf_insCfg,
- &trf_array, &trf_target, &trf_photometry, &trf_vis, &trf_vis2,
- &trf_vis3, &trf_wave, &trf_opd,
- &trf_spectrum, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load OI-FITS file _trf_waveselected.fits");
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
-
- }
- /*Check again if the wavelengths agree*/
- waveconsistency=1;
- if(trf_wave.nbWlen!=science_wave.nbWlen)
- {
- waveconsistency=0;
- }
-
- if(trf_wave.nbWlen==science_wave.nbWlen)
- {
- int i=0;
- for(i=0; i<trf_wave.nbWlen;i++)
- {
- if(trf_wave.wlen[i]!=science_wave.wlen[i])
- {
- waveconsistency=0;
- break;
- }
- }
- }
-
- if(waveconsistency==0)
- {
- /*Free the memory*/
- amdlibReleaseOiArray(&science_array);
- amdlibReleaseOiTarget(&science_target);
- amdlibReleasePhotometry(&science_photometry);
- amdlibReleaseVis(&science_vis);
- amdlibReleaseVis2(&science_vis2);
- amdlibReleaseVis3(&science_vis3);
- amdlibReleaseWavelength(&science_wave);
- amdlibReleaseSpectrum(&science_spectrum);
- amdlibReleasePiston(&science_opd);
-
- amdlibReleaseOiArray(&trf_array);
- amdlibReleaseOiTarget(&trf_target);
- amdlibReleasePhotometry(&trf_photometry);
- amdlibReleaseVis(&trf_vis);
- amdlibReleaseVis2(&trf_vis2);
- amdlibReleaseVis3(&trf_vis3);
- amdlibReleaseWavelength(&trf_wave);
- amdlibReleaseSpectrum(&trf_spectrum);
- amdlibReleasePiston(&trf_opd);
-
- cpl_msg_error(cpl_func, "Wavelength vector of science frame and "
- "transfer function frame differ!! Aborting the visibility "
- "calibration for this file!");
- return cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT,
- "Transfer function is not fully compatible with science frame!");
-
- }
- else
- {
- cpl_msg_info(cpl_func,"Wavelength vector of calibrator and science frame "
- "are (now) identical...");
- }
-
- trf_vis2_average_b1=cpl_vector_new(trf_wave.nbWlen);
- trf_vis2_average_error_b1=cpl_vector_new(trf_wave.nbWlen);
- trf_vis2_average_b2=cpl_vector_new(trf_wave.nbWlen);
- trf_vis2_average_error_b2=cpl_vector_new(trf_wave.nbWlen);
- trf_vis2_average_b3=cpl_vector_new(trf_wave.nbWlen);
- trf_vis2_average_error_b3=cpl_vector_new(trf_wave.nbWlen);
-
- trf_cpphi_average=cpl_vector_new(trf_wave.nbWlen);
- trf_cpphi_average_error=cpl_vector_new(trf_wave.nbWlen);
-
-
- cpl_vector_fill(trf_vis2_average_b1, 0.);
- cpl_vector_fill(trf_vis2_average_b2, 0.);
- cpl_vector_fill(trf_vis2_average_b3, 0.);
- cpl_vector_fill(trf_vis2_average_error_b1, 0.);
- cpl_vector_fill(trf_vis2_average_error_b2, 0.);
- cpl_vector_fill(trf_vis2_average_error_b3, 0.);
- cpl_vector_fill(trf_cpphi_average, 0.);
- cpl_vector_fill(trf_cpphi_average_error, 0.);
-
-
- /* Averaging the Transfer function for Visibility2 and its error*/
- for(iWave = 0; iWave <trf_wave.nbWlen; iWave++){
- dummy_vis2_b1=0.;
- dummy_vis2_error_b1=0.;
- dummy_vis2_counter_b1=0.;
-
- dummy_vis2_b2=0.;
- dummy_vis2_error_b2=0.;
- dummy_vis2_counter_b2=0.;
-
- dummy_vis2_b3=0.;
- dummy_vis2_error_b3=0.;
- dummy_vis2_counter_b3=0.;
-
- for(iFrame = 0; iFrame < (trf_vis.nbFrames * trf_vis.nbBases); iFrame++){
- /*Vis2*/
- if(trf_vis2.table[iFrame].flag[iWave]==amdlibFALSE){
- dummy_vis2_b1+=trf_vis2.table[iFrame].vis2[iWave];
- dummy_vis2_error_b1+=pow(trf_vis2.table[iFrame].vis2Error[iWave],2.);
- dummy_vis2_counter_b1++;
- }
- if(science_vis.nbBases>1){
- iFrame++;
- if(trf_vis2.table[iFrame].flag[iWave]==amdlibFALSE){
- dummy_vis2_b2+=trf_vis2.table[iFrame].vis2[iWave];
- dummy_vis2_error_b2+=pow(trf_vis2.table[iFrame].vis2Error[iWave],2.);
- dummy_vis2_counter_b2++;
- }
- iFrame++;
- if(trf_vis2.table[iFrame].flag[iWave]==amdlibFALSE){
- dummy_vis2_b3+=trf_vis2.table[iFrame].vis2[iWave];
- dummy_vis2_error_b3+=pow(trf_vis2.table[iFrame].vis2Error[iWave],2.);
- dummy_vis2_counter_b3++;
- }
- }
- }
- if(dummy_vis2_counter_b1>0 && dummy_vis2_counter_b2>0 &&
- dummy_vis2_counter_b3>0)
- {
- dummy_vis2_b1=dummy_vis2_b1/dummy_vis2_counter_b1;
- dummy_vis2_error_b1=sqrt(dummy_vis2_error_b1)/dummy_vis2_counter_b1;
- dummy_vis2_b2=dummy_vis2_b2/dummy_vis2_counter_b2;
- dummy_vis2_error_b2=sqrt(dummy_vis2_error_b2)/dummy_vis2_counter_b2;
- dummy_vis2_b3=dummy_vis2_b3/dummy_vis2_counter_b3;
- dummy_vis2_error_b3=sqrt(dummy_vis2_error_b3)/dummy_vis2_counter_b3;
-
- cpl_vector_set(trf_vis2_average_b1,iWave,dummy_vis2_b1);
- cpl_vector_set(trf_vis2_average_error_b1,iWave,dummy_vis2_error_b1);
- cpl_vector_set(trf_vis2_average_b2,iWave,dummy_vis2_b2);
- cpl_vector_set(trf_vis2_average_error_b2,iWave,dummy_vis2_error_b2);
- cpl_vector_set(trf_vis2_average_b3,iWave,dummy_vis2_b3);
- cpl_vector_set(trf_vis2_average_error_b3,iWave,dummy_vis2_error_b3);
- }
- }
-
- /* Averaging the closure phase and its error*/
- if(trf_vis.nbBases>1){
- for(iWave = 0; iWave <trf_wave.nbWlen; iWave++){
- dummy_cp_phi=0.;
- dummy_cp_phi_error=0.;
- dummy_cp_phi_counter=0;
- dummy_cp_phi_error_counter=0;
- for(iFrame = 0; iFrame < trf_vis.nbFrames; iFrame++){
-
- if (trf_vis3.table[iFrame].flag[iWave]==amdlibFALSE)
- {
- if(!amber_isnan(trf_vis3.table[iFrame].vis3Phi[iWave])){
- dummy_cp_phi+=
- trf_vis3.table[iFrame].vis3Phi[iWave];
- dummy_cp_phi_counter++;
- }
- if(!amber_isnan(trf_vis3.table[iFrame].vis3PhiError[iWave])){
- dummy_cp_phi_error+=
- pow(trf_vis3.table[iFrame].vis3PhiError[iWave],2.);
- dummy_cp_phi_error_counter++;
- }
- }
- }
- /*
- dummy_cp_phi=dummy_cp_phi/
- (dummy_cp_phi_counter)*(180. / M_PI);
- dummy_cp_phi_error=sqrt(dummy_cp_phi_error)/
- (dummy_cp_phi_error_counter)*(180. / M_PI);
- */
- if(dummy_cp_phi_counter>0)
- {
-
- dummy_cp_phi=dummy_cp_phi/
- (dummy_cp_phi_counter);
- dummy_cp_phi_error=sqrt(dummy_cp_phi_error)/
- (dummy_cp_phi_error_counter);
-
- cpl_vector_set(trf_cpphi_average,iWave,dummy_cp_phi);
- cpl_vector_set(trf_cpphi_average_error,iWave,dummy_cp_phi_error);
- }
- }
- }
- /*
- cpl_vector_dump(trf_cpphi_average, NULL);
- cpl_vector_dump(trf_cpphi_average_error, NULL);
- exit(0);
- */
-
- if(dummy_cp_phi_counter<1 || dummy_vis2_counter_b1<1 ||
- dummy_vis2_counter_b2<1 || dummy_vis2_counter_b3<1)
- {
-
- cpl_vector_delete(trf_vis2_average_b1);
- cpl_vector_delete(trf_vis2_average_b2);
- cpl_vector_delete(trf_vis2_average_b3);
- cpl_vector_delete(trf_vis2_average_error_b1);
- cpl_vector_delete(trf_vis2_average_error_b2);
- cpl_vector_delete(trf_vis2_average_error_b3);
- cpl_vector_delete(trf_cpphi_average);
- cpl_vector_delete(trf_cpphi_average_error);
-
- cpl_msg_error(cpl_func, "No good visibilitiy values found!! "
- "Aborting visibility calibration for this file!");
- return cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT,
- "Averaged transfer function can not be computed!");
-
- }
- /* Calibrate Visibility2 and propagate the error*/
-
- cpl_msg_info(cpl_func,"Calibrating visibilities squared and propagating "
- "the errors ...");
-
- for(iFrame = 0; iFrame < (science_vis.nbFrames * science_vis.nbBases); iFrame++){
- for(iWave = 0; iWave <science_wave.nbWlen; iWave++){
- /*Vis2*/
- science_vis2.table[iFrame].vis2[iWave] =
- science_vis2.table[iFrame].vis2[iWave]/
- cpl_vector_get(trf_vis2_average_b1,iWave);
- /*Vis2 Error propagation*/
-
- science_vis2.table[iFrame].vis2Error[iWave] =
- science_vis2.table[iFrame].vis2[iWave]*
- sqrt(
- (cpl_vector_get(trf_vis2_average_error_b1, iWave) *
- cpl_vector_get(trf_vis2_average_error_b1, iWave))
- /
- (cpl_vector_get(trf_vis2_average_b1, iWave) *
- cpl_vector_get(trf_vis2_average_b1, iWave))
- +
- ((science_vis2.table[iFrame].vis2Error[iWave]) *
- (science_vis2.table[iFrame].vis2Error[iWave]))
- /
- ((science_vis2.table[iFrame].vis2[iWave]) *
- (science_vis2.table[iFrame].vis2[iWave]))
- );
- }
- if(science_vis.nbBases>1){
- iFrame++;
- for(iWave = 0; iWave <science_wave.nbWlen; iWave++){
- /*Vis2*/
- science_vis2.table[iFrame].vis2[iWave] =
- science_vis2.table[iFrame].vis2[iWave]/
- cpl_vector_get(trf_vis2_average_b2,iWave);
- /*Vis2 Error propagation*/
- science_vis2.table[iFrame].vis2Error[iWave] =
- science_vis2.table[iFrame].vis2[iWave]*
- sqrt(
- (cpl_vector_get(trf_vis2_average_error_b2, iWave) *
- cpl_vector_get(trf_vis2_average_error_b2, iWave))
- /
- (cpl_vector_get(trf_vis2_average_b2, iWave) *
- cpl_vector_get(trf_vis2_average_b2, iWave))
- +
- ((science_vis2.table[iFrame].vis2Error[iWave]) *
- (science_vis2.table[iFrame].vis2Error[iWave]))
- /
- ((science_vis2.table[iFrame].vis2[iWave]) *
- (science_vis2.table[iFrame].vis2[iWave]))
- );
- }
- iFrame++;
- for(iWave = 0; iWave <science_wave.nbWlen; iWave++){
- /*Vis2*/
- science_vis2.table[iFrame].vis2[iWave] =
- science_vis2.table[iFrame].vis2[iWave]/
- cpl_vector_get(trf_vis2_average_b3,iWave);
- /*Vis2 Error propagation*/
- science_vis2.table[iFrame].vis2Error[iWave] =
- science_vis2.table[iFrame].vis2[iWave]*
- sqrt(
- (cpl_vector_get(trf_vis2_average_error_b3, iWave) *
- cpl_vector_get(trf_vis2_average_error_b3, iWave))
- /
- (cpl_vector_get(trf_vis2_average_b3, iWave) *
- cpl_vector_get(trf_vis2_average_b3, iWave))
- +
- ((science_vis2.table[iFrame].vis2Error[iWave]) *
- (science_vis2.table[iFrame].vis2Error[iWave]))
- /
- ((science_vis2.table[iFrame].vis2[iWave]) *
- (science_vis2.table[iFrame].vis2[iWave]))
- );
- }
- }
- }
-
- /* Calibrating the closure phase and propagate the error*/
- if(science_vis.nbBases>1){
- cpl_msg_info(cpl_func,"Calibrating closure phase and propagate "
- "the errors ...");
- /*closure phase*/
- for(iFrame = 0; iFrame < science_vis.nbFrames; iFrame++){
- for(iWave = 0; iWave <science_wave.nbWlen; iWave++){
-
- science_vis3.table[iFrame].vis3Phi[iWave]=
- science_vis3.table[iFrame].vis3Phi[iWave]-
- cpl_vector_get(trf_cpphi_average, iWave);
- /*closure phase error*/
- science_vis3.table[iFrame].vis3PhiError[iWave]=sqrt(
- science_vis3.table[iFrame].vis3PhiError[iWave]*
- science_vis3.table[iFrame].vis3PhiError[iWave] +
- cpl_vector_get(trf_cpphi_average_error, iWave)*
- cpl_vector_get(trf_cpphi_average_error, iWave));
-
- }
- }
-
-
- }
-
-
- pHeader = cpl_propertylist_load(cpl_frame_get_filename(science_frame), 0 );
- qclist=cpl_propertylist_new();
- cpl_propertylist_update_string(qclist, CPL_DFS_PRO_CATG,
- "SCIENCE_CALIBRATED");
- cpl_propertylist_update_string(qclist, CPL_DFS_PRO_TECH,
- "INTERFEROMETRY");
- cpl_propertylist_update_bool(qclist, CPL_DFS_PRO_SCIENCE,
- TRUE);
-
-
- cpl_propertylist_copy_property_regexp(qclist, pHeader, "^ESO QC", 0);
- amber_qc(&science_wave, &science_vis, &science_vis2, &science_vis3, NULL,
- qclist, "cal");
-
-
- outname_calibrated = cpl_sprintf("cal_%s",
- basename((char *)cpl_frame_get_filename(science_frame)));
- cpl_msg_info(cpl_func,"Calibrated Frame :"
- " %s",outname_calibrated);
-
-
- /*Adding the JMMC acknowledgements*/
- amber_JMMC_acknowledgement(qclist);
-
-
- cpl_dfs_save_propertylist(frameset,
- pHeader,
- parlist,
- frameset,
- science_frame,
- recipename,
- qclist,
- NULL,
- PACKAGE "/" PACKAGE_VERSION,
- outname_calibrated);
-
- amdlibSaveOiFile(outname_calibrated, &science_insCfg, &science_array,
- &science_target, &science_photometry, &science_vis, &science_vis2,
- &science_vis3, &science_wave, &science_opd, &science_spectrum,
- errMsg);
-
- /*
- amdlibSaveOiFile_waveselected(outname_calibrated, &science_insCfg, &science_array,
- &science_target, &science_photometry, &science_vis, &science_vis2,
- &science_vis3, &science_wave, &science_opd, &science_spectrum,
- errMsg,2,3);
- */
-
- /*... In order to create a complete paf file :-( */
- amber_qc(&science_wave, &science_vis, &science_vis2, &science_vis3, NULL,
- pHeader, "cal");
-
- outname_calibrated_paf=cpl_sprintf("qc_cal_%s.paf",
- basename(cpl_frame_get_filename(science_frame)));
-
- if (cpl_propertylist_has(pHeader, "ESO QC ARC") == 1)
- {
- cpl_propertylist_append_string(pHeader,"ARCFILE",
- (cpl_propertylist_get_string(pHeader, "ESO QC ARC")));
- //cpl_dfs_save_paf("AMBER", recipename, pHeader, outname_calibrated_paf);
- cpl_propertylist_erase(pHeader,"ARCFILE");
- }
- cpl_free((void *)outname_calibrated_paf);
-
-
-
-
-
- /*Free the memory*/
- amdlibReleaseOiArray(&science_array);
- amdlibReleaseOiTarget(&science_target);
- amdlibReleasePhotometry(&science_photometry);
- amdlibReleaseVis(&science_vis);
- amdlibReleaseVis2(&science_vis2);
- amdlibReleaseVis3(&science_vis3);
- amdlibReleaseWavelength(&science_wave);
- amdlibReleaseSpectrum(&science_spectrum);
- amdlibReleasePiston(&science_opd);
-
- amdlibReleaseOiArray(&trf_array);
- amdlibReleaseOiTarget(&trf_target);
- amdlibReleasePhotometry(&trf_photometry);
- amdlibReleaseVis(&trf_vis);
- amdlibReleaseVis2(&trf_vis2);
- amdlibReleaseVis3(&trf_vis3);
- amdlibReleaseWavelength(&trf_wave);
- amdlibReleaseSpectrum(&trf_spectrum);
- amdlibReleasePiston(&trf_opd);
-
- cpl_vector_delete(trf_vis2_average_b1);
- cpl_vector_delete(trf_vis2_average_error_b1);
- cpl_vector_delete(trf_vis2_average_b2);
- cpl_vector_delete(trf_vis2_average_error_b2);
- cpl_vector_delete(trf_vis2_average_b3);
- cpl_vector_delete(trf_vis2_average_error_b3);
- cpl_vector_delete(trf_cpphi_average);
- cpl_vector_delete(trf_cpphi_average_error);
-
- cpl_free(outname_calibrated);
- cpl_propertylist_delete(pHeader);
- cpl_propertylist_delete(qclist);
- /* Propagate error, if any */
- return cpl_error_set(cpl_func, cpl_error_get_code());
-
-}
-static cpl_error_code amber_check_consitency_trf_science(
- cpl_frame *science_frame, cpl_frame * trf_frame)
-{
- cpl_propertylist * trf_header=NULL;
- cpl_propertylist * science_header=NULL;
-
- trf_header = cpl_propertylist_load(cpl_frame_get_filename(trf_frame), 0);
- science_header = cpl_propertylist_load(
- cpl_frame_get_filename(science_frame), 0);
-
- if(trf_header==NULL || science_header==NULL)
-
- {
- cpl_msg_error(cpl_func,"Transfer function file or science "
- "file missing!");
- cpl_error_set_message(cpl_func, CPL_ERROR_FILE_NOT_FOUND,
- "Transfer function file or science file missing!");
- return cpl_error_set(cpl_func, cpl_error_get_code());
- }
-
- if(strcmp(cpl_propertylist_get_string(science_header, "ESO INS MODE"),
- cpl_propertylist_get_string(trf_header, "ESO INS MODE")))
- {
- cpl_propertylist_delete(science_header);
- cpl_propertylist_delete(trf_header);
-
- cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT,
- "Transfer function is of wrong instrument mode!");
- return cpl_error_set(cpl_func, cpl_error_get_code());
- }
- cpl_propertylist_delete(science_header);
- cpl_propertylist_delete(trf_header);
-
- /* Propagate error, if any */
- return cpl_error_set(cpl_func, cpl_error_get_code());
-
-
-
-
-}
-static cpl_error_code get_common_channels(amdlibWAVELENGTH trf_wlen,
- amdlibWAVELENGTH science_wlen, int * trf_lmin, int * trf_lmax,
- int * science_lmin, int * science_lmax)
-{
-
- int science_nbWlen=0;
- int trf_nbWlen=0;
- int i=0;
- int trf_min_index=INT_MAX;
- int science_min_index=INT_MAX;
- int trf_max_index=0.;
- int science_max_index=0.;
-
- double use_max_value=0.;
- double use_min_value=FLT_MAX;
-
- science_nbWlen=science_wlen.nbWlen;
- trf_nbWlen=trf_wlen.nbWlen;
-
- if(trf_nbWlen>1 && trf_wlen.wlen[0]<trf_wlen.wlen[1]){
- /*ascending vector*/
- use_min_value = (trf_wlen.wlen[0] >= science_wlen.wlen[0]) ?
- trf_wlen.wlen[0] : science_wlen.wlen[0];
-
- use_max_value =
- (trf_wlen.wlen[trf_nbWlen-1] >= science_wlen.wlen[science_nbWlen-1])
- ? science_wlen.wlen[science_nbWlen-1] : trf_wlen.wlen[trf_nbWlen-1];
- }
- else{
- /*descending vector*/
- use_min_value = (trf_wlen.wlen[0] <= science_wlen.wlen[0]) ?
- trf_wlen.wlen[0] : science_wlen.wlen[0];
-
- use_max_value =
- (trf_wlen.wlen[trf_nbWlen-1] <= science_wlen.wlen[science_nbWlen-1])
- ? science_wlen.wlen[science_nbWlen-1] : trf_wlen.wlen[trf_nbWlen-1];
- }
-
-
- cpl_msg_info(cpl_func,"use_min:%g use_max: %g",use_min_value,use_max_value);
-
-
-
- if(trf_nbWlen>1 && trf_wlen.wlen[0]<trf_wlen.wlen[1]){
- /*ascending vector*/
- cpl_msg_info(cpl_func,"ascending wave-vector found");
- for (i=0; i<trf_nbWlen; i++)
- {
- if(trf_wlen.wlen[i]<=use_min_value)
- {
- trf_min_index=i;
- }
- if(trf_wlen.wlen[i]<=use_max_value)
- {
- trf_max_index=i;
- }
- }
-
- for (i=0; i<science_nbWlen; i++)
- {
- /*cpl_msg_info(cpl_func,"ARMIN1:%g",science_wlen.wlen[i]);*/
- if(science_wlen.wlen[i]<=use_min_value)
- {
- science_min_index=i;
- }
- if(science_wlen.wlen[i]<=use_max_value)
- {
- science_max_index=i;
- }
- }
- }
- else
- {
- /*descending vector*/
- cpl_msg_info(cpl_func,"descending wave-vector found" );
- for (i=0; i<trf_nbWlen; i++)
- {
- if(trf_wlen.wlen[i]>=use_min_value)
- {
- trf_min_index=i;
- }
- if(trf_wlen.wlen[i]>=use_max_value)
- {
- trf_max_index=i;
- }
- }
- for (i=0; i<science_nbWlen; i++)
- {
- /*cpl_msg_info(cpl_func,"ARMIN1:%g",science_wlen.wlen[i]);*/
- if(science_wlen.wlen[i]>=use_min_value)
- {
- science_min_index=i;
- }
- if(science_wlen.wlen[i]>=use_max_value)
- {
- science_max_index=i;
- }
- }
- }
-
- cpl_msg_info(cpl_func,"trf_min_index:%d trf_max_index: %d",
- trf_min_index,trf_max_index);
- cpl_msg_info(cpl_func,"science_min_index:%d science_max_index: %d",
- science_min_index,science_max_index);
-
- cpl_msg_info(cpl_func,"trf_min_value:%.6g trf_max_value: %.6g",
- trf_wlen.wlen[trf_min_index],
- trf_wlen.wlen[trf_max_index]);
- cpl_msg_info(cpl_func,"science_min_value:%.6g science_max_value: %.6g",
- science_wlen.wlen[science_min_index],
- science_wlen.wlen[science_max_index]);
-
-
- *science_lmin = science_min_index;
- *trf_lmin = trf_min_index;
-
-
- *science_lmax = (science_nbWlen-science_max_index-1);
- *trf_lmax = (trf_nbWlen-trf_max_index-1);
-
- cpl_msg_info(cpl_func,"science_lmin: %d science_lmax: %d",
- *science_lmin, *science_lmax);
- cpl_msg_info(cpl_func,"trf_lmin: %d trf_lmax: %d",
- *trf_lmin, *trf_lmax);
-
-
-
- /* Propagate error, if any */
- return cpl_error_set(cpl_func, cpl_error_get_code());
-
-}
-/*----------------------------------------------------------------------------*/
-/**
- @brief portable isnan
- */
-/*----------------------------------------------------------------------------*/
-int amber_isnan(double value)
-{
-#if defined HAVE_ISNAN && HAVE_ISNAN
- return isnan(value);
-#else
- return value != value;
-#endif
-}
-
-
diff --git a/amber/esolibCalibVis.h b/amber/esolibCalibVis.h
deleted file mode 100644
index f67be80..0000000
--- a/amber/esolibCalibVis.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * esolibCalibVis.h
- *
- * Created on: Oct 26, 2009
- * Author: agabasch
- */
-
-#ifndef ESOLIBCALIBVIS_H_
-#define ESOLIBCALIBVIS_H_
-
-#include "cpl.h"
-
-/*-----------------------------------------------------------------------------
- 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
-
-
-int amber_isnan(double value);
-
-
-cpl_error_code amber_CalibVis(const char * recipename,
- const char * outname, cpl_parameterlist *parlist,
- cpl_frameset * frameset);
-
-
-#endif /* ESOLIBCALIBVIS_H_ */
diff --git a/amber/esolibSelector.c b/amber/esolibSelector.c
deleted file mode 100644
index 591c2a8..0000000
--- a/amber/esolibSelector.c
+++ /dev/null
@@ -1,3586 +0,0 @@
-/*
- * esolibSelector.c
- *
- * Created on: Sep 25, 2009
- * Author: agabasch
- */
-
-
-/* AMDLIB usage switch */
-#define USE_AMDLIB YES
-//#define amdlibPRECISION 1E-6
-/*-----------------------------------------------------------------------------
- Includes
- -----------------------------------------------------------------------------*/
-#include "esolibSelector.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <math.h>
-#include <cpl.h>
-#include "amdrs.h"
-#include "amber_dfs.h"
-#include "amber_qc.h"
-
-/* AMBER structures */
-amdlibINS_CFG insCfg;
-amdlibOI_ARRAY array;
-amdlibOI_TARGET target;
-amdlibPHOTOMETRY photometry;
-amdlibVIS vis;
-amdlibVIS2 vis2;
-amdlibVIS3 vis3;
-amdlibWAVELENGTH wave;
-amdlibPISTON pst;
-amdlibSPECTRUM spectrum;
-amdlibERROR_MSG errMsg;
-
-double *tmpArray[amdlibNBASELINE];
-double threshold[amdlibNBASELINE];
-
-/* CPL data */
-cpl_frame * pFrame=NULL;
-cpl_propertylist * pHeader;
-
-cpl_parameterlist * gparlist;
-cpl_frameset * gframelist;
-
-FILE * pFITSFile;
-
-const char * selMethod1 = "First_x_Frames";
-const char * selMethod2 = "Fringe_SNR_gt_x";
-const char * selMethod3 = "Fringe_SNR_percentage_x";
-const char * selMethod4 = "Flux_gt_x";
-const char * selMethod5 = "Flux_percentage_x";
-const char * selMethod6 = "Exclude_Frames_by_ASCII_File";
-const char * selMethod7 = "Include_Frames_by_ASCII_File";
-const char * selMethod8 = "IO-Test_no_filtering";
-const char * selMethod9 = "Absolute_piston_value_lt_x";
-const char * selMethod10= "Absolute_piston_value_percentage_x";
-
-/* const char * selMethod1 = "First_x_Frames"; */
-/* const char * selMethod2 = "Fringe_SNR_gt_x"; */
-/* const char * selMethod3 = "Fringe_SNR_percentage_x"; */
-/* const char * selMethod4 = "Flux_gt_x"; */
-/* const char * selMethod5 = "Flux_percentage_x"; */
-/* const char * selMethod6 = "Exclude_Frames_by_ASCII_File"; */
-/* const char * selMethod7 = "Include_Frames_by_ASCII_File"; */
-/* const char * selMethod8 = "IO-Test_no_filtering"; */
-
-
-/*-----------------------------------------------------------------------------
- Functions prototypes
- -----------------------------------------------------------------------------*/
-
-
-static amdlibCOMPL_STAT amdlibWriteOiArray(fitsfile *filePtr,
- amdlibOI_ARRAY *array,
- amdlibERROR_MSG errMsg);
-
-
-static amdlibCOMPL_STAT amdlibWriteOiTarget(fitsfile *filePtr,
- amdlibOI_TARGET *target,
- amdlibERROR_MSG errMsg);
-
-static amdlibCOMPL_STAT amdlibWriteOiWavelength(fitsfile *filePtr,
- char *insName,
- amdlibWAVELENGTH *wave,
- amdlibERROR_MSG errMsg);
-
-static amdlibCOMPL_STAT amdlibWriteOiVisSelectedOnly( fitsfile *filePtr,
- char *insName,
- char *arrName,
- amdlibVIS *vis,
- amdlibSELECTION *selectedFrames,
- amdlibBAND band,
- amdlibERROR_MSG errMsg);
-
-static amdlibCOMPL_STAT amdlibWriteOiVis2SelectedOnly( fitsfile *filePtr,
- char *insName,
- char *arrName,
- amdlibVIS2 *vis2,
- amdlibSELECTION *selectedFrames,
- amdlibBAND band,
- amdlibERROR_MSG errMsg );
-
-static amdlibCOMPL_STAT amdlibWriteOiVis3SelectedOnly( fitsfile *filePtr,
- char *insName,
- char *arrName,
- amdlibVIS3 *vis3,
- amdlibSELECTION *selectedFrames,
- amdlibBAND band,
- amdlibERROR_MSG errMsg );
-
-static amdlibCOMPL_STAT amdlibWriteAmberDataSelectedOnly( fitsfile *filePtr,
- char *insName,
- amdlibPHOTOMETRY *photometry,
- amdlibVIS *vis,
- amdlibPISTON *pst,
- amdlibWAVELENGTH *wave,
- amdlibSELECTION *selectedFrames,
- amdlibBAND bandfct,
- amdlibERROR_MSG errMsg );
-
-static amdlibCOMPL_STAT amdlibSaveOiFileESO( const char *filename,
- /* amdlibINS_CFG *insCfg,*/
- amdlibSELECTION *selectedFrames,
- amdlibOI_ARRAY *array,
- amdlibOI_TARGET *target,
- amdlibPHOTOMETRY *photometry,
- amdlibVIS *vis,
- amdlibVIS2 *vis2,
- amdlibVIS3 *vis3,
- amdlibWAVELENGTH *wave,
- amdlibPISTON *pst,
- amdlibBAND band,
- amdlibSPECTRUM *spectrum,
- amdlibERROR_MSG errMsg );
-
-static amdlibCOMPL_STAT amdlibGetThresholdESO(double *array,
- int arraySize,
- double frameSelectionRatio,
- double *threshold,
- amdlibERROR_MSG errMsg);
-
-static cpl_propertylist * SelectorCreateProduct( const char * fctid, char * szRawFile,
- int iIsScience, char * szProductFile, cpl_propertylist * qclist,
- cpl_frameset * framelist, cpl_parameterlist * parlist,
- const char * recipename);
-
-static void SetupSelected( int iInclude, amdlibSELECTION * selectedFrames,
- amdlibVIS * vis, amdlibBAND band);
-
-
-/*-----------------------------------------------------------------------------
- Static variables
- -----------------------------------------------------------------------------*/
-/*-----------------------------------------------------------------------------
- Functions code
- -----------------------------------------------------------------------------*/
-
-/* FIXME: Cast string literal in fits_create_tbl(), ... to avoid compiler warnings
- - and pray that CFITSIO does not try to modify them :-(((( */
-
-
-#define amdlib_OI_REVISION 1 /*Current revision number*/
-#define amdlibNM_TO_M 1e-9 /* conversion nanometers to meters */
-
-/** Usefull macro to error when reading/writing IO6FITS file */
-#define amdlibOiReturnError(routine,msg) \
- fits_get_errstatus(status, (char*)fitsioMsg); \
- /* amdlibERROR("%s(): %s - %s\n", routine, msg, fitsioMsg); */ \
- sprintf(errMsg, "%s(): %s - %s", routine, msg, fitsioMsg); \
- return (amdlibFAILURE)
-
-
-
-
-
-
-/**
- * Computes the selection threshold, ie the minimal possible value for frame
- * selection criterion so as to a frame should be selected.
- *
- * @param array input data
- * @param arraySize size of array.
- * @param frameSelectionRatio percentage of good frames to keep.
- * @param threshold output threshold.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-static amdlibCOMPL_STAT amdlibGetThresholdESO(double *array,
- int arraySize,
- double frameSelectionRatio,
- double *threshold,
- amdlibERROR_MSG errMsg)
-{
- int i, j;
- double val;
- int index;
- amdlibBOOLEAN isSorted;
- double * phantomArray;
-
- phantomArray = cpl_calloc(arraySize, sizeof(double));
- memcpy(phantomArray, array, arraySize*sizeof(double));
- /* Protected Bubble sort, leaves array invariant! */
- isSorted = amdlibFALSE;
- i = 0;
- while ((i < arraySize) && (isSorted == amdlibFALSE))
- {
- /* Assume array is already sorted */
- isSorted = amdlibTRUE;
- for (j = 1; j < arraySize - i; j++)
- {
- if (phantomArray[j] < phantomArray[j-1])
- {
- /* Invert both values */
- val = phantomArray[j-1];
- phantomArray[j-1] = phantomArray[j];
- phantomArray[j] = val;
-
- /* phantomArray is not sorted yet */
- isSorted = amdlibFALSE;
- }
- }
- i++;
- }
-
- /* Find threshold */
- index = floor((1.0-frameSelectionRatio)*arraySize);
- *threshold = phantomArray[index];
- cpl_free(phantomArray);
-
- if (isnan(*threshold))
- {
- amdlibSetErrMsg("Impossible to determine threshold; probably "
- "due to poor data quality");
- return amdlibFAILURE;
- }
-
- return amdlibSUCCESS;
-}
-
-/**
- * Write OI_ARRAY table in OI-FITS file
- *
- * This function writes the OI_ARRAY binary table defined in the IAU standard
- * in the OI-FITS file given as parameter.
- *
- * @param filePtr pointer on the file to be created
- * @param array OI_ARRAY produced
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibWriteOiArray(fitsfile *filePtr,
- amdlibOI_ARRAY *array,
- amdlibERROR_MSG errMsg)
-{
- const int tfields = 5;
- char *ttype[] = {"TEL_NAME", "STA_NAME", "STA_INDEX", "DIAMETER",
- "STAXYZ"};
- char *tform[] = {"8A", "8A", "I", "E", "3D"};
- char *tunit[] = {"\0", "\0", "\0", "m", "m"};
- char extname[] = "OI_ARRAY";
- int status = 0;
- int iRow;
- char fitsioMsg[256];
- int revision = amdlib_OI_REVISION;
- char *str;
-
- amdlibLogTrace("amdlibWriteOiArray()");
-
- /* Algorithm */
-
- /* Create binary table */
- if (fits_create_tbl(filePtr, BINARY_TBL, 1, tfields, ttype, tform, tunit,
- extname, &status))
- {
- amdlibReturnFitsError("Creating Binary Table");
- }
-
- /* Write revision number */
- if (fits_write_key(filePtr, TINT, "OI_REVN", &revision,
- "Revision number of the table definition", &status))
- {
- amdlibReturnFitsError("OI_REVN");
- }
-
- /* Write array name */
- if (fits_write_key(filePtr, TSTRING, "ARRNAME", array->arrayName,
- "Array name", &status))
- {
- amdlibReturnFitsError("ARRNAME");
- }
-
- /* Write coordinate frame */
- if (fits_write_key(filePtr, TSTRING, "FRAME", array->coordinateFrame,
- "Coordinate frame", &status))
- {
- amdlibReturnFitsError("FRAME");
- }
-
- /* Write array center x coordinate */
- if (fits_write_key(filePtr, TDOUBLE, "ARRAYX",
- &array->arrayCenterCoordinates[0],
- "Array centre x coordinate", &status))
- {
- amdlibReturnFitsError("ARRAYX");
- }
-
- if (fits_write_key_unit(filePtr, "ARRAYX", "m", &status))
- {
- amdlibReturnFitsError("ARRAYX");
- }
-
- /* Write array center y coordinate */
- if (fits_write_key(filePtr, TDOUBLE, "ARRAYY",
- &array->arrayCenterCoordinates[1],
- "Array centre y coordinate", &status))
- {
- amdlibReturnFitsError("ARRAYY");
- }
-
- if (fits_write_key_unit(filePtr, "ARRAYY", "m", &status))
- {
- amdlibReturnFitsError("ARRAYY");
- }
-
- /* Write array center z coordinate */
- if (fits_write_key(filePtr, TDOUBLE, "ARRAYZ",
- &array->arrayCenterCoordinates[2],
- "Array centre z coordinate", &status))
- {
- amdlibReturnFitsError("ARRAYZ");
- }
-
- if (fits_write_key_unit(filePtr, "ARRAYZ", "m", &status))
- {
- amdlibReturnFitsError("ARRAYZ");
- }
-
- /* Write information on instrument */
- for (iRow = 1; iRow <= array->nbStations; iRow++)
- {
- str = array->element[iRow-1].telescopeName;
- if (fits_write_col(filePtr, TSTRING, 1, iRow, 1, 1, &str, &status))
- {
- amdlibReturnFitsError("telescopeName");
- }
- str = array->element[iRow-1].stationName;
- if (fits_write_col(filePtr, TSTRING, 2, iRow, 1, 1, &str, &status))
- {
- amdlibReturnFitsError("stationName");
- }
- if (fits_write_col(filePtr, TINT, 3, iRow, 1, 1,
- &array->element[iRow-1].stationIndex, &status))
- {
- amdlibReturnFitsError("stationIndex");
- }
- if (fits_write_col(filePtr, TDOUBLE, 4, iRow, 1, 1,
- &array->element[iRow-1].elementDiameter, &status))
- {
- amdlibReturnFitsError("diameter");
- }
- if (fits_write_col(filePtr, TDOUBLE, 5, iRow, 1, 3,
- array->element[iRow-1].stationCoordinates, &status))
- {
- amdlibReturnFitsError("staXYZ");
- }
- }
- return amdlibSUCCESS;
-}
-
-/**
- * Write OI_TARGET table in OI-FITS file.
- *
- * This function writes the OI_TARGET binary table defined in the IAU standard
- * in the OI-FITS file given as parameter.
- *
- * @param filePtr pointer on the file to be created.
- * @param target OI_TARGET produced.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibWriteOiTarget(fitsfile *filePtr,
- amdlibOI_TARGET *target,
- amdlibERROR_MSG errMsg)
-{
- const int tfields = 17;
- char *ttype[] = {"TARGET_ID", "TARGET", "RAEP0", "DECEP0", "EQUINOX",
- "RA_ERR", "DEC_ERR", "SYSVEL", "VELTYP", "VELDEF", "PMRA", "PMDEC",
- "PMRA_ERR", "PMDEC_ERR", "PARALLAX", "PARA_ERR", "SPECTYP"};
- char *tform[] = {"I", "16A", "D", "D", "E", "D", "D", "D", "8A",
- "8A", "D", "D", "D", "D", "E", "E", "16A"};
- char *tunit[] = {"\0", "\0", "deg", "deg", "year", "deg", "deg",
- "m/s", "\0", "\0", "deg/year", "deg/year", "deg/year", "deg/year",
- "deg", "deg", "\0"};
- char extname[] = "OI_TARGET";
- char fitsioMsg[256];
- int status = 0;
- int revision = amdlib_OI_REVISION;
- int iRow;
- char *str;
-
- amdlibLogTrace("amdlibWriteOiTarget()");
-
- /* Create binary table */
- if (fits_create_tbl(filePtr, BINARY_TBL, 1, tfields, ttype, tform, tunit,
- extname, &status))
- {
- amdlibReturnFitsError("Creating Binary Table");
- }
-
- /* Write revision number of the table definition */
- if (fits_write_key(filePtr, TINT, "OI_REVN", &revision,
- "Revision number of the table definition", &status))
- {
- amdlibReturnFitsError("OI_REVN");
- }
-
- for (iRow = 1; iRow <= target->nbTargets; iRow++)
- {
- /* Write target identity */
- if (fits_write_col(filePtr, TINT, 1, iRow, 1, 1,
- &target->element[iRow-1].targetId, &status))
- {
- amdlibReturnFitsError("targetId");
- }
-
- str = target->element[iRow-1].targetName;
-
- /* Write target name */
- if (fits_write_col(filePtr, TSTRING, 2, iRow, 1, 1, &str, &status))
- {
- amdlibReturnFitsError("targetName");
- }
-
- /* Write right ascension at mean equinox */
- if (fits_write_col(filePtr, TDOUBLE, 3, iRow, 1, 1,
- &target->element[iRow-1].raEp0, &status))
- {
- amdlibReturnFitsError("raEp0");
- }
- /* Write declinaison at mean equinox */
- if (fits_write_col(filePtr, TDOUBLE, 4, iRow, 1, 1,
- &target->element[iRow-1].decEp0, &status))
- {
- amdlibReturnFitsError("decEp0");
- }
- /* Write equinox of raEp0 and decEp0 */
- if (fits_write_col(filePtr, TDOUBLE, 5, iRow, 1, 1,
- &target->element[iRow-1].equinox, &status))
- {
- amdlibReturnFitsError("equinox");
- }
- /* Write error in apparent RA */
- if (fits_write_col(filePtr, TDOUBLE, 6, iRow, 1, 1,
- &target->element[iRow-1].raErr, &status))
- {
- amdlibReturnFitsError("raErr");
- }
- /* Write error in apparent DEC */
- if (fits_write_col(filePtr, TDOUBLE, 7, iRow, 1, 1,
- &target->element[iRow-1].decErr, &status))
- {
- amdlibReturnFitsError("decErr");
- }
- /* Write systemic radial velocity */
- if (fits_write_col(filePtr, TDOUBLE, 8, iRow, 1, 1,
- &target->element[iRow-1].sysVel, &status))
- {
- amdlibReturnFitsError("sysVel");
- }
-
- str = target->element[iRow-1].velTyp;
- /* Write velocity type of sysVel */
- if (fits_write_col(filePtr, TSTRING, 9, iRow, 1, 1, &str, &status))
- {
- amdlibReturnFitsError("velTyp");
- }
-
- str = target->element[iRow-1].velDef;
- /* Write definition of radial velocity : "OPTICAL" or "RADIO" */
- if (fits_write_col(filePtr, TSTRING, 10, iRow, 1, 1, &str, &status))
- {
- amdlibReturnFitsError("velDef");
- }
-
- /* Write proper motion in RA */
- if (fits_write_col(filePtr, TDOUBLE, 11, iRow, 1, 1,
- &target->element[iRow-1].pmRa, &status))
- {
- amdlibReturnFitsError("pmRa");
- }
- /* Write proper motion in DEC */
- if (fits_write_col(filePtr, TDOUBLE, 12, iRow, 1, 1,
- &target->element[iRow-1].pmDec, &status))
- {
- amdlibReturnFitsError("pmDec");
- }
- /* Write error on pmRa */
- if (fits_write_col(filePtr, TDOUBLE, 13, iRow, 1, 1,
- &target->element[iRow-1].pmRaErr, &status))
- {
- amdlibReturnFitsError("pmRaErr");
- }
- /* Write error on pmDec */
- if (fits_write_col(filePtr, TDOUBLE, 14, iRow, 1, 1,
- &target->element[iRow-1].pmDecErr, &status))
- {
- amdlibReturnFitsError("pmDecErr");
- }
- /* Write parallax value */
- if (fits_write_col(filePtr, TDOUBLE, 15, iRow, 1, 1,
- &target->element[iRow-1].parallax, &status))
- {
- amdlibReturnFitsError("parallax");
- }
- /* Write error in parallax value */
- if (fits_write_col(filePtr, TDOUBLE, 16, iRow, 1, 1,
- &target->element[iRow-1].paraErr, &status))
- {
- amdlibReturnFitsError("paraErr");
- }
- /* Write spectral type */
- str = target->element[iRow-1].specTyp;
- if (fits_write_col(filePtr, TSTRING, 17, iRow, 1, 1, &str, &status))
- {
- amdlibReturnFitsError("specTyp");
- }
- }
- return amdlibSUCCESS;
-}
-
-
-/**
- * Write OI_WAVELENGTH table in OI-FITS file.
- *
- * This function writes the OI_WAVELENGTH binary table defined in the IAU
- * standard in the OI-FITS file given as parameter.
- *
- * @param filePtr pointer on the file to be created.
- * @param insName name of the instrument.
- * @param wave OI_WAVELENGTH produced.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibWriteOiWavelength(fitsfile *filePtr,
- char *insName,
- amdlibWAVELENGTH *wave,
- amdlibERROR_MSG errMsg)
-{
- int status = 0;
- char fitsioMsg[256];
- const int tfields = 2;
- char *ttype[] = {"EFF_WAVE", "EFF_BAND"};
- char *tform[] = {"E", "E"};
- char *tunit[] = {"m", "m"};
- char extname[] = "OI_WAVELENGTH";
- int revision = amdlib_OI_REVISION;
- int i;
- amdlibDOUBLE waveInM, bwInM;
-
- amdlibLogTrace("amdlibWriteOiWavelength()");
-
- /* Create binary table */
- if (fits_create_tbl (filePtr, BINARY_TBL, 1, tfields, ttype, tform, tunit,
- extname, &status))
- {
- amdlibReturnFitsError("Creating Binary Table");
- }
-
- /* Write revision number of the table definition */
- if (fits_write_key (filePtr, TINT, "OI_REVN", &revision,
- "Revision number of the table definition", &status))
- {
- amdlibReturnFitsError("OI_REVN");
- }
-
- /* Write spectral setup unique identifier */
- if (fits_write_key (filePtr, TSTRING, "INSNAME", insName,
- "Instrument name", &status))
- {
- amdlibReturnFitsError("INSNAME");
- }
-
- for (i = 1; i <= wave->nbWlen; i ++)
- {
- waveInM = (wave->wlen[i-1]) * amdlibNM_TO_M;
- bwInM = (wave->bandwidth[i-1]) * amdlibNM_TO_M;
- /* Write EFFective_WAVElengh table */
- if (fits_write_col (filePtr, TDOUBLE, 1, i, 1, 1, &waveInM, &status))
- {
- amdlibReturnFitsError("EFFective_WAVElengh");
- }
-
- /* Write EFFective_BANDwidth table */
- if (fits_write_col (filePtr, TDOUBLE, 2, i, 1, 1, &bwInM, &status))
- {
- amdlibReturnFitsError("EFFective_BANDwidth");
- }
- }
-
- return amdlibSUCCESS;
-}
-
-
-#define amdlibWriteOiVis_FREEALL() free(visError); free(flag); free(convertToDeg);
-
-
-/**
- * Write OI_VIS table in OI-FITS file
- *
- * This function writes the OI_VIS binary table defined in the IAU
- * standard in the OI-FITS file given as parameter.
- *
- * @param filePtr pointer on the file to be created
- * @param insName name of the detector
- * @param arrName array name
- * @param vis OI_VIS produced
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibWriteOiVisSelectedOnly(fitsfile *filePtr,
- char *insName,
- char *arrName,
- amdlibVIS *vis,
- amdlibSELECTION *selectedFrames,
- amdlibBAND band,
- amdlibERROR_MSG errMsg)
-
-{
- /* Local Declarations */
-
- int nbWlen = vis->nbWlen;
- int lVis;
- double *convertToDeg;
- amdlibCOMPLEX *visError;
- unsigned char *flag;
- amdlibDOUBLE amdlibBval=amdlibBLANKING_VALUE;
-
- int status = 0;
- char fitsioMsg[256];
- const int tfields = 14;
- char *ttype[] = {"TARGET_ID", "TIME", "MJD", "INT_TIME",
- "VISDATA", "VISERR", "VISAMP", "VISAMPERR", "VISPHI", "VISPHIERR",
- "UCOORD", "VCOORD", "STA_INDEX", "FLAG"};
- char *Tform[] = {"I", "D", "D", "D", "?C", "?C", "?D", "?D",
- "?D", "?D", "1D", "1D", "2I", "?L"};
- char *tform[tfields];
- char *tunit[] = {"\0", "s", "day", "s", "\0", "\0", "\0", "\0",
- "deg", "deg", "m", "m", "\0", "\0"};
- char extname[] = "OI_VIS";
- int revision = amdlib_OI_REVISION;
- char tmp[16];
- int iFrame = 0, iBase = 0, iVis = 0, i = 0;
- double expTime;
- int iReal=0;
- amdlibLogTrace("amdlibWriteOiVis()");
-
- /* Algorithm */
- if (vis->thisPtr != vis)
- {
- amdlibSetErrMsg("Unitialized vis structure");
- return amdlibFAILURE;
- }
-
- if (vis->nbFrames < 1)
- {
- return amdlibSUCCESS;
- }
-
- /* Create table structure: Make up Tform: substitute nbWlen for '?' */
- for (i = 0; i < tfields; i++)
- {
- if (Tform[i][0] == '?')
- {
- sprintf(tmp, "%d%s", nbWlen, &Tform[i][1]);
- tform[i] = calloc((strlen(tmp)+1), sizeof(char));
- strcpy(tform[i], tmp);
- }
- else
- {
- tform[i] = calloc((strlen(Tform[i])+1), sizeof(char));
- strcpy(tform[i], Tform[i]);
- }
- }
- if (fits_create_tbl(filePtr, BINARY_TBL, 0, tfields, ttype,
- tform, tunit, extname, &status))
- {
- amdlibReturnFitsError("BINARY_TBL");
- }
-
- for (i = 0; i < tfields; i++)
- {
- free(tform[i]);
- }
-
- /* Write revision number of the table definition */
- if (fits_write_key(filePtr, TINT, "OI_REVN", &revision,
- "Revision number of the table definition", &status))
- {
- amdlibReturnFitsError("OI_REVN");
- }
-
- /* Give date */
- if (fits_write_key(filePtr, TSTRING, "DATE-OBS", vis->dateObs,
- "UTC start date of observations", &status))
- {
- amdlibReturnFitsError("DATE-OBS");
- }
-
- /* Write names of array and detector */
- if (fits_write_key (filePtr, TSTRING, "ARRNAME", arrName,
- "Array Name", &status))
- {
- amdlibReturnFitsError("ARRNAME");
- }
- if (fits_write_key(filePtr, TSTRING, "INSNAME", insName,
- "Instrument name", &status))
- {
- amdlibReturnFitsError("INSNAME");
- }
-
- visError = calloc(nbWlen, sizeof(amdlibCOMPLEX));
- convertToDeg = calloc(nbWlen, sizeof(double));
- flag = calloc(nbWlen, sizeof(unsigned char));
-
- /* Write columns */
- for (iFrame = 0; iFrame < vis->nbFrames; iFrame++)
- {
- for (iBase = 0; iBase < vis->nbBases; iBase++)
- {
- if( selectedFrames->band[band].isSelectedPt[iBase][iFrame] == amdlibTRUE )
- {
-
- iReal = (iFrame*vis->nbBases)+iBase;
- iVis++;
-
- /* Write TARGET_IDentity as an index into IO_TARGET table */
- if (fits_write_col(filePtr, TINT, 1, iVis, 1, 1,
- &(vis->table[iReal].targetId), &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("TARGET_IDentity");
- }
-
- /* Write utc TIME of observation */
- if (fits_write_col(filePtr, TDOUBLE, 2, iVis, 1, 1,
- &(vis->table[iReal].time), &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("TIME");
- }
-
- /* Write observation date in ModifiedJulianDay */
- if (fits_write_col(filePtr, TDOUBLE, 3, iVis, 1, 1,
- &(vis->table[iReal].dateObsMJD), &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("ModifiedJulianDay");
- }
-
- /* Write INTegration_TIME (seconds) */
- expTime = (double)vis->table[iReal].expTime;
- if (fits_write_col(filePtr, TDOUBLE, 4, iVis, 1, 1,
- &expTime, &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("INTegration_TIME");
- }
-
- /* Writing ComPleXVISibility (no unit) */
- if (fits_write_col(filePtr,TDBLCOMPLEX, 5, iVis, 1, nbWlen,
- (double*)vis->table[iReal].vis, &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("ComPleXVISibility");
- }
-
- /* Write ComPleXVISibilityERRor (no unit) */
- /* Need to write Error, NOT sigma2 */
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- visError[lVis].re =
- amdlibSignedSqrt(vis->table[iReal].sigma2Vis[lVis].re);
- visError[lVis].im =
- amdlibSignedSqrt(vis->table[iReal].sigma2Vis[lVis].im);
- }
-
- if (fits_write_col(filePtr,TDBLCOMPLEX, 6, iVis, 1,
- nbWlen, (double *)visError, &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("ComPleXVISibilityERRor");
- }
-
- /* Write VISibilityAMPlitude (no unit) */
- if (fits_write_col(filePtr, TDOUBLE, 7, iVis, 1, nbWlen,
- vis->table[iReal].diffVisAmp, &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("VISibilityAMPlitude");
- }
-
- /* Write VISibilityAMPlitudeERRor (no unit) */
- if (fits_write_col(filePtr, TDOUBLE, 8, iVis, 1, nbWlen,
- vis->table[iReal].diffVisAmpErr, &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("VISibilityAMPlitudeERRor");
- }
-
- /* Write VISibilityPHI (degrees) */
- for(lVis = 0; lVis < nbWlen; lVis++)
- {
- if(vis->table[iReal].diffVisPhi[lVis]!=amdlibBLANKING_VALUE)
- {
- convertToDeg[lVis] = 180.0 / M_PI *
- vis->table[iReal].diffVisPhi[lVis];
- }
- else
- {
- convertToDeg[lVis] = amdlibBLANKING_VALUE;
- }
- }
-
- if (fits_write_colnull(filePtr, TDOUBLE, 9, iVis, 1, nbWlen,
- convertToDeg, &amdlibBval, &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("VISibilityPHI");
- }
-
- /* Write VISibilityPHIERRor (degrees) */
- for(lVis = 0; lVis < nbWlen; lVis++)
- {
- if(vis->table[iReal].diffVisPhiErr[lVis]!=amdlibBLANKING_VALUE)
- {
- convertToDeg[lVis] = 180.0 / M_PI *
- vis->table[iReal].diffVisPhiErr[lVis];
- }
- else
- {
- convertToDeg[lVis] = amdlibBLANKING_VALUE;
- }
- }
- if (fits_write_colnull(filePtr, TDOUBLE, 10, iVis, 1, nbWlen,
- convertToDeg, &amdlibBval, &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("VISibilityPHIERRor");
- }
- /* Write UCOORDinate (meters) */
- if (fits_write_col(filePtr, TDOUBLE, 11, iVis, 1, 1,
- &(vis->table[iReal].uCoord), &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("UCOORDinate");
- }
-
- /* Write VCOORDinates (meters) */
- if (fits_write_col(filePtr, TDOUBLE, 12, iVis, 1, 1,
- &(vis->table[iReal].vCoord), &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("VCOORDinates");
- }
-
- /* Write STAtion_INDEX contributing to the data */
- if (fits_write_col(filePtr, TINT, 13, iVis, 1, 2,
- vis->table[iReal].stationIndex, &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("STAtion_INDEX");
- }
-
- /* Write flag as unsigned char -- does not work with booleans */
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- flag[lVis] = vis->table[iReal].flag[lVis];
- }
-
- if (fits_write_col(filePtr, TLOGICAL, 14, iVis, 1, nbWlen,
- flag, &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("FLAG");
- }
- } /* if frame was selected */
- }
- }
- /* free allocated space at end of job */
- amdlibWriteOiVis_FREEALL();
- return amdlibSUCCESS;
-}
-#undef amdlibWriteOiVis_FREEALL
-
-#define amdlibWriteOiVis2_FREEALL() free(flag);
-/**
- * Write OI_VIS2 table in OI-FITS file
- *
- * This function writes the OI_VIS2 binary table defined in the IAU
- * standard in the OI-FITS file given as parameter.
- *
- * @param filePtr pointer on the file to be created
- * @param insName name of the detector
- * @param arrName array name
- * @param vis2 OI_VIS2 produced
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibWriteOiVis2SelectedOnly( fitsfile *filePtr,
- char *insName,
- char *arrName,
- amdlibVIS2 *vis2,
- amdlibSELECTION *selectedFrames,
- amdlibBAND band,
-
- amdlibERROR_MSG errMsg)
-{
- int nbWlen = vis2->nbWlen;
- int lVis;
- int status = 0;
- char fitsioMsg[256];
- const int tfields = 10;
- char *ttype[] = {"TARGET_ID", "TIME", "MJD", "INT_TIME", "VIS2DATA",
- "VIS2ERR", "UCOORD", "VCOORD", "STA_INDEX", "FLAG"};
- char *Tform[] = {"I", "D", "D", "D", "?D", "?D", "1D", "1D", "2I",
- "?L"};
- char *tform[tfields];
- char *tunit[] = {"\0", "s", "day", "s", "\0", "\0", "m", "m", "\0",
- "\0"};
- char extname[] = "OI_VIS2";
- int revision = amdlib_OI_REVISION;
- int iFrame = 0, iBase = 0, iVis = 0, i = 0;
- char tmp[16];
- double expTime;
- unsigned char *flag;
- int iReal=0;
- amdlibLogTrace("amdlibWriteOiVis2()");
-
- if (vis2->thisPtr != vis2)
- {
- amdlibSetErrMsg("Unitialized vis2 structure");
- return amdlibFAILURE;
- }
- if (vis2->nbFrames < 1)
- {
- return amdlibSUCCESS;
- }
-
- /* Create table structure. Make up Tform: substitute nbWlen for '?' */
- for (i = 0; i < tfields; i++)
- {
- if (Tform[i][0] == '?')
- {
- sprintf(tmp, "%d%s", nbWlen, &Tform[i][1]);
- tform[i] = calloc((strlen(tmp)+1), sizeof(char));
- strcpy(tform[i], tmp);
- }
- else
- {
- tform[i] = calloc((strlen(Tform[i])+1), sizeof(char));
- strcpy(tform[i], Tform[i]);
- }
- }
-
- if (fits_create_tbl (filePtr, BINARY_TBL, 0, tfields,
- ttype, tform, tunit, extname, &status))
- {
- amdlibReturnFitsError("BINARY_TBL");
- }
-
- for (i = 0; i < tfields; i++)
- {
- free(tform[i]);
- }
-
- /* Write revision number of the table definition */
- if (fits_write_key (filePtr, TINT, "OI_REVN", &revision,
- "Revision number of the table definition", &status))
- {
- amdlibReturnFitsError("OI_REVN");
- }
-
- /* Give date */
- if (fits_write_key(filePtr, TSTRING,"DATE-OBS", vis2->dateObs,
- "UTC start date of observations", &status))
- {
- amdlibReturnFitsError("DATE-OBS");
- }
-
- /* Write array and detector names */
- if (fits_write_key (filePtr, TSTRING, "ARRNAME", arrName,
- "Array Name", &status))
- {
- amdlibReturnFitsError("ARRNAME");
- }
- if (fits_write_key(filePtr, TSTRING, "INSNAME", insName,
- "Instrument name", &status))
- {
- amdlibReturnFitsError("INSNAME");
- }
-
- flag = calloc(nbWlen, sizeof(unsigned char));
-
- /* Write columns */
- for (iFrame = 0; iFrame < vis2->nbFrames; iFrame++)
- {
- for (iBase = 0; iBase < vis2->nbBases; iBase++)
- {
- if( selectedFrames->band[band].isSelectedPt[iBase][iFrame] == amdlibTRUE )
- {
- iReal = (iFrame*vis2->nbBases)+iBase;
- iVis++;
- /* Write TARGET_IDentity */
- if (fits_write_col (filePtr, TINT, 1, iVis, 1, 1,
- &(vis2->table[iReal].targetId), &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("TARGET_IDentity");
- }
-
- /* Write time */
- if (fits_write_col (filePtr, TDOUBLE, 2, iVis, 1, 1,
- &(vis2->table[iReal].time), &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("Time");
- }
- if (fits_write_col (filePtr, TDOUBLE, 3, iVis, 1, 1,
- &(vis2->table[iReal].dateObsMJD), &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("dateObsMJD");
- }
- expTime = (double)vis2->table[iReal].expTime;
- if (fits_write_col (filePtr, TDOUBLE, 4, iVis, 1, 1,
- &expTime, &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("expTime");
- }
-
- /* Write squared visibility */
- if (fits_write_col(filePtr, TDOUBLE, 5, iVis, 1, nbWlen,
- vis2->table[iReal].vis2, &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("vis2");
- }
- /* Write error in the squared visibility */
- if (fits_write_col(filePtr, TDOUBLE, 6, iVis, 1, nbWlen,
- vis2->table[iReal].vis2Error, &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("vis2Error");
- }
-
- /* Write U and V coordinates on the data */
- if (fits_write_col (filePtr, TDOUBLE, 7, iVis, 1, 1,
- &(vis2->table[iReal].uCoord), &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("uCoord");
- }
- if (fits_write_col (filePtr, TDOUBLE, 8, iVis, 1, 1,
- &(vis2->table[iReal].vCoord), &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("vCoord");
- }
-
- /* Write station index */
- if (fits_write_col (filePtr, TINT, 9, iVis, 1, 2,
- vis2->table[iReal].stationIndex, &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("stationIndex");
- }
- /* Write flag as unsigned char -- does not work with booleans */
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- flag[lVis] = vis2->table[iReal].flag[lVis];
- }
- if (fits_write_col(filePtr, TLOGICAL, 10, iVis, 1, nbWlen,
- flag, &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("FLAG");
- }
- } /* selected frames only */
- }
- }
- /* free allocated space at end of job */
- amdlibWriteOiVis2_FREEALL();
- return amdlibSUCCESS;
-}
-#define amdlibWriteOiVis3_FREEALL() free(flag); free(convertToDeg);
-/**
- * Write OI_T3 table in OI-FITS file.
- *
- * This function writes the OI_T3 binary table defined in the IAU
- * standard in the OI-FITS file given as parameter.
- *
- * @param filePtr pointer on the file to be created.
- * @param insName name of the detector.
- * @param arrName array name.
- * @param vis3 OI_T3 produced.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibWriteOiVis3SelectedOnly(fitsfile *filePtr,
- char *insName,
- char *arrName,
- amdlibVIS3 *vis3,
- amdlibSELECTION *selectedFrames,
- amdlibBAND band,
- amdlibERROR_MSG errMsg)
-{
- int nbWlen =vis3->nbWlen;
- int lVis;
- int status = 0;
- char fitsioMsg[256];
- const int tfields = 14;
- char *ttype[] = {"TARGET_ID", "TIME", "MJD", "INT_TIME", "T3AMP",
- "T3AMPERR", "T3PHI", "T3PHIERR", "U1COORD", "V1COORD", "U2COORD",
- "V2COORD", "STA_INDEX", "FLAG"};
- char *Tform[] = {"I", "D", "D", "D", "?D", "?D", "?D", "?D", "1D",
- "1D", "1D", "1D", "3I", "?L"};
- char *tform[tfields];
- char *tunit[] = {"\0", "s", "day", "s", "\0", "\0", "deg", "deg",
- "m", "m", "m", "m", "\0", "\0"};
- char extname[] = "OI_T3";
- int revision = amdlib_OI_REVISION;
- int i;
- char tmp[16];
- double expTime;
- double *convertToDeg;
- unsigned char *flag;
- amdlibDOUBLE amdlibBval=amdlibBLANKING_VALUE;
-
- int iFrame = 0, iClos = 0, iT3 = 0;
-
- amdlibLogTrace("amdlibWriteOiVis3()");
-
- /*Vis3 may not be initialized (only 1 baseline), this is not a defect*/
- if (vis3->thisPtr != vis3)
- {
- return amdlibSUCCESS;
- }
- /*If initialized but empty, do nothing gracefully*/
- if (vis3->nbFrames < 1)
- {
- return amdlibSUCCESS;
- }
-
- /* Create table structure. Make up Tform: substitute nbWlen for '?' */
- for (i = 0; i < tfields; i++)
- {
- if (Tform[i][0] == '?')
- {
- sprintf(tmp, "%d%s", nbWlen, &Tform[i][1]);
- tform[i] = calloc((strlen(tmp)+1), sizeof(char));
- strcpy(tform[i], tmp);
- }
- else
- {
- tform[i] = calloc((strlen(Tform[i])+1), sizeof(char));
- strcpy(tform[i], Tform[i]);
- }
- }
- if (fits_create_tbl(filePtr, BINARY_TBL, 0, tfields, ttype, tform, tunit,
- extname, &status))
- {
- amdlibReturnFitsError("Creating Binary Table");
- }
-
- for (i = 0; i < tfields; i++)
- {
- free(tform[i]);
- }
-
- /* Write revision number of the table definition */
- if (fits_write_key (filePtr, TINT, "OI_REVN", &revision,
- "Revision number of the table definition", &status))
- {
- amdlibReturnFitsError("OI_REVN");
- }
-
- /* Give date */
- if (fits_write_key(filePtr, TSTRING,"DATE-OBS", vis3->dateObs,
- "UTC start date of observations", &status))
- {
- amdlibReturnFitsError("DATE-OBS");
- }
-
- /* Write names of detector and array */
- if (fits_write_key (filePtr, TSTRING, "ARRNAME", arrName,
- "Array Name", &status))
- {
- amdlibReturnFitsError("ARRNAME");
- }
- if (fits_write_key(filePtr, TSTRING, "INSNAME", insName,
- "Instrument name", &status))
- {
- amdlibReturnFitsError("INSNAME");
- }
-
- convertToDeg = calloc(nbWlen, sizeof(double));
- flag = calloc(nbWlen, sizeof(unsigned char));
-
- /* Write columns */
- for (iFrame = 0; iFrame < vis3->nbFrames; iFrame++)
- {
- /* Always all bases are either rejected or not. Testing base 0 is hence enough */
- if( selectedFrames->band[band].isSelectedPt[0][iFrame] == amdlibTRUE )
- {
-
- for (iClos = 0; iClos < vis3->nbClosures; iClos++)
- {
- /* Write dtarget identity */
- if (fits_write_col(filePtr, TINT, 1, iT3+1, 1, 1,
- &(vis3->table[iT3].targetId), &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("TARGET_ID");
- }
-
- /* Write time */
- if (fits_write_col(filePtr, TDOUBLE, 2, iT3+1, 1, 1,
- &(vis3->table[iT3].time), &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("TIME");
- }
- if (fits_write_col(filePtr, TDOUBLE, 3, iT3+1, 1, 1,
- &(vis3->table[iT3].dateObsMJD), &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("DATEOBS");
- }
- expTime = (double)vis3->table[iT3].expTime;
- if (fits_write_col(filePtr, TDOUBLE, 4, iT3+1, 1, 1,
- &expTime, &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("EXPTIME");
- }
-
- /* Write visibility amplitude and its associated error */
- if (fits_write_col(filePtr, TDOUBLE, 5, iT3+1, 1, nbWlen,
- vis3->table[iT3].vis3Amplitude, &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("VIS3AMP");
- }
- if (fits_write_col(filePtr, TDOUBLE, 6, iT3+1, 1, nbWlen,
- vis3->table[iT3].vis3AmplitudeError,
- &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("VIS3AMPERR");
- }
-
- /* Write visibility phase and its associated error,
- * converted in degrees */
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- if(vis3->table[iT3].vis3Phi[lVis]!=amdlibBLANKING_VALUE)
- {
- convertToDeg[lVis] = 180.0 / M_PI *
- vis3->table[iT3].vis3Phi[lVis];
- }
- else
- {
- convertToDeg[lVis] =amdlibBLANKING_VALUE;
- }
-
- }
- if (fits_write_colnull(filePtr, TDOUBLE, 7, iT3+1, 1, nbWlen,
- convertToDeg, &amdlibBval, &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("VIS3PHI");
- }
- for(lVis = 0; lVis < nbWlen; lVis++)
- {
- if(vis3->table[iT3].vis3PhiError[lVis]!=amdlibBLANKING_VALUE)
- {
- convertToDeg[lVis] = 180.0 / M_PI *
- vis3->table[iT3].vis3PhiError[lVis];
- }
- else
- {
- convertToDeg[lVis] =amdlibBLANKING_VALUE;
- }
- }
- if (fits_write_colnull(filePtr, TDOUBLE, 8, iT3+1, 1, nbWlen,
- convertToDeg, &amdlibBval, &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("VIS3PHIERR");
- }
-
- /* Write U and V coordinates of the data */
- if (fits_write_col(filePtr, TDOUBLE, 9, iT3+1, 1, 1,
- &(vis3->table[iT3].u1Coord), &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("U1COORD");
- }
- if (fits_write_col(filePtr, TDOUBLE, 10, iT3+1, 1, 1,
- &(vis3->table[iT3].v1Coord), &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("V1COORD");
- }
- if (fits_write_col(filePtr, TDOUBLE, 11, iT3+1, 1, 1,
- &(vis3->table[iT3].u2Coord), &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("U2COORD");
- }
- if (fits_write_col(filePtr, TDOUBLE, 12, iT3+1, 1, 1,
- &(vis3->table[iT3].v2Coord), &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("V2COORD");
- }
-
- /* Write station index */
- if (fits_write_col(filePtr, TINT, 13, iT3+1, 1, 3,
- vis3->table[iT3].stationIndex, &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("STATINDEX");
- }
-
- /* Write flag as unsigned char -- does not work with booleans */
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- flag[lVis] = vis3->table[iT3].flag[lVis];
- }
- if (fits_write_col(filePtr, TLOGICAL, 14, iT3+1, 1, nbWlen,
- flag, &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("FLAG");
- }
-
- iT3++;
-
- }
- } /* Selected Frames only */
- }
- amdlibWriteOiVis3_FREEALL();
-
- return amdlibSUCCESS;
-}
-
-/* ------------------------------------------------------------------------------ */
-#define amdlibWriteAmberData_FREEALL() free(errTempVal); \
- free(tempBandNumber);
-/**
- * Write AMBER_DATA table in OI-FITS file.
- *
- * This function writes the AMBER_DATA binary table in the OI-FITS file
- * given as parameter.
- *
- * @param filePtr pointer on the file to be created.
- * @param insName name of the detector.
- * @param photometry photometry data.
- * @param vis AMBER_DATA produced.
- * @param pst piston data.
- * @param wave structure containing the wavelengths.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibWriteAmberDataSelectedOnly(fitsfile *filePtr,
- char *insName,
- amdlibPHOTOMETRY *photometry,
- amdlibVIS *vis,
- amdlibPISTON *pst,
- amdlibWAVELENGTH *wave,
- amdlibSELECTION *selectedFrames,
- amdlibBAND bandfct,
- amdlibERROR_MSG errMsg)
-{
- int nbWlen = photometry->nbWlen;
- int status = 0;
- char fitsioMsg[256];
- const int tfields = 13;
- amdlibDOUBLE amdlibBval=amdlibBLANKING_VALUE;
- char *Ttype[] =
- {
- "TARGET_ID", "TIME", "MJD", "INT_TIME",
- "FLUX_SUM", "FLUX_SUM_CORRECTION", "FLUX_RATIO",
- "FLUX_RATIO_CORRECTION", "FLUX_PRODUCT",
- "OPD", "OPD_ERR", "FRINGE_SNR", "STA_INDEX"
- };
-
- char *Tform[] = {"I", "D", "D", "D", "?D", "?D", "?D", "?D", "?D",
- "?E", "?E", "?D", "2I"};
-
- char *Tunit[] = {"\0", "s", "day", "s", "e-", "e-", "\0", "\0",
- "e-^2", "m", "m", "\0", "\0"};
-
- char *ttype[tfields];
- char *tform[tfields];
- char *tunit[tfields];
-
- char extname[] = "AMBER_DATA";
- int revision = amdlib_OI_REVISION;
- int colNum;
- int i;
- int lVis;
- char tmp[16];
- int iFrame = 0, iBase = 0, iVis = 0;
- double *errTempVal;
- int *tempBandNumber;
- int band, iBand;
- int nbBands = 0;
- amdlibBAND_DESC *bandDesc;
- amdlibDOUBLE bound;
- char keyName[amdlibKEYW_NAME_LEN+1];
- double expTime;
- amdlibDOUBLE pistonTmpVal[amdlibNB_BANDS];
- amdlibDOUBLE pstErrTmpVal[amdlibNB_BANDS];
- double frgTmpVal[amdlibNB_BANDS];
- int iReal=0;
- amdlibLogTrace("amdlibWriteAmberData()");
-
- if (vis->thisPtr != vis)
- {
- amdlibSetErrMsg("Unitialized vis structure");
- return amdlibFAILURE;
- }
-
- /*If initialized but empty, do nothing gracefully*/
- if (vis->nbFrames < 1)
- {
- return amdlibSUCCESS;
- }
-
- if (photometry->thisPtr != photometry)
- {
- amdlibSetErrMsg("Unitialized photometry structure");
- return amdlibFAILURE;
- }
- /*If initialized but empty, do nothing gracefully*/
- if (photometry->nbFrames < 1)
- {
- return amdlibSUCCESS;
- }
-
- if (pst->thisPtr != pst)
- {
- amdlibSetErrMsg("Unitialized piston structure");
- return amdlibFAILURE;
- }
- /*If initialized but empty, do nothing gracefully*/
- if (pst->nbFrames < 1)
- {
- return amdlibSUCCESS;
- }
-
- /* Create table structure. Make up Tform: substitute nbWlen or
- * nbBands for '?' */
- /* (informational) check number of bands */
- nbBands=0;
- for (band = amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- if (pst->bandFlag[band] == amdlibTRUE)
- {
- nbBands++;
- }
- }
- for (i = 0; i < tfields; i++)
- {
- ttype[i] = calloc(strlen(Ttype[i])+1, sizeof(char));
- strcpy(ttype[i],Ttype[i]);
- tunit[i] = calloc(strlen(Tunit[i])+1, sizeof(char));
- strcpy(tunit[i],Tunit[i]);
-
- if (Tform[i][0] == '?')
- {
- if ((i == 9) || (i == 10) || (i == 11))
- {
- sprintf(tmp, "%d%s", nbBands, &Tform[i][1]);
- }
- else
- {
- sprintf(tmp, "%d%s", nbWlen, &Tform[i][1]);
- }
- tform[i] = calloc((strlen(tmp)+1), sizeof(char));
- strcpy(tform[i], tmp);
- }
- else
- {
- tform[i] = calloc((strlen(Tform[i])+1), sizeof(char));
- strcpy(tform[i], Tform[i]);
- }
- }
-
- if (fits_create_tbl(filePtr, BINARY_TBL, 0, tfields, ttype, tform, tunit,
- extname, &status))
- {
- amdlibReturnFitsError("Creating Binary Table");
- }
-
- for (i = 0; i < tfields; i++)
- {
- free(ttype[i]);
- free(tform[i]);
- free(tunit[i]);
- }
-
- /* Give date */
- if (fits_write_key(filePtr, TSTRING, "DATE-OBS", vis->dateObs,
- "UTC start date of observations", &status))
- {
- amdlibReturnFitsError("DATE-OBS");
- }
-
- /* Write detector name */
- if (fits_write_key (filePtr, TSTRING, "INSNAME", insName,
- "Instrument name", &status))
- {
- amdlibReturnFitsError("INSNAME");
- }
-
- /* Write revision number of the table definition */
- if (fits_write_key (filePtr, TINT, "AMB_REVN", &revision,
- "Revision number of the table definition", &status))
- {
- amdlibReturnFitsError("AMB_REVN");
- }
-
- /* Write information on spectral bands. */
- if (fits_write_key (filePtr, TINT, "HIERARCH ESO QC NBBANDS",
- &nbBands, "Number of spectral bands", &status))
- {
- amdlibReturnFitsError("HIERARCH ESO QC NBBANDS");
- }
-
- iBand = 1;
- for (band = amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- if (pst->bandFlag[band] == amdlibTRUE)
- {
- bandDesc = amdlibGetBandDescription(band);
- sprintf(keyName, "HIERARCH ESO QC BAND%d NAME", iBand);
- if (fits_write_key(filePtr, TSTRING, keyName, bandDesc->name,
- "Name of spectral band", &status))
- {
- amdlibReturnFitsError(keyName);
- }
- memset(keyName, '\0', (amdlibKEYW_NAME_LEN+1) * sizeof(char));
- sprintf(keyName, "HIERARCH ESO QC BAND%d LOWBOUND", iBand);
- bound = bandDesc->lowerBound/1000;
- if (fits_write_key(filePtr, TDOUBLE, keyName, &bound,
- "Lower bound of spectral band", &status))
- {
- amdlibReturnFitsError(keyName);
- }
- memset(keyName, '\0', (amdlibKEYW_NAME_LEN+1) * sizeof(char));
- sprintf(keyName, "HIERARCH ESO QC BAND%d UPBOUND", iBand);
- bound = bandDesc->upperBound/1000;
- if (fits_write_key(filePtr, TDOUBLE, keyName, &bound,
- "Upper bound of spectral band", &status))
- {
- amdlibReturnFitsError(keyName);
- }
- iBand++;
- }
-
- }
-
- errTempVal = calloc(nbWlen, sizeof(double));
- tempBandNumber = calloc(nbWlen, sizeof(int));
- /* Retrieve Band number for each Wlen */
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- tempBandNumber[lVis] = amdlibGetBand(wave->wlen[lVis]);
- }
-
- /* Write columns */
- for (iFrame = 0; iFrame < vis->nbFrames; iFrame++)
- {
- /* Always all bases are either rejected or not. Testing base 0 is hence enough */
-
- if( selectedFrames->band[bandfct].isSelectedPt[0][iFrame] == amdlibTRUE )
- {
-
- for (iBase = 0; iBase < vis->nbBases; iBase++)
- {
- iReal = (iFrame*vis->nbBases)+iBase;
- colNum = 1;
- iVis++;
- /* Write target identity */
- if (fits_write_col(filePtr, TINT, colNum, iVis, 1, 1,
- &(vis->table[iReal].targetId), &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("Target Id");
- }
- colNum++;
-
- /* Write time */
- if (fits_write_col(filePtr, TDOUBLE, colNum, iVis, 1, 1,
- &(vis->table[iReal].time), &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("Time");
- }
- colNum++;
-
- if (fits_write_col(filePtr, TDOUBLE, colNum, iVis, 1, 1,
- &(vis->table[iReal].dateObsMJD), &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("dateObsMJD");
- }
- colNum++;
-
- expTime = (double)vis->table[iReal].expTime;
- if (fits_write_col(filePtr, TDOUBLE, 4, iVis, 1, 1,
- &expTime, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("expTime");
- }
- colNum++;
-
- /* Write information on photometry */
- /* Write fluxSumPiPj (number of electrons collected in the spectral
- * channel) and associated error */
- if (fits_write_colnull(filePtr, TDOUBLE, colNum, iVis, 1, nbWlen,
- photometry->table[iReal].fluxSumPiPj,
- &amdlibBval, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("baseFluxSum");
- }
- colNum++;
-
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- if (!(photometry->table[iReal].sigma2FluxSumPiPj[lVis] ==
- amdlibBLANKING_VALUE))
- {
- errTempVal[lVis] =
- sqrt(photometry->table[iReal].sigma2FluxSumPiPj[lVis]);
- }
- else
- {
- errTempVal[lVis] = amdlibBLANKING_VALUE;
- }
- }
-
- if (fits_write_colnull(filePtr, TDOUBLE, colNum, iVis, 1, nbWlen,
- errTempVal, &amdlibBval, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("baseFluxSumCorrection");
- }
- colNum++;
-
- /* Write flux ratio in the spectral channel and associated error */
- if (fits_write_colnull(filePtr, TDOUBLE, colNum, iVis, 1, nbWlen,
- photometry->table[iReal].fluxRatPiPj,
- &amdlibBval, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("baseFluxRatio");
- }
- colNum++;
-
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- if (!(photometry->table[iReal].sigma2FluxRatPiPj[lVis] ==
- amdlibBLANKING_VALUE))
- {
- errTempVal[lVis]=
- sqrt(photometry->table[iReal].sigma2FluxRatPiPj[lVis]);
- }
- else
- {
- errTempVal[lVis] = amdlibBLANKING_VALUE;
- }
- }
- if (fits_write_colnull(filePtr, TDOUBLE, colNum, iVis, 1, nbWlen,
- errTempVal, &amdlibBval, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("baseFluxRatioCorrection");
- }
- colNum++;
-
- /* Write flux product */
- if (fits_write_colnull(filePtr, TDOUBLE, colNum, iVis, 1, nbWlen,
- photometry->table[iReal].PiMultPj,
- &amdlibBval, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("baseFluxProduct");
- }
- colNum++;
-
- /* Write piston value and associated error */
- int i = 0;
- for (band = amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- if (pst->bandFlag[band] == amdlibTRUE )
- {
- if (!amdlibCompareDouble(pst->pistonOPDArray[band][iReal],amdlibBLANKING_VALUE))
- {
- pistonTmpVal[i] = pst->pistonOPDArray[band][iReal] *
- amdlibNM_TO_M;
- pstErrTmpVal[i] = pst->sigmaPistonArray[band][iReal] *
- amdlibNM_TO_M;
- }
- else
- {
- pistonTmpVal[i] = amdlibBLANKING_VALUE;
- pstErrTmpVal[i] = amdlibBLANKING_VALUE;
- }
- frgTmpVal[i] = vis->table[iReal].frgContrastSnrArray[band];
- i++;
- }
- }
- if (fits_write_colnull(filePtr, TDOUBLE, colNum, iVis, 1, nbBands,
- pistonTmpVal, &amdlibBval, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("piston");
- }
- colNum++;
-
- if (fits_write_colnull(filePtr, TDOUBLE, colNum, iVis, 1, nbBands,
- pstErrTmpVal, &amdlibBval, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("pistonErr");
- }
- colNum++;
-
- /* Write fringe contrast SNR */
- if (fits_write_col(filePtr, TDOUBLE, colNum, iVis, 1, nbBands,
- frgTmpVal, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("frgContrastSnr");
- }
- colNum++;
-
- /* Write station idexes corresponding to the baseline */
- if (fits_write_col(filePtr, TINT, colNum, iVis, 1, 2,
- vis->table[iReal].stationIndex, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("stationIndex");
- }
- colNum++;
- }
- }/* Selectd Frames only */
- }
- amdlibWriteAmberData_FREEALL();
- return amdlibSUCCESS;
-}
-#undef amdlibWriteAmberData_FREEALL
-
-
-
-
-/**
- * Write OI-FITS file.
- *
- * This function create OI-FITS file containing the OI_ARRAY, OI_TARGET, OI_VIS,
- * OI_VIS2, OI_T3 and OI_WAVELENGTH binary tables defined in the IAU standard,
- * and the AMBER_DATA binary table which is specific to AMBER. The AMBER_DATA
- * binary table contains photometry and piston data.
- *
- * @note
- * If the file exists, it is overwritten.
- *
- * @param filename name of the OI-FITS file to create
- * @param insCfg array containing keywords of the primary header.
- * @param array structure containing information of OI_ARRAY binary table
- * @param target structure containing information of OI_TARGET binary table
- * @param photometry structure containing photometry which is stored in
- * AMBER_DATA binary table.
- * @param vis structure containing information of OI_VIS binary table
- * @param vis2 structure containing information of OI_VIS2 binary table
- * @param vis3 structure containing information of OI_T3 binary table
- * @param wave structure containing information of OI_WAVELENGTH binary table
- * @param pst structure containing piston which is stored in AMBER_DATA binary
- * table.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-static amdlibCOMPL_STAT amdlibSaveOiFileESO( const char *filename,
- /* amdlibINS_CFG *insCfg,*/
- amdlibSELECTION *selectedFrames,
- amdlibOI_ARRAY *array,
- amdlibOI_TARGET *target,
- amdlibPHOTOMETRY *photometry,
- amdlibVIS *vis,
- amdlibVIS2 *vis2,
- amdlibVIS3 *vis3,
- amdlibWAVELENGTH *wave,
- amdlibPISTON *pst,
- amdlibBAND band,
- amdlibSPECTRUM *spectrum,
- amdlibERROR_MSG errMsg )
-{
- int status = 0;
- fitsfile *oiFile;
-#ifndef ESO_CPL_PIPELINE_VARIANT
- struct stat statBuf;
- time_t timeSecs;
- struct tm *timeNow;
- char strTime[amdlibKEYW_VAL_LEN+1];
-#endif
- char fitsioMsg[256];
- const char *routine = "amdlibSaveOiFile";
- char insName[amdlibKEYW_VAL_LEN+1];
- char arrName[amdlibKEYW_VAL_LEN+1];
- char version[32];
-
- amdlibLogTrace("amdlibSaveOiFile()\n");
-
-#ifndef ESO_CPL_PIPELINE_VARIANT
- /*
- * amdlib will create the file on its own
- */
- /* First remove previous IO file (if any) */
- if (stat(filename, &statBuf) == 0)
- {
- if (remove(filename) != 0)
- {
- sprintf(errMsg,
- "%s(): could not overwrite file %s", routine, filename);
- return (amdlibFAILURE);
- }
- }
-
- /* Create new FITS file */
- if (fits_create_file(&oiFile, filename, &status))
- {
- amdlibOiReturnError(routine, "opening file");
- }
-#else
- /*
- * The ESO pipeline will create that file and prepare the header
- * with DMD compliant keywords. Hence amdlib shall just append to it
- */
- cpl_msg_info(cpl_func, "Opening File %s for appending...", filename);
-
-
- /* Append to FITS file */
- if( fits_open_file(&oiFile, filename, READWRITE, &status) )
- {
- cpl_msg_info(cpl_func,"%s->fits_open_file cannot open in append mode",
- filename);
- amdlibOiReturnError(routine, "opening file");
- }
- else
- {
- cpl_msg_info(cpl_func,"%s->fits_open_file append OK", filename);
- }
-#endif
-
-
- /* Build a uniq INSNAME using P2VM id (if possible), else use default */
- sprintf(insName, "AMBER");
-
- /* Retrieve ARRNAME if possible, else use default.*/
- if (array != NULL)
- {
- strncpy(arrName, array->arrayName, amdlibKEYW_VAL_LEN+1);
- }
- else
- {
- sprintf(arrName, "UNKNOWN");
- }
-
- /* Write OI_ARRAY binary table */
- if (array != NULL)
- {
- if (amdlibWriteOiArray(oiFile, array, errMsg) != amdlibSUCCESS)
- {
- fits_close_file(oiFile, &status);
- amdlibOiReturnError(routine, "writing OI_ARRAY table");
- }
- }
-
- /* Write OI_TARGET binary table */
- if (target != NULL)
- {
- if (amdlibWriteOiTarget(oiFile, target, errMsg) != amdlibSUCCESS)
- {
- fits_close_file(oiFile, &status);
- amdlibOiReturnError(routine, "writing OI_TARGET table");
- }
- }
-
- /* Write OI_WAVELENGTH binary table */
- if (wave != NULL)
- {
- if (amdlibWriteOiWavelength(oiFile, insName,
- wave, errMsg) != amdlibSUCCESS)
- {
- fits_close_file(oiFile, &status);
- amdlibOiReturnError(routine, "writing OI_WAVELENGTH table");
- }
- }
-
- /* Write OI_VIS binary table */
- if (vis != NULL)
- {
- if (amdlibWriteOiVisSelectedOnly(oiFile, insName, arrName, vis, selectedFrames, band, errMsg) != amdlibSUCCESS)
- {
- fits_close_file(oiFile, &status);
- amdlibOiReturnError(routine, "writing OI_VIS table");
- }
- }
-
- /* Write OI_VIS2 binary table */
- if (vis2 != NULL)
- {
- if (amdlibWriteOiVis2SelectedOnly( oiFile, insName, arrName, vis2, selectedFrames, band, errMsg) != amdlibSUCCESS)
- {
- fits_close_file(oiFile, &status);
- amdlibOiReturnError(routine, "writing OI_VIS2 table");
- }
- }
-
- /* Write OI_T3 binary table */
- if (vis3 != NULL)
- {
- if (amdlibWriteOiVis3SelectedOnly( oiFile, insName, arrName, vis3, selectedFrames, band, errMsg) != amdlibSUCCESS)
- {
- fits_close_file(oiFile, &status);
- amdlibOiReturnError(routine, "writing OI_T3");
- }
- }
-
- /* Write AMBER_DATA binary table */
- if ((photometry != NULL) && (vis != NULL) && (pst != NULL))
- {
- if (amdlibWriteAmberDataSelectedOnly( oiFile, insName, photometry, vis, pst, wave,
- selectedFrames, band, errMsg) != amdlibSUCCESS)
-
- {
- fits_close_file(oiFile, &status);
- amdlibOiReturnError(routine, "writing AMBER_DATA table");
- }
- }
-
- /* Write AMBER_SPECTRUM binary table */
- if (spectrum != NULL)
- {
- if (amdlibWriteAmberSpectrum(oiFile, wave, spectrum,
- errMsg) != amdlibSUCCESS)
- {
- fits_close_file(oiFile, &status);
- return amdlibFAILURE;
- }
- }
-
-
- if (fits_movabs_hdu(oiFile, 1, 0, &status) != 0)
- {
- fits_close_file(oiFile, &status);
- amdlibOiReturnError(routine, "main header");
- }
-
-#ifndef ESO_CPL_PIPELINE_VARIANT
- /* Complete main header */
- if (insCfg != NULL)
- {
- /* Add DATE */
- timeSecs = time(NULL);
- timeNow = gmtime(&timeSecs);
- strftime(strTime, sizeof(strTime), "%Y-%m-%dT%H:%M:%S", timeNow);
- if (fits_write_key(oiFile, TSTRING, (char *)"DATE", strTime,
- (char *)"Date this file was written", &status) != 0)
- {
- fits_close_file(oiFile, &status);
- amdlibOiReturnError(routine, "completing main header");
- }
-
- /* Add other keywords */
- for (i = 0; i < insCfg->nbKeywords; i++)
- {
- amdlibKEYW_LINE keywLine;
- if ((strstr(insCfg->keywords[i].name, "SIMPLE") == NULL) &&
- (strstr(insCfg->keywords[i].name, "BITPIX") == NULL) &&
- (strstr(insCfg->keywords[i].name, "NAXIS ") == NULL) &&
- (strstr(insCfg->keywords[i].name, "EXTEND") == NULL) &&
- (strstr(insCfg->keywords[i].name, "DATE ") == NULL))
- {
- sprintf((char*)keywLine, "%s=%s/%s", insCfg->keywords[i].name,
- insCfg->keywords[i].value,
- insCfg->keywords[i].comment);
- if (fits_write_record(oiFile, keywLine, &status) != 0)
- {
- fits_close_file(oiFile, &status);
- amdlibOiReturnError(routine, "completing main header");
- }
- }
- }
-
- if (fits_update_key(oiFile, TSTRING, "HIERARCH ESO PRO CATG",
- "SCIENCE_REDUCED", "", &status) != 0)
- {
- amdlibOiReturnError(routine, "HIERARCH ESO PRO CATG");
- }
- }
-
-#endif
-
- /* Add amdlib version */
- amdlibGetVersion(version);
- if (fits_update_key(oiFile, TSTRING, (char *)"HIERARCH ESO OCS DRS VERSION",
- version,
- (char *)"Data Reduction SW version", &status) != 0)
- {
- amdlibOiReturnError(routine, "HIERARCH ESO OCS DRS VERSION");
- }
-
- /* Close FITS file */
- if (fits_close_file(oiFile, &status))
- {
- amdlibOiReturnError(routine,"closing file");
- }
-
- return (amdlibSUCCESS);
-}
-
-
-static cpl_propertylist * SelectorCreateProduct( const char * fctid, char * szRawFile,
- int iIsScience, char * szProductFile, cpl_propertylist * qclist,
- cpl_frameset * framelist, cpl_parameterlist * parlist,
- const char * recipename)
- {
- int iStatus = 0;
- char szMessage[1024];
- char szFilenameProduct[1024];
-
- cpl_table * pTable;
- cpl_propertylist * pTableHeader;
- int iTable;
- int iError;
- cpl_frame * cur_frame=NULL;
-
-
-
-
- cur_frame = cpl_frameset_get_first(framelist);
- while(cur_frame)
- {
- /* Check the right filename */
- if (strcmp((char*)cpl_frame_get_filename(cur_frame), szRawFile)) {
- cur_frame = cpl_frameset_get_next( framelist );
- continue;
- }
- else{
- cpl_msg_info(cpl_func, "Inheriting Header from: %s",
- cpl_frame_get_filename(cur_frame));
- break;
- }
- }
-
-
- /*cpl_frame * pFrame;*/
- /*cpl_propertylist * pHeader;*/
-
- /* For DFS fill Header function later */;
- /* pHeader = cpl_propertylist_new(); */
- /*pFrame = cpl_frame_new();*/
-
- strcpy( szFilenameProduct, szProductFile );
-
- pFrame = cpl_frame_new();
-
- if( pFrame )
- {
- cpl_frame_set_filename( pFrame, szFilenameProduct );
- cpl_frame_set_type( pFrame, CPL_FRAME_TYPE_TABLE );
-
- if( iIsScience )
- cpl_frame_set_tag( pFrame, "SCIENCE_REDUCED_FILTERED" );
- else
- cpl_frame_set_tag( pFrame, "CALIB_REDUCED_FILTERED" );
-
- cpl_frame_set_group( pFrame, CPL_FRAME_GROUP_PRODUCT );
- cpl_frame_set_level( pFrame, CPL_FRAME_LEVEL_FINAL );
- }
- else
- {
- cpl_msg_info( fctid, "No memory for product frame." );
- iStatus = 15;
- }
-
- /*
- sprintf( szMessage, "cpl_frame_set (\"%s\")", cpl_frame_get_filename(pframeSCIENCE[iProductNumber]) );
- cpl_msg_info( fctid, "%s", szMessage );
- */
-
- /*
- * Create the Product file, start with filling the header
- *
- * Attention: for the time of this workaround for cpl 3D tables the amdlib must
- * be patched to NOT create OWN files, but APPEND to existing ones!!
- *
- * see comment below
- *
- */
-
-
- /*
- * Workaround for cpl_dfs_setup_product_header picking the wrong Header in this CPL release and
- * also might pick the wrong in the future! It uses the first RAW frame, but this recipe can handle
- * many raw frames. Hence:
- *
- * Read the Header of the RAW file to be written as a product and send it to the function
- */
-
- /*
- sprintf( szMessage, "Extracting product header from file %s.", szRawFile );
- cpl_msg_info( fctid, "%s", szMessage );
- */
-
- pHeader = cpl_propertylist_load( szRawFile, 0 );
-
-
-
- /* Add the necessary DFS fits header information to the product */
-#if defined CPL_VERSION_CODE && CPL_VERSION_CODE >= CPL_VERSION(4, 8, 0)
- if( cpl_dfs_setup_product_header( pHeader,
- pFrame,
- framelist,
- parlist,
- recipename, /* const char * recid, */
- PACKAGE "/" PACKAGE_VERSION, /* const char * pipeline_id, */
- PRODUCT_DID, /* const char * dictionary_id */
- cur_frame
- ) != CPL_ERROR_NONE )
- {
- /* Error */
- sprintf( szMessage, "Error in setting up the product header." );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = 16;
- }
-#else
- if( cpl_dfs_setup_product_header( pHeader,
- pFrame,
- framelist,
- parlist,
- recipename, /* const char * recid, */
- PACKAGE "/" PACKAGE_VERSION, /* const char * pipeline_id, */
- PRODUCT_DID /* const char * dictionary_id */
- ) != CPL_ERROR_NONE )
- {
- /* Error */
- sprintf( szMessage, "Error in setting up the product header." );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = 16;
- }
-#endif
-
-
-
-
- /* Erase all old QC parameter */
- cpl_propertylist_erase_regexp(pHeader, "^ESO QC FRAMES SELECTED SNRGT2", 0);
- cpl_propertylist_erase_regexp(pHeader, "^ESO QC FRAMES SELECTED PERCENT", 0);
- /* cpl_propertylist_erase_regexp(pHeader, "^ESO QC *", 0); */
-
- /* Append new QC parameter */
- cpl_propertylist_copy_property_regexp(pHeader, qclist, "^ESO QC",0);
- /* cpl_propertylist_append(pHeader,qclist); */
-
-
-
-
- /* Write the product including proper DFS header*/
-
- pTable = NULL;
- pTableHeader = NULL;
- iTable = 1;
- iError = CPL_ERROR_NONE;
-
- /*
- sprintf( szMessage, "Creating product file %s...", szFilenameProduct );
- cpl_msg_info( fctid, "%s", szMessage );
- */
-
- /*
- * Workaround:
- * CPL cannot handle 3D-tables, hence, write just the header to a fits file and let
- * the amdlibWriteOI just append the data (and not create a whole file as intended by amdlib design
- * see Module amdlibWriteOI.c
- */
-
-
- cpl_image_save(NULL, szFilenameProduct, CPL_BPP_IEEE_FLOAT, pHeader, CPL_IO_DEFAULT );
-
-
- if (CPL_ERROR_NONE != cpl_image_save(NULL, szFilenameProduct, CPL_BPP_16_SIGNED, pHeader, CPL_IO_DEFAULT ))
- {
- cpl_msg_error(cpl_func,"Error in cpl_image_save");
- }
-
-
- if (cpl_error_get_code() != CPL_ERROR_NONE) {
- cpl_msg_error(cpl_func, "%s():%d: An error is already set: %s",
- cpl_func, __LINE__, cpl_error_get_where());
- cpl_error_get_message();
- }
-
-
-
- return pHeader;
- }
-
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Setup of a new array of selected frames
- @param
- @return 0 if everything is ok
-
-
- */
-/*----------------------------------------------------------------------------*/
-static void SetupSelected( int iInclude, amdlibSELECTION * selectedFrames, amdlibVIS * vis, amdlibBAND band)
-{
- /* Loop through frames and count good ones */
- int iFrame = 0;
- int iBase = 0;
-
- for (iFrame = 0; iFrame < vis->nbFrames; iFrame++)
- {
- for( iBase = 0; iBase < vis->nbBases; iBase++)
- {
- /* In case we later want to "include" files, all the others must be "excluded" */
- if( iInclude )
- selectedFrames->band[band].isSelectedPt[iBase][iFrame] = amdlibFALSE;
- else
- selectedFrames->band[band].isSelectedPt[iBase][iFrame] = amdlibTRUE;
-
- } /* For all bases */
- } /* for all frames */
-}
-
-int amber_selector_lib(double x1, double x2, double x3, int ANDselection,
- const char * szMethod, const char * inname, const char * outname,
- int iIsScience, cpl_frameset * framelist, cpl_parameterlist * parlist,
- const char * recipename)
-{
-
- /* CPL structures */
- cpl_frameset * cur_set;
-
- char szMessage[1024];
- char * szFilnameOI=NULL;
- char szProductfile[1024];
- char szASCII[1024];
- const char * outname_selector_paf=NULL;
- char szCommand[1024];
- char szBuffer[1204];
- char * pszFilename;
- char * pszFileTag;
- FILE * fp = NULL;
- int iStatus;
- int base;
- int iInclude;
- int iSelFrame;
- int iAverage;
- int iFramesLeft;
- int iFrameIsGood;
- double fThreshold[3];
- amdlibSELECTION selectedFrames;
- /*
- const char * tag ;
- int nframes ;
- int i ;
- */
- const char * fctid = "amber_selector";
- int iTotal;
- int iFrame;
- int iFittingFrame;
- double dLowSNR;
- double dHighSNR;
- double dFringeSNR;
- int bFrameOK;
- amdlibCPT_VIS_OPTIONS visOptions;
- amdlibBAND band;
- int iReal;
- cpl_propertylist * pHeader_tmp;
- cpl_vector * MaxSnrArray[3];
- double MaxSnrArray_at_fThreshold[3];
- cpl_vector * MaxOpdArray[3];
- double MaxOpdArray_at_fThreshold[3];
- double frameSelectionRatio[3];
- amdlibPHOTOMETRY_TABLE_ENTRY **photTablePtr = NULL;
- int iBase=0;
- int index =0;
- int index2 =0;
- int iWlen =0;
- amdlibBOOLEAN select[amdlibNBASELINE] = {amdlibTRUE, amdlibTRUE, amdlibTRUE};
- cpl_propertylist * qclist;
-
- cpl_propertylist * pHeader;
-
- iStatus = 0;
- base = 0;
- iInclude = 0;
- iSelFrame = 0;
- iAverage = 0;
- iFramesLeft = 0;
- iFrameIsGood = 0;
-
- fThreshold[0] = x1;
- fThreshold[1] = x2;
- fThreshold[2] = x3;
-
- cur_set = NULL;
- pszFilename = NULL;
- pszFileTag = NULL;
-
-
-
- strcpy(szProductfile, outname);
-
-
- cpl_msg_info( fctid, "Start of DataReduction");
-
- szFilnameOI = cpl_sprintf("%s",inname);
- if( iIsScience != -1 )
- {
- amdlibClearInsCfg(&insCfg);
- /*if( amdlibLoadOiFile( szFilnameOI, &insCfg, &array, &target, &photometry,
- &vis, &vis2, &vis3, &wave, &pst, errMsg ) == amdlibSUCCESS )
-
-
- amdlib NEVER returns amdlibSUCCESS here?!?
- */
-
- /* iStatus = amdlibLoadOiFile( szFilnameOI, &insCfg, &array,
- * &target, &photometry, &vis, &vis2, &vis3, &wave, &pst, errMsg ); */
- iStatus = amdlibLoadOiFile( szFilnameOI, &insCfg, &array, &target,
- &photometry, &vis, &vis2, &vis3, &wave, &pst, &spectrum,errMsg);
-
-
- if(photometry.thisPtr==NULL || pst.thisPtr==NULL || spectrum.thisPtr==NULL)
- {
- if(photometry.thisPtr==NULL) cpl_msg_error(cpl_func,"problems in "
- "reading the photometry structure");
- if(pst.thisPtr ==NULL) cpl_msg_error(cpl_func,"problems in "
- "reading the piston structure");
- if(spectrum.thisPtr ==NULL) cpl_msg_error(cpl_func,"problems in "
- "reading the spectrum structure");
- cpl_msg_info( cpl_func, "Amdlib error message: %s", errMsg );
-
- /* Reset error message */
- memset(errMsg, '\0', sizeof(amdlibERROR_MSG));
-
- /*Release the memory*/
- if(array.thisPtr !=NULL) amdlibReleaseOiArray(&array);
- if(target.thisPtr !=NULL) amdlibReleaseOiTarget(&target);
- if(photometry.thisPtr !=NULL) amdlibReleasePhotometry(&photometry);
- if(vis.thisPtr !=NULL) amdlibReleaseVis(&vis);
- if(vis2.thisPtr !=NULL) amdlibReleaseVis2(&vis2);
- if(vis3.thisPtr !=NULL) amdlibReleaseVis3(&vis3);
- if(wave.thisPtr !=NULL) amdlibReleaseWavelength(&wave);
- if(spectrum.thisPtr !=NULL) amdlibReleaseSpectrum(&spectrum);
- if(pst.thisPtr !=NULL) amdlibReleasePiston(&pst);
- cpl_free(szFilnameOI);
- return amdlibFAILURE;
-
- }
-
- /*sprintf( szMessage, "%d", iStatus );
- cpl_msg_info( fctid, "%s", szMessage );*/
-
- /* 1 seems to be a warning ?!? */
- if( iStatus == amdlibSUCCESS /* || iStatus == 1*/ )
- {
-
- /* Reset to OK - no error */
- iStatus = 0;
-
-
- sprintf ( szMessage, "Status: %d for input file %s [%s]", iStatus, szFilnameOI, errMsg );
- cpl_msg_info( fctid, "%s", szMessage );
-
- /* Count number of frames */
- iTotal = vis.nbFrames * vis.nbBases;
- sprintf( szMessage, "Number of Frames = %d giving %d Visibilities", iTotal / vis.nbBases, iTotal );
- cpl_msg_info( fctid, "%s", szMessage );
-
- /* Count frames for Photometry and Piston */
-
- sprintf( szMessage, "Photometry: %d / Piston: %d", photometry.nbFrames, pst.nbFrames );
- cpl_msg_info( fctid, "%s", szMessage );
-
-
- /* Count Frames with Fringe SNR greater than xxx */
- iFrame = 0;
- iFittingFrame = 0;
- dLowSNR = 99999999.9;
- dHighSNR = 0;
- dFringeSNR = 0;
- bFrameOK = 0;
-
- /* Setup the default Options for Storing and Frame Selection */
-
- /* Number of frames used to measure a visibility in output */
- visOptions.binSize=1;
- /* Noise computation type */
- visOptions.errorType=amdlibSTATISTICAL_ERROR;
- /* Piston computation type */
- visOptions.pistonType=amdlibUNWRAPPED_PHASE;
- /* Forces to use the given p2vm even if its id is not OK */
- visOptions.noCheckP2vmId=1;
- /* Frame selection */
- visOptions.frameSelectionType=amdlibNO_FRAME_SEL;
- /* Percentage of frames to be selected */
- visOptions.frameSelectionRatio=fThreshold[0];
-
- /* Orig: visOptions = { 1, amdlibSTATISTICAL_ERROR, amdlibUNWRAPPED_PHASE, 1, amdlibNO_FRAME_SEL, fThreshold }; */
-
- /* amdlibBAND band = amdlibK_BAND; */
- band = amdlibH_BAND;
-
- /* Test the band */
- band = amdlibGetBand(wave.wlen[0]);
- /* printf( "The band oben is : %d \n", band ); */
- /*
- if (amdlibGetBand(wave.wlen[wave.nbWlen-1]) != band)
- {
- sprintf ( szMessage, "Sorry, frame selection is only possible for one band. This data contains more than one band" );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = 666;
- }
- */
-
-
- /* Method 1: Take the first x frames only */
- if( !strcmp( szMethod, selMethod1 ) )
- {
- ; /* No corresponding amdlib selection */
- }
- /* Method 2: Fringe_SNR_gt_x */
- else if( !strcmp( szMethod, selMethod2 ) )
- {
- visOptions.frameSelectionType = amdlibFRG_CONTRAST_SEL_THR;
- }
- /* Method 3: Fringe_SNR_percentage_x */
- else if( !strcmp( szMethod, selMethod3 ) )
- {
- visOptions.frameSelectionType = amdlibFRG_CONTRAST_SEL_PCG;
- fThreshold[0] /= 100.0;
- fThreshold[1] /= 100.0;
- fThreshold[2] /= 100.0;
- }
- /* Method 4: Flux_gt_x */
- else if( !strcmp( szMethod, selMethod4 ) )
- {
- visOptions.frameSelectionType = amdlibFLUX_SEL_THR;
- }
- /* Method 5: Flux_percentage_x */
- else if( !strcmp( szMethod, selMethod5 ) )
- {
- visOptions.frameSelectionType = amdlibFLUX_SEL_PCG;
- fThreshold[0] /= 100.0;
- fThreshold[1] /= 100.0;
- fThreshold[2] /= 100.0;
-
- }
- /* Method 9: Absolute_piston_value_lt_x */
- else if( !strcmp( szMethod, selMethod9 ) )
- {
- visOptions.frameSelectionType = amdlibOPD_SEL_THR;
- }
-
- /* Method 10: Absolute_piston_value_percentage_x */
- else if( !strcmp( szMethod, selMethod10 ) )
- {
- visOptions.frameSelectionType = amdlibOPD_SEL_PCG;
- fThreshold[0] /= 100.0;
- fThreshold[1] /= 100.0;
- fThreshold[2] /= 100.0;
- }
-
- /* Frame selection */
- {
- sprintf( szMessage, "Now selecting ..." );
- cpl_msg_info( fctid, "%s", szMessage );
-
- amdlibAllocateSelection( &selectedFrames, vis.nbFrames,vis.nbBases,errMsg );
-
- /* Method 8 */
- if( !strcmp( szMethod, selMethod8 ) )
- {
- /* Include all frames */
- iInclude = 0;
- SetupSelected( iInclude, &selectedFrames, &vis , band);
-
- sprintf( szMessage, "All frames have been selected for testing purpose." );
- cpl_msg_info( fctid, "%s", szMessage );
- }
-
- /* Method 2 */
- if( !strcmp( szMethod, selMethod2 ) )
- {
- /* Select first x frames */
- if( fThreshold[0] < 0 || fThreshold[1] < 0 || fThreshold[2] < 0 )
- {
- /* No negative or Zero values for that method */
- iStatus = 5;
-
- sprintf( szMessage, "This method does not allow thresholds less or equal to zero." );
- cpl_msg_error( fctid, "%s", szMessage );
- }
-
- if( !iStatus )
- {
- /* Invalidate all frames first for later inclusion */
- iInclude = 1;
- SetupSelected( iInclude, &selectedFrames, &vis ,band);
-
- /* Include all Frames with Fringe_SNR_gt_x */
- for (iFrame = 0; iFrame < vis.nbFrames; iFrame++)
- {
- iReal=iFrame*vis.nbBases;
- iFrameIsGood = 0;
-
- if(ANDselection==1){
- if( vis.nbBases == 3 &&
- (vis.table[iReal].frgContrastSnrArray[band] > fThreshold[0] &&
- vis.table[iReal+1].frgContrastSnrArray[band] > fThreshold[1] &&
- vis.table[iReal+2].frgContrastSnrArray[band] > fThreshold[2]))
- iFrameIsGood = 1;
- }
-
- if(ANDselection==0){
- if( vis.nbBases == 3 &&
- (vis.table[iReal].frgContrastSnrArray[band] > fThreshold[0] ||
- vis.table[iReal+1].frgContrastSnrArray[band] > fThreshold[1] ||
- vis.table[iReal+2].frgContrastSnrArray[band] > fThreshold[2]))
- iFrameIsGood = 1;
- }
-
- if( vis.nbBases == 1 &&
- (vis.table[iReal].frgContrastSnrArray[band] > fThreshold[0]))
- iFrameIsGood = 1;
-
- /* Set all three bases to inlcude */
-
- if( iFrameIsGood){
- for( base = 0; base < vis.nbBases; base++){
- selectedFrames.band[band].isSelectedPt[base][iFrame] = amdlibTRUE;
- /* cpl_msg_info(cpl_func,"iFrame: %d Base: %d vis.table[iFrame].frgContrastSnrArray[band]: %f vis.table[iFrame+base].vis[band]: %f %f", */
- /* iFrame, base, vis.table[iFrame].frgContrastSnrArray[band], */
- /* vis.table[iFrame].vis->re, vis.table[iFrame].vis->im); */
- }
- }
- } /* for all frames */
- } /* if still OK */
- } /* Method 2 */
-
-
- /* Method 3 */
- if( !strcmp( szMethod, selMethod3 ) )
- {
- /* "Fringe_SNR_percentage_x" */
- if( fThreshold[0] < 0. || fThreshold[1] < 0. || fThreshold[2] < 0. || fThreshold[0] > 1. || fThreshold[1] > 1. || fThreshold[2] > 1.)
- {
- /* No negative or Zero values for that method */
- iStatus = 5;
-
- sprintf( szMessage, "This method does not allow thresholds less to zero or larger than 100" );
- cpl_msg_error( fctid, "%s", szMessage );
- }
-
- if( !iStatus )
- {
- /* Invalidate all frames first for later inclusion */
- iInclude = 1;
- SetupSelected( iInclude, &selectedFrames, &vis ,band);
-
- /* Include all Frames with Fringe_SNR_gt_x Percent*/
-
-
- /* Deriving a vector with the the Fringe contrast.
- * If three Baselines are available, the maximum of
- * the fringe contrast of ths three baselines is
- * assigned to the vector. */
-
-
- MaxSnrArray[0]=cpl_vector_new(vis.nbFrames);
- cpl_vector_fill (MaxSnrArray[0], 0.);
-
- MaxSnrArray[1]=cpl_vector_new(vis.nbFrames);
- cpl_vector_fill (MaxSnrArray[1], 0.);
-
- MaxSnrArray[2]=cpl_vector_new(vis.nbFrames);
- cpl_vector_fill (MaxSnrArray[2], 0.);
-
-
-
- /* Derive a vector including the maximum frgContrastSnr if there are 3 baselines ... */
- for (iFrame = 0; iFrame < vis.nbFrames; iFrame++)
- {
- iReal=iFrame*vis.nbBases;
-
- if(vis.nbBases == 3){
- cpl_vector_set(MaxSnrArray[0], iFrame, vis.table[iReal].frgContrastSnrArray[band]);
- cpl_vector_set(MaxSnrArray[1], iFrame, vis.table[iReal+1].frgContrastSnrArray[band]);
- cpl_vector_set(MaxSnrArray[2], iFrame, vis.table[iReal+2].frgContrastSnrArray[band]);
-
- }
- else if (vis.nbBases == 1){
- cpl_vector_set(MaxSnrArray[0], iFrame, vis.table[iReal].frgContrastSnrArray[band]);
- }
-
- }
-
-
- /* sort by decreasing data */
- cpl_vector_sort(MaxSnrArray[0],-1);
- cpl_vector_sort(MaxSnrArray[1],-1);
- cpl_vector_sort(MaxSnrArray[2],-1);
-
- /* Get the fringe-contrast value at the fThreshold level */
- /* fThreshold /= 100.0; */
-
- MaxSnrArray_at_fThreshold[0]=cpl_vector_get(MaxSnrArray[0], (int)floor((vis.nbFrames-1)*fThreshold[0]));
- MaxSnrArray_at_fThreshold[1]=cpl_vector_get(MaxSnrArray[1], (int)floor((vis.nbFrames-1)*fThreshold[1]));
- MaxSnrArray_at_fThreshold[2]=cpl_vector_get(MaxSnrArray[2], (int)floor((vis.nbFrames-1)*fThreshold[2]));
-
-
- if (fThreshold[0]>=1) MaxSnrArray_at_fThreshold[0]=-FLT_MAX;
- if (fThreshold[1]>=1) MaxSnrArray_at_fThreshold[1]=-FLT_MAX;
- if (fThreshold[2]>=1) MaxSnrArray_at_fThreshold[2]=-FLT_MAX;
-
- if (fThreshold[0]<=0) MaxSnrArray_at_fThreshold[0]=FLT_MAX;
- if (fThreshold[1]<=0) MaxSnrArray_at_fThreshold[1]=FLT_MAX;
- if (fThreshold[2]<=0) MaxSnrArray_at_fThreshold[2]=FLT_MAX;
-
- cpl_msg_info(cpl_func,"SNR threshold for baseline 1: %g",MaxSnrArray_at_fThreshold[0]);
- cpl_msg_info(cpl_func,"SNR threshold for baseline 2: %g",MaxSnrArray_at_fThreshold[1]);
- cpl_msg_info(cpl_func,"SNR threshold for baseline 3: %g",MaxSnrArray_at_fThreshold[2]);
-
-
-
- /* cpl_vector_dump(MaxSnrArray, stdout); */
-
- for (iFrame = 0; iFrame < vis.nbFrames; iFrame++)
- {
- iReal=iFrame*vis.nbBases;
- iFrameIsGood = 0;
-
- if(ANDselection==1){
- if( vis.nbBases == 3 &&
- (vis.table[iReal].frgContrastSnrArray[band] >= MaxSnrArray_at_fThreshold[0] &&
- vis.table[iReal+1].frgContrastSnrArray[band] >= MaxSnrArray_at_fThreshold[1] &&
- vis.table[iReal+2].frgContrastSnrArray[band] >= MaxSnrArray_at_fThreshold[2]))
- iFrameIsGood = 1;
- }
-
- if(ANDselection==0){
- if( vis.nbBases == 3 &&
- (vis.table[iReal].frgContrastSnrArray[band] >= MaxSnrArray_at_fThreshold[0] ||
- vis.table[iReal+1].frgContrastSnrArray[band] >= MaxSnrArray_at_fThreshold[1] ||
- vis.table[iReal+2].frgContrastSnrArray[band] >= MaxSnrArray_at_fThreshold[2]))
- iFrameIsGood = 1;
- }
-
-
- if( vis.nbBases == 1 &&
- (vis.table[iReal].frgContrastSnrArray[band] >= MaxSnrArray_at_fThreshold[0]))
- iFrameIsGood = 1;
-
- /* Set all three bases to inlcude */
-
- if( iFrameIsGood){
- for( base = 0; base < vis.nbBases; base++){
- selectedFrames.band[band].isSelectedPt[base][iFrame] = amdlibTRUE;
- /* cpl_msg_info(cpl_func,"iFrame: %d Base: %d vis.table[iFrame].frgContrastSnrArray[band]: %f vis.table[iFrame+base].vis[band]: %f %f", */
- /* iFrame, base, vis.table[iFrame].frgContrastSnrArray[band], */
- /* vis.table[iFrame].vis->re, vis.table[iFrame].vis->im); */
- }
- }
- } /* for all frames */
- cpl_vector_delete(MaxSnrArray[0]);
- cpl_vector_delete(MaxSnrArray[1]);
- cpl_vector_delete(MaxSnrArray[2]);
-
- } /* if still OK */
- } /* Method 3 */
-
-
-
-
- /* Method 4 */
- if( !strcmp( szMethod, selMethod4 ) || !strcmp( szMethod, selMethod5 ))
- {
-
-
- frameSelectionRatio[0]=fThreshold[0];
- frameSelectionRatio[1]=fThreshold[1];
- frameSelectionRatio[2]=fThreshold[2];
-
- /* Wrap phot table */
- photTablePtr =
- (amdlibPHOTOMETRY_TABLE_ENTRY **)amdlibWrap2DArray(photometry.table,
- photometry.nbBases, photometry.nbFrames,
- sizeof(amdlibPHOTOMETRY_TABLE_ENTRY),
- errMsg);
- if (photTablePtr == NULL)
- {
- return amdlibFAILURE;
- }
- /* Allocate memory for temporary arrays */
- for (iBase = 0; iBase < photometry.nbBases; iBase++)
- {
- tmpArray[iBase] = cpl_calloc(selectedFrames.band[band].nbSelectedFrames[iBase],
- sizeof(double));
- if (tmpArray[iBase] == NULL)
- {
- amdlibSetErrMsg("Could not allocate memory for temporary buffer");
- return amdlibFAILURE;
- }
- }
- /* Loop on frames, insert flux criterion in the temporary array
- * for each baseline. Flux criterion is here
- * sqrt(Pi*Pj)/signedsqrt(fluxPi+fluxPj+npix*RON^2)
- * (summed over spectrum = all lambdas)
- */
- for (iBase = 0; iBase < photometry.nbBases; iBase++)
- {
- index = 0;
- for (iFrame = 0; iFrame < photometry.nbFrames; iFrame++)
- {
- if (selectedFrames.band[band].isSelectedPt[iBase][iFrame] == amdlibTRUE)
- {
- /* FIXME: handle of not a number:
- they should not appear here ! */
- index2=0;
-
- for (iWlen = 0; iWlen < photometry.nbWlen; iWlen++)
- {
- if(!isnan(photTablePtr[iFrame][iBase].sigma2FluxSumPiPj[iWlen]))
- {
- tmpArray[iBase][index] +=
- amdlibSignedSqrt(photTablePtr[iFrame][iBase].PiMultPj[iWlen])
- / amdlibSignedSqrt(photTablePtr[iFrame][iBase].sigma2FluxSumPiPj[iWlen]);
- index2++;
- }
- }
- /* bugfix: sqrt(nbWlen) instead of nbWlen (changed by
- index for nans handling) */
- tmpArray[iBase][index] /= sqrt(index2);
- /* cpl_msg_info(cpl_func,"iBase %5d index %5d tmpArray[iBase][index] %f",iBase, index, tmpArray[iBase][index]); */
- index++;
- }
- }
- }
-
-
- if (visOptions.frameSelectionType == amdlibFLUX_SEL_THR)
- {
- for (iBase = 0; iBase < photometry.nbBases; iBase++)
- {
- threshold[iBase] = frameSelectionRatio[iBase];
- }
- }
- else if (visOptions.frameSelectionType == amdlibFLUX_SEL_PCG)
- {
- /* Sort these temporary arrays and get associated thresholds */
- for (iBase = 0; iBase < photometry.nbBases; iBase++)
- {
- if (frameSelectionRatio[iBase]<=0){
- threshold[iBase]=FLT_MAX;
- }
- if (frameSelectionRatio[iBase]>0 && amdlibGetThresholdESO(tmpArray[iBase],
- selectedFrames.band[band].nbSelectedFrames[iBase],
- frameSelectionRatio[iBase],
- &threshold[iBase],
- errMsg) != amdlibSUCCESS)
- {
- amdlibLogWarning("Could not get threshold associated to "
- "the frameSelectionRatio");
- amdlibLogWarningDetail(errMsg);
- amdlibLogWarning("Could not perform frame selection on "
- "baseline %d in band %c",
- iBase+1, amdlibBandNumToStr(band));
- select[iBase] = amdlibFALSE;
- }
-
- cpl_msg_info(cpl_func,"Flux threshold for baseline %d: %g",iBase,threshold[iBase]);
- }
-
- }
-
- /* cpl_msg_info(cpl_func,"Threshold0: %f Threshold1: %f Threshold2: %f",threshold[0], threshold[1], threshold[2]); */
- /* Invalidate all frames first for later inclusion */
- iInclude = 1;
- SetupSelected( iInclude, &selectedFrames, &vis ,band);
-
-
-
- if( !strcmp( szMethod, selMethod4 ))
- {
-
-
- /* Include all Frames with Flux_gt_x */
- for (iFrame = 0; iFrame < vis.nbFrames; iFrame++)
- {
- iReal=iFrame*vis.nbBases;
- iFrameIsGood = 0;
-
- if(ANDselection==1){
- if( vis.nbBases == 3 &&
- (tmpArray[0][iFrame] > threshold[0] &&
- tmpArray[1][iFrame] > threshold[1] &&
- tmpArray[2][iFrame] > threshold[2]))
- iFrameIsGood = 1;
- }
- if(ANDselection==0){
- if( vis.nbBases == 3 &&
- (tmpArray[0][iFrame] > threshold[0] ||
- tmpArray[1][iFrame] > threshold[1] ||
- tmpArray[2][iFrame] > threshold[2]))
- iFrameIsGood = 1;
- }
-
- if( vis.nbBases == 1 &&
- (tmpArray[0][iFrame] > threshold[0]))
- iFrameIsGood = 1;
-
- /* Set all three bases to inlcude */
-
- if( iFrameIsGood){
- for( base = 0; base < vis.nbBases; base++){
- selectedFrames.band[band].isSelectedPt[base][iFrame] = amdlibTRUE;
- /* cpl_msg_info(cpl_func,"iFrame: %d Base: %d vis.table[iFrame].frgContrastSnrArray[band]: %f vis.table[iFrame+base].vis[band]: %f %f", */
- /* iFrame, base, vis.table[iFrame].frgContrastSnrArray[band], */
- /* vis.table[iFrame].vis->re, vis.table[iFrame].vis->im); */
- }
- }
- } /* for all frames */
- }
-
- if( !strcmp( szMethod, selMethod5 ))
- {
-
- /* Include all Frames with Flux_percentage_x */
- for (iFrame = 0; iFrame < vis.nbFrames; iFrame++)
- {
- iReal=iFrame*vis.nbBases;
- iFrameIsGood = 0;
-
- if(ANDselection==1){
- if( vis.nbBases == 3 &&
- (tmpArray[0][iFrame] >= threshold[0] &&
- tmpArray[1][iFrame] >= threshold[1] &&
- tmpArray[2][iFrame] >= threshold[2]))
- iFrameIsGood = 1;
- }
- if(ANDselection==0){
- if( vis.nbBases == 3 &&
- (tmpArray[0][iFrame] >= threshold[0] ||
- tmpArray[1][iFrame] >= threshold[1] ||
- tmpArray[2][iFrame] >= threshold[2]))
- iFrameIsGood = 1;
- }
-
- if( vis.nbBases == 1 &&
- (tmpArray[0][iFrame] >= threshold[0]))
- iFrameIsGood = 1;
-
- /* Set all three bases to inlcude */
-
- if( iFrameIsGood){
- for( base = 0; base < vis.nbBases; base++){
- selectedFrames.band[band].isSelectedPt[base][iFrame] = amdlibTRUE;
- /* cpl_msg_info(cpl_func,"iFrame: %d Base: %d vis.table[iFrame].frgContrastSnrArray[band]: %f vis.table[iFrame+base].vis[band]: %f %f", */
- /* iFrame, base, vis.table[iFrame].frgContrastSnrArray[band], */
- /* vis.table[iFrame].vis->re, vis.table[iFrame].vis->im); */
- }
- }
- } /* for all frames */
-
- }
-
-
-
-
- /* /\* Loop on frames and stamp the good ones ( criterion upper than */
- /* * threshold) *\/ */
-
-
- /* for (iBase = 0; iBase < photometry.nbBases; iBase++) */
- /* { */
- /* if (select[iBase] == amdlibTRUE) */
- /* { */
- /* index = 0; */
- /* for (iFrame = 0; iFrame < photometry.nbFrames; iFrame++) */
- /* { */
- /* if (selectedFrames.band[band].isSelectedPt[iBase][iFrame] == amdlibTRUE) */
- /* { */
- /* if (tmpArray[iBase][index] < threshold[iBase]) */
- /* { */
- /* selectedFrames.band[band].isSelectedPt[iBase][iFrame] = amdlibFALSE; */
- /* selectedFrames.band[band].nbSelectedFrames[iBase]--; */
- /* } */
- /* index++; */
- /* } */
- /* } */
- /* } */
- /* /\* In the case no selection was possible, set all frames to false *\/ */
- /* else */
- /* { */
- /* for (iFrame = 0; iFrame < photometry.nbFrames; iFrame++) */
- /* { */
- /* selectedFrames.band[band].isSelectedPt[iBase][iFrame] = amdlibFALSE; */
- /* } */
- /* selectedFrames.band[band].nbSelectedFrames[iBase] = 0; */
- /* } */
- /* } */
-
-
-
- for (iBase = 0; iBase < photometry.nbBases; iBase++)
- {
- cpl_free(tmpArray[iBase]);
- }
- amdlibFree2DArrayWrapping((void **)photTablePtr);
- }
-
-
-
-
-
-
-
-
- /* Method 8 */
- if( !strcmp( szMethod, selMethod8 ) )
- {
- /* Include all frames */
- iInclude = 0;
- SetupSelected( iInclude, &selectedFrames, &vis ,band);
-
- sprintf( szMessage, "All frames have been selected for testing purpose." );
- cpl_msg_info( fctid, "%s", szMessage );
- }
-
- /* Method 1 */
- if( !strcmp( szMethod, selMethod1 ) )
- {
- /* Select first x frames */
- if( fThreshold[0] <= 0 )
- {
- /* No negative or Zero values for that method */
- iStatus = 5;
-
- sprintf( szMessage, "This method does not allow thresholds less or equal to zero." );
- cpl_msg_error( fctid, "%s", szMessage );
- }
-
- if( fThreshold[0] > vis.nbFrames )
- {
- /* Threshold too high */
- iStatus = 6;
-
- sprintf( szMessage, "This method does not allow thresholds greater than the total number of frames." );
- cpl_msg_error( fctid, "%s", szMessage );
- }
-
- if( !iStatus )
- {
- /* Invalidate all frames first for later inclusion */
- iInclude = 1;
- SetupSelected( iInclude, &selectedFrames, &vis ,band);
-
- /* Include first x Frames */
- for (iFrame = 0; iFrame < (int)fThreshold[0] ; iFrame++)
- {
- for( base = 0; base < vis.nbBases; base++)
- selectedFrames.band[band].isSelectedPt[base][iFrame] = amdlibTRUE;
-
- } /* for all frames */
- } /* if still OK */
-
- } /* Method 1 */
-
- /* Method 6 and 7 */
- if( !strcmp( szMethod, selMethod6 ) || !strcmp( szMethod, selMethod7 ) )
- {
- /* ASCII file selection */
- if( !strcmp( szMethod, selMethod7 ) )
- {
- iInclude = 1;
- strcpy( szASCII, "/tmp/amber_include.txt" );
- }
- else
- {
- iInclude = 0;
- strcpy( szASCII, "/tmp/amber_exclude.txt" );
- }
-
- SetupSelected( iInclude, &selectedFrames, &vis, band );
-
- sprintf( szMessage, "Default selection for ASCII file done..." );
- cpl_msg_info( fctid, "%s", szMessage );
-
- /* Open the ASCII file */
- fp = fopen( szASCII, "rt" );
-
- if( fp )
- {
- /* Walk through the file and exclude/include the given frames by their index number */
- while( !feof( fp ) )
- {
- fgets( szBuffer, sizeof(szBuffer)-2, fp );
-
- if( !feof( fp ) )
- {
- iSelFrame = atoi( szBuffer );
-
- if( iSelFrame < vis.nbFrames && iSelFrame >=1 )
- {
- /*
- sprintf( szMessage, "Found Frame %d in File %s.", iSelFrame, szASCII );
- cpl_msg_info( fctid, "%s", szMessage );
- */
-
- for( base = 0; base < vis.nbBases; base++ )
- {
- if( iInclude )
- selectedFrames.band[band].isSelectedPt[base][iSelFrame-1] = amdlibTRUE;
- else
- selectedFrames.band[band].isSelectedPt[base][iSelFrame-1] = amdlibFALSE;
- }
- }
- else
- {
- sprintf( szMessage, "Warning: Frame %d is out of Range and has been ignored.", iSelFrame );
- cpl_msg_info( fctid, "%s", szMessage );
- }
- } /* end of file ? */
-
- } /* While more lines in file */
- fclose( fp );
- }
- else
- {
- sprintf( szMessage, "Error: The File %s has not been found.", szASCII );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = 1;
- }
-
- /* Set Method of this manual selection to nothing particular*/
- visOptions.frameSelectionType = amdlibNO_FRAME_SEL;
- } /* Method 6 and 7 */
-
-
-
-
-
-
- /* Method 9 */
- if( !strcmp( szMethod, selMethod9 ) )
- {
- if( fThreshold[0] < 0 || fThreshold[1] < 0 || fThreshold[2] < 0 )
- {
- /* No negative or Zero values for that method */
- iStatus = 5;
-
- sprintf( szMessage, "This method does not allow thresholds less to zero." );
- cpl_msg_error( fctid, "%s", szMessage );
- }
-
- if( !iStatus )
- {
- /* Invalidate all frames first for later inclusion */
- iInclude = 1;
- SetupSelected( iInclude, &selectedFrames, &vis ,band);
-
- /* Include all frames with an absloute pisten value < x */
- for (iFrame = 0; iFrame < vis.nbFrames; iFrame++)
- {
- iReal=iFrame*vis.nbBases;
- iFrameIsGood = 0;
-
-
- if(ANDselection==1){
- if( vis.nbBases == 3 &&
- (fabs(pst.pistonOPDArray[band][iReal] * amdlibNM_TO_M) < fThreshold[0] &&
- fabs(pst.pistonOPDArray[band][iReal+1] * amdlibNM_TO_M) < fThreshold[1] &&
- fabs(pst.pistonOPDArray[band][iReal+2] * amdlibNM_TO_M) < fThreshold[2]))
- iFrameIsGood = 1;
- }
-
- if(ANDselection==0){
- if( vis.nbBases == 3 &&
- (fabs(pst.pistonOPDArray[band][iReal] * amdlibNM_TO_M) < fThreshold[0] ||
- fabs(pst.pistonOPDArray[band][iReal+1] * amdlibNM_TO_M) < fThreshold[1] ||
- fabs(pst.pistonOPDArray[band][iReal+2] * amdlibNM_TO_M) < fThreshold[2]))
- iFrameIsGood = 1;
- }
-
-
- if( vis.nbBases == 1 &&
- (fabs(pst.pistonOPDArray[band][iReal] * amdlibNM_TO_M) < fThreshold[0]))
- iFrameIsGood = 1;
-
- /* Set all three bases to inlcude */
-
- if( iFrameIsGood){
- for( base = 0; base < vis.nbBases; base++){
- selectedFrames.band[band].isSelectedPt[base][iFrame] = amdlibTRUE;
- }
- }
- } /* for all frames */
- } /* if still OK */
- } /* Method 9 */
-
-
-
-
-
-
-
-
- /* Method 10 */
- if( !strcmp( szMethod, selMethod10 ) )
- {
- /* "Fringe_SNR_percentage_x" */
- if( fThreshold[0] < 0. || fThreshold[1] < 0. || fThreshold[2] < 0. || fThreshold[0] > 1. || fThreshold[1] > 1. || fThreshold[2] > 1.)
- {
- /* This method does not allow thresholds less to zero or larger than 100 */
- iStatus = 5;
-
- sprintf( szMessage, "This method does not allow thresholds less than zero or larger than 100" );
- cpl_msg_error( fctid, "%s", szMessage );
- }
-
- if( !iStatus )
- {
- /* Invalidate all frames first for later inclusion */
- iInclude = 1;
- SetupSelected( iInclude, &selectedFrames, &vis ,band);
-
- /* Include all Frames with the absolute pisten value >= x Percent*/
- /* Deriving a vector with the the OPD. */
-
-
- MaxOpdArray[0]=cpl_vector_new(vis.nbFrames);
- cpl_vector_fill (MaxOpdArray[0], FLT_MAX);
-
- MaxOpdArray[1]=cpl_vector_new(vis.nbFrames);
- cpl_vector_fill (MaxOpdArray[1], FLT_MAX);
-
- MaxOpdArray[2]=cpl_vector_new(vis.nbFrames);
- cpl_vector_fill (MaxOpdArray[2], FLT_MAX);
-
-
-
- /* Derive a vector including the maximum pistonOPD if there are 3 baselines ... */
- for (iFrame = 0; iFrame < vis.nbFrames; iFrame++)
- {
- iReal=iFrame*vis.nbBases;
-
- if(vis.nbBases == 3){
- cpl_vector_set(MaxOpdArray[0], iFrame, fabs(pst.pistonOPDArray[band][iReal] * amdlibNM_TO_M));
- cpl_vector_set(MaxOpdArray[1], iFrame, fabs(pst.pistonOPDArray[band][iReal+1] * amdlibNM_TO_M));
- cpl_vector_set(MaxOpdArray[2], iFrame, fabs(pst.pistonOPDArray[band][iReal+2] * amdlibNM_TO_M));
-
- }
- else if (vis.nbBases == 1){
- cpl_vector_set(MaxOpdArray[0], iFrame, fabs(pst.pistonOPDArray[band][iReal] * amdlibNM_TO_M));
- }
-
- }
-
-
- /* sort by increasing data */
- cpl_vector_sort(MaxOpdArray[0],+1);
- cpl_vector_sort(MaxOpdArray[1],+1);
- cpl_vector_sort(MaxOpdArray[2],+1);
-
- /* Get the fringe-contrast value at the fThreshold level */
- /* fThreshold /= 100.0; */
-
- MaxOpdArray_at_fThreshold[0]=cpl_vector_get(MaxOpdArray[0], (int)floor((vis.nbFrames-1)*fThreshold[0]));
- MaxOpdArray_at_fThreshold[1]=cpl_vector_get(MaxOpdArray[1], (int)floor((vis.nbFrames-1)*fThreshold[1]));
- MaxOpdArray_at_fThreshold[2]=cpl_vector_get(MaxOpdArray[2], (int)floor((vis.nbFrames-1)*fThreshold[2]));
-
-
- if (fThreshold[0]>=1) MaxOpdArray_at_fThreshold[0]=FLT_MAX;
- if (fThreshold[1]>=1) MaxOpdArray_at_fThreshold[1]=FLT_MAX;
- if (fThreshold[2]>=1) MaxOpdArray_at_fThreshold[2]=FLT_MAX;
-
- if (fThreshold[0]<=0) MaxOpdArray_at_fThreshold[0]=FLT_MIN;
- if (fThreshold[1]<=0) MaxOpdArray_at_fThreshold[1]=FLT_MIN;
- if (fThreshold[2]<=0) MaxOpdArray_at_fThreshold[2]=FLT_MIN;
-
- cpl_msg_info(cpl_func,"Piston threshold for baseline 1: %g ",MaxOpdArray_at_fThreshold[0]);
- cpl_msg_info(cpl_func,"Piston threshold for baseline 2: %g ",MaxOpdArray_at_fThreshold[1]);
- cpl_msg_info(cpl_func,"Piston threshold for baseline 3: %g ",MaxOpdArray_at_fThreshold[2]);
-
-
-
- /* cpl_vector_dump(MaxOpdArray, stdout); */
-
- for (iFrame = 0; iFrame < vis.nbFrames; iFrame++)
- {
- iReal=iFrame*vis.nbBases;
- iFrameIsGood = 0;
-
- if(ANDselection==1){
- if( vis.nbBases == 3 &&
- (fabs(pst.pistonOPDArray[band][iReal] * amdlibNM_TO_M) <= MaxOpdArray_at_fThreshold[0] &&
- fabs(pst.pistonOPDArray[band][iReal+1] * amdlibNM_TO_M) <= MaxOpdArray_at_fThreshold[1] &&
- fabs(pst.pistonOPDArray[band][iReal+2] * amdlibNM_TO_M) <= MaxOpdArray_at_fThreshold[2]))
- iFrameIsGood = 1;
- }
-
- if(ANDselection==0){
- if( vis.nbBases == 3 &&
- (fabs(pst.pistonOPDArray[band][iReal] * amdlibNM_TO_M) <= MaxOpdArray_at_fThreshold[0] ||
- fabs(pst.pistonOPDArray[band][iReal+1] * amdlibNM_TO_M) <= MaxOpdArray_at_fThreshold[1] ||
- fabs(pst.pistonOPDArray[band][iReal+2] * amdlibNM_TO_M) <= MaxOpdArray_at_fThreshold[2]))
- iFrameIsGood = 1;
- }
-
- if( vis.nbBases == 1 &&
- (fabs(pst.pistonOPDArray[band][iReal] * amdlibNM_TO_M) <= MaxOpdArray_at_fThreshold[0]))
- iFrameIsGood = 1;
-
- /* Set all three bases to inlcude */
-
- if( iFrameIsGood){
- for( base = 0; base < vis.nbBases; base++){
- selectedFrames.band[band].isSelectedPt[base][iFrame] = amdlibTRUE;
- /* cpl_msg_info(cpl_func,"iFrame: %d Base: %d vis.table[iFrame].pistonOPDArray[band]: %f vis.table[iFrame+base].vis[band]: %f %f", */
- /* iFrame, base, vis.table[iFrame].pistonOPDArray[band], */
- /* vis.table[iFrame].vis->re, vis.table[iFrame].vis->im); */
- }
- }
- } /* for all frames */
- cpl_vector_delete(MaxOpdArray[0]);
- cpl_vector_delete(MaxOpdArray[1]);
- cpl_vector_delete(MaxOpdArray[2]);
-
- } /* if still OK */
- } /* Method 10 */
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- /*----------------------------------------------------------------------------------------*/
- /* Loop through frames and count good ones */
- sprintf( szMessage, "Counting the frames that passed the filtering..." );
- cpl_msg_info( fctid, "%s", szMessage );
- iFittingFrame = 0;
- for (iFrame = 0; iFrame < vis.nbFrames && !iStatus; iFrame++)
- {
- for (base = 0; base < vis.nbBases; base++)
- {
- if( selectedFrames.band[band].isSelectedPt[base][iFrame] == amdlibTRUE )
- iFittingFrame++;
- }
- }
- /* cpl_msg_info(cpl_func,"iFittingFrame: %d\n",iFittingFrame); */
-
- /* Correct the number of Frames for amdlib Saving */
- iFramesLeft = iFittingFrame / vis.nbBases;
- /* vis.nbFrames = iFramesLeft; */
- /* vis2.nbFrames = iFramesLeft; */
- /* vis3.nbFrames = iFramesLeft; */
- /* photometry.nbFrames = iFramesLeft; */
- /* pst.nbFrames = iFramesLeft; */
-
- /* cpl_msg_info(cpl_func,"iFramesLeft: %d\n",iFramesLeft); */
-
- /* Average visibilities, photometries and pistons on good frames */
- if( !iStatus && iFittingFrame && iAverage )
- {
- sprintf( szMessage, "Averaging the remaining %d frames...", iFittingFrame );
- cpl_msg_info( fctid, "%s", szMessage );
-
- if (amdlibAverageVisibilities( &photometry,
- &vis, &vis2, &vis3,
- &pst, band, &wave,
- &selectedFrames, errMsg) != amdlibSUCCESS)
- {
- /* Averaging failed! */
- iStatus = 555;
- }
- }
-
- } /* Frame Selection */
-
-
- strcpy( szMessage, "----------------------------------------------------------------------------" );
- cpl_msg_info( fctid, "%s", szMessage );
- sprintf( szMessage, "%d Frames = %d Visibilities passed the Filter = %.02f Percent", iFramesLeft, iFittingFrame, 100.0 * (float)iFittingFrame / (float)iTotal );
- cpl_msg_info( fctid, "%s", szMessage );
- strcpy( szMessage, "----------------------------------------------------------------------------" );
- cpl_msg_info( fctid, "%s", szMessage );
-
-
- if( iStatus == 0 )
- {
-
- /* Frames remaining? */
- if( iFittingFrame == 0 )
- {
- sprintf( szMessage, "No Frames passed! Please check the filtering Criteria!!" );
- cpl_msg_warning( fctid, "%s", szMessage );
- iStatus = 4;
- }
-
-#ifdef OLLER_SCHROTT
- /* Info about min/max, but not for Method1 */
- if( strcmp( szMethod, selMethod1 ) )
- {
- sprintf( szMessage, "For all frames: lowest Fringe SNR is %0.4f and highest is %0.4f", dLowSNR, dHighSNR );
- cpl_msg_info( fctid, "%s", szMessage );
- }
-#endif
-
- /* Write the QC Parameter */
- qclist = cpl_propertylist_new();
-
-
- if( !strcmp( szMethod, selMethod3 ))
- {
- cpl_propertylist_update_double(qclist, "ESO QC X1 THRESHOLD", MaxSnrArray_at_fThreshold[0]);
- cpl_propertylist_update_double(qclist, "ESO QC X2 THRESHOLD", MaxSnrArray_at_fThreshold[1]);
- cpl_propertylist_update_double(qclist, "ESO QC X3 THRESHOLD", MaxSnrArray_at_fThreshold[2]);
- }
- else if(!strcmp( szMethod, selMethod4 )|| !strcmp( szMethod, selMethod5 ))
- {
- cpl_propertylist_update_double(qclist, "ESO QC X1 THRESHOLD", threshold[0]);
- cpl_propertylist_update_double(qclist, "ESO QC X2 THRESHOLD", threshold[1]);
- cpl_propertylist_update_double(qclist, "ESO QC X3 THRESHOLD", threshold[2]);
- }
-
- else if( !strcmp( szMethod, selMethod10 ))
- {
- cpl_propertylist_update_double(qclist, "ESO QC X1 THRESHOLD", MaxOpdArray_at_fThreshold[0]);
- cpl_propertylist_update_double(qclist, "ESO QC X2 THRESHOLD", MaxOpdArray_at_fThreshold[1]);
- cpl_propertylist_update_double(qclist, "ESO QC X3 THRESHOLD", MaxOpdArray_at_fThreshold[2]);
- }
- else
- {
- cpl_propertylist_update_double(qclist, "ESO QC X1 THRESHOLD", fThreshold[0]);
- cpl_propertylist_update_double(qclist, "ESO QC X2 THRESHOLD", fThreshold[1]);
- cpl_propertylist_update_double(qclist, "ESO QC X3 THRESHOLD", fThreshold[2]);
-
- }
-
- cpl_propertylist_update_int (qclist, "ESO QC FRAMES SELECTED" , (int)iFramesLeft);
- cpl_propertylist_update_double(qclist, "ESO QC FRAMES PERCENTAGE SELECTED", 100.0*(float)iFittingFrame/(float)iTotal);
- cpl_propertylist_set_comment (qclist, "ESO QC FRAMES SELECTED" , "Number of selected frames");
- cpl_propertylist_set_comment (qclist, "ESO QC FRAMES PERCENTAGE SELECTED", "Percentage of selected frames");
-
- cpl_propertylist_update_string (qclist,
- "ESO QC USEDVALUE METHOD", szMethod);
- cpl_propertylist_update_bool (qclist,
- "ESO QC USEDVALUE AND", ANDselection);
- cpl_propertylist_update_double (qclist,
- "ESO QC USEDVALUE X1", x1);
- cpl_propertylist_update_double (qclist,
- "ESO QC USEDVALUE X2", x2);
- cpl_propertylist_update_double (qclist,
- "ESO QC USEDVALUE X3", x3);
-
-
-
-
- /*---------------------------------------------------------------------------------------------------------------*/
- /* Creates Product File and sets up DFO compliant Header */
- /*qc_properties =*/
- pHeader_tmp=SelectorCreateProduct( fctid, (char *)szFilnameOI,
- iIsScience, (char*)szProductfile, qclist, framelist,
- parlist, recipename);
- cpl_propertylist_delete(pHeader_tmp);
-
- cpl_propertylist_delete(qclist);
-
- /*---------------------------------------------------------------------------------------------------------------*/
- /* Writes instrument description header and scientific data */
-
- /*
- sprintf ( szMessage, "Now writing filtered Scientific Data to %s...", szProductfile );
- cpl_msg_info( fctid, "%s", szMessage );
- */
-
-
- if( amdlibSaveOiFileESO( szProductfile, &selectedFrames,
- &array, &target,
- &photometry, &vis, &vis2,
- &vis3, &wave,
- &pst, band, &spectrum, errMsg
- ) != amdlibSUCCESS)
- {
- iStatus = 3;
- sprintf ( szMessage, "ERROR saving Scientific Data to %s. [%s]", szProductfile, errMsg );
- cpl_msg_info( fctid, "%s", szMessage );
-
- }
-
- amdlibReleaseSelection(&selectedFrames);
- if(array.thisPtr !=NULL) amdlibReleaseOiArray(&array);
- if(target.thisPtr !=NULL) amdlibReleaseOiTarget(&target);
- if(photometry.thisPtr!=NULL) amdlibReleasePhotometry(&photometry);
- if(vis.thisPtr !=NULL) amdlibReleaseVis(&vis);
- if(vis2.thisPtr !=NULL) amdlibReleaseVis2(&vis2);
- if(vis3.thisPtr !=NULL) amdlibReleaseVis3(&vis3);
- if(wave.thisPtr !=NULL) amdlibReleaseWavelength(&wave);
- if(spectrum.thisPtr !=NULL) amdlibReleaseSpectrum(&spectrum);
- if(pst.thisPtr !=NULL) amdlibReleasePiston(&pst);
-
-
-
- /* ---------------------------------------------------------- */
- if(iStatus==0){
-
- amdlibClearInsCfg(&insCfg);
- if (amdlibLoadOiFile( szProductfile, &insCfg, &array, &target, &photometry,
- &vis, &vis2, &vis3, &wave, &pst, &spectrum, errMsg ) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load OI-FITS file amber_filtered.fits" );
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
-
- }
-
- pHeader = cpl_propertylist_load(szProductfile, 0 );
-
- amber_qc(&wave, &vis, &vis2, &vis3, NULL, pHeader, "uncal");
-
- /*Adding the JMMC acknowledgements*/
- amber_JMMC_acknowledgement(pHeader);
-
- cpl_image_save(NULL, szProductfile, CPL_BPP_16_SIGNED, pHeader, CPL_IO_DEFAULT );
- outname_selector_paf=cpl_sprintf("qc_%s.paf", szProductfile);
-
-
-
- if (cpl_propertylist_has(pHeader, "ESO QC ARC") == 1)
- {
- cpl_propertylist_append_string(pHeader,"ARCFILE",
- (cpl_propertylist_get_string(pHeader, "ESO QC ARC")));
- //cpl_dfs_save_paf("AMBER",recipename,pHeader,outname_selector_paf);
- cpl_propertylist_erase(pHeader,"ARCFILE");
- }
-
- cpl_free((void *)outname_selector_paf);
-
- cpl_propertylist_delete(pHeader);
-
-
- amdlibSaveOiFile( szProductfile, &insCfg, &array, &target,
- &photometry, &vis, &vis2, &vis3, &wave, &pst, &spectrum, errMsg);
-
- amdlibReleaseSelection(&selectedFrames);
- if(array.thisPtr !=NULL) amdlibReleaseOiArray(&array);
- if(target.thisPtr !=NULL) amdlibReleaseOiTarget(&target);
- if(photometry.thisPtr!=NULL) amdlibReleasePhotometry(&photometry);
- if(vis.thisPtr !=NULL) amdlibReleaseVis(&vis);
- if(vis2.thisPtr !=NULL) amdlibReleaseVis2(&vis2);
- if(vis3.thisPtr !=NULL) amdlibReleaseVis3(&vis3);
- if(wave.thisPtr !=NULL) amdlibReleaseWavelength(&wave);
- if(spectrum.thisPtr !=NULL) amdlibReleaseSpectrum(&spectrum);
- if(pst.thisPtr !=NULL) amdlibReleasePiston(&pst);
- /* Now copy the file to tmp to be able to plot the files after the
- originals are renamed by ESOREX
- */
- //sprintf( szCommand, "cp %s /tmp/%s", szProductfile, szProductfile );
- //system( szCommand );
-
-
-
- }
- /* ---------------------------------------------------------- */
-
-
-
-
- } /* Selection did not cause errors */
-
- }
- else
- {
- /* not an AMBER file */
- iStatus = 2;
- sprintf ( szMessage, "ERROR: Cannot read [%s]. OI table structure is not from AMBER or the file has been corrupted. [%s]", szFilnameOI, errMsg );
- cpl_msg_info( fctid, "%s", szMessage );
- }
- }
- else /* found fitting frame ? */
- {
- /* no fitting frame */
- iStatus = 1;
- sprintf ( szMessage, "ERROR: Please input one file with either SCIENCE_REDUCED or CALIB_REDUCED." );
- cpl_msg_info( fctid, "%s", szMessage );
- }
-
-
- if( pFrame && !iStatus )
- {
- /*
- sprintf( szMessage, "cpl_frame_insert [%s]", cpl_frame_get_filename(pFrame ) );
- cpl_msg_info( fctid, "%s", szMessage );
- */
- cpl_frameset_insert( framelist, pFrame );
-
-
- }
- else
- {
- if(pFrame!=NULL)
- {
- cpl_frame_delete(pFrame);
- }
- }
- /*
- sprintf ( szMessage, "Status: %d for %s", iStatus, szProductfile );
- cpl_msg_info( fctid, "%s", szMessage );
- */
-
- cpl_msg_info( fctid, "End of DataReduction");
-
- cpl_error_reset();
-
- if (szFilnameOI != NULL)
- {
- cpl_free(szFilnameOI);
- }
- return iStatus;
-}
diff --git a/amber/esolibSelector.h b/amber/esolibSelector.h
deleted file mode 100644
index e7ad3d0..0000000
--- a/amber/esolibSelector.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * esolibSelector.h
- *
- * Created on: Sep 25, 2009
- * Author: agabasch
- */
-
-#ifndef ESOLIBSELECTOR_H_
-#define ESOLIBSELECTOR_H_
-#include "cpl.h"
-int amber_selector_lib(double x1, double x2, double x3, int ANDselection,
- const char * Method, const char * inname, const char * outname,
- int iIsScience, cpl_frameset * framelist, cpl_parameterlist * parlist,
- const char * recipename);
-
-#endif /* ESOLIBSELECTOR_H_ */
diff --git a/amber/esolibTransferfunction.c b/amber/esolibTransferfunction.c
deleted file mode 100644
index e46716b..0000000
--- a/amber/esolibTransferfunction.c
+++ /dev/null
@@ -1,1244 +0,0 @@
-/*
- * esolibTransferfunction.c
- *
- * Created on: Oct 5, 2009
- * Author: agabasch
- */
-
-#include "esolibTransferfunction.h"
-#include "cpl.h"
-#include <math.h>
-#include <string.h>
-#include "amdrs.h"
-#include "amber_qc.h"
-#include "amber_dfs.h"
-#include <libgen.h>
-/*Function prototypes*/
-
-static cpl_error_code amber_get_calibparam(double * Average,
- cpl_propertylist * plist, const char * startkey, const char * endkey);
-
-static double amber_computeBesselK1o1 (double xArg, double xArgErr,
- double *besselK1o1Err);
-static cpl_error_code amber_getCalibratorDiameter (const char * filename,
- CalibratorParam *calibrator, cpl_frameset *frameset, int *error);
-
-
-static cpl_error_code amber_TransferFunctionCompute(
- CalibratorParam *calibrator12, CalibratorParam *calibrator13,
- CalibratorParam *calibrator23, const char * recipename,
- const char * outname_selector, cpl_parameterlist *parlist,
- cpl_frameset * framelist);
-
-static cpl_error_code amber_identifyCalibrator (const char * filename,
- CalibratorParam *calibrator, const char * baseline,
- cpl_frameset * framelist, int *error);
-static cpl_error_code amber_computeExpectedVis (CalibratorParam *calibrator);
-
-static cpl_error_code amber_getInvWavelength (const char * filename,
- CalibratorParam *calibrator);
-
-static cpl_error_code midi_amber_computeExpectedVis (CalibratorParam
- *calibrator);
-static cpl_error_code amber_init_calibrator (CalibratorParam *calibrator);
-
-
-
-/*-------------------------------------*/
-/*Function implementation*/
-
-
-static cpl_error_code amber_identifyCalibrator (const char * filename,
- CalibratorParam *calibrator, const char * baseline,
- cpl_frameset * framelist, int *error)
-{
- cpl_propertylist * plist=NULL;
- const char * headerkey_start=NULL;
- const char * headerkey_end = NULL;
- /*Set error to OK*/
- *error=0;
-
- /* Extract RA and DEC for the calibrator */
- plist = cpl_propertylist_load(filename, 0);
- if (plist==NULL)
- {
- cpl_msg_warning(cpl_func,"Error loading the header of %s",filename);
- *error=1;
- /* Propagate error, if any */
- return cpl_error_set(cpl_func, cpl_error_get_code());
- }
- if (cpl_propertylist_has(plist, "RA") == 1)
- {
- calibrator->calibRA=(cpl_propertylist_get_double(plist, "RA"));
- calibrator->calibRA *= DEG_TO_RAD;
- }
- else
- {
- *error=1;
- cpl_propertylist_delete(plist);
- return cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
- "Can not fined RA from the header!");
- }
- if (cpl_propertylist_has(plist, "DEC") == 1)
- {
- calibrator->calibDEC=(cpl_propertylist_get_double(plist, "DEC"));
- calibrator->calibDEC *= DEG_TO_RAD;
- }
- else
- {
- *error=1;
- cpl_propertylist_delete(plist);
- return cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
- "Can not fined DEC from the header!");
- }
-
- /* Get target name */
- if (cpl_propertylist_has(plist, "ESO OBS TARG NAME") == 1)
- {
- calibrator->calibNameObserved=cpl_sprintf("%s",
- cpl_propertylist_get_string(plist, "ESO OBS TARG NAME"));
- }
- else
- {
- cpl_msg_warning(cpl_func,"ESO OBS TARG NAME not found!"
- " Using default value NO_NAME");
- calibrator->calibNameObserved=cpl_sprintf("NO_NAME");
- }
-
- /* Get PBL */
- headerkey_start=cpl_sprintf("ESO ISS PBL%s START",baseline);
- headerkey_end=cpl_sprintf("ESO ISS PBL%s END",baseline);
-
- if(amber_get_calibparam(&(calibrator->calibPblAverage), plist,
- headerkey_start , headerkey_end))
- {
- *error=1;
- cpl_free((void *)headerkey_start);
- cpl_free((void *)headerkey_end);
- cpl_propertylist_delete(plist);
- cpl_msg_warning (cpl_func, "Error when calculating calibPblAverage: "
- "%s",cpl_error_get_message());
- return cpl_error_set(cpl_func, cpl_error_get_code());
-
- }
- cpl_free((void *)headerkey_start);
- cpl_free((void *)headerkey_end);
- /* Get PARANG */
-
- if(amber_get_calibparam(&(calibrator->calibParangAverage), plist,
- "ESO ISS PARANG START", "ESO ISS PARANG END"))
- {
- *error=1;
- cpl_propertylist_delete(plist);
- cpl_msg_warning (cpl_func, "Error when calculating calibParangAverage: "
- "%s",cpl_error_get_message());
- return cpl_error_set(cpl_func, cpl_error_get_code());
-
- }
-
- cpl_msg_info(cpl_func,"Observed Calibrator = %s ",
- calibrator->calibNameObserved);
- cpl_msg_info(cpl_func,"Observed Calibrator RA = %f radians ",
- calibrator->calibRA);
- cpl_msg_info(cpl_func,"Observed Calibrator DEC = %f radians ",
- calibrator->calibDEC);
- cpl_msg_info(cpl_func,"Observed Calibrator Average PBL = %f metres ",
- calibrator->calibPblAverage);
- cpl_msg_info(cpl_func,"Observed Calibrator Average PARANG = %f degrees ",
- calibrator->calibParangAverage);
-
- /*Get diameter of the calibrator from the Calibrator database*/
- if(amber_getCalibratorDiameter (filename, calibrator, framelist, error))
- {
- cpl_propertylist_delete(plist);
- cpl_msg_warning (cpl_func, "%s",cpl_error_get_message());
- return cpl_error_set(cpl_func, cpl_error_get_code());
- }
-
- if (plist!=NULL)
- {
- cpl_propertylist_delete(plist);
- }
-
- /* Propagate error, if any */
- return cpl_error_set(cpl_func, cpl_error_get_code());
-}
-
-
-static cpl_error_code amber_getCalibratorDiameter (const char * filename,
- CalibratorParam *calibrator,
- cpl_frameset *frameset,
- int *error)
-{
-
- /* Local Declarations
- --------------------*/
- int i=0;
- double searchRA=0.;
- double searchDEC=0.;
- double diffAngle=0.;
- /* cpl_errorstate prestate = cpl_errorstate_get();*/
- cpl_frame * cur_frame;
- cpl_table * table;
- cpl_propertylist * plist=NULL;
- const char ** Name=NULL;
- int * hourRA=NULL;
- int * minuteRA=NULL;
- double * secondRA=NULL;
- int * signDEC=NULL;
- int * degreeDEC=NULL;
- int * minuteDEC=NULL;
- double * secondDEC=NULL;
- double * magJ=NULL;
- double * magH=NULL;
- double * magK=NULL;
- int * flag=NULL;
- double * diameter=NULL;
- double * diameterErr=NULL;
- int ext_calibrator_data=0;
- int dimen_calibrator_data=0;
- char * tag=NULL;
- char * tag_needed=NULL;
- int calibNameDatabase_index=0;
-
- cur_frame = cpl_frameset_get_first(frameset);
- if (cur_frame == NULL) {
- cpl_msg_error(cpl_func, "No frame found in the SOF");
- *error = 1;
- /* Propagate error, if any */
- return cpl_error_set(cpl_func, cpl_error_get_code());
- }
-
- /* Extract the FILTER J,H,K */
- plist = cpl_propertylist_load(filename, 0);
- if (plist==NULL)
- {
- cpl_msg_warning(cpl_func,"Error loading the header of %s",filename);
- *error=1;
- /* Propagate error, if any */
- return cpl_error_set(cpl_func, cpl_error_get_code());
- }
- if (cpl_propertylist_has(plist, "ESO QC BAND") == 1)
- {
- tag_needed=cpl_sprintf("CALIB_DATABASE_%s",
- cpl_propertylist_get_string(plist, "ESO QC BAND"));
- cpl_msg_info(cpl_func, "Searching for the calibrator database tagged %s"
- , tag_needed);
- }
- else
- {
- *error=1;
- cpl_propertylist_delete(plist);
- return cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
- "Can not determine the Band from the header! ");
- }
- cpl_propertylist_delete(plist);
-
- /* Find the calibrator database file in the SOF */
- while(cur_frame)
- {
- /* Check the right tags */
- tag = (char*)cpl_frame_get_tag(cur_frame);
- if (strcmp(tag, tag_needed)) {
- cur_frame = cpl_frameset_get_next( frameset );
- continue;
- }
- else{
- cpl_msg_info(cpl_func, "Calibrator database found in the SOF: %s",
- cpl_frame_get_filename(cur_frame));
- break;
- }
- }
-
- if (strcmp(tag, tag_needed)) {
- cpl_free(tag_needed);
- *error = 1;
- return cpl_error_set_message(cpl_func, CPL_ERROR_FILE_NOT_FOUND,
- "No calibrator database file in the SOF! "
- "Transfer function can not be calculated!");
- }
- cpl_free(tag_needed);
-
- /* Load extension CALIBRATOR_DATA */
-
- /* prestate = cpl_errorstate_get();*/
-
- cpl_msg_info(cpl_func, "Reading %s",cpl_frame_get_filename(cur_frame));
-
- ext_calibrator_data=cpl_fits_find_extension(
- cpl_frame_get_filename(cur_frame),"CALIBRATOR_DATA");
-
- /* Load extension */
- if((table = cpl_table_load(cpl_frame_get_filename(cur_frame),
- ext_calibrator_data, 1))==NULL)
- {
- cpl_msg_info(cpl_func, "No siutable table found in the file: %s",
- cpl_frame_get_filename(cur_frame));
- cpl_msg_warning(cpl_func, "Transfer function can not be calculated!");
- /* cpl_errorstate_set(prestate);*/
- *error = 1;
- /* Propagate error, if any */
- return cpl_error_set(cpl_func, cpl_error_get_code());
- }
-
- if (cpl_table_has_column(table, "Name" ))
- {
- Name =cpl_table_get_data_string_const(table, "Name" );
- }
- else
- {
- cpl_msg_warning(cpl_func, "Entry not found: Name" );
- *error = 1;
- }
- if (cpl_table_has_column(table, "hourRA" ))
- {
- hourRA =cpl_table_get_data_int (table, "hourRA" );
- }
- else
- {
- cpl_msg_warning(cpl_func, "Entry not found: hourRA" );
- *error = 1;
- }
- if (cpl_table_has_column(table, "minuteRA" ))
- {
- minuteRA =cpl_table_get_data_int (table, "minuteRA" );
- }
- else
- {
- cpl_msg_warning(cpl_func, "Entry not found: minuteRA" );
- *error = 1;
- }
- if (cpl_table_has_column(table, "secondRA" ))
- {
- secondRA =cpl_table_get_data_double (table, "secondRA" );
- }
- else
- {
- cpl_msg_warning(cpl_func, "Entry not found: secondRA" );
- *error = 1;
- }
- if (cpl_table_has_column(table, "signDEC" ))
- {
- signDEC =cpl_table_get_data_int (table, "signDEC" );
- }
- else
- {
- cpl_msg_warning(cpl_func, "Entry not found: signDEC" );
- *error = 1;
- }
- if (cpl_table_has_column(table, "degreeDEC" ))
- {
- degreeDEC =cpl_table_get_data_int (table, "degreeDEC" );
- }
- else
- {
- cpl_msg_warning(cpl_func, "Entry not found: degreeDEC" );
- *error = 1;
- }
- if (cpl_table_has_column(table, "minuteDEC" ))
- {
- minuteDEC =cpl_table_get_data_int (table, "minuteDEC" );
- }
- else
- {
- cpl_msg_warning(cpl_func, "Entry not found: minuteDEC" );
- *error = 1;
- }
- if (cpl_table_has_column(table, "secondDEC" ))
- {
- secondDEC =cpl_table_get_data_double (table, "secondDEC" );
- }
- else
- {
- cpl_msg_warning(cpl_func, "Entry not found: secondDEC" );
- *error = 1;
- }
- if (cpl_table_has_column(table, "J_band") &&
- cpl_table_has_column(table, "H_band") &&
- cpl_table_has_column(table, "K_band"))
- {
- magJ =cpl_table_get_data_double(table, "J_band" );
- magH =cpl_table_get_data_double(table, "H_band" );
- magK =cpl_table_get_data_double(table, "K_band" );
- }
- else
- {
- cpl_msg_warning(cpl_func, "Entry not found: J or H or K-band");
- *error = 1;
- }
- if (cpl_table_has_column(table, "flag" ))
- {
- flag =cpl_table_get_data_int (table, "flag" );
- }
- else
- {
- cpl_msg_warning(cpl_func, "Entry not found: flag" );
- *error = 1;
- }
- if (cpl_table_has_column(table, "diameter" ))
- {
- diameter =cpl_table_get_data_double (table, "diameter" );
- }
- else
- {
- cpl_msg_warning(cpl_func, "Entry not found: diameter" );
- *error = 1;
- }
- if (cpl_table_has_column(table, "diameterErr"))
- {
- diameterErr=cpl_table_get_data_double (table, "diameterErr");
- }
- else
- {
- cpl_msg_warning(cpl_func, "Entry not found: diameterErr");
- *error = 1;
- }
-
- dimen_calibrator_data=cpl_table_get_nrow(table);
-
- cpl_msg_info(cpl_func, "Total number of Calibrators in the table: %d",
- dimen_calibrator_data);
-
- calibrator->calibDistance =FLT_MAX;
-
- /* Search for the minimum distance and get the diameter */
- for (i=0; i<dimen_calibrator_data;i++)
- {
-
- searchRA= HOUR_TO_RAD * ((double) hourRA[i] + minuteRA[i]/60.0 +
- secondRA[i]/3600.0);
- searchDEC= DEG_TO_RAD * (((double) degreeDEC[i] + minuteDEC[i]/60.0 +
- secondDEC[i]/3600.0) * signDEC[i]);
- diffAngle = acos ( sin(searchDEC) * sin(calibrator->calibDEC) +
- cos(searchDEC) * cos(calibrator->calibDEC) *
- cos(searchRA - calibrator->calibRA) );
-
-
- if (diffAngle < calibrator->calibDistance)
- {
- calibrator->calibDistance = diffAngle;
- calibrator->calibDiameter = diameter[i];
- calibrator->calibDiameterErr = diameterErr[i];
- calibNameDatabase_index=i;
- calibrator->calibMagJ = magJ[i];
- calibrator->calibMagH = magH[i];
- calibrator->calibMagK = magK[i];
- calibrator->calibFlag = flag[i]; // Quality Parameter/Flag
- }
-
- }
-
- calibrator->calibNameDatabase=
- cpl_sprintf("%s",Name[calibNameDatabase_index]);
-
- /* Check if minimum angle is within the threshold */
- if (calibrator->calibDistance <= CALIBRATOR_MIN_THRESHOLD)
- {
- cpl_msg_info(cpl_func,"Closest Calibrator in the database = "
- "%s ", calibrator->calibNameDatabase);
- cpl_msg_info(cpl_func,"Calibrator Diameter = "
- "%f marcsec ", calibrator->calibDiameter);
- cpl_msg_info(cpl_func,"Calibrator Diameter error = "
- "%f marcsec ", calibrator->calibDiameterErr);
- cpl_msg_info(cpl_func,"Computed Distance to Observed Calibrator = "
- "%f arcsec ", RAD_TO_ARCSEC * calibrator->calibDistance);
- cpl_msg_info(cpl_func,"Calibrator Magnitude in the J-Band = "
- "%g mag ", calibrator->calibMagJ);
- cpl_msg_info(cpl_func,"Calibrator Magnitude in the H-Band = "
- "%g mag ", calibrator->calibMagH);
- cpl_msg_info(cpl_func,"Calibrator Magnitude in the K-Band = "
- "%g mag ", calibrator->calibMagK);
- cpl_msg_info(cpl_func,"Calibrator quality flag = "
- "%d ", calibrator->calibFlag);
-
- }
- else
- {
- cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
- "Cannot find a close match in the database!");
- cpl_msg_warning(cpl_func,"Cannot find a close match in the database");
- *error = 1;
- }
-
- /* Release memory */
- if(table !=NULL) cpl_table_delete(table);
-
- /* Propagate error, if any */
- return cpl_error_set(cpl_func, cpl_error_get_code());
-}
-
-
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Computes Bessel function of first kind of order 1 and the associated
- errors.
- @param xArg Bessel argument
- @param xArgErr Error of argument
- @param xArgErr Error of computed Bessel function
- @return Bessel function of first kind
- */
-/*----------------------------------------------------------------------------*/
-static double amber_computeBesselK1o1 (double xArg, double xArgErr,
- double *besselK1o1Err)
-{
-
- /* Algorithm
- -----------*/
-
- *besselK1o1Err = (
- 0.5 * xArgErr +
- 0.062500000000 * xArgErr * fabs (3.0 * xArg * xArg) +
- 0.002604166666 * xArgErr * fabs (5.0 * xArg * xArg * xArg * xArg) +
- 0.000054253472 * xArgErr * fabs (7.0 * xArg * xArg * xArg * xArg *
- xArg * xArg));
-
- return (
- 0.5 * xArg -
- 0.062500000000 * xArg * xArg * xArg +
- 0.002604166666 * xArg * xArg * xArg * xArg * xArg -
- 0.000054253472 * xArg * xArg * xArg * xArg * xArg * xArg * xArg);
-}
-
-
-static cpl_error_code amber_get_calibparam(double * Average,
- cpl_propertylist * plist, const char * startkey, const char * endkey)
-{
- double startvalue=0.;
- double endvalue=0.;
- int local_error=0;
- *Average=0.;
-
-
- if (cpl_propertylist_has(plist, startkey) == 1)
- {
- startvalue=(cpl_propertylist_get_double(plist, startkey));
- }
- else
- {
- local_error=1;
- }
-
- if (cpl_propertylist_has(plist, endkey) == 1)
- {
- endvalue=(cpl_propertylist_get_double(plist, endkey));
- }
- else
- {
- local_error=1;
- }
-
- if (!local_error)
- {
- *Average=(endvalue+startvalue)/2.;
-
- return 0;
- }
- else
- {
- return cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
- "Can not compute the average!");
- }
-}
-
-
-static cpl_error_code amber_computeExpectedVis(CalibratorParam *calibrator)
-{
- int dimen=0;
- int i=0;
- double besselK1o1=0.;
- double besselK1o1Err=0.;
- double xArg=0.;
- double xArgErr=0.;
- cpl_vector * vec_xArg=NULL;
- cpl_vector * vec_xArgErr=NULL;
- cpl_vector * vec_ArgTmp=NULL;
- cpl_vector * vec_besselK1o1=NULL;
- cpl_vector * vec_besselK1o1Err=NULL;
- cpl_vector * vec_xArg_fabs=NULL;
- cpl_vector * vec_besselK1o1_fabs=NULL;
- cpl_vector * vec_calibVis_fabs=NULL;
-
- dimen=cpl_vector_get_size(calibrator->calibInvWavelength);
-
- /*Local vectors*/
- vec_ArgTmp=cpl_vector_duplicate(calibrator->calibInvWavelength);
- vec_besselK1o1=cpl_vector_new(dimen);
- vec_besselK1o1Err=cpl_vector_new(dimen);
-
- cpl_vector_multiply_scalar(vec_ArgTmp,(AMBER_PI * DIAMETER_FACTOR *
- calibrator->calibPblAverage ));
-
- /* Compute Bessel function of first kind of order 1
- For faster processing most divisions are stated by multiplying factors */
-
- vec_xArg =cpl_vector_duplicate(vec_ArgTmp);
- vec_xArgErr=cpl_vector_duplicate(vec_ArgTmp);
- cpl_vector_delete(vec_ArgTmp);
- cpl_vector_multiply_scalar(vec_xArg,calibrator->calibDiameter);
- cpl_vector_multiply_scalar(vec_xArgErr,calibrator->calibDiameterErr);
-
- for(i=0;i<dimen;i++)
- {
- xArg=cpl_vector_get(vec_xArg,i);
- xArgErr=cpl_vector_get(vec_xArgErr,i);
- besselK1o1=0.;
- besselK1o1Err=0.;
- besselK1o1 = amber_computeBesselK1o1 (xArg, xArgErr, &besselK1o1Err);
- cpl_vector_set(vec_besselK1o1,i,besselK1o1);
- cpl_vector_set(vec_besselK1o1Err,i,besselK1o1Err);
- }
-
- /* Compute expected visibilities */
-
- calibrator->calibVis = cpl_vector_duplicate(vec_besselK1o1);
- cpl_vector_divide(calibrator->calibVis, vec_xArg);
- cpl_vector_multiply_scalar(calibrator->calibVis, 2.);
-
- calibrator->calibVisSqrd = cpl_vector_duplicate(calibrator->calibVis);
- cpl_vector_multiply(calibrator->calibVisSqrd, calibrator->calibVis);
-
- /* cpl_vector_dump(calibrator->calibVis,NULL); */
- /* cpl_vector_dump(calibrator->calibVisSqrd,NULL); */
-
-
- /* Compute error for visibility */
-
- vec_xArg_fabs=cpl_vector_new(dimen);
- vec_besselK1o1_fabs=cpl_vector_new(dimen);
- vec_calibVis_fabs=cpl_vector_new(dimen);
-
- for(i=0;i<dimen;i++)
- {
- cpl_vector_set(vec_xArg_fabs ,i,
- fabs(cpl_vector_get(vec_xArg,i)));
- cpl_vector_set(vec_besselK1o1_fabs,i,
- fabs(cpl_vector_get(vec_besselK1o1,i)));
- cpl_vector_set(vec_calibVis_fabs ,i,
- fabs(cpl_vector_get(calibrator->calibVis,i)));
- }
-
- cpl_vector_divide(vec_besselK1o1Err, vec_xArg_fabs);
- cpl_vector_divide(vec_besselK1o1_fabs, vec_xArg);
- cpl_vector_divide(vec_besselK1o1_fabs, vec_xArg);
- cpl_vector_multiply(vec_besselK1o1_fabs, vec_xArgErr);
- cpl_vector_add(vec_besselK1o1Err,vec_besselK1o1_fabs);
- cpl_vector_multiply_scalar(vec_besselK1o1Err,2.0);
-
- calibrator->calibVisErr=cpl_vector_duplicate(vec_besselK1o1Err);
-
- /* Compute error for squared visibility */
-
- cpl_vector_multiply(vec_calibVis_fabs,calibrator->calibVisErr);
- cpl_vector_multiply_scalar(vec_calibVis_fabs,2.0);
-
- calibrator->calibVisSqrdErr=cpl_vector_duplicate(vec_calibVis_fabs);
-
-/*
- cpl_vector_dump(calibrator->calibVis,NULL);
- cpl_vector_dump(calibrator->calibVisSqrd,NULL);
- cpl_vector_dump(calibrator->calibVisErr,NULL);
- cpl_vector_dump(calibrator->calibVisSqrdErr,NULL);
-*/
- /*exit(0);*/
-
- /*Free the memory*/
- cpl_vector_delete(vec_besselK1o1);
- cpl_vector_delete(vec_besselK1o1Err);
-
- cpl_vector_delete(vec_xArg_fabs);
- cpl_vector_delete(vec_besselK1o1_fabs);
-
- cpl_vector_delete(vec_xArg);
- cpl_vector_delete(vec_xArgErr);
- cpl_vector_delete(vec_calibVis_fabs);
-
- /*Propagate error, if any*/
- return cpl_error_set(cpl_func, cpl_error_get_code());
-
-}
-
-static cpl_error_code amber_getInvWavelength (const char * filename,
- CalibratorParam *calibrator)
-{
- int ext_oi_wavelength=0;
- cpl_table * table=NULL;
-
- /* Load extension OI_WAVELENGTH */
- ext_oi_wavelength=cpl_fits_find_extension(filename,"OI_WAVELENGTH");
- table = cpl_table_load(filename, ext_oi_wavelength, 0);
- if (table == NULL) {
- return cpl_error_set_message(cpl_func, cpl_error_get_code(),
- "Could not load the table");
- }
-
- /*Load column EFF_WAVE ...*/
- if (cpl_table_has_column(table,"EFF_WAVE")){
- const int dimen_table=cpl_table_get_nrow(table);
- int i;
- /*Allocate memory*/
- calibrator->calibInvWavelength=cpl_vector_new(dimen_table);
-
- /*Write the inverse (!!!) values in the cpl_vector*/
- for(i=0;i<dimen_table;i++){
- cpl_vector_set(calibrator->calibInvWavelength,i,
- 1./cpl_table_get_float(table,"EFF_WAVE",i,NULL));
- }
- }
- cpl_table_delete(table);
-
- /* Propagate error, if any */
- return cpl_error_set(cpl_func, cpl_error_get_code());
-}
-
-static cpl_error_code midi_amber_computeExpectedVis(CalibratorParam *calibrator)
-{
- /* Local Declarations
- --------------------*/
-
- double besselK1o1, besselK1o1Err, xArg, xArgErr;
-
- /* Algorithm
- -----------*/
-
-
- /* Compute Bessel function of first kind of order 1
- For faster processing most divisions are stated by multiplying factors */
- xArg=(double) (AMBER_PI * DIAMETER_FACTOR * calibrator->calibDiameter
- * calibrator->calibPblAverage * INVERSE_WAVELENGTH);
- xArgErr=(double) (AMBER_PI * DIAMETER_FACTOR * calibrator->calibDiameterErr
- * calibrator->calibPblAverage * INVERSE_WAVELENGTH);
- besselK1o1=amber_computeBesselK1o1 (xArg, xArgErr, &besselK1o1Err);
-
- /* Compute expected visibilities */
- calibrator->mcalibVis = (float) (2.0 * (besselK1o1 / xArg));
- calibrator->mcalibVisSqrd = calibrator->mcalibVis * calibrator->mcalibVis;
-
- /* Compute errors */
- calibrator->mcalibVisErr = (float) (2.0 * (besselK1o1Err/fabs(xArg)
- + xArgErr * (fabs(besselK1o1)/(xArg * xArg))));
- calibrator->mcalibVisSqrdErr = 2.0 * (calibrator->mcalibVisErr
- * fabs (calibrator->mcalibVis));
-
- cpl_msg_info(cpl_func,"Expected Visibility = %f \n",
- calibrator->mcalibVis);
- cpl_msg_info(cpl_func,"Expected Visibility Error = %f \n",
- calibrator->mcalibVisErr);
- cpl_msg_info(cpl_func,"Expected Squared Visibility = %f \n",
- calibrator->mcalibVisSqrd);
- cpl_msg_info(cpl_func,"Expected Squared Visibility Error = %f \n",
- calibrator->mcalibVisSqrdErr);
-
- /* Propagate error, if any */
- return cpl_error_set(cpl_func, cpl_error_get_code());
-
-}
-static cpl_error_code amber_init_calibrator (CalibratorParam *calibrator)
-{
- calibrator->calibRA=0.;
- calibrator->calibDEC=0.;
- calibrator->calibDistance=0.;
- calibrator->calibNameDatabase=NULL;
- calibrator->calibNameObserved=NULL;
- calibrator->calibInvWavelength=NULL;
- calibrator->calibVis=NULL;
- calibrator->calibVisErr=NULL;
- calibrator->calibVisSqrd=NULL;
- calibrator->calibVisSqrdErr=NULL;
- calibrator->calibPblAverage=0.;
- calibrator->calibParangAverage=0.;
- calibrator->calibDiameter=0.;
- calibrator->calibDiameterErr=0.;
- calibrator->calibMagJ=-9.9e+100;
- calibrator->calibMagH=-9.9e+100;
- calibrator->calibMagK=-9.9e+100;
- calibrator->calibFlag=0;
- calibrator->calibEsoTrusted=TRUE;
- calibrator->mcalibVis=0.; /*only for crosscheck with MIDI results*/
- calibrator->mcalibVisErr=0.; /*only for crosscheck with MIDI results*/
- calibrator->mcalibVisSqrd=0.; /*only for crosscheck with MIDI results*/
- calibrator->mcalibVisSqrdErr=0.; /*only for crosscheck with MIDI results*/
-
- /* Propagate error, if any */
- return cpl_error_set(cpl_func, cpl_error_get_code());
-
-}
-
-cpl_error_code amber_TransferFunction(const char * recipename,
- const char * outname_selector, cpl_parameterlist *parlist,
- cpl_frameset * framelist)
-{
- int error;
- int nTel=0;
- cpl_propertylist * plist=NULL;
- CalibratorParam *calibrator12=NULL;
- CalibratorParam *calibrator13=NULL;
- CalibratorParam *calibrator23=NULL;
-
- /* Extract number of telescopes */
- plist = cpl_propertylist_load(outname_selector, 0);
- if (plist==NULL)
- {
- cpl_msg_warning(cpl_func,"Error loading the primary header of %s",
- outname_selector);
- /* Propagate error, if any */
- return cpl_error_set(cpl_func, cpl_error_get_code());
- }
- if (cpl_propertylist_has(plist, "ESO ISS CONF NTEL") == 1)
- {
- nTel=cpl_propertylist_get_int(plist, "ESO ISS CONF NTEL");
- }
- else
- {
- cpl_propertylist_delete(plist);
- return cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
- "Can not find number of telescopes from the header!");
- }
-
-
- calibrator12=cpl_calloc(1,sizeof(CalibratorParam));
- if (amber_init_calibrator(calibrator12))
- {
- cpl_msg_warning (cpl_func, "amber_init_calibrator: %s",
- cpl_error_get_message());
- }
- if (amber_identifyCalibrator (outname_selector, calibrator12,
- "12", framelist, &error))
- {
- cpl_propertylist_delete(plist);
- cpl_free((void *)calibrator12->calibNameObserved);
- cpl_free((void *)calibrator12->calibNameDatabase);
- cpl_free(calibrator12);
- return cpl_error_set(cpl_func, cpl_error_get_code());
- }
-
- if(amber_getInvWavelength (outname_selector, calibrator12))
- {
- cpl_msg_warning (cpl_func, "amber_getInvWavelength: %s",
- cpl_error_get_message());
- }
-
- if(cpl_error_get_code())
- {
-
- cpl_propertylist_delete(plist);
- cpl_free((void *)calibrator12->calibNameObserved);
- cpl_free((void *)calibrator12->calibNameDatabase);
- cpl_vector_delete(calibrator12->calibInvWavelength);
- cpl_free(calibrator12);
- return cpl_error_set(cpl_func, cpl_error_get_code());
- }
-
- /*fake the midi value for testing purpose*/
- /*
- cpl_vector_fill(calibrator12->calibInvWavelength,100000.);
- cpl_vector_dump(calibrator12->calibInvWavelength,NULL);
- */
- if(amber_computeExpectedVis (calibrator12))
- {
- cpl_msg_warning (cpl_func, "amber_computeExpectedVis: %s",
- cpl_error_get_message());
- }
-
-
- if(nTel>2)
- {
- calibrator13=cpl_calloc(1,sizeof(CalibratorParam));
- calibrator23=cpl_calloc(1,sizeof(CalibratorParam));
-
- if (amber_init_calibrator(calibrator13))
- {
- cpl_msg_warning (cpl_func, "amber_init_calibrator: %s",
- cpl_error_get_message());
- }
- if (amber_init_calibrator(calibrator23))
- {
- cpl_msg_warning (cpl_func, "amber_init_calibrator: %s",
- cpl_error_get_message());
- }
-
- if (amber_identifyCalibrator (outname_selector, calibrator13,
- "13", framelist, &error))
- {
- cpl_msg_warning (cpl_func, "amber_identifyCalibrator: %s",
- cpl_error_get_message());
- }
- if (amber_identifyCalibrator (outname_selector, calibrator23,
- "23", framelist, &error))
- {
- cpl_msg_warning (cpl_func, "amber_identifyCalibrator: %s",
- cpl_error_get_message());
- }
-
- if(amber_getInvWavelength (outname_selector, calibrator13))
- {
- cpl_msg_warning (cpl_func, "amber_getInvWavelength: %s",
- cpl_error_get_message());
- }
- if(amber_getInvWavelength (outname_selector, calibrator23))
- {
- cpl_msg_warning (cpl_func, "amber_getInvWavelength: %s",
- cpl_error_get_message());
- }
- if(amber_computeExpectedVis (calibrator13))
- {
- cpl_msg_warning (cpl_func, "amber_computeExpectedVis: %s",
- cpl_error_get_message());
- }
- if(amber_computeExpectedVis (calibrator23))
- {
- cpl_msg_warning (cpl_func, "amber_computeExpectedVis: %s",
- cpl_error_get_message());
- }
- }
-
-
- if(amber_TransferFunctionCompute(calibrator12, calibrator13,
- calibrator23, recipename, outname_selector, parlist, framelist))
- {
- cpl_msg_warning (cpl_func, "amber_TransferFunctionCompute: %s",
- cpl_error_get_message());
- }
- /*
- midi_computeExpectedVis (calibrator12);
- cpl_msg_info(cpl_func,"AAAAAAAAAAAAAAAAAAAAAAAAAAAA");
- cpl_msg_info(cpl_func,"Expected Visibility = %f \n",
- calibrator12->mcalibVis);
- cpl_msg_info(cpl_func,"Expected Visibility Error = %f \n",
- calibrator12->mcalibVisErr);
- cpl_msg_info(cpl_func,"Expected Squared Visibility = %f \n",
- calibrator12->mcalibVisSqrd);
- cpl_msg_info(cpl_func,"Expected Squared Visibility Error = %f \n",
- calibrator12->mcalibVisSqrdErr);
- */
-
-
- /*Free the memory*/
- cpl_free((void *)calibrator12->calibNameDatabase);
- cpl_free((void *)calibrator12->calibNameObserved);
- cpl_vector_delete(calibrator12->calibInvWavelength);
- cpl_vector_delete(calibrator12->calibVis);
- cpl_vector_delete(calibrator12->calibVisErr);
- cpl_vector_delete(calibrator12->calibVisSqrd);
- cpl_vector_delete(calibrator12->calibVisSqrdErr);
-
-
- if(nTel>2)
- {
- cpl_free((void *)calibrator13->calibNameDatabase);
- cpl_free((void *)calibrator13->calibNameObserved);
- cpl_vector_delete(calibrator13->calibInvWavelength);
- cpl_vector_delete(calibrator13->calibVis);
- cpl_vector_delete(calibrator13->calibVisErr);
- cpl_vector_delete(calibrator13->calibVisSqrd);
- cpl_vector_delete(calibrator13->calibVisSqrdErr);
-
- cpl_free((void *)calibrator23->calibNameDatabase);
- cpl_free((void *)calibrator23->calibNameObserved);
- cpl_vector_delete(calibrator23->calibInvWavelength);
- cpl_vector_delete(calibrator23->calibVis);
- cpl_vector_delete(calibrator23->calibVisErr);
- cpl_vector_delete(calibrator23->calibVisSqrd);
- cpl_vector_delete(calibrator23->calibVisSqrdErr);
- }
-
- cpl_free(calibrator12);
- cpl_free(calibrator13);
- cpl_free(calibrator23);
- cpl_propertylist_delete(plist);
-
-
- /* Propagate error, if any */
- return cpl_error_set(cpl_func, cpl_error_get_code());
-
-}
-static cpl_error_code amber_TransferFunctionCompute(
- CalibratorParam *calibrator12, CalibratorParam *calibrator13,
- CalibratorParam *calibrator23,const char * recipename,
- const char * filename, cpl_parameterlist *parlist,
- cpl_frameset * framelist)
-{
- int iFrame=0;
- int iWave=0;
- const char * outname_trf=NULL;
- const char * outname_trf_paf=NULL;
- char * local_filename=NULL;
- const char * tag_trf=NULL;
- cpl_frame * final_local_frame=NULL;
- cpl_frame * local_frame=NULL;
- cpl_propertylist * pHeader=NULL;
- amdlibERROR_MSG errMsg;
- amdlibPHOTOMETRY photometry = {NULL};
- amdlibWAVELENGTH wave = {NULL};
- amdlibPISTON opd = {NULL};
- amdlibOI_TARGET target = {NULL};
- amdlibOI_ARRAY array = {NULL};
- amdlibVIS vis = {NULL};
- amdlibVIS2 vis2 = {NULL};
- amdlibVIS3 vis3 = {NULL};
- amdlibINS_CFG insCfg;
- amdlibSPECTRUM spectrum={NULL};
-
- amdlibLogTrace("amdlibPerformSelection()");
-
- /* Load input OI-FITS file */
- amdlibLogInfo("Loading OI-FITS file...");
- /* amdlibLogInfoDetail(inputFile);*/
-
- amdlibClearInsCfg(&insCfg);
-
- if (amdlibLoadOiFile(filename, &insCfg, &array, &target, &photometry,
- &vis, &vis2, &vis3, &wave, &opd, &spectrum,
- errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not load OI-FITS file '%s'", filename);
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
-
- /*cpl_msg_info(cpl_func, "AA: %g",vis2.table[0].vis2[0]);*/
-
- /* Transfer function for Visibility2*/
- for(iFrame = 0; iFrame < (vis.nbFrames * vis.nbBases); iFrame++){
- for(iWave = 0; iWave <wave.nbWlen; iWave++){
- /*Vis2*/
- vis2.table[iFrame].vis2[iWave] =
- (vis2.table[iFrame].vis2[iWave])/
- cpl_vector_get(calibrator12->calibVisSqrd, iWave);
- /*
- cpl_vector_get(calibrator12->calibVisSqrd, iWave)
- / (vis2.table[iFrame].vis2[iWave]);
- */
- /*Vis2 Error propagation*/
- vis2.table[iFrame].vis2Error[iWave] = sqrt(
- (cpl_vector_get(calibrator12->calibVisSqrdErr, iWave) *
- cpl_vector_get(calibrator12->calibVisSqrdErr, iWave))
- + ((vis2.table[iFrame].vis2Error[iWave]) *
- (vis2.table[iFrame].vis2Error[iWave])));
-
- }
- if(vis.nbBases>1){
- iFrame++;
- for(iWave = 0; iWave < wave.nbWlen; iWave++){
- /*Vis2*/
- vis2.table[iFrame].vis2[iWave] =
- (vis2.table[iFrame].vis2[iWave])/
- cpl_vector_get(calibrator13->calibVisSqrd, iWave);
- /*
- cpl_vector_get(calibrator13->calibVisSqrd, iWave)
- / (vis2.table[iFrame].vis2[iWave]);
- */
- /*Vis2 Error propagation*/
- vis2.table[iFrame].vis2Error[iWave] = sqrt(
- (cpl_vector_get(calibrator13->calibVisSqrdErr, iWave) *
- cpl_vector_get(calibrator13->calibVisSqrdErr, iWave))
- + ((vis2.table[iFrame].vis2Error[iWave]) *
- (vis2.table[iFrame].vis2Error[iWave])));
-
- }
- iFrame++;
- for(iWave = 0; iWave < wave.nbWlen; iWave++){
- /*Vis2*/
- vis2.table[iFrame].vis2[iWave] =
- (vis2.table[iFrame].vis2[iWave])/
- cpl_vector_get(calibrator23->calibVisSqrd, iWave);
- /*
- cpl_vector_get(calibrator23->calibVisSqrd, iWave)
- / (vis2.table[iFrame].vis2[iWave]);
- */
- /*Vis2 Error propagation*/
- vis2.table[iFrame].vis2Error[iWave] = sqrt(
- (cpl_vector_get(calibrator23->calibVisSqrdErr, iWave) *
- cpl_vector_get(calibrator23->calibVisSqrdErr, iWave))
- + ((vis2.table[iFrame].vis2Error[iWave]) *
- (vis2.table[iFrame].vis2Error[iWave])));
-
- }
- }
- }
-
-
- /*Workarround to inherit important parameters from the selected frame and
- * not the first raw frame*/
-
-
- /*basename() may modify its argument, therefore I duplicate it*/
-
- local_filename=cpl_sprintf("%s", filename);
- local_frame = cpl_frameset_get_first(framelist);
- while(local_frame)
- {
- if(!strcmp(cpl_frame_get_filename(local_frame),filename))
- {
- break;
- }
- else{
- local_frame = cpl_frameset_get_next( framelist );
- }
- }
-
- cpl_msg_info(cpl_func,"Frame to inherit: %s",
- cpl_frame_get_filename(local_frame));
-
- final_local_frame=cpl_frame_duplicate(local_frame);
- cpl_frame_set_group(final_local_frame,CPL_FRAME_GROUP_PRODUCT);
-
- outname_trf = cpl_sprintf("trf_%s", basename(local_filename));
- cpl_msg_info(cpl_func,"Frame to write the corresponding transfer function:"
- " %s",outname_trf);
- pHeader = cpl_propertylist_load(filename, 0 );
-
- if( cpl_dfs_setup_product_header( pHeader,
- final_local_frame,
- framelist,
- parlist,
- recipename, /* const char * recid, */
- PACKAGE "/" PACKAGE_VERSION, /* const char * pipeline_id, */
- PRODUCT_DID, /* const char * dictionary_id */
- local_frame
- ) != CPL_ERROR_NONE )
- {
- /* Error */
- cpl_msg_warning(cpl_func, "Error in setting up the product header." );
- }
-
-
- amber_qc(&wave, &vis, &vis2, &vis3, NULL, pHeader, "trf");
-
- if (cpl_propertylist_has(pHeader, "ESO QC BAND") == 1)
- {
- tag_trf=cpl_sprintf("AMBER_TRF_%s",
- cpl_propertylist_get_string(pHeader, "ESO QC BAND"));
- }
- else{
-
- tag_trf=cpl_sprintf("AMBER_TRF");
- }
-
-
-
-
- cpl_propertylist_update_string(pHeader, CPL_DFS_PRO_CATG, tag_trf);
- cpl_free((void *)tag_trf);
-
- cpl_propertylist_update_double(pHeader, "ESO QC OBS CAL RA" ,
- calibrator12->calibRA);
- cpl_propertylist_update_double(pHeader, "ESO QC OBS CAL DEC" ,
- calibrator12->calibDEC);
- cpl_propertylist_update_string(pHeader, "ESO QC OBS NAME" ,
- calibrator12->calibNameObserved);
- cpl_propertylist_update_string(pHeader, "ESO QC DB NAME" ,
- calibrator12->calibNameDatabase);
- cpl_propertylist_update_double(pHeader, "ESO QC DB DIAM" ,
- calibrator12->calibDiameter);
- cpl_propertylist_update_double(pHeader, "ESO QC DB DIAM ERR " ,
- calibrator12->calibDiameterErr);
- cpl_propertylist_update_double(pHeader, "ESO QC DB DIST" ,
- RAD_TO_ARCSEC * calibrator12->calibDistance);
- cpl_propertylist_update_double(pHeader, "ESO QC DB MAG JBAND" ,
- calibrator12->calibMagJ);
- cpl_propertylist_update_double(pHeader, "ESO QC DB MAG HBAND" ,
- calibrator12->calibMagH);
- cpl_propertylist_update_double(pHeader, "ESO QC DB MAG KBAND" ,
- calibrator12->calibMagK);
- cpl_propertylist_update_int (pHeader, "ESO QC DB FLAG" ,
- calibrator12->calibFlag);
- cpl_propertylist_update_double(pHeader, "ESO QC OBS AVR PARANG" ,
- calibrator12->calibParangAverage);
- cpl_propertylist_update_bool(pHeader, "ESO QC OBS ESOTRUSTED" ,
- calibrator12->calibEsoTrusted);
-
- cpl_propertylist_update_double(pHeader, "ESO QC OBS AVR PBL12 " ,
- calibrator12->calibPblAverage);
- if(vis.nbBases>1){
- cpl_propertylist_update_double(pHeader, "ESO QC OBS AVR PBL13 " ,
- calibrator13->calibPblAverage);
- cpl_propertylist_update_double(pHeader, "ESO QC OBS AVR PBL23 " ,
- calibrator23->calibPblAverage);
- }
-
- cpl_propertylist_set_comment (pHeader, "ESO QC OBS CAL RA" ,
- "Observed Calibrator RA in radians");
- cpl_propertylist_set_comment (pHeader, "ESO QC OBS CAL DEC" ,
- "Observed Calibrator DEC in radians");
- cpl_propertylist_set_comment (pHeader, "ESO QC OBS NAME" ,
- "Observed Calibrator name");
- cpl_propertylist_set_comment (pHeader, "ESO QC DB NAME" ,
- "Closest Calibrator in the database");
- cpl_propertylist_set_comment (pHeader, "ESO QC DB DIAM" ,
- "Calibrator Diameter in marcsec");
- cpl_propertylist_set_comment (pHeader, "ESO QC DB DIAM ERR " ,
- "Calibrator Diameter error in marcsec");
- cpl_propertylist_set_comment (pHeader, "ESO QC DB DIST" ,
- "Computed Distance in arcsec");
- cpl_propertylist_set_comment (pHeader, "ESO QC DB MAG JBAND" ,
- "Calibrator Magnitude in the J-Band");
- cpl_propertylist_set_comment (pHeader, "ESO QC DB MAG HBAND" ,
- "Calibrator Magnitude in the H-Band");
- cpl_propertylist_set_comment (pHeader, "ESO QC DB MAG KBAND" ,
- "Calibrator Magnitude in the K-Band");
- cpl_propertylist_set_comment (pHeader, "ESO QC DB FLAG" ,
- "Calibrator Quality Flag");
- cpl_propertylist_set_comment (pHeader, "ESO QC OBS AVR PARANG" ,
- "Observed Calibrator Average PARANG in degrees");
- cpl_propertylist_set_comment (pHeader, "ESO QC OBS ESOTRUSTED" ,
- "Observed Calibrator Trusted status");
-
-
- cpl_propertylist_set_comment (pHeader, "ESO QC OBS AVR PBL12 " ,
- "Observed Calibrator Average PBL12 in meter");
- if(vis.nbBases>1){
- cpl_propertylist_set_comment (pHeader, "ESO QC OBS AVR PBL13 " ,
- "Observed Calibrator Average PBL13 in meter");
- cpl_propertylist_set_comment (pHeader, "ESO QC OBS AVR PBL23 " ,
- "Observed Calibrator Average PBL23 in meter");
- }
-
- /*Adding the JMMC acknowledgements*/
- amber_JMMC_acknowledgement(pHeader);
-
- cpl_image_save(NULL, outname_trf, CPL_BPP_16_SIGNED,pHeader,CPL_IO_DEFAULT);
- outname_trf_paf=cpl_sprintf("qc_trf_%s.paf", basename(local_filename));
-
-
- if (cpl_propertylist_has(pHeader, "ESO QC ARC") == 1)
- {
- cpl_propertylist_append_string(pHeader,"ARCFILE",
- (cpl_propertylist_get_string(pHeader, "ESO QC ARC")));
- //cpl_dfs_save_paf("AMBER", recipename, pHeader, outname_trf_paf);
- cpl_propertylist_erase(pHeader,"ARCFILE");
- }
-
-
- cpl_free((void *)outname_trf_paf);
- cpl_propertylist_delete(pHeader);
-
-
- amdlibSaveOiFile(outname_trf, &insCfg, &array, &target,
- &photometry, &vis, &vis2, &vis3, &wave, &opd, &spectrum, errMsg);
-
- /* amdlibReleaseSelection(&selectedFrames);*/
- amdlibReleaseOiArray(&array);
- amdlibReleaseOiTarget(&target);
- amdlibReleasePhotometry(&photometry);
- amdlibReleaseVis(&vis);
- amdlibReleaseVis2(&vis2);
- amdlibReleaseVis3(&vis3);
- amdlibReleaseWavelength(&wave);
- amdlibReleaseSpectrum(&spectrum);
- amdlibReleasePiston(&opd);
-
- /*Append the saved image to the global framelist*/
-
- cpl_frame_set_filename(final_local_frame, outname_trf);
-
- cpl_free((void *)outname_trf);
- cpl_free((void *)local_filename);
- cpl_frameset_insert( framelist, final_local_frame);
- /*cpl_frameset_dump(framelist, NULL);*/
-
-
- /* Propagate error, if any */
- return cpl_error_set(cpl_func, cpl_error_get_code());
-
-}
diff --git a/amber/esolibTransferfunction.h b/amber/esolibTransferfunction.h
deleted file mode 100644
index 153ba03..0000000
--- a/amber/esolibTransferfunction.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * esolibTransferfunction.h
- *
- * Created on: Oct 5, 2009
- * Author: agabasch
- */
-
-#ifndef ESOLIBTRANSFERFUNCTION_H_
-#define ESOLIBTRANSFERFUNCTION_H_
-
-#define DEG_TO_RAD (0.017453292519943295474372)
-#define HOUR_TO_RAD (0.261799387799149407829447)
-/* Minimum threshold for finding diameter in radians (60 arcsec) */
-#define CALIBRATOR_MIN_THRESHOLD (0.000290888)
-#define RAD_TO_ARCSEC (206264.8062470963551564733)
-#define AMBER_PI (3.141592653589793115997963)
-
-/* Inverse Effective wavelength = (1.0 / 10 micron) from midi*/
- /*needed only for crosscheck with MIDI results !!!*/
-#define INVERSE_WAVELENGTH (100000.0)
-/* Diameter factor = (1.0 / (1000 * 206264.8)) */
-#define DIAMETER_FACTOR (4.848136958e-9)
-#include "cpl.h"
-typedef struct
-{
- double calibRA;
- double calibDEC;
- double calibDistance;
- const char * calibNameDatabase;
- const char * calibNameObserved;
- cpl_vector * calibInvWavelength;
- cpl_vector * calibVis;
- cpl_vector * calibVisErr;
- cpl_vector * calibVisSqrd;
- cpl_vector * calibVisSqrdErr;
- double calibPblAverage;
- double calibParangAverage;
- double calibDiameter;
- double calibDiameterErr;
- double calibMagJ;
- double calibMagH;
- double calibMagK;
- int calibFlag;
- int calibEsoTrusted;
- float mcalibVis; /*only for crosscheck with MIDI results*/
- float mcalibVisErr; /*only for crosscheck with MIDI results*/
- float mcalibVisSqrd; /*only for crosscheck with MIDI results*/
- float mcalibVisSqrdErr; /*only for crosscheck with MIDI results*/
-} CalibratorParam;
-
-cpl_error_code amber_TransferFunction(const char * recipename,
- const char * outname_calibrator, cpl_parameterlist *parlist,
- cpl_frameset * framelist);
-
-#endif /* ESOLIBTRANSFERFUNCTION_H_ */
diff --git a/amber/esolibamdlibOi.c b/amber/esolibamdlibOi.c
deleted file mode 100644
index 391f84c..0000000
--- a/amber/esolibamdlibOi.c
+++ /dev/null
@@ -1,2031 +0,0 @@
-
-/**
- * @file
- * Functions to read/write IO-FITS file
- */
-#define _POSIX_SOURCE 1
-
-static char *rcsId="@(#) $Id: esolibamdlibOi.c,v 1.5 2011-09-26 12:54:06 agabasch Exp $";
-static void *use_rcsId = (0 ? &use_rcsId : (void*)&rcsId);
-
-/*
- System Headers
-*/
-
-#include "fitsio.h"
-#include <string.h>
-#include <math.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-/*
- Local Headers
-*/
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-
-
-
-/* Local function declaration */
-static amdlibCOMPL_STAT amdlibWriteOiArray(fitsfile *filePtr,
- amdlibOI_ARRAY *array,
- amdlibERROR_MSG errMsg, int lmin, int lmax);
-static amdlibCOMPL_STAT amdlibWriteOiTarget(fitsfile *filePtr,
- amdlibOI_TARGET *target,
- amdlibERROR_MSG errMsg, int lmin, int lmax);
-
-
-static amdlibCOMPL_STAT amdlibWriteOiWavelength(fitsfile *filePtr,
- char *insName,
- amdlibWAVELENGTH *wave,
- amdlibERROR_MSG errMsg, int lmin, int lmax);
-static amdlibCOMPL_STAT amdlibWriteOiVis(fitsfile *filePtr,
- char *insName,
- char *arrName,
- amdlibVIS *vis,
- amdlibERROR_MSG errMsg, int lmin, int lmax);
-static amdlibCOMPL_STAT amdlibWriteOiVis2(fitsfile *filePtr,
- char *insName,
- char *arrName,
- amdlibVIS2 *vis2,
- amdlibERROR_MSG errMsg, int lmin, int lmax);
-
-static amdlibCOMPL_STAT amdlibWriteOiVis3(fitsfile *filePtr,
- char *insName,
- char *arrName,
- amdlibVIS3 *vis3,
- amdlibERROR_MSG errMsg, int lmin, int lmax);
-
-static amdlibCOMPL_STAT amdlibWriteAmberData(fitsfile *filePtr,
- char *insName,
- amdlibPHOTOMETRY *photometry,
- amdlibVIS *vis,
- amdlibPISTON *pst,
- amdlibWAVELENGTH *wave,
- amdlibERROR_MSG errMsg, int lmin, int lmax);
-static amdlibCOMPL_STAT esolibamdlibWriteAmberSpectrum(fitsfile *filePtr,
- amdlibWAVELENGTH *wave,
- amdlibSPECTRUM *spc,
- amdlibERROR_MSG errMsg, int lmin, int lmax);
-
-
-/*
- * Public functions
- */
-/**
- * Write OI-FITS file.
- *
- * This function create OI-FITS file containing the OI_ARRAY, OI_TARGET, OI_VIS,
- * OI_VIS2, OI_T3 and OI_WAVELENGTH binary tables defined in the IAU standard,
- * and the AMBER_DATA binary table which is specific to AMBER. The AMBER_DATA
- * binary table contains photometry and piston data.
- *
- * @note
- * If the file exists, it is overwritten.
- *
- * @param filename name of the OI-FITS file to create
- * @param insCfg array containing keywords of the primary header.
- * @param array structure containing information of OI_ARRAY binary table
- * @param target structure containing information of OI_TARGET binary table
- * @param photometry structure containing photometry which is stored in
- * AMBER_DATA binary table.
- * @param vis structure containing information of OI_VIS binary table
- * @param vis2 structure containing information of OI_VIS2 binary table
- * @param vis3 structure containing information of OI_T3 binary table
- * @param wave structure containing information of OI_WAVELENGTH binary table
- * @param pst structure containing piston which is stored in AMBER_DATA binary
- * table.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibSaveOiFile_waveselected(const char *filename,
- amdlibINS_CFG *insCfg,
- amdlibOI_ARRAY *array,
- amdlibOI_TARGET *target,
- amdlibPHOTOMETRY *photometry,
- amdlibVIS *vis,
- amdlibVIS2 *vis2,
- amdlibVIS3 *vis3,
- amdlibWAVELENGTH *wave,
- amdlibPISTON *pst,
- amdlibSPECTRUM *spectrum,
- amdlibERROR_MSG errMsg,
- int lmin,
- int lmax)
-{
- int status = 0;
- fitsfile *filePtr;
- int i;
-#ifndef ESO_CPL_PIPELINE_VARIANT
- struct stat statBuf;
- time_t timeSecs;
- struct tm *timeNow;
- char strTime[amdlibKEYW_VAL_LEN+1];
-#endif
- char fitsioMsg[256];
- char insName[amdlibKEYW_VAL_LEN+1];
- char arrName[amdlibKEYW_VAL_LEN+1];
- char version[32];
-
- amdlibLogTrace("amdlibSaveOiFile()");
-
-#ifndef ESO_CPL_PIPELINE_VARIANT
- /*
- * amdlib will create the file on its own
- */
- /* First remove previous IO file (if any) */
- if (stat(filename, &statBuf) == 0)
- {
- if (remove(filename) != 0)
- {
- amdlibSetErrMsg("Could not overwrite file %s", filename);
- return amdlibFAILURE;
- }
- }
-
- /* Create new FITS file */
- if (fits_create_file(&filePtr, filename, &status))
- {
- amdlibReturnFitsError("opening file");
- }
-#else
- /*
- * The ESO pipeline will create that file and prepare the header
- * with DMD compliant keywords. Hence amdlib shall just append to it
- */
-
- /* Append to FITS file */
- if (fits_open_file(&filePtr, filename, READWRITE, &status))
- {
- printf("%s->fits_open_file cannot open in append mode\n", filename );
- amdlibReturnFitsError("opening file");
- }
- else
- {
- printf("%s->fits_open_file append OK\n", filename);
- }
-#endif
-
- /* Build a uniq INSNAME using P2VM id (if possible), else use default */
- sprintf(insName, "AMBER");
-
- /* Retrieve ARRNAME if possible, else use default.*/
- if (array != NULL)
- {
- strncpy(arrName, array->arrayName, amdlibKEYW_VAL_LEN+1);
- }
- else
- {
- sprintf(arrName, "UNKNOWN");
- }
-
- /* Write OI_ARRAY binary table */
- if (array != NULL)
- {
- if (amdlibWriteOiArray(filePtr, array, errMsg, lmin, lmax) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
-
- /* Write OI_TARGET binary table */
- if (target != NULL)
- {
- if (amdlibWriteOiTarget(filePtr, target, errMsg, lmin, lmax) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
-
- /* Write OI_WAVELENGTH binary table */
- if (wave != NULL)
- {
- if (amdlibWriteOiWavelength(filePtr, insName,
- wave, errMsg, lmin, lmax) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
-
- /* Write OI_VIS binary table */
- if (vis != NULL)
- {
- if (amdlibWriteOiVis(filePtr, insName, arrName,
- vis, errMsg, lmin, lmax) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
-
- /* Write OI_VIS2 binary table */
- if (vis2 != NULL)
- {
- if (amdlibWriteOiVis2(filePtr, insName, arrName,
- vis2, errMsg, lmin, lmax) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
- /* Write OI_T3 binary table */
- if (vis3 != NULL)
- {
- if (amdlibWriteOiVis3(filePtr, insName, arrName,
- vis3, errMsg, lmin, lmax) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
-
- /* Write AMBER_DATA binary table */
- if ((photometry != NULL) && (vis != NULL) && (pst != NULL))
- {
- if (vis->nbFrames != 1)
- {
- if (amdlibWriteAmberData(filePtr, insName,
- photometry, vis, pst, wave,
- errMsg, lmin, lmax) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
- }
-
- /* Write AMBER_SPECTRUM binary table */
- if (spectrum != NULL)
- {
- if (esolibamdlibWriteAmberSpectrum(filePtr, wave, spectrum,
- errMsg, lmin, lmax) != amdlibSUCCESS)
- {
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
-
- /* Move to main header */
- if (fits_movabs_hdu(filePtr, 1, 0, &status) != 0)
- {
- amdlibGetFitsError("main header");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
-
-#ifndef ESO_CPL_PIPELINE_VARIANT
- /* Complete main header */
- if (insCfg != NULL)
- {
- /* Add DATE */
- timeSecs = time(NULL);
- timeNow = gmtime(&timeSecs);
- strftime(strTime, sizeof(strTime), "%Y-%m-%dT%H:%M:%S", timeNow);
- if (fits_write_key(filePtr, TSTRING, "DATE", strTime,
- "Date this file was written", &status) != 0)
- {
- amdlibGetFitsError("completing main header");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- /* Add other keywords */
- for (i = 0; i < insCfg->nbKeywords; i++)
- {
- amdlibKEYW_LINE keywLine;
- if ((strstr(insCfg->keywords[i].name, "SIMPLE") == NULL) &&
- (strstr(insCfg->keywords[i].name, "BITPIX") == NULL) &&
- (strstr(insCfg->keywords[i].name, "NAXIS ") == NULL) &&
- (strstr(insCfg->keywords[i].name, "EXTEND") == NULL) &&
- (strstr(insCfg->keywords[i].name, "DATE ") == NULL))
- {
- sprintf((char*)keywLine, "%s=%s/%s", insCfg->keywords[i].name,
- insCfg->keywords[i].value,
- insCfg->keywords[i].comment);
- if (fits_write_record(filePtr, keywLine, &status) != 0)
- {
- amdlibGetFitsError("completing main header");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
- }
- }
-#else
- /* Complete main header */
- if (insCfg != NULL)
- {
- /* Add QC keywords - spectral shifts */
- for (i = 0; i < insCfg->nbKeywords; i++)
- {
- amdlibKEYW_LINE keywLine;
- if ((strstr(insCfg->keywords[i].name,
- "HIERARCH ESO QC P1 ") != NULL) ||
- (strstr(insCfg->keywords[i].name,
- "HIERARCH ESO QC P2 ") != NULL) ||
- (strstr(insCfg->keywords[i].name,
- "HIERARCH ESO QC P3 ") != NULL))
- {
- sprintf((char*)keywLine, "%s=%s/%s", insCfg->keywords[i].name,
- insCfg->keywords[i].value,
- insCfg->keywords[i].comment);
- if (fits_write_record(filePtr, keywLine, &status) != 0)
- {
- amdlibGetFitsError("completing main header");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
- }
- }
- }
-#endif
-
- /* Add amdlib version */
- amdlibGetVersion(version);
- if (fits_update_key(filePtr, TSTRING, "HIERARCH ESO OCS DRS VERSION",
- version,
- "Data Reduction SW version", &status) != 0)
- {
- amdlibGetFitsError("HIERARCH ESO OCS DRS VERSION");
- fits_close_file(filePtr, &status);
- return amdlibFAILURE;
- }
-
- /* Close FITS file */
- if (fits_close_file(filePtr, &status))
- {
- amdlibReturnFitsError("closing file");
- }
-
- return amdlibSUCCESS;
-}
-
-
-/*
- * Protected functions
- */
-
-/*
- * Local functions
- */
-/**
- * Write OI_ARRAY table in OI-FITS file
- *
- * This function writes the OI_ARRAY binary table defined in the IAU standard
- * in the OI-FITS file given as parameter.
- *
- * @param filePtr pointer on the file to be created
- * @param array OI_ARRAY produced
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibWriteOiArray(fitsfile *filePtr,
- amdlibOI_ARRAY *array,
- amdlibERROR_MSG errMsg, int lmin, int lmax)
-{
- const int tfields = 5;
- char *ttype[] = {"TEL_NAME", "STA_NAME", "STA_INDEX", "DIAMETER",
- "STAXYZ"};
- char *tform[] = {"8A", "8A", "I", "E", "3D"};
- char *tunit[] = {"\0", "\0", "\0", "m", "m"};
- char extname[] = "OI_ARRAY";
- int status = 0;
- int iRow;
- char fitsioMsg[256];
- int revision = amdlib_OI_REVISION;
- char *str;
-
- amdlibLogTrace("amdlibWriteOiArray()");
-
- /* Algorithm */
-
- /* Create binary table */
- if (fits_create_tbl(filePtr, BINARY_TBL, 1, tfields, ttype, tform, tunit,
- extname, &status))
- {
- amdlibReturnFitsError("Creating Binary Table");
- }
-
- /* Write revision number */
- if (fits_write_key(filePtr, TINT, "OI_REVN", &revision,
- "Revision number of the table definition", &status))
- {
- amdlibReturnFitsError("OI_REVN");
- }
-
- /* Write array name */
- if (fits_write_key(filePtr, TSTRING, "ARRNAME", array->arrayName,
- "Array name", &status))
- {
- amdlibReturnFitsError("ARRNAME");
- }
-
- /* Write coordinate frame */
- if (fits_write_key(filePtr, TSTRING, "FRAME", array->coordinateFrame,
- "Coordinate frame", &status))
- {
- amdlibReturnFitsError("FRAME");
- }
-
- /* Write array center x coordinate */
- if (fits_write_key(filePtr, TDOUBLE, "ARRAYX",
- &array->arrayCenterCoordinates[0],
- "Array centre x coordinate", &status))
- {
- amdlibReturnFitsError("ARRAYX");
- }
-
- if (fits_write_key_unit(filePtr, "ARRAYX", "m", &status))
- {
- amdlibReturnFitsError("ARRAYX");
- }
-
- /* Write array center y coordinate */
- if (fits_write_key(filePtr, TDOUBLE, "ARRAYY",
- &array->arrayCenterCoordinates[1],
- "Array centre y coordinate", &status))
- {
- amdlibReturnFitsError("ARRAYY");
- }
-
- if (fits_write_key_unit(filePtr, "ARRAYY", "m", &status))
- {
- amdlibReturnFitsError("ARRAYY");
- }
-
- /* Write array center z coordinate */
- if (fits_write_key(filePtr, TDOUBLE, "ARRAYZ",
- &array->arrayCenterCoordinates[2],
- "Array centre z coordinate", &status))
- {
- amdlibReturnFitsError("ARRAYZ");
- }
-
- if (fits_write_key_unit(filePtr, "ARRAYZ", "m", &status))
- {
- amdlibReturnFitsError("ARRAYZ");
- }
-
- /* Write information on instrument */
- for (iRow = 1; iRow <= array->nbStations; iRow++)
- {
- str = array->element[iRow-1].telescopeName;
- if (fits_write_col(filePtr, TSTRING, 1, iRow, 1, 1, &str, &status))
- {
- amdlibReturnFitsError("telescopeName");
- }
- str = array->element[iRow-1].stationName;
- if (fits_write_col(filePtr, TSTRING, 2, iRow, 1, 1, &str, &status))
- {
- amdlibReturnFitsError("stationName");
- }
- if (fits_write_col(filePtr, TINT, 3, iRow, 1, 1,
- &array->element[iRow-1].stationIndex, &status))
- {
- amdlibReturnFitsError("stationIndex");
- }
- if (fits_write_col(filePtr, TDOUBLE, 4, iRow, 1, 1,
- &array->element[iRow-1].elementDiameter, &status))
- {
- amdlibReturnFitsError("diameter");
- }
- if (fits_write_col(filePtr, TDOUBLE, 5, iRow, 1, 3,
- array->element[iRow-1].stationCoordinates, &status))
- {
- amdlibReturnFitsError("staXYZ");
- }
- }
- return amdlibSUCCESS;
-}
-
-
-/**
- * Write OI_TARGET table in OI-FITS file.
- *
- * This function writes the OI_TARGET binary table defined in the IAU standard
- * in the OI-FITS file given as parameter.
- *
- * @param filePtr pointer on the file to be created.
- * @param target OI_TARGET produced.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibWriteOiTarget(fitsfile *filePtr,
- amdlibOI_TARGET *target,
- amdlibERROR_MSG errMsg, int lmin, int lmax)
-{
- const int tfields = 17;
- char *ttype[] = {"TARGET_ID", "TARGET", "RAEP0", "DECEP0", "EQUINOX",
- "RA_ERR", "DEC_ERR", "SYSVEL", "VELTYP", "VELDEF", "PMRA", "PMDEC",
- "PMRA_ERR", "PMDEC_ERR", "PARALLAX", "PARA_ERR", "SPECTYP"};
- char *tform[] = {"I", "16A", "D", "D", "E", "D", "D", "D", "8A",
- "8A", "D", "D", "D", "D", "E", "E", "16A"};
- char *tunit[] = {"\0", "\0", "deg", "deg", "year", "deg", "deg",
- "m/s", "\0", "\0", "deg/year", "deg/year", "deg/year", "deg/year",
- "deg", "deg", "\0"};
- char extname[] = "OI_TARGET";
- char fitsioMsg[256];
- int status = 0;
- int revision = amdlib_OI_REVISION;
- int iRow;
- char *str;
-
- amdlibLogTrace("amdlibWriteOiTarget()");
-
- /* Create binary table */
- if (fits_create_tbl(filePtr, BINARY_TBL, 1, tfields, ttype, tform, tunit,
- extname, &status))
- {
- amdlibReturnFitsError("Creating Binary Table");
- }
-
- /* Write revision number of the table definition */
- if (fits_write_key(filePtr, TINT, "OI_REVN", &revision,
- "Revision number of the table definition", &status))
- {
- amdlibReturnFitsError("OI_REVN");
- }
-
- for (iRow = 1; iRow <= target->nbTargets; iRow++)
- {
- /* Write target identity */
- if (fits_write_col(filePtr, TINT, 1, iRow, 1, 1,
- &target->element[iRow-1].targetId, &status))
- {
- amdlibReturnFitsError("targetId");
- }
-
- str = target->element[iRow-1].targetName;
-
- /* Write target name */
- if (fits_write_col(filePtr, TSTRING, 2, iRow, 1, 1, &str, &status))
- {
- amdlibReturnFitsError("targetName");
- }
-
- /* Write right ascension at mean equinox */
- if (fits_write_col(filePtr, TDOUBLE, 3, iRow, 1, 1,
- &target->element[iRow-1].raEp0, &status))
- {
- amdlibReturnFitsError("raEp0");
- }
- /* Write declinaison at mean equinox */
- if (fits_write_col(filePtr, TDOUBLE, 4, iRow, 1, 1,
- &target->element[iRow-1].decEp0, &status))
- {
- amdlibReturnFitsError("decEp0");
- }
- /* Write equinox of raEp0 and decEp0 */
- if (fits_write_col(filePtr, TDOUBLE, 5, iRow, 1, 1,
- &target->element[iRow-1].equinox, &status))
- {
- amdlibReturnFitsError("equinox");
- }
- /* Write error in apparent RA */
- if (fits_write_col(filePtr, TDOUBLE, 6, iRow, 1, 1,
- &target->element[iRow-1].raErr, &status))
- {
- amdlibReturnFitsError("raErr");
- }
- /* Write error in apparent DEC */
- if (fits_write_col(filePtr, TDOUBLE, 7, iRow, 1, 1,
- &target->element[iRow-1].decErr, &status))
- {
- amdlibReturnFitsError("decErr");
- }
- /* Write systemic radial velocity */
- if (fits_write_col(filePtr, TDOUBLE, 8, iRow, 1, 1,
- &target->element[iRow-1].sysVel, &status))
- {
- amdlibReturnFitsError("sysVel");
- }
-
- str = target->element[iRow-1].velTyp;
- /* Write velocity type of sysVel */
- if (fits_write_col(filePtr, TSTRING, 9, iRow, 1, 1, &str, &status))
- {
- amdlibReturnFitsError("velTyp");
- }
-
- str = target->element[iRow-1].velDef;
- /* Write definition of radial velocity : "OPTICAL" or "RADIO" */
- if (fits_write_col(filePtr, TSTRING, 10, iRow, 1, 1, &str, &status))
- {
- amdlibReturnFitsError("velDef");
- }
-
- /* Write proper motion in RA */
- if (fits_write_col(filePtr, TDOUBLE, 11, iRow, 1, 1,
- &target->element[iRow-1].pmRa, &status))
- {
- amdlibReturnFitsError("pmRa");
- }
- /* Write proper motion in DEC */
- if (fits_write_col(filePtr, TDOUBLE, 12, iRow, 1, 1,
- &target->element[iRow-1].pmDec, &status))
- {
- amdlibReturnFitsError("pmDec");
- }
- /* Write error on pmRa */
- if (fits_write_col(filePtr, TDOUBLE, 13, iRow, 1, 1,
- &target->element[iRow-1].pmRaErr, &status))
- {
- amdlibReturnFitsError("pmRaErr");
- }
- /* Write error on pmDec */
- if (fits_write_col(filePtr, TDOUBLE, 14, iRow, 1, 1,
- &target->element[iRow-1].pmDecErr, &status))
- {
- amdlibReturnFitsError("pmDecErr");
- }
- /* Write parallax value */
- if (fits_write_col(filePtr, TDOUBLE, 15, iRow, 1, 1,
- &target->element[iRow-1].parallax, &status))
- {
- amdlibReturnFitsError("parallax");
- }
- /* Write error in parallax value */
- if (fits_write_col(filePtr, TDOUBLE, 16, iRow, 1, 1,
- &target->element[iRow-1].paraErr, &status))
- {
- amdlibReturnFitsError("paraErr");
- }
- /* Write spectral type */
- str = target->element[iRow-1].specTyp;
- if (fits_write_col(filePtr, TSTRING, 17, iRow, 1, 1, &str, &status))
- {
- amdlibReturnFitsError("specTyp");
- }
- }
- return amdlibSUCCESS;
-}
-
-
-/**
- * Write OI_WAVELENGTH table in OI-FITS file.
- *
- * This function writes the OI_WAVELENGTH binary table defined in the IAU
- * standard in the OI-FITS file given as parameter.
- *
- * @param filePtr pointer on the file to be created.
- * @param insName name of the instrument.
- * @param wave OI_WAVELENGTH produced.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibWriteOiWavelength(fitsfile *filePtr,
- char *insName,
- amdlibWAVELENGTH *wave,
- amdlibERROR_MSG errMsg, int lmin, int lmax)
-{
- int status = 0;
- char fitsioMsg[256];
- const int tfields = 2;
- char *ttype[] = {"EFF_WAVE", "EFF_BAND"};
- char *tform[] = {"E", "E"};
- char *tunit[] = {"m", "m"};
- char extname[] = "OI_WAVELENGTH";
- int revision = amdlib_OI_REVISION;
- int i;
- amdlibDOUBLE waveInM, bwInM;
-
- amdlibLogTrace("amdlibWriteOiWavelength()");
-
- /* Create binary table */
- if (fits_create_tbl (filePtr, BINARY_TBL, 1, tfields, ttype, tform, tunit,
- extname, &status))
- {
- amdlibReturnFitsError("Creating Binary Table");
- }
-
- /* Write revision number of the table definition */
- if (fits_write_key (filePtr, TINT, "OI_REVN", &revision,
- "Revision number of the table definition", &status))
- {
- amdlibReturnFitsError("OI_REVN");
- }
-
- /* Write spectral setup unique identifier */
- if (fits_write_key (filePtr, TSTRING, "INSNAME", insName,
- "Instrument name", &status))
- {
- amdlibReturnFitsError("INSNAME");
- }
-
- for (i = 1; i <= wave->nbWlen-(lmin+lmax); i ++)
- {
- waveInM = (wave->wlen[i-1+lmin]) * amdlibNM_TO_M;
- bwInM = (wave->bandwidth[i-1+lmin]) * amdlibNM_TO_M;
- /* Write EFFective_WAVElengh table */
- if (fits_write_col (filePtr, TDOUBLE, 1, i, 1, 1, &waveInM, &status))
- {
- amdlibReturnFitsError("EFFective_WAVElengh");
- }
-
- /* Write EFFective_BANDwidth table */
- if (fits_write_col (filePtr, TDOUBLE, 2, i, 1, 1, &bwInM, &status))
- {
- amdlibReturnFitsError("EFFective_BANDwidth");
- }
- }
-
- return amdlibSUCCESS;
-}
-
-#define amdlibWriteOiVis_FREEALL() free(visError); free(flag); free(convertToDeg);
-
-/**
- * Write OI_VIS table in OI-FITS file
- *
- * This function writes the OI_VIS binary table defined in the IAU
- * standard in the OI-FITS file given as parameter.
- *
- * @param filePtr pointer on the file to be created
- * @param insName name of the detector
- * @param arrName array name
- * @param vis OI_VIS produced
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibWriteOiVis(fitsfile *filePtr,
- char *insName,
- char *arrName,
- amdlibVIS *vis,
- amdlibERROR_MSG errMsg, int lmin, int lmax)
-
-{
- /* Local Declarations */
-
- int nbWlen = vis->nbWlen-(lmin+lmax);
- int lVis;
- double *convertToDeg;
- amdlibCOMPLEX *visError;
- unsigned char *flag;
- amdlibDOUBLE amdlibBval=amdlibBLANKING_VALUE;
-
- int status = 0;
- char fitsioMsg[256];
- const int tfields = 14;
- char *ttype[] = {"TARGET_ID", "TIME", "MJD", "INT_TIME",
- "VISDATA", "VISERR", "VISAMP", "VISAMPERR", "VISPHI", "VISPHIERR",
- "UCOORD", "VCOORD", "STA_INDEX", "FLAG"};
- char *Tform[] = {"I", "D", "D", "D", "?C", "?C", "?D", "?D",
- "?D", "?D", "1D", "1D", "2I", "?L"};
- char *tform[tfields];
- char *tunit[] = {"\0", "s", "day", "s", "\0", "\0", "\0", "\0",
- "deg", "deg", "m", "m", "\0", "\0"};
- char extname[] = "OI_VIS";
- int revision = amdlib_OI_REVISION;
- char tmp[16];
- int iFrame = 0, iBase = 0, iVis = 0, i = 0;
- double expTime;
-
- amdlibLogTrace("amdlibWriteOiVis()");
-
- /* Algorithm */
- if (vis->thisPtr != vis)
- {
- amdlibSetErrMsg("Unitialized vis structure");
- return amdlibFAILURE;
- }
-
- if (vis->nbFrames < 1)
- {
- return amdlibSUCCESS;
- }
-
- /* Create table structure: Make up Tform: substitute nbWlen for '?' */
- for (i = 0; i < tfields; i++)
- {
- if (Tform[i][0] == '?')
- {
- sprintf(tmp, "%d%s", nbWlen, &Tform[i][1]);
- tform[i] = calloc((strlen(tmp)+1), sizeof(char));
- strcpy(tform[i], tmp);
- }
- else
- {
- tform[i] = calloc((strlen(Tform[i])+1), sizeof(char));
- strcpy(tform[i], Tform[i]);
- }
- }
- if (fits_create_tbl(filePtr, BINARY_TBL, 0, tfields, ttype,
- tform, tunit, extname, &status))
- {
- amdlibReturnFitsError("BINARY_TBL");
- }
-
- for (i = 0; i < tfields; i++)
- {
- free(tform[i]);
- }
-
- /* Write revision number of the table definition */
- if (fits_write_key(filePtr, TINT, "OI_REVN", &revision,
- "Revision number of the table definition", &status))
- {
- amdlibReturnFitsError("OI_REVN");
- }
-
- /* Give date */
- if (fits_write_key(filePtr, TSTRING, "DATE-OBS", vis->dateObs,
- "UTC start date of observations", &status))
- {
- amdlibReturnFitsError("DATE-OBS");
- }
-
- /* Write names of array and detector */
- if (fits_write_key (filePtr, TSTRING, "ARRNAME", arrName,
- "Array Name", &status))
- {
- amdlibReturnFitsError("ARRNAME");
- }
- if (fits_write_key(filePtr, TSTRING, "INSNAME", insName,
- "Instrument name", &status))
- {
- amdlibReturnFitsError("INSNAME");
- }
-
- visError = calloc(nbWlen, sizeof(amdlibCOMPLEX));
- convertToDeg = calloc(nbWlen, sizeof(double));
- flag = calloc(nbWlen, sizeof(unsigned char));
-
- /* Write columns */
- for (iFrame = 0; iFrame < vis->nbFrames; iFrame++)
- {
- for (iBase = 0; iBase < vis->nbBases; iBase++)
- {
- iVis++;
-
- /* Write TARGET_IDentity as an index into IO_TARGET table */
- if (fits_write_col(filePtr, TINT, 1, iVis, 1, 1,
- &(vis->table[iVis-1].targetId), &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("TARGET_IDentity");
- }
-
- /* Write utc TIME of observation */
- if (fits_write_col(filePtr, TDOUBLE, 2, iVis, 1, 1,
- &(vis->table[iVis-1].time), &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("TIME");
- }
-
- /* Write observation date in ModifiedJulianDay */
- if (fits_write_col(filePtr, TDOUBLE, 3, iVis, 1, 1,
- &(vis->table[iVis-1].dateObsMJD), &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("ModifiedJulianDay");
- }
-
- /* Write INTegration_TIME (seconds) */
- expTime = (double)vis->table[iVis-1].expTime;
- if (fits_write_col(filePtr, TDOUBLE, 4, iVis, 1, 1,
- &expTime, &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("INTegration_TIME");
- }
-
- /* Writing ComPleXVISibility (no unit) */
- if (fits_write_col(filePtr,TDBLCOMPLEX, 5, iVis, 1, nbWlen,
- (double*)vis->table[iVis-1].vis, &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("ComPleXVISibility");
- }
-
- /* Write ComPleXVISibilityERRor (no unit) */
- /* Need to write Error, NOT sigma2 */
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- visError[lVis].re =
- amdlibSignedSqrt(vis->table[iVis-1].sigma2Vis[lVis+lmin].re);
- visError[lVis].im =
- amdlibSignedSqrt(vis->table[iVis-1].sigma2Vis[lVis+lmin].im);
- }
-
- if (fits_write_col(filePtr,TDBLCOMPLEX, 6, iVis, 1,
- nbWlen, (double *)visError, &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("ComPleXVISibilityERRor");
- }
-
- /* Write VISibilityAMPlitude (no unit) */
- if (fits_write_col(filePtr, TDOUBLE, 7, iVis, 1, nbWlen,
- vis->table[iVis-1].diffVisAmp, &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("VISibilityAMPlitude");
- }
-
- /* Write VISibilityAMPlitudeERRor (no unit) */
- if (fits_write_col(filePtr, TDOUBLE, 8, iVis, 1, nbWlen,
- vis->table[iVis-1].diffVisAmpErr, &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("VISibilityAMPlitudeERRor");
- }
-
- /* Write VISibilityPHI (degrees) */
- for(lVis = 0; lVis < nbWlen; lVis++)
- {
- if(vis->table[iVis-1].diffVisPhi[lVis+lmin]!=amdlibBLANKING_VALUE)
- {
- convertToDeg[lVis] = 180.0 / M_PI *
- vis->table[iVis-1].diffVisPhi[lVis+lmin];
- }
- else
- {
- convertToDeg[lVis] = amdlibBLANKING_VALUE;
- }
- }
-
- if (fits_write_colnull(filePtr, TDOUBLE, 9, iVis, 1, nbWlen,
- convertToDeg, &amdlibBval, &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("VISibilityPHI");
- }
-
- /* Write VISibilityPHIERRor (degrees) */
- for(lVis = 0; lVis < nbWlen; lVis++)
- {
- if(vis->table[iVis-1].diffVisPhiErr[lVis+lmin]!=amdlibBLANKING_VALUE)
- {
- convertToDeg[lVis] = 180.0 / M_PI *
- vis->table[iVis-1].diffVisPhiErr[lVis+lmin];
- }
- else
- {
- convertToDeg[lVis] = amdlibBLANKING_VALUE;
- }
- }
- if (fits_write_colnull(filePtr, TDOUBLE, 10, iVis, 1, nbWlen,
- convertToDeg, &amdlibBval, &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("VISibilityPHIERRor");
- }
- /* Write UCOORDinate (meters) */
- if (fits_write_col(filePtr, TDOUBLE, 11, iVis, 1, 1,
- &(vis->table[iVis-1].uCoord), &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("UCOORDinate");
- }
-
- /* Write VCOORDinates (meters) */
- if (fits_write_col(filePtr, TDOUBLE, 12, iVis, 1, 1,
- &(vis->table[iVis-1].vCoord), &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("VCOORDinates");
- }
-
- /* Write STAtion_INDEX contributing to the data */
- if (fits_write_col(filePtr, TINT, 13, iVis, 1, 2,
- vis->table[iVis-1].stationIndex, &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("STAtion_INDEX");
- }
-
- /* Write flag as unsigned char -- does not work with booleans */
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- flag[lVis] = vis->table[iVis-1].flag[lVis+lmin];
- }
-
- if (fits_write_col(filePtr, TLOGICAL, 14, iVis, 1, nbWlen,
- flag, &status))
- {
- amdlibWriteOiVis_FREEALL();
- amdlibReturnFitsError("FLAG");
- }
- }
- }
- /* free allocated space at end of job */
- amdlibWriteOiVis_FREEALL();
- return amdlibSUCCESS;
-}
-#undef amdlibWriteOiVis_FREEALL
-
-#define amdlibWriteOiVis2_FREEALL() free(flag);
-/**
- * Write OI_VIS2 table in OI-FITS file
- *
- * This function writes the OI_VIS2 binary table defined in the IAU
- * standard in the OI-FITS file given as parameter.
- *
- * @param filePtr pointer on the file to be created
- * @param insName name of the detector
- * @param arrName array name
- * @param vis2 OI_VIS2 produced
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibWriteOiVis2( fitsfile *filePtr,
- char *insName,
- char *arrName,
- amdlibVIS2 *vis2,
- amdlibERROR_MSG errMsg, int lmin, int lmax)
-{
- int nbWlen = vis2->nbWlen-(lmin+lmax);
- int lVis;
- int status = 0;
- char fitsioMsg[256];
- const int tfields = 10;
- char *ttype[] = {"TARGET_ID", "TIME", "MJD", "INT_TIME", "VIS2DATA",
- "VIS2ERR", "UCOORD", "VCOORD", "STA_INDEX", "FLAG"};
- char *Tform[] = {"I", "D", "D", "D", "?D", "?D", "1D", "1D", "2I",
- "?L"};
- char *tform[tfields];
- char *tunit[] = {"\0", "s", "day", "s", "\0", "\0", "m", "m", "\0",
- "\0"};
- char extname[] = "OI_VIS2";
- int revision = amdlib_OI_REVISION;
- int iFrame = 0, iBase = 0, iVis = 0, i = 0;
- char tmp[16];
- double expTime;
- unsigned char *flag;
-
- amdlibLogTrace("amdlibWriteOiVis2()");
-
- if (vis2->thisPtr != vis2)
- {
- amdlibSetErrMsg("Unitialized vis2 structure");
- return amdlibFAILURE;
- }
- if (vis2->nbFrames < 1)
- {
- return amdlibSUCCESS;
- }
-
- /* Create table structure. Make up Tform: substitute nbWlen for '?' */
- for (i = 0; i < tfields; i++)
- {
- if (Tform[i][0] == '?')
- {
- sprintf(tmp, "%d%s", nbWlen, &Tform[i][1]);
- tform[i] = calloc((strlen(tmp)+1), sizeof(char));
- strcpy(tform[i], tmp);
- }
- else
- {
- tform[i] = calloc((strlen(Tform[i])+1), sizeof(char));
- strcpy(tform[i], Tform[i]);
- }
- }
-
- if (fits_create_tbl (filePtr, BINARY_TBL, 0, tfields,
- ttype, tform, tunit, extname, &status))
- {
- amdlibReturnFitsError("BINARY_TBL");
- }
-
- for (i = 0; i < tfields; i++)
- {
- free(tform[i]);
- }
-
- /* Write revision number of the table definition */
- if (fits_write_key (filePtr, TINT, "OI_REVN", &revision,
- "Revision number of the table definition", &status))
- {
- amdlibReturnFitsError("OI_REVN");
- }
-
- /* Give date */
- if (fits_write_key(filePtr, TSTRING,"DATE-OBS", vis2->dateObs,
- "UTC start date of observations", &status))
- {
- amdlibReturnFitsError("DATE-OBS");
- }
-
- /* Write array and detector names */
- if (fits_write_key (filePtr, TSTRING, "ARRNAME", arrName,
- "Array Name", &status))
- {
- amdlibReturnFitsError("ARRNAME");
- }
- if (fits_write_key(filePtr, TSTRING, "INSNAME", insName,
- "Instrument name", &status))
- {
- amdlibReturnFitsError("INSNAME");
- }
-
- flag = calloc(nbWlen, sizeof(unsigned char));
-
- /* Write columns */
- for (iFrame = 0; iFrame < vis2->nbFrames; iFrame++)
- {
- for (iBase = 0; iBase < vis2->nbBases; iBase++)
- {
- iVis++;
- /* Write TARGET_IDentity */
- if (fits_write_col (filePtr, TINT, 1, iVis, 1, 1,
- &(vis2->table[iVis-1].targetId), &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("TARGET_IDentity");
- }
-
- /* Write time */
- if (fits_write_col (filePtr, TDOUBLE, 2, iVis, 1, 1,
- &(vis2->table[iVis-1].time), &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("Time");
- }
- if (fits_write_col (filePtr, TDOUBLE, 3, iVis, 1, 1,
- &(vis2->table[iVis-1].dateObsMJD), &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("dateObsMJD");
- }
- expTime = (double)vis2->table[iVis-1].expTime;
- if (fits_write_col (filePtr, TDOUBLE, 4, iVis, 1, 1,
- &expTime, &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("expTime");
- }
-
- /* Write squared visibility */
- if (fits_write_col(filePtr, TDOUBLE, 5, iVis, 1, nbWlen,
- vis2->table[iVis-1].vis2+ lmin, &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("vis2");
- }
- /* Write error in the squared visibility */
- if (fits_write_col(filePtr, TDOUBLE, 6, iVis, 1, nbWlen,
- vis2->table[iVis-1].vis2Error+ lmin, &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("vis2Error");
- }
-
- /* Write U and V coordinates on the data */
- if (fits_write_col (filePtr, TDOUBLE, 7, iVis, 1, 1,
- &(vis2->table[iVis-1].uCoord), &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("uCoord");
- }
- if (fits_write_col (filePtr, TDOUBLE, 8, iVis, 1, 1,
- &(vis2->table[iVis-1].vCoord), &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("vCoord");
- }
-
- /* Write station index */
- if (fits_write_col (filePtr, TINT, 9, iVis, 1, 2,
- vis2->table[iVis-1].stationIndex, &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("stationIndex");
- }
- /* Write flag as unsigned char -- does not work with booleans */
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- flag[lVis] = vis2->table[iVis-1].flag[lVis+ lmin];
- }
- if (fits_write_col(filePtr, TLOGICAL, 10, iVis, 1, nbWlen,
- flag, &status))
- {
- amdlibWriteOiVis2_FREEALL();
- amdlibReturnFitsError("FLAG");
- }
-
- }
- }
- /* free allocated space at end of job */
- amdlibWriteOiVis2_FREEALL();
- return amdlibSUCCESS;
-}
-
-#define amdlibWriteOiVis3_FREEALL() free(flag); free(convertToDeg);
-/**
- * Write OI_T3 table in OI-FITS file.
- *
- * This function writes the OI_T3 binary table defined in the IAU
- * standard in the OI-FITS file given as parameter.
- *
- * @param filePtr pointer on the file to be created.
- * @param insName name of the detector.
- * @param arrName array name.
- * @param vis3 OI_T3 produced.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibWriteOiVis3(fitsfile *filePtr,
- char *insName,
- char *arrName,
- amdlibVIS3 *vis3,
- amdlibERROR_MSG errMsg, int lmin, int lmax)
-{
- int nbWlen =vis3->nbWlen-(lmin+lmax);
- int lVis;
- int status = 0;
- char fitsioMsg[256];
- const int tfields = 14;
- char *ttype[] = {"TARGET_ID", "TIME", "MJD", "INT_TIME", "T3AMP",
- "T3AMPERR", "T3PHI", "T3PHIERR", "U1COORD", "V1COORD", "U2COORD",
- "V2COORD", "STA_INDEX", "FLAG"};
- char *Tform[] = {"I", "D", "D", "D", "?D", "?D", "?D", "?D", "1D",
- "1D", "1D", "1D", "3I", "?L"};
- char *tform[tfields];
- char *tunit[] = {"\0", "s", "day", "s", "\0", "\0", "deg", "deg",
- "m", "m", "m", "m", "\0", "\0"};
- char extname[] = "OI_T3";
- int revision = amdlib_OI_REVISION;
- int i;
- char tmp[16];
- double expTime;
- double *convertToDeg;
- unsigned char *flag;
- amdlibDOUBLE amdlibBval=amdlibBLANKING_VALUE;
-
- int iFrame = 0, iClos = 0, iT3 = 0;
-
- amdlibLogTrace("amdlibWriteOiVis3()");
-
- /*Vis3 may not be initialized (only 1 baseline), this is not a defect*/
- if (vis3->thisPtr != vis3)
- {
- return amdlibSUCCESS;
- }
- /*If initialized but empty, do nothing gracefully*/
- if (vis3->nbFrames < 1)
- {
- return amdlibSUCCESS;
- }
-
- /* Create table structure. Make up Tform: substitute nbWlen for '?' */
- for (i = 0; i < tfields; i++)
- {
- if (Tform[i][0] == '?')
- {
- sprintf(tmp, "%d%s", nbWlen, &Tform[i][1]);
- tform[i] = calloc((strlen(tmp)+1), sizeof(char));
- strcpy(tform[i], tmp);
- }
- else
- {
- tform[i] = calloc((strlen(Tform[i])+1), sizeof(char));
- strcpy(tform[i], Tform[i]);
- }
- }
- if (fits_create_tbl(filePtr, BINARY_TBL, 0, tfields, ttype, tform, tunit,
- extname, &status))
- {
- amdlibReturnFitsError("Creating Binary Table");
- }
-
- for (i = 0; i < tfields; i++)
- {
- free(tform[i]);
- }
-
- /* Write revision number of the table definition */
- if (fits_write_key (filePtr, TINT, "OI_REVN", &revision,
- "Revision number of the table definition", &status))
- {
- amdlibReturnFitsError("OI_REVN");
- }
-
- /* Give date */
- if (fits_write_key(filePtr, TSTRING,"DATE-OBS", vis3->dateObs,
- "UTC start date of observations", &status))
- {
- amdlibReturnFitsError("DATE-OBS");
- }
-
- /* Write names of detector and array */
- if (fits_write_key (filePtr, TSTRING, "ARRNAME", arrName,
- "Array Name", &status))
- {
- amdlibReturnFitsError("ARRNAME");
- }
- if (fits_write_key(filePtr, TSTRING, "INSNAME", insName,
- "Instrument name", &status))
- {
- amdlibReturnFitsError("INSNAME");
- }
-
- convertToDeg = calloc(nbWlen, sizeof(double));
- flag = calloc(nbWlen, sizeof(unsigned char));
-
- /* Write columns */
- for (iFrame = 0; iFrame < vis3->nbFrames; iFrame++)
- {
- for (iClos = 0; iClos < vis3->nbClosures; iClos++)
- {
- /* Write dtarget identity */
- if (fits_write_col(filePtr, TINT, 1, iT3+1, 1, 1,
- &(vis3->table[iT3].targetId), &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("TARGET_ID");
- }
-
- /* Write time */
- if (fits_write_col(filePtr, TDOUBLE, 2, iT3+1, 1, 1,
- &(vis3->table[iT3].time), &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("TIME");
- }
- if (fits_write_col(filePtr, TDOUBLE, 3, iT3+1, 1, 1,
- &(vis3->table[iT3].dateObsMJD), &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("DATEOBS");
- }
- expTime = (double)vis3->table[iT3].expTime;
- if (fits_write_col(filePtr, TDOUBLE, 4, iT3+1, 1, 1,
- &expTime, &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("EXPTIME");
- }
-
- /* Write visibility amplitude and its associated error */
- if (fits_write_col(filePtr, TDOUBLE, 5, iT3+1, 1, nbWlen,
- vis3->table[iT3].vis3Amplitude+ lmin, &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("VIS3AMP");
- }
- if (fits_write_col(filePtr, TDOUBLE, 6, iT3+1, 1, nbWlen,
- vis3->table[iT3].vis3AmplitudeError+ lmin,
- &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("VIS3AMPERR");
- }
-
- /* Write visibility phase and its associated error,
- * converted in degrees */
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- if(vis3->table[iT3].vis3Phi[lVis+lmin]!=amdlibBLANKING_VALUE)
- {
- convertToDeg[lVis] = 180.0 / M_PI *
- vis3->table[iT3].vis3Phi[lVis+lmin];
- }
- else
- {
- convertToDeg[lVis] =amdlibBLANKING_VALUE;
- }
-
- }
- if (fits_write_colnull(filePtr, TDOUBLE, 7, iT3+1, 1, nbWlen,
- convertToDeg, &amdlibBval, &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("VIS3PHI");
- }
- for(lVis = 0; lVis < nbWlen; lVis++)
- {
- if(vis3->table[iT3].vis3PhiError[lVis + lmin]!=amdlibBLANKING_VALUE)
- {
- convertToDeg[lVis] = 180.0 / M_PI *
- vis3->table[iT3].vis3PhiError[lVis + lmin];
- }
- else
- {
- convertToDeg[lVis] =amdlibBLANKING_VALUE;
- }
- }
- if (fits_write_colnull(filePtr, TDOUBLE, 8, iT3+1, 1, nbWlen,
- convertToDeg, &amdlibBval, &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("VIS3PHIERR");
- }
-
- /* Write U and V coordinates of the data */
- if (fits_write_col(filePtr, TDOUBLE, 9, iT3+1, 1, 1,
- &(vis3->table[iT3].u1Coord), &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("U1COORD");
- }
- if (fits_write_col(filePtr, TDOUBLE, 10, iT3+1, 1, 1,
- &(vis3->table[iT3].v1Coord), &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("V1COORD");
- }
- if (fits_write_col(filePtr, TDOUBLE, 11, iT3+1, 1, 1,
- &(vis3->table[iT3].u2Coord), &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("U2COORD");
- }
- if (fits_write_col(filePtr, TDOUBLE, 12, iT3+1, 1, 1,
- &(vis3->table[iT3].v2Coord), &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("V2COORD");
- }
-
- /* Write station index */
- if (fits_write_col(filePtr, TINT, 13, iT3+1, 1, 3,
- vis3->table[iT3].stationIndex, &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("STATINDEX");
- }
-
- /* Write flag as unsigned char -- does not work with booleans */
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- flag[lVis] = vis3->table[iT3].flag[lVis + lmin];
- }
- if (fits_write_col(filePtr, TLOGICAL, 14, iT3+1, 1, nbWlen,
- flag, &status))
- {
- amdlibWriteOiVis3_FREEALL();
- amdlibReturnFitsError("FLAG");
- }
-
- iT3++;
-
- }
- }
- amdlibWriteOiVis3_FREEALL();
-
- return amdlibSUCCESS;
-}
-
-#define amdlibWriteAmberData_FREEALL() free(errTempVal); \
- free(tempBandNumber);
-/**
- * Write AMBER_DATA table in OI-FITS file.
- *
- * This function writes the AMBER_DATA binary table in the OI-FITS file
- * given as parameter.
- *
- * @param filePtr pointer on the file to be created.
- * @param insName name of the detector.
- * @param photometry photometry data.
- * @param vis AMBER_DATA produced.
- * @param pst piston data.
- * @param wave structure containing the wavelengths.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-amdlibCOMPL_STAT amdlibWriteAmberData(fitsfile *filePtr,
- char *insName,
- amdlibPHOTOMETRY *photometry,
- amdlibVIS *vis,
- amdlibPISTON *pst,
- amdlibWAVELENGTH *wave,
- amdlibERROR_MSG errMsg, int lmin, int lmax)
-{
- int nbWlen = photometry->nbWlen-(lmin + lmax);
- int status = 0;
- char fitsioMsg[256];
- const int tfields = 13;
- amdlibDOUBLE amdlibBval=amdlibBLANKING_VALUE;
- char *Ttype[] =
- {
- "TARGET_ID", "TIME", "MJD", "INT_TIME",
- "FLUX_SUM", "FLUX_SUM_CORRECTION", "FLUX_RATIO",
- "FLUX_RATIO_CORRECTION", "FLUX_PRODUCT",
- "OPD", "OPD_ERR", "FRINGE_SNR", "STA_INDEX"
- };
-
- char *Tform[] = {"I", "D", "D", "D", "?D", "?D", "?D", "?D", "?D",
- "?E", "?E", "?D", "2I"};
-
- char *Tunit[] = {"\0", "s", "day", "s", "e-", "e-", "\0", "\0",
- "e-^2", "m", "m", "\0", "\0"};
-
- char *ttype[tfields];
- char *tform[tfields];
- char *tunit[tfields];
-
- char extname[] = "AMBER_DATA";
- int revision = amdlib_OI_REVISION;
- int colNum;
- int i;
- int lVis;
- char tmp[16];
- int iFrame = 0, iBase = 0, iVis = 0;
- double *errTempVal;
- int *tempBandNumber;
- int band, iBand;
- int nbBands = 0;
- amdlibBAND_DESC *bandDesc;
- amdlibDOUBLE bound;
- char keyName[amdlibKEYW_NAME_LEN+1];
- double expTime;
- amdlibDOUBLE pistonTmpVal[amdlibNB_BANDS];
- amdlibDOUBLE pstErrTmpVal[amdlibNB_BANDS];
- double frgTmpVal[amdlibNB_BANDS];
-
- amdlibLogTrace("amdlibWriteAmberData()");
-
- if (vis->thisPtr != vis)
- {
- amdlibSetErrMsg("Unitialized vis structure");
- return amdlibFAILURE;
- }
-
- /*If initialized but empty, do nothing gracefully*/
- if (vis->nbFrames < 1)
- {
- return amdlibSUCCESS;
- }
-
- if (photometry->thisPtr != photometry)
- {
- amdlibSetErrMsg("Unitialized photometry structure");
- return amdlibFAILURE;
- }
- /*If initialized but empty, do nothing gracefully*/
- if (photometry->nbFrames < 1)
- {
- return amdlibSUCCESS;
- }
-
- if (pst->thisPtr != pst)
- {
- amdlibSetErrMsg("Unitialized piston structure");
- return amdlibFAILURE;
- }
- /*If initialized but empty, do nothing gracefully*/
- if (pst->nbFrames < 1)
- {
- return amdlibSUCCESS;
- }
-
- /* Create table structure. Make up Tform: substitute nbWlen or
- * nbBands for '?' */
- /* (informational) check number of bands */
- nbBands=0;
- for (band = amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- if (pst->bandFlag[band] == amdlibTRUE)
- {
- nbBands++;
- }
- }
- for (i = 0; i < tfields; i++)
- {
- ttype[i] = calloc(strlen(Ttype[i])+1, sizeof(char));
- strcpy(ttype[i],Ttype[i]);
- tunit[i] = calloc(strlen(Tunit[i])+1, sizeof(char));
- strcpy(tunit[i],Tunit[i]);
-
- if (Tform[i][0] == '?')
- {
- if ((i == 9) || (i == 10) || (i == 11))
- {
- sprintf(tmp, "%d%s", nbBands, &Tform[i][1]);
- }
- else
- {
- sprintf(tmp, "%d%s", nbWlen, &Tform[i][1]);
- }
- tform[i] = calloc((strlen(tmp)+1), sizeof(char));
- strcpy(tform[i], tmp);
- }
- else
- {
- tform[i] = calloc((strlen(Tform[i])+1), sizeof(char));
- strcpy(tform[i], Tform[i]);
- }
- }
-
- if (fits_create_tbl(filePtr, BINARY_TBL, 0, tfields, ttype, tform, tunit,
- extname, &status))
- {
- amdlibReturnFitsError("Creating Binary Table");
- }
-
- for (i = 0; i < tfields; i++)
- {
- free(ttype[i]);
- free(tform[i]);
- free(tunit[i]);
- }
-
- /* Give date */
- if (fits_write_key(filePtr, TSTRING, "DATE-OBS", vis->dateObs,
- "UTC start date of observations", &status))
- {
- amdlibReturnFitsError("DATE-OBS");
- }
-
- /* Write detector name */
- if (fits_write_key (filePtr, TSTRING, "INSNAME", insName,
- "Instrument name", &status))
- {
- amdlibReturnFitsError("INSNAME");
- }
-
- /* Write revision number of the table definition */
- if (fits_write_key (filePtr, TINT, "AMB_REVN", &revision,
- "Revision number of the table definition", &status))
- {
- amdlibReturnFitsError("AMB_REVN");
- }
-
- /* Write information on spectral bands. */
- if (fits_write_key (filePtr, TINT, "HIERARCH ESO QC NBBANDS",
- &nbBands, "Number of spectral bands", &status))
- {
- amdlibReturnFitsError("HIERARCH ESO QC NBBANDS");
- }
-
- iBand = 1;
- for (band = amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- if (pst->bandFlag[band] == amdlibTRUE)
- {
- bandDesc = amdlibGetBandDescription(band);
- sprintf(keyName, "HIERARCH ESO QC BAND%d NAME", iBand);
- if (fits_write_key(filePtr, TSTRING, keyName, bandDesc->name,
- "Name of spectral band", &status))
- {
- amdlibReturnFitsError(keyName);
- }
- memset(keyName, '\0', (amdlibKEYW_NAME_LEN+1) * sizeof(char));
- sprintf(keyName, "HIERARCH ESO QC BAND%d LOWBOUND", iBand);
- bound = bandDesc->lowerBound/1000;
- if (fits_write_key(filePtr, TDOUBLE, keyName, &bound,
- "Lower bound of spectral band", &status))
- {
- amdlibReturnFitsError(keyName);
- }
- memset(keyName, '\0', (amdlibKEYW_NAME_LEN+1) * sizeof(char));
- sprintf(keyName, "HIERARCH ESO QC BAND%d UPBOUND", iBand);
- bound = bandDesc->upperBound/1000;
- if (fits_write_key(filePtr, TDOUBLE, keyName, &bound,
- "Upper bound of spectral band", &status))
- {
- amdlibReturnFitsError(keyName);
- }
- iBand++;
- }
-
- }
-
- errTempVal = calloc(nbWlen, sizeof(double));
- tempBandNumber = calloc(nbWlen, sizeof(int));
- /* Retrieve Band number for each Wlen */
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- tempBandNumber[lVis] = amdlibGetBand(wave->wlen[lVis+lmin]);
- }
-
- /* Write columns */
- for (iFrame = 0; iFrame < vis->nbFrames; iFrame++)
- {
- for (iBase = 0; iBase < vis->nbBases; iBase++)
- {
- colNum = 1;
- iVis++;
- /* Write target identity */
- if (fits_write_col(filePtr, TINT, colNum, iVis, 1, 1,
- &(vis->table[iVis-1].targetId), &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("Target Id");
- }
- colNum++;
-
- /* Write time */
- if (fits_write_col(filePtr, TDOUBLE, colNum, iVis, 1, 1,
- &(vis->table[iVis-1].time), &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("Time");
- }
- colNum++;
-
- if (fits_write_col(filePtr, TDOUBLE, colNum, iVis, 1, 1,
- &(vis->table[iVis-1].dateObsMJD), &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("dateObsMJD");
- }
- colNum++;
-
- expTime = (double)vis->table[iVis-1].expTime;
- if (fits_write_col(filePtr, TDOUBLE, 4, iVis, 1, 1,
- &expTime, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("expTime");
- }
- colNum++;
-
- /* Write information on photometry */
- /* Write fluxSumPiPj (number of electrons collected in the spectral
- * channel) and associated error */
- if (fits_write_colnull(filePtr, TDOUBLE, colNum, iVis, 1, nbWlen,
- photometry->table[iVis-1].fluxSumPiPj+lmin,
- &amdlibBval, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("baseFluxSum");
- }
- colNum++;
-
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- if (!(photometry->table[iVis-1].sigma2FluxSumPiPj[lVis+lmin] ==
- amdlibBLANKING_VALUE))
- {
- errTempVal[lVis] =
- sqrt(photometry->table[iVis-1].sigma2FluxSumPiPj[lVis+lmin]);
- }
- else
- {
- errTempVal[lVis] = amdlibBLANKING_VALUE;
- }
- }
-
- if (fits_write_colnull(filePtr, TDOUBLE, colNum, iVis, 1, nbWlen,
- errTempVal, &amdlibBval, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("baseFluxSumCorrection");
- }
- colNum++;
-
- /* Write flux ratio in the spectral channel and associated error */
- if (fits_write_colnull(filePtr, TDOUBLE, colNum, iVis, 1, nbWlen,
- photometry->table[iVis-1].fluxRatPiPj+lmin,
- &amdlibBval, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("baseFluxRatio");
- }
- colNum++;
-
- for (lVis = 0; lVis < nbWlen; lVis++)
- {
- if (!(photometry->table[iVis-1].sigma2FluxRatPiPj[lVis+lmin] ==
- amdlibBLANKING_VALUE))
- {
- errTempVal[lVis]=
- sqrt(photometry->table[iVis-1].sigma2FluxRatPiPj[lVis+lmin]);
- }
- else
- {
- errTempVal[lVis] = amdlibBLANKING_VALUE;
- }
- }
- if (fits_write_colnull(filePtr, TDOUBLE, colNum, iVis, 1, nbWlen,
- errTempVal, &amdlibBval, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("baseFluxRatioCorrection");
- }
- colNum++;
-
- /* Write flux product */
- if (fits_write_colnull(filePtr, TDOUBLE, colNum, iVis, 1, nbWlen,
- photometry->table[iVis-1].PiMultPj+lmin,
- &amdlibBval, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("baseFluxProduct");
- }
- colNum++;
-
- /* Write piston value and associated error */
- int i = 0;
- for (band = amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- if (pst->bandFlag[band] == amdlibTRUE )
- {
- if (!amdlibCompareDouble(pst->pistonOPDArray[band][iVis-1],amdlibBLANKING_VALUE))
- {
- pistonTmpVal[i] = pst->pistonOPDArray[band][iVis-1] *
- amdlibNM_TO_M;
- pstErrTmpVal[i] = pst->sigmaPistonArray[band][iVis-1] *
- amdlibNM_TO_M;
- }
- else
- {
- pistonTmpVal[i] = amdlibBLANKING_VALUE;
- pstErrTmpVal[i] = amdlibBLANKING_VALUE;
- }
- frgTmpVal[i] = vis->table[iVis-1].frgContrastSnrArray[band];
- i++;
- }
- }
- if (fits_write_colnull(filePtr, TDOUBLE, colNum, iVis, 1, nbBands,
- pistonTmpVal, &amdlibBval, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("piston");
- }
- colNum++;
-
- if (fits_write_colnull(filePtr, TDOUBLE, colNum, iVis, 1, nbBands,
- pstErrTmpVal, &amdlibBval, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("pistonErr");
- }
- colNum++;
-
- /* Write fringe contrast SNR */
- if (fits_write_col(filePtr, TDOUBLE, colNum, iVis, 1, nbBands,
- frgTmpVal, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("frgContrastSnr");
- }
- colNum++;
-
- /* Write station idexes corresponding to the baseline */
- if (fits_write_col(filePtr, TINT, colNum, iVis, 1, 2,
- vis->table[iVis-1].stationIndex, &status))
- {
- amdlibWriteAmberData_FREEALL();
- amdlibReturnFitsError("stationIndex");
- }
- colNum++;
- }
- }
- amdlibWriteAmberData_FREEALL();
- return amdlibSUCCESS;
-}
-#undef amdlibWriteAmberData_FREEALL
-
-
-/**
- * Write AMBER_SPECTRUM table in OI-FITS file.
- *
- * This function writes the AMBER_SPECTRUM binary table in the OI-FITS file
- * given as parameter.
- *
- * @param filePtr pointer on the file to be created.
- * @param wave OI_WAVELENGTH produced.
- * @param spc amdlibSPECTRUM produced.
- * @param errMsg error description message returned if function fails.
- *
- * @return
- * amdlibSUCCESS on successful completion. Otherwise amdlibFAILURE is returned.
- */
-static amdlibCOMPL_STAT esolibamdlibWriteAmberSpectrum(fitsfile *filePtr,
- amdlibWAVELENGTH *wave,
- amdlibSPECTRUM *spc,
- amdlibERROR_MSG errMsg, int lmin, int lmax)
-{
- int status = 0;
- char fitsioMsg[256];
- const int tfields = 4;
- char *Ttype[] = {"EFF_WAVE", "EFF_BAND", "SPECTRUM", "SPECTRUM_ERROR"};
- char *Tform[] = {"E", "E", "?D", "?D"};
- char *Tunit[] = {"m", "m", "\0", "\0"};
- char *ttype[tfields];
- char *tform[tfields];
- char *tunit[tfields];
-
- char extname[] = "AMBER_SPECTRUM";
- int revision = amdlib_OI_REVISION;
- int i, l;
- char tmp[16];
- double specDouble[amdlibNB_TEL];
- double specErrDouble[amdlibNB_TEL];
- char insName[amdlibKEYW_VAL_LEN+1];
-
- amdlibLogTrace("amdlibWriteAmberSpectrum()");
-
- if (spc->thisPtr != spc)
- {
- amdlibSetErrMsg("Unitialized spc structure");
- return amdlibFAILURE;
- }
-
- /* If initialized but empty, do nothing gracefully */
- if (spc->nbWlen < 1)
- {
- return amdlibSUCCESS;
- }
-
- /* Create table structure. Make up Tform: substitute spc->nbTels for '?' */
- for (i = 0; i < tfields; i++)
- {
- ttype[i] = calloc(strlen(Ttype[i]) + 1, sizeof(char));
- strcpy(ttype[i], Ttype[i]);
- tunit[i] = calloc(strlen(Tunit[i]) + 1, sizeof(char));
- strcpy(tunit[i], Tunit[i]);
-
- if (Tform[i][0] == '?')
- {
- sprintf(tmp, "%d%s", spc->nbTels, &Tform[i][1]);
- }
- else
- {
- strcpy(tmp, Tform[i]);
- }
- tform[i] = calloc((strlen(tmp) + 1), sizeof(char));
- strcpy(tform[i], tmp);
- }
-
- if (fits_create_tbl(filePtr, BINARY_TBL, 0, tfields, ttype, tform, tunit,
- extname, &status))
- {
- amdlibReturnFitsError("Creating Binary Table");
- }
-
- for (i = 0; i < tfields; i++)
- {
- free(ttype[i]);
- free(tform[i]);
- free(tunit[i]);
- }
-
- /* Write revision number of the table definition */
- if (fits_write_key (filePtr, TINT, "AMB_REVN", &revision,
- "Revision number of the table definition", &status))
- {
- amdlibReturnFitsError("AMB_REVN");
- }
-
- /* Write spectral setup unique identifier */
- sprintf(insName, "AMBER");
- if (fits_write_key (filePtr, TSTRING, "INSNAME", insName,
- "Instrument name", &status))
- {
- amdlibReturnFitsError("INSNAME");
- }
-
- for (l=0; l < wave->nbWlen-(lmin+lmax); l++)
- {
- amdlibDOUBLE waveInM;
- waveInM = wave->wlen[l+lmin] * amdlibNM_TO_M; /* Convert nm to m */
- if (fits_write_col(filePtr, TDOUBLE, 1, l+1, 1, 1, &waveInM, &status))
- {
- amdlibReturnFitsError("EFF_WAVE");
- }
-
- amdlibDOUBLE bandInM;
- bandInM = wave->bandwidth[l+lmin] * amdlibNM_TO_M; /* Convert nm to m */
- if (fits_write_col(filePtr, TDOUBLE, 2, l+1, 1, 1, &bandInM, &status))
- {
- amdlibReturnFitsError("EFF_BAND");
- }
-
- for (i=0; i < spc->nbTels; i++)
- {
- specDouble[i] = spc->spec[i][l+lmin];
- specErrDouble[i] = spc->specErr[i][l+lmin];
- }
- if (fits_write_col(filePtr, TDOUBLE, 3, l+1, 1, spc->nbTels,
- specDouble, &status))
- {
- amdlibReturnFitsError("SPECTRUM");
- }
-
- if (fits_write_col(filePtr, TDOUBLE, 4, l+1, 1, spc->nbTels,
- specErrDouble, &status))
- {
- amdlibReturnFitsError("SPECTRUM_ERROR");
- }
- }
-
- return amdlibSUCCESS;
-}
diff --git a/amber/esolibamdlibOi.h b/amber/esolibamdlibOi.h
deleted file mode 100644
index 5a00cb1..0000000
--- a/amber/esolibamdlibOi.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * esolibamdlibOi.h
- *
- * Created on: Oct 29, 2009
- * Author: agabasch
- */
-
-#ifndef ESOLIBAMDLIBOI_H_
-#define ESOLIBAMDLIBOI_H_
-#include "amdlib.h"
-amdlibCOMPL_STAT amdlibSaveOiFile_waveselected(const char *filename,
- amdlibINS_CFG *insCfg,
- amdlibOI_ARRAY *array,
- amdlibOI_TARGET *target,
- amdlibPHOTOMETRY *photometry,
- amdlibVIS *vis,
- amdlibVIS2 *vis2,
- amdlibVIS3 *vis3,
- amdlibWAVELENGTH *wave,
- amdlibPISTON *pst,
- amdlibSPECTRUM *spectrum,
- amdlibERROR_MSG errMsg,
- int lmin,
- int lmax);
-
-#endif /* ESOLIBAMDLIBOI_H_ */
diff --git a/amber/gipaf.c b/amber/gipaf.c
deleted file mode 100644
index 9c709a3..0000000
--- a/amber/gipaf.c
+++ /dev/null
@@ -1,898 +0,0 @@
-/* $Id: gipaf.c,v 1.4 2011-09-26 12:54:06 agabasch Exp $
- *
- * This file is part of the GIRAFFE Pipeline
- * Copyright (C) 2002-2005 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: agabasch $
- * $Date: 2011-09-26 12:54:06 $
- * $Revision: 1.4 $
- * $Name: not supported by cvs2svn $
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <pwd.h>
-#if defined HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#include <time.h>
-#include <string.h>
-#include <regex.h>
-
-#include <cxmemory.h>
-#include <cxstring.h>
-#include <cxstrutils.h>
-#include <cxtypes.h>
-
-/*
-#include <cpl_plist.h>
-*/
-
-/* #include "giutils.h" */
-#include "gipaf.h"
-
-
-#define PAF_HDR_START "PAF.HDR.START"
-#define PAF_TYPE "PAF.TYPE"
-#define PAF_ID "PAF.ID"
-#define PAF_NAME "PAF.NAME"
-#define PAF_DESC "PAF.DESC"
-#define PAF_CRTE_NAME "PAF.CRTE.NAME"
-#define PAF_CRTE_TIME "PAF.CRTE.DAYTIM"
-#define PAF_LCHG_NAME "PAF.LCHG.NAME"
-#define PAF_LCHG_TIME "PAF.LCHG.DAYTIM"
-#define PAF_CHCK_NAME "PAF.CHCK.NAME"
-#define PAF_CHCK_TIME "PAF.CHCK.DAYTIM"
-#define PAF_CHCK_CHECKSUM "PAF.CHCK.CHECKSUM"
-#define PAF_HDR_END "PAF.HDR.END"
-
-
-/*
- * Value and comment field start position
- */
-
-static const cxsize PAF_FIELD_OFFSET_VALUE = 20;
-static const cxsize PAF_FIELD_OFFSET_COMMENT = 45;
-
-
-/*
- * Maximum length of a parameter file record, i.e. maximum number of
- * characters per line of a parameter file on disk. This does not include
- * a trailing 0.
- */
-
-static const cxsize PAF_RECORD_MAX = 256;
-
-
-/**
- * @defgroup gipaf VLT Parameter File Support
- *
- * TBD
- */
-
-/**@{*/
-
-struct _AmPafHdr_
-{
- cxchar *name;
- cxchar *type;
- cxchar *id;
- cxchar *description;
-};
-
-typedef struct _AmPafHdr_ AmPafHdr;
-
-
-struct _AmPaf_
-{
- AmPafHdr *header;
- cpl_propertylist *records;
-};
-
-
-inline static cxint _amber_paf_format_line(cx_string *line, const cxchar *name,
- const cxchar *value, const cxchar *comment,
- cxbool append)
-{
-
- cxchar buffer[PAF_RECORD_MAX + 2];
-
- cxsize sz = 0;
- cxsize cpos = 0;
-
-
- cx_assert(line != NULL);
-
- if (name == NULL) {
- return -1;
- }
-
-
- /*
- * Verify that the record name fits into the buffer. The extra
- * character is for the semicolon which has to be present.
- */
-
- sz = strlen(name);
-
- if (sz + 1 > PAF_RECORD_MAX) {
- return 1;
- }
-
- memset(buffer, ' ', PAF_RECORD_MAX + 1);
- memcpy(buffer, name, sz);
-
- cpos = sz;
-
- if (value != NULL) {
-
- if (cpos < PAF_FIELD_OFFSET_VALUE) {
- cpos = PAF_FIELD_OFFSET_VALUE;
- }
- else {
- ++cpos;
- }
-
- sz = strlen(value);
-
-
- /*
- * Verify that writing the value string does not overflow
- * the buffer.
- */
-
- if (sz > PAF_RECORD_MAX - cpos + 1) {
- return 2;
- }
-
- memcpy(&buffer[cpos], value, sz);
- cpos += sz;
-
- }
-
- buffer[cpos++] = ';';
-
-
- /*
- * Comments are only printed if there is room in the buffer for
- * at least 3 characters, so that not only the hash and the
- * following blank appear in the output because of the finite
- * record size.
- */
-
- if (comment != NULL && comment[0] != '\0' &&
- (PAF_RECORD_MAX - cpos + 1) > 2) {
-
- if (cpos < PAF_FIELD_OFFSET_COMMENT) {
- cpos = PAF_FIELD_OFFSET_COMMENT;
- }
- else {
- ++cpos;
- }
-
- memcpy(&buffer[cpos], "# ", 2);
- cpos += 2;
-
- sz = strlen(comment);
- sz = sz < PAF_RECORD_MAX - cpos + 1 ? sz : PAF_RECORD_MAX - cpos + 1;
-
- memcpy(&buffer[cpos], comment, sz);
- cpos += sz;
- }
-
- buffer[cpos] = '\n';
- buffer[++cpos] = '\0';
-
-
- if (append == TRUE) {
- cx_string_append(line, buffer);
- }
- else {
- cx_string_set(line, buffer);
- }
-
- return 0;
-
-}
-
-
-inline static cxint _amber_paf_convert_property(cx_string *line, cpl_property *property,
- cxbool append)
-{
-
- cxint status = 0;
-
- const cxchar *name;
- const cxchar *comment;
-
- cx_string *value = NULL;
-
-
- cx_assert(line != NULL);
-
- if (property == NULL) {
- return -1;
- }
-
- value = cx_string_new();
-
- switch (cpl_property_get_type(property)) {
- case CPL_TYPE_CHAR:
- {
- cxchar c = cpl_property_get_char(property);
-
- cx_string_sprintf(value, "%c", c);
- }
- break;
-
- case CPL_TYPE_BOOL:
- {
- cxint b = cpl_property_get_bool(property);
-
- if (b != 0) {
- cx_string_set(value, "T");
- }
- else {
- cx_string_set(value, "F");
- }
- }
- break;
-
- case CPL_TYPE_INT:
- {
- cxint i = cpl_property_get_int(property);
-
- cx_string_sprintf(value, "%d", i);
- }
- break;
-
- case CPL_TYPE_LONG:
- {
- cxlong l = cpl_property_get_long(property);
-
- cx_string_sprintf(value, "%ld", l);
- }
- break;
-
- case CPL_TYPE_FLOAT:
- {
- cxfloat f = cpl_property_get_float(property);
-
- cx_string_sprintf(value, "%.15G", f);
-
- if (!strchr(cx_string_get(value), '.')) {
-
- if (strchr(cx_string_get(value), 'E')) {
- cx_string_sprintf(value, "%.1E", f);
- }
- else {
- cx_string_append(value, ".");
- }
- }
- }
- break;
-
- case CPL_TYPE_DOUBLE:
- {
- cxdouble d = cpl_property_get_double(property);
-
- cx_string_sprintf(value, "%.15G", d);
-
- if (!strchr(cx_string_get(value), '.')) {
-
- if (strchr(cx_string_get(value), 'E')) {
- cx_string_sprintf(value, "%.1E", d);
- }
- else {
- cx_string_append(value, ".");
- }
- }
- }
- break;
-
- case CPL_TYPE_STRING:
- {
- const cxchar *s = cpl_property_get_string(property);
-
- cx_string_sprintf(value, "\"%s\"", s);
- }
- break;
-
- default:
-
- /*
- * Unsupported property type. This point should never be
- * reached!
- */
-
- cx_string_delete(value);
-
- return 1;
- break;
- }
-
- name = cpl_property_get_name(property);
- comment = cpl_property_get_comment(property);
-
- status = _amber_paf_format_line(line, name, cx_string_get(value),
- comment, append);
-
- if (status != 0) {
- cx_string_delete(value);
- return 2;
- }
-
- cx_string_delete(value);
-
- return 0;
-
-}
-
-
-inline static AmPafHdr * _amber_pafhdr_create(const cxchar *name, const cxchar *type,
- const cxchar *id, const cxchar *description)
-{
-
- AmPafHdr *self = cx_calloc(1, sizeof *self);
-
-
- self->name = cx_strdup(name);
- self->type = cx_strdup(type);
-
- if (id != NULL) {
- self->id = cx_strdup(id);
- }
-
- if (description != NULL) {
- self->description = cx_strdup(description);
- }
-
- return self;
-
-}
-
-
-inline static void _amber_pafhdr_destroy(AmPafHdr *self)
-{
-
- if (self != NULL) {
- if (self->name != NULL) {
- cx_free(self->name);
- self->name = NULL;
- }
-
- if (self->type != NULL) {
- cx_free(self->type);
- self->type = NULL;
- }
-
- if (self->id != NULL) {
- cx_free(self->id);
- self->id = NULL;
- }
-
- if (self->description != NULL) {
- cx_free(self->description);
- self->description = NULL;
- }
-
- cx_free(self);
- }
-
- return;
-
-}
-
-
-inline static cxint _amber_pafhdr_write(AmPafHdr *self, FILE *stream)
-{
-
- if (stream == NULL) {
- return -1;
- }
-
- if (self != NULL) {
-
- cxchar *user;
- cxchar *timestamp;
-
- cx_string *header = cx_string_new();
-
-
-#if defined HAVE_GETUID && defined HAVE_GETPWUID
-
- struct passwd *pw;
-
- pw = getpwuid(getuid());
-
- if (pw == NULL) {
- cx_string_delete(header);
- return 1;
- }
-
- user = pw->pw_name;
-
-#else
- user = getenv("USER");
- user = user == NULL ? getenv("LOGNAME") : user;
-
- if (user == NULL) {
- cx_string_delete(header);
- return 1;
- }
-
-#endif
-
- timestamp = amber_localtime_iso8601();
-
- if (timestamp == NULL) {
- cx_string_delete(header);
- return 2;
- }
-
-
- /*
- * Write formatted header records to a string buffer
- */
-
- _amber_paf_format_line(header, PAF_HDR_START, NULL, NULL, TRUE);
- _amber_paf_format_line(header, PAF_TYPE, self->type, "Type of "
- "parameter file", TRUE);
-
- if (self->id != NULL) {
- _amber_paf_format_line(header, PAF_ID, self->id, NULL, TRUE);
- }
- else {
- _amber_paf_format_line(header, PAF_ID, "", NULL, TRUE);
- }
-
- _amber_paf_format_line(header, PAF_NAME, self->name, "Name of "
- "PAF", TRUE);
-
- if (self->description != NULL) {
- _amber_paf_format_line(header, PAF_DESC, self->description,
- "Short description of PAF", TRUE);
- }
- else {
- _amber_paf_format_line(header, PAF_DESC, "", "Short "
- "description of PAF", TRUE);
- }
-
- _amber_paf_format_line(header, PAF_CRTE_NAME, user, "Name of "
- "creator", TRUE);
- _amber_paf_format_line(header, PAF_CRTE_TIME, timestamp,
- "Civil time for creation", TRUE);
-
- _amber_paf_format_line(header, PAF_LCHG_NAME, "", "Author of "
- "par. file", TRUE);
- _amber_paf_format_line(header, PAF_LCHG_TIME, "", "Timestamp for "
- "last change", TRUE);
-
- _amber_paf_format_line(header, PAF_CHCK_NAME, "", "Name of appl. "
- "checking", TRUE);
- _amber_paf_format_line(header, PAF_CHCK_TIME, "", "Time for "
- "checking", TRUE);
- _amber_paf_format_line(header, PAF_CHCK_CHECKSUM, "", "Checksum "
- "for the PAF", TRUE);
-
- _amber_paf_format_line(header, PAF_HDR_END, NULL, NULL, TRUE);
-
-
- /*
- * Write string buffer contents to the output stream
- */
-
- fprintf(stream, "%s", cx_string_get(header));
-
- if (ferror(stream) != 0) {
- cx_free(timestamp);
- cx_string_delete(header);
-
- return 3;
- }
-
- cx_free(timestamp);
- cx_string_delete(header);
- }
-
- return 0;
-
-}
-
-
-AmPaf * amber_paf_new(const cxchar *name, const cxchar *type, const cxchar *id,
- const cxchar *description)
-{
-
- AmPaf *self = NULL;
-
-
- if (name == NULL || type == NULL) {
- return NULL;
- }
-
- self = cx_malloc(sizeof *self);
-
- self->header = _amber_pafhdr_create(name, type, id, description);
- self->records = cpl_propertylist_new();
-
- cx_assert(self->header != NULL);
- cx_assert(self->records != NULL);
-
- return self;
-
-}
-
-
-void amber_paf_delete(AmPaf *self)
-{
-
- if (self != NULL) {
- if (self->records != NULL) {
- cpl_propertylist_delete(self->records);
- self->records = NULL;
- }
-
- if (self->header != NULL) {
- _amber_pafhdr_destroy(self->header);
- self->header = NULL;
- }
-
- cx_free(self);
- }
-
- return;
-
-}
-
-
-cxchar * amber_paf_get_name(const AmPaf *self)
-{
-
- if (self == NULL) {
- return NULL;
- }
-
- cx_assert(self->header != NULL);
- cx_assert(self->header->name != NULL);
-
- return self->header->name;
-
-}
-
-
-cxint amber_paf_set_name(AmPaf *self, const cxchar *name)
-{
-
- cx_assert(self != NULL);
-
- if (name == NULL) {
- return -1;
- }
-
- if (self->header->name != NULL) {
- self->header->name = cx_realloc(self->header->name,
- (strlen(name) + 1) * sizeof(cxchar));
- strcpy(self->header->name, name);
- }
- else {
- self->header->name = cx_strdup(name);
- }
-
- return 0;
-
-}
-
-
-cxchar * amber_paf_get_type(const AmPaf *self)
-{
-
- if (self == NULL) {
- return NULL;
- }
-
- cx_assert(self->header != NULL);
- cx_assert(self->header->type != NULL);
-
- return self->header->type;
-
-}
-
-
-cxint amber_paf_set_type(AmPaf *self, const cxchar *type)
-{
-
- cx_assert(self != NULL);
-
- if (type == NULL) {
- return -1;
- }
-
- if (self->header->type != NULL) {
- self->header->type = cx_realloc(self->header->type,
- (strlen(type) + 1) * sizeof(cxchar));
- strcpy(self->header->type, type);
- }
- else {
- self->header->type = cx_strdup(type);
- }
-
- return 0;
-
-}
-
-
-cxchar * amber_paf_get_id(const AmPaf *self)
-{
-
- if (self == NULL) {
- return NULL;
- }
-
- cx_assert(self->header != NULL);
-
- return self->header->id;
-
-}
-
-
-cxint amber_paf_set_id(AmPaf *self, const cxchar *id)
-{
-
- cx_assert(self != NULL);
-
- if (id == NULL) {
- return -1;
- }
-
- if (self->header->id != NULL) {
- self->header->id = cx_realloc(self->header->id,
- (strlen(id) + 1) * sizeof(cxchar));
- strcpy(self->header->id, id);
- }
- else {
- self->header->id = cx_strdup(id);
- }
-
- return 0;
-
-}
-
-
-cxchar * amber_paf_get_description(const AmPaf *self)
-{
-
- if (self == NULL) {
- return NULL;
- }
-
- cx_assert(self->header != NULL);
-
- return self->header->description;
-
-}
-
-
-cxint amber_paf_set_description(AmPaf *self, const cxchar *description)
-{
-
- cx_assert(self != NULL);
-
- if (description == NULL) {
- return -1;
- }
-
- if (self->header->description != NULL) {
- self->header->description = cx_realloc(self->header->description,
- (strlen(description) + 1) *
- sizeof(cxchar));
- strcpy(self->header->description, description);
- }
- else {
- self->header->description = cx_strdup(description);
- }
-
- return 0;
-
-}
-
-
-cpl_propertylist * amber_paf_get_properties(const AmPaf *self)
-{
-
- if (self == NULL) {
- return NULL;
- }
-
- cx_assert(self->records != NULL);
-
- return self->records;
-
-}
-
-
-cxint amber_paf_set_properties(AmPaf *self, const cpl_propertylist *properties)
-{
-
- cx_assert(self != NULL);
-
- if (properties == NULL) {
- return -1;
- }
-
- if (self->records != NULL) {
- cpl_propertylist_delete(self->records);
- }
-
- self->records = cpl_propertylist_duplicate(properties);
-
- return 0;
-
-}
-
-
-cxint amber_paf_write(const AmPaf *self)
-{
-
- cxint status = 0;
-
- FILE *stream = NULL;
-
-
- if (self == NULL) {
- return -1;
- }
-
- cx_assert(self->header != NULL);
-
- stream = fopen(amber_paf_get_name(self), "wb");
-
- if (stream == NULL) {
- return 1;
- }
-
-
- /*
- * Write PAF header
- */
-
- status = _amber_pafhdr_write(self->header, stream);
-
- if (status != 0) {
- fclose(stream);
- return 2;
- }
-
- fflush(stream);
-
-
- /*
- * Write PAF records
- */
-
- if (self->records != NULL && !cpl_propertylist_is_empty(self->records)) {
-
- cxchar buffer[PAF_RECORD_MAX];
-
- register cxlong i;
-
- cx_string *line = NULL;
-
-
- buffer[0] = '#';
- memset(&buffer[1], '-', 78);
- buffer[79] = '\0';
- fprintf(stream, "%s\n", buffer);
-
- if (ferror(stream) != 0) {
- fclose(stream);
- return 3;
- }
-
- line = cx_string_new();
-
- for (i = 0; i < cpl_propertylist_get_size(self->records); i++) {
-
- cxint status = 0;
-
- cpl_property *p = cpl_propertylist_get(self->records, i);
-
-
- status = _amber_paf_convert_property(line, p, FALSE);
-
- if (status != 0) {
- cx_string_delete(line);
- fclose(stream);
-
- return 4;
- }
-
- fprintf(stream, "%s", cx_string_get(line));
-
- if (ferror(stream) != 0) {
- cx_string_delete(line);
- fclose(stream);
-
- return 5;
- }
- }
-
- cx_string_delete(line);
- fflush(stream);
-
- }
-
- fclose(stream);
-
- return 0;
-
-}
-
-/**
- * @brief
- * Get the current date and time in ISO 8601 format.
- *
- * @return The string containing the current date and time in the
- * ISO 8601 format. If an error occurs the function returns @c NULL.
- *
- * The function formats the current date and the local system time according
- * to the ISO 8601 format and puts both together in a string. The returned
- * string must be deallocated using cx_free().
- */
-
-cxchar * amber_localtime_iso8601(void)
-{
-
- struct tm *ts;
-
- time_t seconds = time(NULL);
-
- cxchar *sdate = NULL;
-
- cxulong milliseconds = 0;
-
- cx_string *self = cx_string_new();
-
-
- cx_assert(self != NULL);
-
- ts = localtime(&seconds);
-
- cx_string_sprintf(self, "%4d-%02d-%02dT%02d:%02d:%02d.%03ld",
- ts->tm_year + 1900,
- ts->tm_mon + 1,
- ts->tm_mday,
- ts->tm_hour,
- ts->tm_min,
- ts->tm_sec,
- milliseconds);
-
- sdate = cx_strdup(cx_string_get(self));
- cx_string_delete(self);
-
- return sdate;
-
-}
-
-/**@}*/
diff --git a/amber/gipaf.h b/amber/gipaf.h
deleted file mode 100644
index 8f2a8b1..0000000
--- a/amber/gipaf.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* $Id: gipaf.h,v 1.4 2011-09-26 12:54:06 agabasch Exp $
- *
- * This file is part of the GIRAFFE Pipeline
- * Copyright (C) 2002-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: agabasch $
- * $Date: 2011-09-26 12:54:06 $
- * $Revision: 1.4 $
- * $Name: not supported by cvs2svn $
- */
-
-#ifndef GIPAF_H
-#define GIPAF_H
-
-#include <cxtypes.h>
-#include <cpl.h>
-/*
-#include <cpl_macros.h>
-#include <cpl_plist.h>
-*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-typedef struct _AmPaf_ AmPaf;
-
-AmPaf *amber_paf_new(const cxchar *name, const cxchar *type,
- const cxchar *id, const cxchar *description);
-void amber_paf_delete(AmPaf *self);
-
-cxchar *amber_paf_get_name(const AmPaf *self);
-cxint amber_paf_set_name(AmPaf *self, const cxchar *name);
-
-cxchar *amber_paf_get_type(const AmPaf *self);
-cxint amber_paf_set_type(AmPaf *self, const cxchar *type);
-
-cxchar *amber_paf_get_id(const AmPaf *self);
-cxint amber_paf_set_id(AmPaf *self, const cxchar *id);
-
-cxchar *amber_paf_get_description(const AmPaf *self);
-cxint amber_paf_set_description(AmPaf *self, const cxchar *description);
-
-cpl_propertylist *amber_paf_get_properties(const AmPaf *self);
-cxint amber_paf_set_properties(AmPaf *self, const cpl_propertylist *properties);
-
-cxint amber_paf_write(const AmPaf *self);
-
-cxchar * amber_localtime_iso8601(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GIPAF_H */
diff --git a/amber/giqclog.c b/amber/giqclog.c
deleted file mode 100644
index 2ded302..0000000
--- a/amber/giqclog.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/* $Id: giqclog.c,v 1.5 2011-09-26 13:20:08 agabasch Exp $
- *
- * This file is part of the GIRAFFE Pipeline
- * Copyright (C) 2002-2005 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: agabasch $
- * $Date: 2011-09-26 13:20:08 $
- * $Revision: 1.5 $
- * $Name: not supported by cvs2svn $
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <cxstring.h>
-
-#include "giqclog.h"
-
-
-/**
- * @defgroup giqclog Quality Control Logs
- *
- * TBD
- */
-
-/**@{*/
-
-AmPaf * amber_qclog_open(cxsize id)
-{
-
- cx_string *name = cx_string_new();
-
- cpl_propertylist *properties = NULL;
-
- AmPaf *self = NULL;
-
-
- cx_string_sprintf(name, "qc%04d.paf", id);
-
- self = amber_paf_new(cx_string_get(name), "QC1 parameters", NULL, NULL);
-
- cx_string_delete(name);
- name = NULL;
-
- properties = amber_paf_get_properties(self);
- cpl_propertylist_append_string(properties, "QC.DID", QC_DID);
- cpl_propertylist_set_comment(properties,"QC.DID", "QC1 dictionary");
-
- return self;
-
-}
-
-
-cxint amber_qclog_close(AmPaf *qclog)
-{
-
- if (qclog != NULL) {
-
- cxint status = 0;
-
- //status = amber_paf_write(qclog);
- amber_paf_delete(qclog);
-
- if (status != 0) {
- return 1;
- }
-
- }
-
- return 0;
-
-}
-/**@}*/
diff --git a/amber/giqclog.h b/amber/giqclog.h
deleted file mode 100644
index ebe3097..0000000
--- a/amber/giqclog.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* $Id: giqclog.h,v 1.3 2011-09-26 12:54:06 agabasch Exp $
- *
- * This file is part of the GIRAFFE Pipeline
- * Copyright (C) 2002-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: agabasch $
- * $Date: 2011-09-26 12:54:06 $
- * $Revision: 1.3 $
- * $Name: not supported by cvs2svn $
- */
-
-#ifndef GIQCLOG_H
-#define GIQCLOG_H
-
-#include <cpl.h>
-/*
-#include <cpl_macros.h>
-*/
-
-#include <gipaf.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-AmPaf *amber_qclog_open(cxsize id);
-cxint amber_qclog_close(AmPaf *qclog);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GIQCLOG_H */
diff --git a/calib/cal_size b/calib/cal_size
deleted file mode 100644
index b6c68b1..0000000
--- a/calib/cal_size
+++ /dev/null
@@ -1 +0,0 @@
-28904
diff --git a/calib/dic/ESO-DFS-DIC.AMBER_QC b/calib/dic/ESO-DFS-DIC.AMBER_QC
deleted file mode 100644
index 6aac824..0000000
--- a/calib/dic/ESO-DFS-DIC.AMBER_QC
+++ /dev/null
@@ -1,4464 +0,0 @@
-#******************************************************************************
-# E.S.O. - VLT project
-#
-# "@(#) $Id: ESO-DFS-DIC.AMBER_QC,v 1.12 2012-02-08 13:45:09 agabasch Exp $"
-#
-# AMBER_CFG dictionary
-#
-# who when what
-# -------- -------- ----------------------------------------------
-# alongino 19/01/00 created
-#
-
-#******************************************************************************
-#
-# This dictionary contains the AMBER instrument specific configuration
-# keywords used by ICS at startup to understand and interprete the
-# contents of the configuration file
-# $INS_ROOT/SYSTEM/COMMON/CONFIGFILES/INS.cfg (source in xxmcfg/config).
-# The configuration keywords common to all instruments are defined in
-# the dictionary $INTROOT/config/ESO-VLT-DIC.ICB_CFG
-# The two dictionaries (ESO-VLT-DIC.ICB_CFG and ESO-VLT-DIC.AMBER_CFG)
-# are listed in the file $INS_ROOT/SYSTEM/COMMON/CONFIGFILES/INS.dic,
-# which is used to declare which dictionaries have to be used to
-# understand the contents of INS.cfg.
-#
-#******************************************************************************
-
-Dictionary Name: ESO-DFS-DIC.AMBER_QC
-Scope: AMBER
-Source: ESO VLT
-Version Control: $Id: ESO-DFS-DIC.AMBER_QC,v 1.12 2012-02-08 13:45:09 agabasch Exp $
-Revision: $Revision: 1.12 $
-Date: 2001-02-16
-Status: Development
-Description: QC1 dictionary for AMBER
-
-Parameter Name: TELESCOP
-Class: qc-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Telescope
-
-Parameter Name: INSTRUME
-Class: qc-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Instrument name
-
-Parameter Name: INS GRATi NAMEi
-Class: conf-log|config|header|setup
-Context: Instrument
-Type: string
-Value Format: %15s
-Unit:
-Comment Format: Grating common name.
-Description: Name for grating unit.
-
-Parameter Name: INS GRATi RESOL
-Class: config|header
-Context: Instrument
-Type: double
-Value Format: %.3f
-Unit: Enc/deg
-Comment Format: Encoder resolution [Enc/deg].
-Description: Encoder resolution RESOL used in the conversion
- formula:
- ENC=ZORDER+ALIGN+RESOL*asin(WLEN*ORDER*GRV/(2*cos(ROT)))
- +TEMPRAMP*(TEMP-TEMPREF)
-
-Parameter Name: INS GRATi WLEN
-Class: header|setup
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit: nm
-Comment Format: Grating central wavelength [nm].
-Description: Wavelength that the grating transmits along
- the optical axis of the instrument.
-
-Parameter Name: INS GRATi WLENMINi
-Class: conf-log|config
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit: nm
-Comment Format: Minimum grating central wavelength [nm].
-Description: Minimum wavelength that the grating transmits along
- the optical axis of the instrument.
-
-Parameter Name: INS GRATi WLENMAXi
-Class: conf-log|config
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit: nm
-Comment Format: Maximum grating central wavelength [nm].
-Description: Maximum wavelength that the grating transmits along
- the optical axis of the instrument.
-
-Parameter Name: INS GRATi ZORDERi
-Class: conf-log|config|header
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit: Enc
-Comment Format: Grating zero order position [Enc].
-Description: The zero order position ZORDER is used in the
- conversion formula:
- ENC=ZORDER+ALIGN+RESOL*asin(WLEN*ORDER*GRV/(2*cos(ROT)))
- +TEMPRAMP*(TEMP-TEMPREF)
-
-Parameter Name: INS GRISi NAMEi
-Class: conf-log|header|setup
-Context: Instrument
-Type: string
-Value Format: %15s
-Unit:
-Comment Format: OPTIi name.
-Description: Name of element.
-
-Parameter Name: INS MODE
-Class: header|setup
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Instrument mode used.
-Description: Acronym of instrument mode used. This acronym identifies
- the optical path within the instrument. Examples:
- BLUE, RED, DIC1, DIC2
-
-Parameter Name: COU AOi ENC_MEAN
-Class: header
-Context: Telescope
-Type: double
-Value Format: %.3f
-Unit:
-Comment Format: Encircled energy at 2.2um norm beam i
-Description: Mean encircled energy at 2.2um between STARTEX and ENDEX as computed by MACAO RTC on telescope corresponding to beam i
-
-Parameter Name: COU AOi ENC_RMS
-Class: header
-Context: Telescope
-Type: double
-Value Format: %.3f
-Unit:
-Comment Format: Encircled energy at 2.2um norm beam i
-Description: RMS encircled energy at 2.2um between STARTEX and ENDEX as computed by MACAO RTC on telescope corresponding to beam i
-
-
-Parameter Name: COU AOi FWHM_MEAN
-Class: header
-Context: Telescope
-Type: double
-Value Format: %.3f
-Unit: mas
-Comment Format: Delivered fwhm at 2.2um mas beam i
-Description: Mean delivered full width half maximum in marcsec at 2.2um between STARTEX and ENDEX as comp
-uted by MACAO RTC on telescope corresponding to beam i
-
-Parameter Name: COU AOi FWHM_RMS
-Class: header
-Context: Telescope
-Type: double
-Value Format: %.3f
-Unit: mas
-Comment Format: Delivered fwhm at 2.2um mas beam i
-Description: RMS delivered full width half maximum in marcsec at 2.2um between STARTEX and ENDEX as compu
-ted by MACAO RTC on telescope corresponding to beam i
-
-Parameter Name: COU AOi L0_MEAN
-Class: header
-Context: Telescope
-Type: double
-Value Format: %.3f
-Unit: m
-Comment Format: Outer scale m beam i
-Description: Mean outer scale in meters between STARTEX and ENDEX as computed by MACAO RTC on telescope c
-orresponding to beam i
-
-
-Parameter Name: COU AOi L0_RMS
-Class: header
-Context: Telescope
-Type: double
-Value Format: %.3f
-Unit: m
-Comment Format: Outer scale m beam i
-Description: RMS outer scale in meters between STARTEX and ENDEX as computed by MACAO RTC on telescope co
-rresponding to beam i
-
-Parameter Name: COU AOi R0_MEAN
-Class: header
-Context: Telescope
-Type: double
-Value Format: %.3f
-Unit: m
-Comment Format: Fried parameter at 500nm m beam i
-Description: Mean Fried parameter at 500 nm in meters between STARTEX and ENDEX as computed by MACAO RTC
-on telescope corresponding to beam i
-
-Parameter Name: COU AOi R0_RMS
-Class: header
-Context: Telescope
-Type: double
-Value Format: %.3f
-Unit: m
-Comment Format: Fried parameter at 500nm m beam i
-Description: RMS Fried parameter at 500 nm in meters between STARTEX and ENDEX as computed by MACAO RTC o
-n telescope corresponding to beam i
-
-
-Parameter Name: COU AOi STREHL_MEAN
-Class: header
-Context: Telescope
-Type: double
-Value Format: %.3f
-Unit:
-Comment Format: Strehl at 2.2um norm beam i
-Description: Mean Strehl at lambda 2.2um between STARTEX and ENDEX as computed by MACAO RTC on telescope
-corresponding to beam i
-
-Parameter Name: COU AOi STREHL_RMS
-Class: header
-Context: Telescope
-Type: double
-Value Format: %.3f
-Unit:
-Comment Format: Strehl at 2.2um norm beam i
-Description: RMS Strehl at lambda 2.2um between STARTEX and ENDEX as computed by MACAO RTC on telescope c
-orresponding to beam i
-
-Parameter Name: COU AOi T0_MEAN
-Class: header
-Context: Telescope
-Type: double
-Value Format: %.3f
-Unit: ms
-Comment Format: Coherence time at 500nm ms beam i
-Description: Mean AO coherence time at 500 nm in ms between STARTEX and ENDEX as computed by MACAO RTC on
- telescope corresponding to beam i
-
-Parameter Name: COU AOi T0_RMS
-Class: header
-Context: Telescope
-Type: double
-Value Format: %.3f
-Unit: ms
-Comment Format: Coherence time at 500nm ms beam i
-Description: RMS AO coherence time at 500 nm in ms between STARTEX and ENDEX as computed by MACAO RTC on
-telescope corresponding to beam i
-
-Parameter Name: COU AOi WFE_MEAN
-Class: header
-Context: Telescope
-Type: double
-Value Format: %.3f
-Unit: rad2
-Comment Format: Wavefront error at 2.2um rad2 beam i
-Description: Mean wavefront error rad squared at 2.2um between STARTEX and ENDEX as computed by MACAO RTC
- on telescope corresponding to beam i
-
-Parameter Name: COU AOi WFE_RMS
-Class: header
-Context: Telescope
-Type: double
-Value Format: %.3f
-Unit: rad2
-Comment Format: Wavefront error at 2.2um rad2 beam i
-Description: RMS wavefront error rad squared at 2.2um between STARTEX and ENDEX as computed by MACAO RTC
-on telescope corresponding to beam i
-
-Parameter Name: COU GUID STATUS
-Class: header
-Context: Telescope
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: VLTI guiding substate
-Description: VLTI guiding substate (IDLE, OPERATING, GUIDING)
-
-Parameter Name: COU GUID MODE
-Class: header
-Context: Telescope
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: VLTI mode of Coude guiding
-Description: VLTI mode of Coude guiding (NONE, AUTO_GUID, FIELD_STAB, FIELD_STAB_TCCD, ADAPT_OPT or ADAPT
-_OPT_TCCD)
-
-Parameter Name: ISS AIRM END
-Class: header
-Context: VLTI Control
-Type: double
-Value Format: %.3f
-Unit:
-Comment Format: Airmass at end
-Description: Reflects airmass for all VLTI telescopes
-
-Parameter Name: ISS AIRM START
-Class: header
-Context: VLTI Control
-Type: double
-Value Format: %.3f
-Unit:
-Comment Format: Airmass at start
-Description: Reflects airmass for all VLTI telescopes
-
-Parameter Name: ISS AIRM END
-Class: header
-Context: VLTI Control
-Type: double
-Value Format: %.3f
-Unit:
-Comment Format: Airmass at end
-Description: Reflects airmass for all VLTI telescopes
-
-Parameter Name: ISS AIRM START
-Class: header
-Context: VLTI Control
-Type: double
-Value Format: %.3f
-Unit:
-Comment Format: Airmass at start
-Description: Reflects airmass for all VLTI telescopes
-
-Parameter Name: ISS AMBI FWHM START
-Class: header
-Context: VLTI Control
-Type: double
-Value Format: %.2f
-Unit: arcsec
-Comment Format: Observatory seeing
-Description: Observatory seeing at start
-
-Parameter Name: ISS AMBI FWHM END
-Class: header
-Context: VLTI Control
-Type: double
-Value Format: %.2f
-Unit: arcsec
-Comment Format: Observatory seeing
-Description: Observatory seeing at end
-
-Parameter Name: ISS AMBI TAU0 START
-Class: header
-Context: VLTI Control
-Type: double
-Value Format: %.6f
-Unit: seconds
-Comment Format: Coherence time
-Description: Coherence time as computed by ASM
-
-Parameter Name: ISS AMBI TAU0 END
-Class: header
-Context: VLTI Control
-Type: double
-Value Format: %.6f
-Unit: seconds
-Comment Format: Coherence time
-Description: Coherence time as computed by ASM
-
-Parameter Name: ISS AMBI TEMP
-Class: header
-Context: VLTI Control
-Type: double
-Value Format: %.2f
-Unit: C
-Comment Format: Observatory ambient temperature.
-Description:
-
-Parameter Name: ISS AMBI RHUM
-Class: header
-Context: VLTI Control
-Type: double
-Value Format: %.f
-Unit: percentage
-Comment Format: Relative humidity
-Description: Observatory ambient relative humidity
-
-Parameter Name: ISS AMBI WINDDIR
-Class: header
-Context: VLTI Control
-Type: double
-Value Format: %.f
-Unit: deg
-Comment Format: Wind direction
-Description: Observatory wind direction (N=0 E=90)
-
-Parameter Name: ISS AMBI WINDSP
-Class: header
-Context: VLTI Control
-Type: double
-Value Format: %.2f
-Unit: m/s
-Comment Format: Observatory wind speed
-Description: Observatory wind speed
-
-Parameter Name: ISS AZ
-Class: header
-Context: VLTI Control
-Type: double
-Value Format: %.3f
-Unit: deg
-Comment Format: Azimuth angles at start
-Description: Reflects azimuth angle for all VLTI telescopes (S=0, W=90)
-
-Parameter Name: ISS CHOP ST
-Class: header
-Context: VLTI control
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Chopping status
-Description: True when chopping is active or nulling. False when chopping is inactive or undefined
-
-Parameter Name: ISS CONF DL1
-Class: header
-Context: VLTI Control
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Delay line used
-Description: Delay line used by VLTI telescope 1
-
-Parameter Name: ISS CONF DL2
-Class: header
-Context: VLTI Control
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Delay line used
-Description: Delay line used by telescope 2
-
-Parameter Name: ISS CONF DL3
-Class: header
-Context: VLTI Control
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Delay line used
-Description: Delay line used by telescope 3 (only if NTEL>2)
-
-Parameter Name: PRO DID
-Class: header
-Context: process
-Type: string
-Value Format: %30s
-Unit:
-Comment Field: Data dictionary for PRO
-Description: Name/version of ESO DID to which PRO keywords comply.
-
-Parameter Name: PRO CATG
-Class: header
-Context: process
-Type: string
-Value Format: %30s
-Unit:
-Comment Field: Category of pipeline product frame
-Description: Category of pipeline product defined in the instrument's
- product data description file (pdd).
-
-Parameter Name: PRO TYPE
-Class: header
-Context: process
-Type: string
-Value Format: %20s
-Unit:
-Comment Field: Product type
-Description: Identification of type of data product.
- Value: either "TEMPORARY", "PREPROCESSED", "REDUCED" or
- "QCPARAM".
-
-Parameter Name: PRO RECi ID
-Class: header
-Context: process
-Type: string
-Value Format: %32s
-Unit:
-Comment Field: Pipeline recipe (unique) identifier
-Description: Identification of pipeline recipe which produced
- the frame. Note: If frame is generated from raw data
- i=1, otherwise PRO REC1 ID, PRO REC2 ID, ... reflect
- the processing history.
- Format: Recipe-name.
-
-Parameter Name: PRO RECi DRS ID
-Class: header
-Context: process
-Type: string
-Value Format: %20s
-Unit:
-Comment Field: Data Reduction System identifier
-Description: Identification of Data Reduction system used.
- Format: DRS-name/version.
-
-Parameter Name: PRO RECi PIPE ID
-Class: header
-Context: process
-Type: string
-Value Format: %32s
-Unit:
-Comment Field: Pipeline (unique) identifier
-Description: Identification of the instrument pipeline which produced
- the frame.
- Format: Pipeline-name/version.
-
-Parameter Name: PRO RECi RAWi NAME
-Class: header
-Context: process
-Type: string
-Value Format: %45s
-Unit:
-Comment Field: File name of raw frame
-Description: File name of raw frame.
-
-Parameter Name: PRO RECi RAWi CATG
-Class: header
-Context: process
-Type: string
-Value Format: %32s
-Unit:
-Comment Field: Frame category of raw frame
-Description: Category of the raw frame as given by the instrument's .bdd
- or .pdd file.
-
-Parameter Name: DEL FT STATUS
-Class: header
-Context: delay lines
-Type: string
-Value Format: %s
-Unit: list_item
-Comment Field: Fringe Tracker Status
-Description: TBD
-
-Parameter Name: DEL FT SENSOR
-Class: setup|header
-Context: delay lines
-Type: string
-Value Format: %s
-Unit: list_item
-Comment Field: Fringe Tracker Sensor Name
-Description: Value must be: NONE, VINCI, MIDI, FINITO, FSUA, FSUB, MET
-
-
-Parameter Name: ISS CONF NTEL
-Class: header|setup
-Context: VLTI Control
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Number of telescopes used
-Description: Number of telescopes used by VLTI
-
-Parameter Name: ISS CONF T1X
-Class: header
-Context: VLTI Control
-Type: double
-Value Format: %.4f
-Unit: m
-Comment Format: Relative X coordinate
-Description: Relative X coordinate for VLTI telescope 1
-
-Parameter Name: ISS CONF T1Y
-Class: header
-Context: VLTI Control
-Type: double
-Value Format: %.4f
-Unit: m
-Comment Format: Relative Y coordinate
-Description: Relative Y coordinate for VLTI telescope 1
-
-Parameter Name: ISS CONF T1Z
-Class: header
-Context: VLTI Control
-Type: double
-Value Format: %.4f
-Unit: m
-Comment Format: Relative Z coordinate
-Description: Relative Z coordinate for VLTI telescope 1
-
-Parameter Name: ISS CONF STATION1
-Class: header
-Context: VLTI Control
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Station of telescope 1
-Description: Station of telescope 1
-
-Parameter Name: ISS CONF STATION2
-Class: header
-Context: VLTI Control
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Station of telescope 2
-Description: Station of telescope 2
-
-Parameter Name: ISS CONF STATION3
-Class: header
-Context: VLTI Control
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Station of telescope 3
-Description: Station of telescope 3 (only if NTEL>2)
-
-Parameter Name: ISS PARANG END
-Class: header
-Context: VLTI Control
-Type: double
-Value Format: %.3f
-Unit: deg
-Comment Format: Parallactic angle at end
-Description: Reflects parallactic angle for all VLTI telescopes at end
-
-Parameter Name: ISS PARANG START
-Class: header
-Context: VLTI Control
-Type: double
-Value Format: %.3f
-Unit: deg
-Comment Format: Parallactic angle at start
-Description: Reflects parallactic angle for all VLTI telescopes at start
-
-Parameter Name: ISS PBLA12 END
-Class: header
-Context: VLTI Control
-Type: double
-Value Format: %.1f
-Unit: deg
-Comment Format: Projected baseline angle T1 T2 at end
-Description: Reflects the projected baseline angle as function of alt and az
-
-Parameter Name: ISS PBLA12 START
-Class: header
-Context: VLTI Control
-Type: double
-Value Format: %.1f
-Unit: deg
-Comment Format: Projected baseline angle T1 T2 at start
-Description: Reflects the projected baseline angle as function of alt and az
-
-Parameter Name: ISS PBLA13 END
-Class: header
-Context: VLTI Control
-Type: double
-Value Format: %.1f
-Unit: deg
-Comment Format: Projected baseline angle T1 T3 at end
-Description: Reflects the projected baseline angle as function of alt and az (only in NTEL>2)
-
-Parameter Name: ISS PBLA13 START
-Class: header
-Context: VLTI Control
-Type: double
-Value Format: %.1f
-Unit: deg
-Comment Format: Projected baseline angle T1 T3 at start
-Description: Reflects the projected baseline angle as function of alt and az (only in NTEL>2)
-
-Parameter Name: ISS PBLA23 END
-Class: header
-Context: VLTI Control
-Type: double
-Value Format: %.1f
-Unit: deg
-Comment Format: Projected baseline angle T2 T3 at end
-Description: Reflects the projected baseline angle as function of alt and az (only in NTEL>2)
-
-Parameter Name: ISS PBLA23 START
-Class: header
-Context: VLTI Control
-Type: double
-Value Format: %.1f
-Unit: deg
-Comment Format: Projected baseline angle T2 T3 at start
-Description: Reflects the projected baseline angle as function of alt and az (only in NTEL>2)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Parameter Name: ARCFILE
-Class: config
-Context: Instrument
-Type: string
-Value Format: %s
-Unit: unitless
-Comment Format: Archive File Name
-Description: Archive File Nam
-
-
-
-Parameter Name: INSTRUMENT MODE
-Class: qc-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Instrument mode (undispersed, dispersed, etc..)
-
-Parameter Name: BAND
-Class: qc-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Spectral band (K, ..)
-
-
-
-Parameter Name: STATIONi
-Class: qc-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Baseline
-
-Parameter Name: OBSERVER
-Class: qc-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Observer name
-
-Parameter Name: OB NAME
-Class: qc-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: OB name
-
-
-Parameter Name: PI COI NAME
-Class: qc-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: PI-COI Name
-
-Parameter Name: PI COI ID
-Class: qc-log
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: PI-COI Internal ESO ID
-
-Parameter Name: DATE OBS
-Class: qc-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Observation date
-
-Parameter Name: FILE OBS
-Class: qc-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Processed file name
-
-Parameter Name: DATE PIPE
-Class: header | qc-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Pipeline processing date
-
-Parameter Name: TARGET NAME
-Class: qc-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Target name
-
-Parameter Name: NSCANS
-Class: qc-log
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Number of scans
-
-Parameter Name: NFRAMES
-Class: qc-log
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Number of frames per scan
-
-Parameter Name: MUi
-Class: header | qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit:
-Comment Format: Squared coherence factor mu12,mu22
-Description: Squared coherence factor mu12,mu22
-
-Parameter Name: EMUi
-Class: header | qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit:
-Comment Format: Standard Deviation of squared coh. factor mu12,mu22
-Description: Standard Deviation of squared coh. factor mu12,mu22
-
-Parameter Name: Ti
-Class: header | qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit:
-Comment Format: Measured transfer function (ratio of square visibilities)
-Description: Measured transfer function (ratio of square visibilities)
-
-Parameter Name: DTi
-Class: header | qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit:
-Comment Format: Error on measured transfer function
-Description: Error on measured transfer function
-
-Parameter Name: COTi
-Class: header | qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit:
-Comment Format: Inverse transfer function
-Description: Inverse transfer function
-
-Parameter Name: DCOTi
-Class: header | qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit:
-Comment Format: Error on inverse transfer function
-Description: Error on inverse transfer function
-
-Parameter Name: ATi
-Class: header | qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit:
-Comment Format: Applied transfer function
-Description: Applied transfer function
-
-Parameter Name: DATi
-Class: header | qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit:
-Comment Format: Error on applied transfer function
-Description: Error on applied transfer function
-
-Parameter Name: Vi
-Class: header | qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit:
-Comment Format: Calibrated square visibility
-Description: Calibrated square visibility
-
-Parameter Name: DVi
-Class: header | qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit:
-Comment Format: Error (std.dev.) on calibrated square visibility
-Description: Error (std.dev.) on calibrated square visibility
-
-Parameter Name: OPD RATE
-Class: header | qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit: micron/s
-Comment Format: OPD rate in micron/sec
-Description: OPD rate in micron/sec
-
-Parameter Name: FRINGE RATE
-Class: header | qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit: Hz
-Comment Format: Fringe rate
-Description: Fringe rate
-
-Parameter Name: SCANS PROCESSED
-Class: header | qc-log
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Number of scans processed
-Description: Number of scans processed
-
-Parameter Name: SCANS REJECTED
-Class: header | qc-log
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Number of scans rejected
-Description: Number of scans rejected
-
-Parameter Name: CALIB POS
-Class: header | qc-log
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Position of the calibrator entry
-Description: Position of the calibrator entry
-
-Parameter Name: CALIB NAME
-Class: header | qc-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Name of the calibrator entry
-Description: Name of the calibrator entry
-
-Parameter Name: CALIB RA
-Class: header | qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit: micron/s
-Comment Format: Calibrator Right Ascension
-Description: Calibrator Right Ascension
-
-Parameter Name: CALIB DEC
-Class: header | qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit: micron/s
-Comment Format: Calibrator Declination
-Description: Calibrator Declination
-
-Parameter Name: CALIB DIST
-Class: header | qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit:
-Comment Format: Calibrator radial distance in degrees
-Description: Calibrator radial distance in degrees
-
-Parameter Name: CALIB DIAM
-Class: header | qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit:
-Comment Format: Calibrator diameter in milliarcsec
-Description: Calibrator diameter in milliarcsec
-
-Parameter Name: CALIB EDIAM
-Class: header | qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit:
-Comment Format: Error on Calibrator diameter in milliarcsec
-Description: Error on Calibrator diameter in milliarcsec
-
-Parameter Name: CALIB FLAG
-Class: header | qc-log
-Context: Instrument
-Type: integer
-Value Format: %i
-Unit:
-Comment Format: Calibrator quality flag
-Description: Calibrator quality flag
-
-Parameter Name: CALIB VIS
-Class: header | qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit:
-Comment Format: Calibrator estimated square visibility
-Description: Calibrated estimated square visibility
-
-Parameter Name: CALIB EVIS
-Class: header | qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit:
-Comment Format: Variance of calibrator estimated square visibility
-Description: Variance of calibrator estimated square visibility
-
-Parameter Name: TARG DIAM
-Class: header | qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit:
-Comment Format: Estimated diameter of the target (mas, Un.Disk model)
-Description: Estimated diameter of the target (mas, Un.Disk model)
-
-Parameter Name: TARG EDIAM
-Class: header | qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit:
-Comment Format: Error on estimated diameter in milliarcsec
-Description: Error on estimated diameter in milliarcsec
-
-Parameter Name: BASELINE UVWi
-Class: header | qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit:
-Comment Format: 3 components of UVW vector
-Description: 3 components of UVW vector
-
-Parameter Name: BASELINE LENGTH
-Class: header | qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit:
-Comment Format: Projected baseline length
-Description: Projected baseline length
-
-Parameter Name: BASELINE ANGLE
-Class: header | qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit:
-Comment Format: Baseline vector angle
-Description: Baseline vector angle
-
-Parameter Name: SEEING START
-Class: qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit: arcsec
-Comment Format: Observatory seeing (arcsec)
-Description: Observatory seeing (arcsec)
-
-Parameter Name: SEEING END
-Class: qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit: arcsec
-Comment Format: Observatory seeing (arcsec)
-Description: Observatory seeing (arcsec)
-
-Parameter Name: TAU0 START
-Class: qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit: s
-Comment Format: DIMM coherence time
-Description: DIMM coherence time
-
-Parameter Name: TAU0 END
-Class: qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit: s
-Comment Format: DIMM coherence time
-Description: DIMM coherence time
-
-Parameter Name: ISSPBL START
-Class: qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit: m
-Comment Format: ISS Projected Baseline
-Description: ISS Projected Baseline
-
-Parameter Name: ISSPBL END
-Class: qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit: m
-Comment Format: ISS Projected Baseline
-Description: ISS Projected Baseline
-
-Parameter Name: READMODE
-Class: qc-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Detector readout mode
-Description: Detector readout mode
-
-Parameter Name: CATG
-Class: qc-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: DO category of the file
-Description: DO category of the file
-
-Parameter Name: SNRPA
-Class: header | qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit: micron/s
-Comment Format: Signal to noise ratio on PA
-Description: Signal to noise ratio on PA
-
-Parameter Name: SNRPB
-Class: header | qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit: micron/s
-Comment Format: Signal to noise ratio on PB
-Description: Signal to noise ratio on PB
-
-Parameter Name: RA
-Class: qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit: degrees
-Comment Format: Right Ascension
-Description: Right Ascension
-
-Parameter Name: DEC
-Class: qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit: degrees
-Comment Format: Declination
-Description: Declination
-
-Parameter Name: EQUINOX
-Class: qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit: date
-Comment Format: Equinox
-Description: Equinox
-
-Parameter Name: TRANSFER MATRIXi
-Class: header | qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit: unitless
-Comment Format: Elements of the transfer matrix
-Description: Elements of the transfer matrix
-
-Parameter Name: TEL T1X
-Class: qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit: unitless
-Comment Format: Telescope ground coordinate
-Description: Telescope ground coordinate
-
-Parameter Name: TEL T1Y
-Class: qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit: unitless
-Comment Format: Telescope ground coordinate
-Description: Telescope ground coordinate
-
-Parameter Name: TEL T1Z
-Class: qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit: unitless
-Comment Format: Telescope ground coordinate
-Description: Telescope ground coordinate
-
-Parameter Name: TEL T2X
-Class: qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit: unitless
-Comment Format: Telescope ground coordinate
-Description: Telescope ground coordinate
-
-Parameter Name: TEL T2Y
-Class: qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit: unitless
-Comment Format: Telescope ground coordinate
-Description: Telescope ground coordinate
-
-Parameter Name: TEL T2Z
-Class: qc-log
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit: unitless
-Comment Format: Telescope ground coordinate
-Description: Telescope ground coordinate
-
-Parameter Name: PRO CATG
-Class: header | qc-log
-Context: product
-Type: string
-Value Format: %s
-Unit:
-Comment Format: pipeline product category
-Description: pipeline product
-
-Parameter Name: ARCFILE
-Class: header | qc-log
-Context: product
-Type: string
-Value Format: %s
-Unit:
-Comment Format: arcfile name of first raw file
-Description: arcfile name of first raw file
-
-Parameter Name: PRO PIPEDATE
-Class: header | qc-log
-Context: product
-Type: string
-Value Format: %s
-Unit:
-Comment Format: pipeline run date
-Description: pipeline run date
-
-Parameter Name: PRO VERSION
-Class: header | qc-log
-Context: product
-Type: string
-Value Format: %s
-Unit:
-Comment Format: pipeline version
-Description: pipeline version
-
-Parameter Name: PRO PIPEFILE
-Class: header | qc-log
-Context: product
-Type: string
-Value Format: %s
-Unit:
-Comment Format: pipeline product file name
-Description: pipeline product file name
-
-Parameter Name: DET NTEL
-Class: setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Number of telescopes
-Description: Number of telescopes
-
-Parameter Name: QC FRAMES SELECTED SNRGT2
-Class: config
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: number of frames with SNR greater than 2
-Description: number of frames with SNR greater than 2
-
-Parameter Name: QC FRAMES SELECTED PERCENT
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.3f
-Unit:
-Comment Format: percentage of frames with SNR greater than 2
-Description: percentage of frames with SNR greater than 2
-
-Parameter Name: QC BAND
-Class: config
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Band used during observation
-Description: Band used during observation
-
-Parameter Name: QC STA1
-Class: config
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Station index
-Description: Station index of the 1. telescope
-
-Parameter Name: QC STA2
-Class: config
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Station index
-Description: Station index of the 2. telescope
-
-Parameter Name: QC STA3
-Class: config
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Station index
-Description: Station index of the 3. telescope
-
-Parameter Name: QC BADPIX
-Class: config
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Number of Badpixels
-Description: Number of Badpixels of the Detector
-
-Parameter Name: QC GOODPIX
-Class: config
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Number of Goodpixels
-Description: Number of Goodpixels of the Detector
-
-Parameter Name: QC BADRATIO
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.4f
-Unit:
-Comment Format: Percentage of bad Pixels vs all Pixels
-Description: Percentage of bad Pixels vs all Pixels
-
-Parameter Name: QC REFPIX CLDSTP X
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X position of beam in Pixels
-Description: X position of beam in Pixels
-
-Parameter Name: QC REFPIX CLDSTP Y
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y position of beam in Pixels
-Description: Y position of beam in Pixels
-
-Parameter Name: QC REFPIX CLDSTP SIZX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X size of beam in Pixels
-Description: X size of beam in Pixels
-
-Parameter Name: QC REFPIX CLDSTP SIZY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y size of beam in Pixels
-Description: Y size of beam in Pixels
-
-Parameter Name: QC REFPIX CLDSTP FLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Flux of beam
-Description: Flux of beam
-
-Parameter Name: QC REFPIX CLDSTP ANGLE
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Position Angle of beam
-Description: Position Angle of beam
-
-Parameter Name: QC REFPIX A K X
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X position of beam in Pixels
-Description: X position of beam in Pixels
-
-Parameter Name: QC REFPIX A K Y
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y position of beam in Pixels
-Description: Y position of beam in Pixels
-
-Parameter Name: QC REFPIX A K SIZX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X size of beam in Pixels
-Description: X size of beam in Pixels
-
-Parameter Name: QC REFPIX A K SIZY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y size of beam in Pixels
-Description: Y size of beam in Pixels
-
-Parameter Name: QC REFPIX A K FLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Flux of beam
-Description: Flux of beam
-
-Parameter Name: QC REFPIX A K ANGLE
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Position Angle of beam
-Description: Position Angle of beam
-
-Parameter Name: QC REFPIX B K X
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X position of beam in Pixels
-Description: X position of beam in Pixels
-
-Parameter Name: QC REFPIX B K Y
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y position of beam in Pixels
-Description: Y position of beam in Pixels
-
-Parameter Name: QC REFPIX B K SIZX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X size of beam in Pixels
-Description: X size of beam in Pixels
-
-Parameter Name: QC REFPIX B K SIZY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y size of beam in Pixels
-Description: Y size of beam in Pixels
-
-Parameter Name: QC REFPIX B K FLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Flux of beam
-Description: Flux of beam
-
-Parameter Name: QC REFPIX B K ANGLE
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Position Angle of beam
-Description: Position Angle of beam
-
-Parameter Name: QC REFPIX C K X
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X position of beam in Pixels
-Description: X position of beam in Pixels
-
-Parameter Name: QC REFPIX C K Y
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y position of beam in Pixels
-Description: Y position of beam in Pixels
-
-Parameter Name: QC REFPIX C K SIZX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X size of beam in Pixels
-Description: X size of beam in Pixels
-
-Parameter Name: QC REFPIX C K SIZY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y size of beam in Pixels
-Description: Y size of beam in Pixels
-
-Parameter Name: QC REFPIX C K FLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Flux of beam
-Description: Flux of beam
-
-Parameter Name: QC REFPIX C K ANGLE
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Position Angle of beam
-Description: Position Angle of beam
-
-Parameter Name: QC REFPIX A H X
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X position of beam in Pixels
-Description: X position of beam in Pixels
-
-Parameter Name: QC REFPIX A H Y
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y position of beam in Pixels
-Description: Y position of beam in Pixels
-
-Parameter Name: QC REFPIX A H SIZX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X size of beam in Pixels
-Description: X size of beam in Pixels
-
-Parameter Name: QC REFPIX A H SIZY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y size of beam in Pixels
-Description: Y size of beam in Pixels
-
-Parameter Name: QC REFPIX A H FLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Flux of beam
-Description: Flux of beam
-
-Parameter Name: QC REFPIX A H ANGLE
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Position Angle of beam
-Description: Position Angle of beam
-
-Parameter Name: QC REFPIX B H X
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X position of beam in Pixels
-Description: X position of beam in Pixels
-
-Parameter Name: QC REFPIX B H Y
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y position of beam in Pixels
-Description: Y position of beam in Pixels
-
-Parameter Name: QC REFPIX B H SIZX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X size of beam in Pixels
-Description: X size of beam in Pixels
-
-Parameter Name: QC REFPIX B H SIZY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y size of beam in Pixels
-Description: Y size of beam in Pixels
-
-Parameter Name: QC REFPIX B H FLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Flux of beam
-Description: Flux of beam
-
-Parameter Name: QC REFPIX B H ANGLE
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Position Angle of beam
-Description: Position Angle of beam
-
-Parameter Name: QC REFPIX C H X
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X position of beam in Pixels
-Description: X position of beam in Pixels
-
-Parameter Name: QC REFPIX C H Y
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y position of beam in Pixels
-Description: Y position of beam in Pixels
-
-Parameter Name: QC REFPIX C H SIZX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X size of beam in Pixels
-Description: X size of beam in Pixels
-
-Parameter Name: QC REFPIX C H SIZY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y size of beam in Pixels
-Description: Y size of beam in Pixels
-
-Parameter Name: QC REFPIX C H FLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Flux of beam
-Description: Flux of beam
-
-Parameter Name: QC REFPIX C H ANGLE
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Position Angle of beam
-Description: Position Angle of beam
-
-Parameter Name: QC REFPIX A J X
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X position of beam in Pixels
-Description: X position of beam in Pixels
-
-Parameter Name: QC REFPIX A J Y
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y position of beam in Pixels
-Description: Y position of beam in Pixels
-
-Parameter Name: QC REFPIX A J SIZX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X size of beam in Pixels
-Description: X size of beam in Pixels
-
-Parameter Name: QC REFPIX A J SIZY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y size of beam in Pixels
-Description: Y size of beam in Pixels
-
-Parameter Name: QC REFPIX A J FLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Flux of beam
-Description: Flux of beam
-
-Parameter Name: QC REFPIX A J ANGLE
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Position Angle of beam
-Description: Position Angle of beam
-
-Parameter Name: QC REFPIX B J X
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X position of beam in Pixels
-Description: X position of beam in Pixels
-
-Parameter Name: QC REFPIX B J Y
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y position of beam in Pixels
-Description: Y position of beam in Pixels
-
-Parameter Name: QC REFPIX B J SIZX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X size of beam in Pixels
-Description: X size of beam in Pixels
-
-Parameter Name: QC REFPIX B J SIZY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y size of beam in Pixels
-Description: Y size of beam in Pixels
-
-Parameter Name: QC REFPIX B J FLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Flux of beam
-Description: Flux of beam
-
-Parameter Name: QC REFPIX B J ANGLE
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Position Angle of beam
-Description: Position Angle of beam
-
-Parameter Name: QC REFPIX C J X
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X position of beam in Pixels
-Description: X position of beam in Pixels
-
-Parameter Name: QC REFPIX C J Y
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y position of beam in Pixels
-Description: Y position of beam in Pixels
-
-Parameter Name: QC REFPIX C J SIZX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X size of beam in Pixels
-Description: X size of beam in Pixels
-
-Parameter Name: QC REFPIX C J SIZY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y size of beam in Pixels
-Description: Y size of beam in Pixels
-
-Parameter Name: QC REFPIX C J FLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Flux of beam
-Description: Flux of beam
-
-Parameter Name: QC REFPIX C J ANGLE
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Position Angle of beam
-Description: Position Angle of beam
-
-Parameter Name: QC REFPIX BCD A K ANGLE
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Position Angle of beam
-Description: Position Angle of beam
-
-Parameter Name: QC REFPIX BCD A K X
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X position of beam in Pixels
-Description: X position of beam in Pixels
-
-Parameter Name: QC REFPIX BCD A K Y
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y position of beam in Pixels
-Description: Y position of beam in Pixels
-
-Parameter Name: QC REFPIX BCD A K SIZX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X size of beam in Pixels
-Description: X size of beam in Pixels
-
-Parameter Name: QC REFPIX BCD A K SIZY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y size of beam in Pixels
-Description: Y size of beam in Pixels
-
-Parameter Name: QC REFPIX BCD A K FLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Flux of beam
-Description: Flux of beam
-
-Parameter Name: QC REFPIX BCD A K ANGLE
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Position Angle of beam
-Description: Position Angle of beam
-
-Parameter Name: QC REFPIX BCD B K X
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X position of beam in Pixels
-Description: X position of beam in Pixels
-
-Parameter Name: QC REFPIX BCD B K Y
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y position of beam in Pixels
-Description: Y position of beam in Pixels
-
-Parameter Name: QC REFPIX BCD B K SIZX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X size of beam in Pixels
-Description: X size of beam in Pixels
-
-Parameter Name: QC REFPIX BCD B K SIZY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y size of beam in Pixels
-Description: Y size of beam in Pixels
-
-Parameter Name: QC REFPIX BCD B K FLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Flux of beam
-Description: Flux of beam
-
-Parameter Name: QC REFPIX BCD B K ANGLE
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Position Angle of beam
-Description: Position Angle of beam
-
-Parameter Name: QC REFPIX BCD C K X
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X position of beam in Pixels
-Description: X position of beam in Pixels
-
-Parameter Name: QC REFPIX BCD C K Y
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y position of beam in Pixels
-Description: Y position of beam in Pixels
-
-Parameter Name: QC REFPIX BCD C K SIZX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X size of beam in Pixels
-Description: X size of beam in Pixels
-
-Parameter Name: QC REFPIX BCD C K SIZY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y size of beam in Pixels
-Description: Y size of beam in Pixels
-
-Parameter Name: QC REFPIX BCD C K FLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Flux of beam
-Description: Flux of beam
-
-Parameter Name: QC REFPIX BCD C K ANGLE
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Position Angle of beam
-Description: Position Angle of beam
-
-Parameter Name: QC REFPIX BCD A H X
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X position of beam in Pixels
-Description: X position of beam in Pixels
-
-Parameter Name: QC REFPIX BCD A H Y
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y position of beam in Pixels
-Description: Y position of beam in Pixels
-
-Parameter Name: QC REFPIX BCD A H SIZX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X size of beam in Pixels
-Description: X size of beam in Pixels
-
-Parameter Name: QC REFPIX BCD A H SIZY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y size of beam in Pixels
-Description: Y size of beam in Pixels
-
-Parameter Name: QC REFPIX BCD A H FLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Flux of beam
-Description: Flux of beam
-
-Parameter Name: QC REFPIX BCD A H ANGLE
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Position Angle of beam
-Description: Position Angle of beam
-
-Parameter Name: QC REFPIX BCD B H X
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X position of beam in Pixels
-Description: X position of beam in Pixels
-
-Parameter Name: QC REFPIX BCD B H Y
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y position of beam in Pixels
-Description: Y position of beam in Pixels
-
-Parameter Name: QC REFPIX BCD B H SIZX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X size of beam in Pixels
-Description: X size of beam in Pixels
-
-Parameter Name: QC REFPIX BCD B H SIZY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y size of beam in Pixels
-Description: Y size of beam in Pixels
-
-Parameter Name: QC REFPIX BCD B H FLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Flux of beam
-Description: Flux of beam
-
-Parameter Name: QC REFPIX BCD B H ANGLE
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Position Angle of beam
-Description: Position Angle of beam
-
-Parameter Name: QC REFPIX BCD C H X
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X position of beam in Pixels
-Description: X position of beam in Pixels
-
-Parameter Name: QC REFPIX BCD C H Y
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y position of beam in Pixels
-Description: Y position of beam in Pixels
-
-Parameter Name: QC REFPIX BCD C H SIZX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X size of beam in Pixels
-Description: X size of beam in Pixels
-
-Parameter Name: QC REFPIX BCD C H SIZY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y size of beam in Pixels
-Description: Y size of beam in Pixels
-
-Parameter Name: QC REFPIX BCD C H FLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Flux of beam
-Description: Flux of beam
-
-Parameter Name: QC REFPIX BCD C H ANGLE
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Position Angle of beam
-Description: Position Angle of beam
-
-Parameter Name: QC REFPIX BCD A J X
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X position of beam in Pixels
-Description: X position of beam in Pixels
-
-Parameter Name: QC REFPIX BCD A J Y
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y position of beam in Pixels
-Description: Y position of beam in Pixels
-
-Parameter Name: QC REFPIX BCD A J SIZX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X size of beam in Pixels
-Description: X size of beam in Pixels
-
-Parameter Name: QC REFPIX BCD A J SIZY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y size of beam in Pixels
-Description: Y size of beam in Pixels
-
-Parameter Name: QC REFPIX BCD A J FLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Flux of beam
-Description: Flux of beam
-
-Parameter Name: QC REFPIX BCD A J ANGLE
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Position Angle of beam
-Description: Position Angle of beam
-
-Parameter Name: QC REFPIX BCD B J X
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X position of beam in Pixels
-Description: X position of beam in Pixels
-
-Parameter Name: QC REFPIX BCD B J Y
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y position of beam in Pixels
-Description: Y position of beam in Pixels
-
-Parameter Name: QC REFPIX BCD B J SIZX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X size of beam in Pixels
-Description: X size of beam in Pixels
-
-Parameter Name: QC REFPIX BCD B J SIZY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y size of beam in Pixels
-Description: Y size of beam in Pixels
-
-Parameter Name: QC REFPIX BCD B J FLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Flux of beam
-Description: Flux of beam
-
-Parameter Name: QC REFPIX BCD B J ANGLE
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Position Angle of beam
-Description: Position Angle of beam
-
-Parameter Name: QC REFPIX BCD C J X
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X position of beam in Pixels
-Description: X position of beam in Pixels
-
-Parameter Name: QC REFPIX BCD C J Y
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y position of beam in Pixels
-Description: Y position of beam in Pixels
-
-Parameter Name: QC REFPIX BCD C J SIZX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X size of beam in Pixels
-Description: X size of beam in Pixels
-
-Parameter Name: QC REFPIX BCD C J SIZY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y size of beam in Pixels
-Description: Y size of beam in Pixels
-
-Parameter Name: QC REFPIX BCD C J FLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Flux of beam
-Description: Flux of beam
-
-Parameter Name: QC REFPIX BCD C J ANGLE
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Position Angle of beam
-Description: Position Angle of beam
-
-Parameter Name: QC REFPIX OUTF A X
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X position of beam in Pixels
-Description: X position of beam in Pixels
-
-Parameter Name: QC REFPIX OUTF A Y
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y position of beam in Pixels
-Description: Y position of beam in Pixels
-
-Parameter Name: QC REFPIX OUTF A SIZX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X size of beam in Pixels
-Description: X size of beam in Pixels
-
-Parameter Name: QC REFPIX OUTF A SIZY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y size of beam in Pixels
-Description: Y size of beam in Pixels
-
-Parameter Name: QC REFPIX OUTF A FLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Flux of beam
-Description: Flux of beam
-
-Parameter Name: QC REFPIX OUTF A ANGLE
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Position Angle of beam
-Description: Position Angle of beam
-
-Parameter Name: QC REFPIX OUTF B X
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X position of beam in Pixels
-Description: X position of beam in Pixels
-
-Parameter Name: QC REFPIX OUTF B Y
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y position of beam in Pixels
-Description: Y position of beam in Pixels
-
-Parameter Name: QC REFPIX OUTF B SIZX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X size of beam in Pixels
-Description: X size of beam in Pixels
-
-Parameter Name: QC REFPIX OUTF B SIZY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y size of beam in Pixels
-Description: Y size of beam in Pixels
-
-Parameter Name: QC REFPIX OUTF B FLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Flux of beam
-Description: Flux of beam
-
-Parameter Name: QC REFPIX OUTF B ANGLE
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Position Angle of beam
-Description: Position Angle of beam
-
-Parameter Name: QC REFPIX OUTF C X
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X position of beam in Pixels
-Description: X position of beam in Pixels
-
-Parameter Name: QC REFPIX OUTF C Y
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y position of beam in Pixels
-Description: Y position of beam in Pixels
-
-Parameter Name: QC REFPIX OUTF C SIZX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X size of beam in Pixels
-Description: X size of beam in Pixels
-
-Parameter Name: QC REFPIX OUTF C SIZY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y size of beam in Pixels
-Description: Y size of beam in Pixels
-
-Parameter Name: QC REFPIX OUTF C FLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Flux of beam
-Description: Flux of beam
-
-Parameter Name: QC REFPIX OUTF C ANGLE
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Position Angle of beam
-Description: Position Angle of beam
-
-Parameter Name: QC P1 OFFSETY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.8f
-Unit:
-Comment Format: Offset wavelength calibration
-Description: Offset after wavelength calibration of beam 1
-
-Parameter Name: QC P2 OFFSETY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.8f
-Unit:
-Comment Format: Offset wavelength calibration
-Description: Offset after wavelength calibration of beam 2
-
-Parameter Name: QC P3 OFFSETY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.8f
-Unit:
-Comment Format: Offset wavelength calibration
-Description: Offset after wavelength calibration of beam 3
-
-Parameter Name: QC REFPIX CLDSTP SHX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X shift of beam in Pixels
-Description: X shift of beam in Pixels
-
-Parameter Name: QC REFPIX A K SHX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X shift of beam in Pixels
-Description: X shift of beam in Pixels
-
-Parameter Name: QC REFPIX B K SHX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X shift of beam in Pixels
-Description: X shift of beam in Pixels
-
-Parameter Name: QC REFPIX C K SHX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X shift of beam in Pixels
-Description: X shift of beam in Pixels
-
-Parameter Name: QC REFPIX A H SHX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X shift of beam in Pixels
-Description: X shift of beam in Pixels
-
-Parameter Name: QC REFPIX B H SHX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X shift of beam in Pixels
-Description: X shift of beam in Pixels
-
-Parameter Name: QC REFPIX C H SHX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X shift of beam in Pixels
-Description: X shift of beam in Pixels
-
-Parameter Name: QC REFPIX A J SHX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X shift of beam in Pixels
-Description: X shift of beam in Pixels
-
-Parameter Name: QC REFPIX B J SHX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X shift of beam in Pixels
-Description: X shift of beam in Pixels
-
-Parameter Name: QC REFPIX C J SHX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X shift of beam in Pixels
-Description: X shift of beam in Pixels
-
-Parameter Name: QC REFPIX BCD A K SHX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X shift of beam in Pixels
-Description: X shift of beam in Pixels
-
-Parameter Name: QC REFPIX BCD B K SHX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X shift of beam in Pixels
-Description: X shift of beam in Pixels
-
-Parameter Name: QC REFPIX BCD C K SHX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X shift of beam in Pixels
-Description: X shift of beam in Pixels
-
-Parameter Name: QC REFPIX BCD A H SHX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X shift of beam in Pixels
-Description: X shift of beam in Pixels
-
-Parameter Name: QC REFPIX BCD B H SHX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X shift of beam in Pixels
-Description: X shift of beam in Pixels
-
-Parameter Name: QC REFPIX BCD C H SHX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X shift of beam in Pixels
-Description: X shift of beam in Pixels
-
-Parameter Name: QC REFPIX BCD A J SHX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X shift of beam in Pixels
-Description: X shift of beam in Pixels
-
-Parameter Name: QC REFPIX BCD B J SHX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X shift of beam in Pixels
-Description: X shift of beam in Pixels
-
-Parameter Name: QC REFPIX BCD C J SHX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X shift of beam in Pixels
-Description: X shift of beam in Pixels
-
-Parameter Name: QC REFPIX OUTF A SHX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X shift of beam in Pixels
-Description: X shift of beam in Pixels
-
-Parameter Name: QC REFPIX OUTF B SHX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X shift of beam in Pixels
-Description: X shift of beam in Pixels
-
-Parameter Name: QC REFPIX OUTF C SHX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: X shift of beam in Pixels
-Description: X shift of beam in Pixels
-
-Parameter Name: QC REFPIX CLDSTP SHY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y shift of beam in Pixels
-Description: Y shift of beam in Pixels
-
-Parameter Name: QC REFPIX A K SHY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y shift of beam in Pixels
-Description: Y shift of beam in Pixels
-
-Parameter Name: QC REFPIX B K SHY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y shift of beam in Pixels
-Description: Y shift of beam in Pixels
-
-Parameter Name: QC REFPIX C K SHY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y shift of beam in Pixels
-Description: Y shift of beam in Pixels
-
-Parameter Name: QC REFPIX A H SHY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y shift of beam in Pixels
-Description: Y shift of beam in Pixels
-
-Parameter Name: QC REFPIX B H SHY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y shift of beam in Pixels
-Description: Y shift of beam in Pixels
-
-Parameter Name: QC REFPIX C H SHY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y shift of beam in Pixels
-Description: Y shift of beam in Pixels
-
-Parameter Name: QC REFPIX A J SHY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y shift of beam in Pixels
-Description: Y shift of beam in Pixels
-
-Parameter Name: QC REFPIX B J SHY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y shift of beam in Pixels
-Description: Y shift of beam in Pixels
-
-Parameter Name: QC REFPIX C J SHY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y shift of beam in Pixels
-Description: Y shift of beam in Pixels
-
-Parameter Name: QC REFPIX BCD A K SHY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y shift of beam in Pixels
-Description: Y shift of beam in Pixels
-
-Parameter Name: QC REFPIX BCD B K SHY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y shift of beam in Pixels
-Description: Y shift of beam in Pixels
-
-Parameter Name: QC REFPIX BCD C K SHY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y shift of beam in Pixels
-Description: Y shift of beam in Pixels
-
-Parameter Name: QC REFPIX BCD A H SHY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y shift of beam in Pixels
-Description: Y shift of beam in Pixels
-
-Parameter Name: QC REFPIX BCD B H SHY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y shift of beam in Pixels
-Description: Y shift of beam in Pixels
-
-Parameter Name: QC REFPIX BCD C H SHY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y shift of beam in Pixels
-Description: Y shift of beam in Pixels
-
-Parameter Name: QC REFPIX BCD A J SHY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y shift of beam in Pixels
-Description: Y shift of beam in Pixels
-
-Parameter Name: QC REFPIX BCD B J SHY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y shift of beam in Pixels
-Description: Y shift of beam in Pixels
-
-Parameter Name: QC REFPIX BCD C J SHY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y shift of beam in Pixels
-Description: Y shift of beam in Pixels
-
-Parameter Name: QC REFPIX OUTF A SHY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y shift of beam in Pixels
-Description: Y shift of beam in Pixels
-
-Parameter Name: QC REFPIX OUTF B SHY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y shift of beam in Pixels
-Description: Y shift of beam in Pixels
-
-Parameter Name: QC REFPIX OUTF C SHY
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.2f
-Unit:
-Comment Format: Y shift of beam in Pixels
-Description: Y shift of beam in Pixels
-
-Parameter Name: QC P2VM VIS12
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Int vis of baseline 12
-Description: Int vis of baseline 12
-
-Parameter Name: QC P2VM ERRVIS12
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Int vis error baseline 12
-Description: Int vis error baseline 12
-
-Parameter Name: QC P2VM J VIS12
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Int vis of baseline 12 in J
-Description: Int vis of baseline 12 in J
-
-Parameter Name: QC P2VM J ERRVIS12
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Int vis error baseline 12 in J
-Description: Int vis error baseline 12 in J
-
-Parameter Name: QC P2VM H VIS12
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Int vis of baseline 12 in H
-Description: Int vis of baseline 12 in H
-
-Parameter Name: QC P2VM H ERRVIS12
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Int vis error baseline 12 in H
-Description: Int vis error baseline 12 in H
-
-Parameter Name: QC P2VM K VIS12
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Int vis of baseline 12 in K
-Description: Int vis of baseline 12 in K
-
-Parameter Name: QC P2VM K ERRVIS12
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Int vis error baseline 12 in K
-Description: Int vis error baseline 12 in K
-
-Parameter Name: QC P2VM VIS23
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Int vis of baseline 23
-Description: Int vis of baseline 23
-
-Parameter Name: QC P2VM ERRVIS23
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Int vis error baseline 23
-Description: Int vis error baseline 23
-
-Parameter Name: QC P2VM J VIS23
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Int vis of baseline 23 in J
-Description: Int vis of baseline 23 in J
-
-Parameter Name: QC P2VM J ERRVIS23
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Int vis error baseline 23 in J
-Description: Int vis error baseline 23 in J
-
-Parameter Name: QC P2VM H VIS23
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Int vis of baseline 23 in H
-Description: Int vis of baseline 23 in H
-
-Parameter Name: QC P2VM H ERRVIS23
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Int vis error baseline 23 in H
-Description: Int vis error baseline 23 in H
-
-Parameter Name: QC P2VM K VIS23
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Int vis of baseline 23 in K
-Description: Int vis of baseline 23 in K
-
-Parameter Name: QC P2VM K ERRVIS23
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Int vis error baseline 23 in K
-Description: Int vis error baseline 23 in K
-
-Parameter Name: QC P2VM VIS31
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Int vis of baseline 31
-Description: Int vis of baseline 31
-
-Parameter Name: QC P2VM ERRVIS31
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Int vis error baseline 31
-Description: Int vis error baseline 31
-
-Parameter Name: QC P2VM J VIS31
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Int vis of baseline 31 in J
-Description: Int vis of baseline 31 in J
-
-Parameter Name: QC P2VM J ERRVIS31
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Int vis error baseline 31 in J
-Description: Int vis error baseline 31 in J
-
-Parameter Name: QC P2VM H VIS31
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Int vis of baseline 31 in H
-Description: Int vis of baseline 31 in H
-
-Parameter Name: QC P2VM H ERRVIS31
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Int vis error baseline 31 in H
-Description: Int vis error baseline 31 in H
-
-Parameter Name: QC P2VM K VIS31
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Int vis of baseline 31 in K
-Description: Int vis of baseline 31 in K
-
-Parameter Name: QC P2VM K ERRVIS31
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Int vis error baseline 31 in K
-Description: Int vis error baseline 31 in K
-
-Parameter Name: QC REFPIX CLDSTP PEAKFLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Fluxpeak of beam
-Description: Fluxpeak of beam
-
-Parameter Name: QC REFPIX A K PEAKFLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Fluxpeak of beam
-Description: Fluxpeak of beam
-
-Parameter Name: QC REFPIX B K PEAKFLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Fluxpeak of beam
-Description: Fluxpeak of beam
-
-Parameter Name: QC REFPIX C K PEAKFLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Fluxpeak of beam
-Description: Fluxpeak of beam
-
-Parameter Name: QC REFPIX A H PEAKFLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Fluxpeak of beam
-Description: Fluxpeak of beam
-
-Parameter Name: QC REFPIX B H PEAKFLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Fluxpeak of beam
-Description: Fluxpeak of beam
-
-Parameter Name: QC REFPIX C H PEAKFLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Fluxpeak of beam
-Description: Fluxpeak of beam
-
-Parameter Name: QC REFPIX A J PEAKFLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Fluxpeak of beam
-Description: Fluxpeak of beam
-
-Parameter Name: QC REFPIX B J PEAKFLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Fluxpeak of beam
-Description: Fluxpeak of beam
-
-Parameter Name: QC REFPIX C J PEAKFLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Fluxpeak of beam
-Description: Fluxpeak of beam
-
-Parameter Name: QC REFPIX BCD A K PEAKFLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Fluxpeak of beam
-Description: Fluxpeak of beam
-
-Parameter Name: QC REFPIX BCD B K PEAKFLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Fluxpeak of beam
-Description: Fluxpeak of beam
-
-Parameter Name: QC REFPIX BCD C K PEAKFLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Fluxpeak of beam
-Description: Fluxpeak of beam
-
-Parameter Name: QC REFPIX BCD A H PEAKFLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Fluxpeak of beam
-Description: Fluxpeak of beam
-
-Parameter Name: QC REFPIX BCD B H PEAKFLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Fluxpeak of beam
-Description: Fluxpeak of beam
-
-Parameter Name: QC REFPIX BCD C H PEAKFLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Fluxpeak of beam
-Description: Fluxpeak of beam
-
-Parameter Name: QC REFPIX BCD A J PEAKFLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Fluxpeak of beam
-Description: Fluxpeak of beam
-
-Parameter Name: QC REFPIX BCD B J PEAKFLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Fluxpeak of beam
-Description: Fluxpeak of beam
-
-Parameter Name: QC REFPIX BCD C J PEAKFLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Fluxpeak of beam
-Description: Fluxpeak of beam
-
-Parameter Name: QC REFPIX OUTF A PEAKFLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Fluxpeak of beam
-Description: Fluxpeak of beam
-
-Parameter Name: QC REFPIX OUTF B PEAKFLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Fluxpeak of beam
-Description: Fluxpeak of beam
-
-Parameter Name: QC REFPIX OUTF C PEAKFLUX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.1f
-Unit:
-Comment Format: Fluxpeak of beam
-Description: Fluxpeak of beam
-
-Parameter Name: QC LAMBDA CHAN
-Class: config
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit: NONE
-Comment Format: Number of channels
-Description: Number of channels
-
-Parameter Name: QC LAMBDA CEN CHAN
-Class: config
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit: NONE
-Comment Format: Number of channels
-Description: Number of channels
-
-Parameter Name: QC LAMBDA BIN1 CHAN
-Class: config
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit: NONE
-Comment Format: Number of channels
-Description: Number of channels
-
-Parameter Name: QC LAMBDA BIN2 CHAN
-Class: config
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit: NONE
-Comment Format: Number of channels
-Description: Number of channels
-
-Parameter Name: QC LAMBDA BIN3 CHAN
-Class: config
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit: NONE
-Comment Format: Number of channels
-Description: Number of channels
-
-Parameter Name: QC LAMBDA MIN
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: micron
-Comment Format: wavelength inclusive used
-Description: minimal wavelength used
-
-Parameter Name: QC LAMBDA MAX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: micron
-Comment Format: wavelength inclusive used
-Description: maximal wavelength used
-
-Parameter Name: QC LAMBDA CEN MIN
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: micron
-Comment Format: wavelength inclusive used
-Description: minimal wavelength used
-
-Parameter Name: QC LAMBDA CEN MAX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: micron
-Comment Format: wavelength inclusive used
-Description: maximal wavelength used
-
-Parameter Name: QC LAMBDA BIN1 MIN
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: micron
-Comment Format: wavelength inclusive used
-Description: minimal wavelength used
-
-Parameter Name: QC LAMBDA BIN1 MAX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: micron
-Comment Format: wavelength inclusive used
-Description: maximal wavelength used
-
-Parameter Name: QC LAMBDA BIN2 MIN
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: micron
-Comment Format: wavelength inclusive used
-Description: minimal wavelength used
-
-Parameter Name: QC LAMBDA BIN2 MAX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: micron
-Comment Format: wavelength inclusive used
-Description: maximal wavelength used
-
-Parameter Name: QC LAMBDA BIN3 MIN
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: micron
-Comment Format: wavelength inclusive used
-Description: minimal wavelength used
-
-Parameter Name: QC LAMBDA BIN3 MAX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: micron
-Comment Format: wavelength inclusive used
-Description: maximal wavelength used
-
-Parameter Name: QC UNCALV2 CEN BAS1
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC UNCALV2 CEN BAS2
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC UNCALV2 CEN BAS3
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC UNCALCP CEN
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: deg
-Comment Format: mean closure phase
-Description: mean closure phase
-
-Parameter Name: QC UNCALV2 BIN1 BAS1
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC UNCALV2 BIN1 BAS2
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC UNCALV2 BIN1 BAS3
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC UNCALCP BIN1
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: deg
-Comment Format: mean closure phase
-Description: mean closure phase
-
-Parameter Name: QC UNCALV2 BIN2 BAS1
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC UNCALV2 BIN2 BAS2
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC UNCALV2 BIN2 BAS3
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC UNCALCP BIN2
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: deg
-Comment Format: mean closure phase
-Description: mean closure phase
-
-Parameter Name: QC UNCALV2 BIN3 BAS1
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC UNCALV2 BIN3 BAS2
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC UNCALV2 BIN3 BAS3
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC UNCALCP BIN3
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: deg
-Comment Format: mean closure phase
-Description: mean closure phase
-
-
-Parameter Name: QC DB DIAM ERR
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: marcsec
-Comment Format: Calibrator Diameter error
-Description: Calibrator Diameter error
-
-Parameter Name: QC DB DIAM
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: marcsec
-Comment Format: Calibrator Diameter
-Description: Calibrator Diameter
-
-Parameter Name: QC DB DIST
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: arcsec
-Comment Format: Computed calibrator Distance in arcsec
-Description: Computed calibrator Distance in arcsec
-
-Parameter Name: QC DB FLAG
-Class: config
-Context: Instrument
-Type: int
-Value Format: %d
-Unit: deg
-Comment Format: Calibrator Quality Flag
-Description: Calibrator Quality Flag
-
-Parameter Name: QC DB MAG HBAND
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: mag
-Comment Format: Calibrator Magnitude in the H-Band
-Description: Calibrator Magnitude in the H-Band
-
-Parameter Name: QC DB MAG JBAND
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: mag
-Comment Format: Calibrator Magnitude in the J-Band
-Description: Calibrator Magnitude in the J-Band
-
-Parameter Name: QC DB MAG KBAND
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: mag
-Comment Format: Calibrator Magnitude in the K-Band
-Description: Calibrator Magnitude in the K-Band
-
-Parameter Name: QC DB NAME
-Class: config
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Closest Calibrator in the database
-Description: Closest Calibrator in the database
-
-Parameter Name: QC FRAMES PERCENTAGE SELECTED
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Percentage of selected frame
-Description: Percentage of selected frame
-
-Parameter Name: QC OBS AVR PARANG
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: deg
-Comment Format: Observed Calibrator Average PARANG
-Description: Observed Calibrator Average PARANG
-
-Parameter Name: QC OBS AVR PBL12
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: meter
-Comment Format: Observed Calibrator Average PBL12
-Description: Observed Calibrator Average PBL12
-
-Parameter Name: QC OBS AVR PBL13
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: meter
-Comment Format: Observed Calibrator Average PBL13
-Description: Observed Calibrator Average PBL13
-
-Parameter Name: QC OBS AVR PBL23
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: meter
-Comment Format: Observed Calibrator Average PBL23
-Description: Observed Calibrator Average PBL23
-
-Parameter Name: QC OBS CAL DEC
-Class: config
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit: radians
-Comment Format: Observed Calibrator DEC
-Description: Observed Calibrator DEC
-
-Parameter Name: QC OBS CAL RA
-Class: config
-Context: Instrument
-Type: double
-Value Format: %.6f
-Unit: radians
-Comment Format: Observed Calibrator RA
-Description: Observed Calibrator RA
-
-Parameter Name: QC OBS NAME
-Class: config
-Context: Instrument
-Type: string
-Value Format: %s
-Unit: deg
-Comment Format: Observed Calibrator name
-Description: Observed Calibrator name
-
-Parameter Name: QC OBS ESOTRUSTED
-Class: config
-Context: Instrument
-Type: logical
-Value Format: %c
-Unit:
-Comment Format: The calibrator is trusted by ESO if true
-Description: The calibrator is trusted by ESO if true
-
-Parameter Name: QC USEDVALUE AND
-Class: config
-Context: Instrument
-Type: logical
-Value Format: %c
-Unit:
-Comment Format: All criteria must be fulfilled if true
-Description: All criteria must be fulfilled if true
-
-Parameter Name: QC USEDVALUE METHOD
-Class: config
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Used Method to select the visibilities
-Description: Used Method to select the visibilities
-
-Parameter Name: QC USEDVALUE X1
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Baseline 1
-Description: Baseline 1
-
-Parameter Name: QC USEDVALUE X2
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Baseline 2
-Description: Baseline 2
-
-Parameter Name: QC USEDVALUE X3
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit:
-Comment Format: Baseline 3
-Description: Baseline 3
-
-Parameter Name: QC X1 THRESHOLD
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: meter
-Comment Format: Selection threshold for baseline 1
-Description: Selection threshold for baseline 1
-
-Parameter Name: QC X2 THRESHOLD
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: meter
-Comment Format: Selection threshold for baseline 2
-Description: Selection threshold for baseline 2
-
-Parameter Name: QC X3 THRESHOLD
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: meter
-Comment Format: Selection threshold for baseline 3
-Description: Selection threshold for baseline 3
-
-Parameter Name: QC CALV2 CEN BAS1
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC CALV2 CEN BAS2
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC CALV2 CEN BAS3
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC CALCP CEN
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: deg
-Comment Format: mean closure phase
-Description: mean closure phase
-
-Parameter Name: QC CALV2 BIN1 BAS1
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC CALV2 BIN1 BAS2
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC CALV2 BIN1 BAS3
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC CALCP BIN1
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: deg
-Comment Format: mean closure phase
-Description: mean closure phase
-
-Parameter Name: QC CALV2 BIN2 BAS1
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC CALV2 BIN2 BAS2
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC CALV2 BIN2 BAS3
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC CALCP BIN2
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: deg
-Comment Format: mean closure phase
-Description: mean closure phase
-
-Parameter Name: QC CALV2 BIN3 BAS1
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC CALV2 BIN3 BAS2
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC CALV2 BIN3 BAS3
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC CALCP BIN3
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: deg
-Comment Format: mean closure phase
-Description: mean closure phase
-
-Parameter Name: QC TRFV2 CEN BAS1
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC TRFV2 CEN BAS2
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC TRFV2 CEN BAS3
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC TRFCP CEN
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: deg
-Comment Format: mean closure phase
-Description: mean closure phase
-
-Parameter Name: QC TRFV2 BIN1 BAS1
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC TRFV2 BIN1 BAS2
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC TRFV2 BIN1 BAS3
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC TRFCP BIN1
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: deg
-Comment Format: mean closure phase
-Description: mean closure phase
-
-Parameter Name: QC TRFV2 BIN2 BAS1
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC TRFV2 BIN2 BAS2
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC TRFV2 BIN2 BAS3
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC TRFCP BIN2
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: deg
-Comment Format: mean closure phase
-Description: mean closure phase
-
-Parameter Name: QC TRFV2 BIN3 BAS1
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC TRFV2 BIN3 BAS2
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC TRFV2 BIN3 BAS3
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean squared visibility
-Description: mean squared visibility
-
-Parameter Name: QC TRFCP BIN3
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: deg
-Comment Format: mean closure phase
-Description: mean closure phase
-
-
-Parameter Name: QC UNCALSNR BAS1
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean signal to noise ratio
-Description: mean signal to noise ratio
-
-Parameter Name: QC UNCALSNR BAS2
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean signal to noise ratio
-Description: mean signal to noise ratio
-
-Parameter Name: QC UNCALSNR BAS3
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean signal to noise ratio
-Description: mean signal to noise ratio
-
-Parameter Name: QC CALSNR BAS1
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean signal to noise ratio
-Description: mean signal to noise ratio
-
-Parameter Name: QC CALSNR BAS2
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean signal to noise ratio
-Description: mean signal to noise ratio
-
-Parameter Name: QC CALSNR BAS3
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean signal to noise ratio
-Description: mean signal to noise ratio
-
-Parameter Name: QC TRFSNR BAS1
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean signal to noise ratio
-Description: mean signal to noise ratio
-
-Parameter Name: QC TRFSNR BAS2
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean signal to noise ratio
-Description: mean signal to noise ratio
-
-Parameter Name: QC TRFSNR BAS3
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean signal to noise ratio
-Description: mean signal to noise ratio
-
-Parameter Name: QC ZEROFRAMES
-Class: config
-Context: Instrument
-Type: int
-Value Format: %d
-Unit: Number
-Comment Format: Number of zero-frames
-Description: Number of zero-frames
-
-
-Parameter Name: QC UNCALV2 CEN BAS1 STDEV
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean standard deviation squared visibility
-Description: mean standard deviation squared visibility
-
-Parameter Name: QC UNCALV2 CEN BAS2 STDEV
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean standard deviation squared visibility
-Description: mean standard deviation squared visibility
-
-Parameter Name: QC UNCALV2 CEN BAS3 STDEV
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean standard deviation squared visibility
-Description: mean standard deviation squared visibility
-
-Parameter Name: QC UNCALCP CEN STDEV
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: deg
-Comment Format: mean standard deviation closure phase
-Description: mean standard deviation closure phase
-
-Parameter Name: QC CALV2 CEN BAS1 STDEV
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean standard deviation squared visibility
-Description: mean standard deviation squared visibility
-
-Parameter Name: QC CALV2 CEN BAS2 STDEV
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean standard deviation squared visibility
-Description: mean standard deviation squared visibility
-
-Parameter Name: QC CALV2 CEN BAS3 STDEV
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean standard deviation squared visibility
-Description: mean standard deviation squared visibility
-
-Parameter Name: QC CALCP CEN STDEV
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: deg
-Comment Format: mean standard deviation closure phase
-Description: mean standard deviation closure phase
-
-Parameter Name: QC TRFV2 CEN BAS1 STDEV
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean standard deviation squared visibility
-Description: mean standard deviation squared visibility
-
-Parameter Name: QC TRFV2 CEN BAS2 STDEV
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean standard deviation squared visibility
-Description: mean standard deviation squared visibility
-
-Parameter Name: QC TRFV2 CEN BAS3 STDEV
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean standard deviation squared visibility
-Description: mean standard deviation squared visibility
-
-Parameter Name: QC TRFCP CEN STDEV
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: deg
-Comment Format: mean standard deviation closure phase
-Description: mean standard deviation closure phase
-
-Parameter Name: QC SPECTRUM CEN TEL1
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean spectrum within the central bin of telescope 1
-Description: mean spectrum within the central bin of telescope 1
-
-Parameter Name: QC SPECTRUM CEN TEL2
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean spectrum within the central bin of telescope 2
-Description: mean spectrum within the central bin of telescope 2
-
-Parameter Name: QC SPECTRUM CEN TEL3
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: unitless
-Comment Format: mean spectrum within the central bin of telescope 3
-Description: mean spectrum within the central bin of telescope 3
-
-Parameter Name: QC P2VM LAMBDA MIN
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: micron
-Comment Format: wavelength inclusive used
-Description: minimal wavelength used
-
-Parameter Name: QC P2VM LAMBDA MAX
-Class: config
-Context: Instrument
-Type: float
-Value Format: %.6f
-Unit: micron
-Comment Format: wavelength inclusive used
-Description: maximal wavelength used
diff --git a/calib/dic/ESO-VLT-DIC.AMBER_CFG b/calib/dic/ESO-VLT-DIC.AMBER_CFG
deleted file mode 100644
index e180c9e..0000000
--- a/calib/dic/ESO-VLT-DIC.AMBER_CFG
+++ /dev/null
@@ -1,45 +0,0 @@
-#******************************************************************************
-# E.S.O. - VLT project
-#
-# "@(#) $Id: ESO-VLT-DIC.AMBER_CFG,v 1.1.1.1 2008-03-04 14:11:07 agabasch Exp $"
-#
-# AMBER_CFG dictionary
-#
-# who when what
-# -------- -------- ----------------------------------------------
-# alongino 19/01/00 created
-#
-
-#******************************************************************************
-#
-# This dictionary contains the AMBER instrument specific configuration
-# keywords used by ICS at startup to understand and interprete the
-# contents of the configuration file
-# $INS_ROOT/SYSTEM/COMMON/CONFIGFILES/INS.cfg (source in xxmcfg/config).
-# The configuration keywords common to all instruments are defined in
-# the dictionary $INTROOT/config/ESO-VLT-DIC.ICB_CFG
-# The two dictionaries (ESO-VLT-DIC.ICB_CFG and ESO-VLT-DIC.VNCI_CFG)
-# are listed in the file $INS_ROOT/SYSTEM/COMMON/CONFIGFILES/INS.dic,
-# which is used to declare which dictionaries have to be used to
-# understand the contents of INS.cfg.
-#
-#******************************************************************************
-
-Dictionary Name: ESO-VLT-DIC.AMBER_CFG
-Scope: AMBER
-Source: ESO VLT
-Version Control: $Id: ESO-VLT-DIC.AMBER_CFG,v 1.1.1.1 2008-03-04 14:11:07 agabasch Exp $
-Revision: $Revision: 1.1.1.1 $
-Date: 2001-02-16
-Status: Development
-Description: AMBER specific
-
-
-Parameter Name: DET NTEL
-Class: qc-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: # of telescopes
-Description: faked by tlicha: # of telescopes
diff --git a/calib/dic/ESO-VLT-DIC.AMBER_DCS b/calib/dic/ESO-VLT-DIC.AMBER_DCS
deleted file mode 100644
index b4993e7..0000000
--- a/calib/dic/ESO-VLT-DIC.AMBER_DCS
+++ /dev/null
@@ -1,438 +0,0 @@
-Dictionary Name: ESO-VLT-DIC.AMBER_DCS
-Scope: LISA/Vinci InfraRed DCS
-Source: ESO VLT
-Version Control: $Id: ESO-VLT-DIC.AMBER_DCS,v 1.1.1.1 2008-03-04 14:11:07 agabasch Exp $
-Revision: 1.0
-Date: 2001-02-16
-Status: Development
-Description: -------------------
-# Recommended max. comment length ---------|
-# V
-# -----------------------------------------+------------------
-Parameter Name: DETi NC FRAW
-Class: setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: 0/1 enable raw pixel gen.
-Description: LISA Number Cruncher Plug-In param.
- Order readmode to transmit raw pixel data to RTD/DTT
-# -----------------------------------------+------------------
-Parameter Name: DETi NC FLUX
-Class: setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: 0/1 enable flux data gen.
-Description: LISA Number Cruncher Plug-In param.
- Order readmode to transmit 6 x nScan flux vector data to RTD/DTT
-# -----------------------------------------+------------------
-Parameter Name: DETi NC FDLO
-Class: setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: 0/1 enable delay data gen.
-Description: LISA Number Cruncher Plug-In param.
- Order readmode to transmit delay-line-offsets calculated to RTD/DTT
-# -----------------------------------------+------------------
-Parameter Name: DETi NC BATCH
-Class: header|setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: tags data.
-Description: LISA Number Cruncher Plug-In param.
- info transmitted with DLO to LCU, autoincrement every nScan
-# -----------------------------------------+------------------
-Parameter Name: DETi NC NSCAN
-Class: header|setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: # scans in batch.
-Description: LISA Number Cruncher Plug-In param.
- counter for acquire loop & batch count, sent with dlo data
-# -----------------------------------------+------------------
-Parameter Name: DETi NC ADC
-Class: setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: 0..3 select ADC read.
-Description: LISA Number Cruncher Plug-In param.
- only one of four ADCs is wired. Tells plugin wich. Don't change.
-# -----------------------------------------+------------------
-Parameter Name: DETi NC DOFLAT
-Class: header|setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: 0..2 enable flatfield.
-Description: LISA Number Cruncher Plug-In param.
- 0 none, 1 beam-flat, 2 pixel-wise-flat.
-# -----------------------------------------+------------------
-Parameter Name: DETi NC DOBACK
-Class: header|setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: 0/1 enable background.
-Description: LISA Number Cruncher Plug-In param.
- beam-wise background subtraction (means over pixels in beam)
-# -----------------------------------------+------------------
-Parameter Name: DETi NC DOSORT
-Class: header|setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: 0/1 enab overlap pix sort.
-Description: LISA Number Cruncher Plug-In param.
- if beams overlap on clock-rows, use pixels->beams sortlist
-# -----------------------------------------+------------------
-Parameter Name: DETi QL ST
-Class: header|setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Start/stop properly of quick look
-Description: LISA Quicklook algo. param.
- Valid: 0/1
-# -----------------------------------------+------------------
-Parameter Name: DETi QL OPDST
-Class: header|setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Start/stop sending of offsets to DL
-Description: LISA Quicklook algo. param.
- Valid: 0/1
-# -----------------------------------------+------------------
-Parameter Name: DETi QL OFFSET
-Class: header|setup
-Context: Detector
-Type: string
-Value Format: %s
-Unit:
-Comment Format: OPD Offset calculated
-Description: LISA Quicklook algo. result
- Defined as string for test purpose
- Defined as string for test purpose
-# -----------------------------------------+------------------
-Parameter Name: DETi QL FRINGE
-Class: header|setup
-Context: Detector
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Fringes nbr found
-Description: LISA Quicklook algo. result
- Defined as string for test purpose
-# -----------------------------------------+------------------
-Parameter Name: DETi QL SNRPA
-Class: header|setup
-Context: Detector
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Signal Noise ratio Photometric 1
-Description: LISA Quicklook algo. result
- Defined as string for test purpose
-# -----------------------------------------+------------------
-Parameter Name: DETi QL SNRPB
-Class: header|setup
-Context: Detector
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Signal Noise ratio Photometric 2
-Description: LISA Quicklook algo. result
- Defined as string for test purpose
-# -----------------------------------------+------------------
-Parameter Name: DETi QL BEAMI1
-Class: setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: 0..3 which beam is I1.
-Description: LISA Quicklook algo. param.
- Beams are counted l->r, t->d 0..3. Identifies which corresponds
- to the intensity fiber from telescope 1
-# -----------------------------------------+------------------
-Parameter Name: DETi QL BEAMI2
-Class: setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: 0..3 which beam is I2.
-Description: LISA Quicklook algo. param.
- Beams are counted l->r, t->d 0..3. Identifies which corresponds
- to the intensity fiber from telescope 2
-# -----------------------------------------+------------------
-Parameter Name: DETi QL BEAMPA
-Class: setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: 0..3 which beam is P1.
-Description: LISA Quicklook algo. param.
- Beams are counted l->r, t->d 0..3. Identifies which corresponds
- to the power ref fiber from telescope 1
-# -----------------------------------------+------------------
-Parameter Name: DETi QL BEAMPB
-Class: setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: 0..3 which beam is P2.
-Description: LISA Quicklook algo. param.
- Beams are counted l->r, t->d 0..3. Identifies which corresponds
- to the power ref fiber from telescope 2
-# -----------------------------------------+------------------
-Parameter Name: DETi QL OBSMODE
-Class: setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: 0:undefined 1:off source 2:beam A 3:beam B 4:on sourc
-Description: LISA Quicklook algo. param.
-# -----------------------------------------+------------------
-Parameter Name: DETi QL INSMODE
-Class: setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: 0:undefined 1:autotest 2:autocollimation 3:interferometer
-Description: LISA Quicklook algo. param.
-# -----------------------------------------+------------------
-Parameter Name: DETi QL DBLCHK
-Class: setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Fringe double check
-Description: LISA Quicklook algo. param.
- Valid: 0/1
-# -----------------------------------------+------------------
-Parameter Name: DETi QL GAINHW
-Class: setup
-Context: Detector
-Type: double
-Value Format: %f
-Unit:
-Comment Format: gain half width (no unit ?)
-Description: LISA Quicklook algo. param.
-# -----------------------------------------+------------------
-Parameter Name: DETi QL FRINGESPD
-Class: setup
-Context: Detector
-Type: double
-Value Format: %f
-Unit:
-Comment Format: fringe speed (um/sec)
-Description: LISA Quicklook algo. param.
-# -----------------------------------------+------------------
-Parameter Name: DETi QL FRAMERATE
-Class: setup
-Context: Detector
-Type: double
-Value Format: %f
-Unit:
-Comment Format: frame rate (Hz)
-Description: LISA Quicklook algo. param.
-# -----------------------------------------+------------------
-Parameter Name: DETi QL MINWAVEK
-Class: setup
-Context: Detector
-Type: double
-Value Format: %f
-Unit:
-Comment Format: min wave length K (um)
-Description: LISA Quicklook algo. param.
-# -----------------------------------------+------------------
-Parameter Name: DETi QL MAXWAVEK
-Class: setup
-Context: Detector
-Type: double
-Value Format: %f
-Unit:
-Comment Format: max wave length K (um)
-Description: LISA Quicklook algo. param.
-# -----------------------------------------+------------------
-Parameter Name: DETi QL MINWAVEOFF
-Class: setup
-Context: Detector
-Type: double
-Value Format: %f
-Unit:
-Comment Format: min wave length Offsource (um)
-Description: LISA Quicklook algo. param.
-# -----------------------------------------+------------------
-Parameter Name: DETi QL MAXWAVEOFF
-Class: setup
-Context: Detector
-Type: double
-Value Format: %f
-Unit:
-Comment Format: max wave length Off source (um)
-Description: LISA Quicklook algo. param.
-# -----------------------------------------+------------------
-Parameter Name: DETi QL SCANBEG
-Class: setup
-Context: Detector
-Type: double
-Value Format: %f
-Unit:
-Comment Format: time till first frame (sec).
-Description: LISA Quicklook algo. param.
- time between start of scan mirror and start of frame reads
-# -----------------------------------------+------------------
-Parameter Name: DETi QL SCANEND
-Class: setup
-Context: Detector
-Type: double
-Value Format: %f
-Unit:
-Comment Format: time till last frame (sec).
-Description: LISA Quicklook algo. param.
- time between start of scan mirror and end of frame reads
- defines time-length of fringe pattern
-# -----------------------------------------+------------------
-Parameter Name: DETi QL SPEED
-Class: setup
-Context: Detector
-Type: double
-Value Format: %f
-Unit:
-Comment Format: time scale of fringe (um/sec).
-Description: LISA Quicklook algo. param.
- multiplies fringe time into delay line offset
-# -----------------------------------------+------------------
-Parameter Name: DETi QL LEVEL
-Class: setup
-Context: Detector
-Type: double
-Value Format: %f
-Unit:
-Comment Format: fringe detect level (no unit ?).
-Description: LISA Quicklook algo. param.
- [stdv] level for fringe center detection
-# -----------------------------------------+------------------
-Parameter Name: DETi RM NFRAM
-Class: setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: frames per scan.
-Description: Read mode param.
-# -----------------------------------------+------------------
-Parameter Name: DETi RM NPIX
-Class: setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: pixels per image.
-Description: Read mode param.
-# -----------------------------------------+------------------
-Parameter Name: DETi RM NDMA
-Class: setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: one transfer per scan.
-Description: Read mode param.
-# -----------------------------------------+------------------
-Parameter Name: DET NTEL
-Class: setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: normal RRR not RnR.
-Description: Faked by tlicha: Number of telescopes
-# -----------------------------------------+------------------
-Parameter Name: DETi RM MODE
-Class: setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: normal RRR not RnR.
-Description: Read mode param.
-# -----------------------------------------+------------------
-Parameter Name: DETi WINi STRX
-Class: setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Lower left pixel in X
-Description: First window pixel in X direction
- 4 windows readout mode
-# -----------------------------------------+------------------
-Parameter Name: DETi WINi STRY
-Class: setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Lower left pixel in Y
-Description: First window pixel in Y direction
- 4 windows readout mode
-
-# -----------------------------------------+------------------
-Parameter Name: DETi WINi NX
-Class: setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: # of pixels along X
-Description: The total number of columns in the window.
- 4 windows readout mode
-# -----------------------------------------+------------------
-Parameter Name: DETi WINi NY
-Class: setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: # of pixels along Y
-Description: The total number of rows in the window.
- 4 windows readout mode
-# -----------------------------------------+------------------
-Parameter Name: DETi DACQ MODE
-Class: setup
-Context: Detector
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: # Instrument piezo scan mode
-Description: 0 = No wave (No ACQ)
- 1 = Full Wave ( two Acq ramp per Period)
- 2 = Half wave (one ACQ on Rising slope)
- 3 = Half wave (one ACQ on Falling slope)
- Used for 4 windows readout mode
-
-
diff --git a/calib/dic/ESO-VLT-DIC.AMBER_ICS b/calib/dic/ESO-VLT-DIC.AMBER_ICS
deleted file mode 100644
index f8a9f0a..0000000
--- a/calib/dic/ESO-VLT-DIC.AMBER_ICS
+++ /dev/null
@@ -1,1705 +0,0 @@
-#******************************************************************************
-# E.S.O. - VLT project
-#
-# "@(#) $Id: ESO-VLT-DIC.AMBER_ICS,v 1.1.1.1 2008-03-04 14:11:07 agabasch Exp $"
-#
-# who when what
-# -------- ---------- ----------------------------------------------
-# alongino 29/01/2001 changes as from DICB comments
-# ptilloles 03/07/2000 change keyword parameters type from %10s to T
-# for : MIRR1.OPD and MIRR1.START
-# jpDupin 15/0620/00 change keyword parameters type from %d to %10s
-# for : MIRR1.OPD and MIRR1.START
-# alongino 16/05/2000 added keys for INS.SHUTi and INS.SENSORi (JP Dupin)
-# jpdupin 31/03/2000 other changes related to piezo
-# alongino 13/03/2000 added INS.ROTi.POS INS.MIRRi.START (JP Dupin)
-# alongino 04/02/1999 created
-#
-
-#************************************************************************
-# NAME
-# ESO-VLT-DIC.VNCI_ICS - Data Interface Dictionary for VINCI ICS part
-#
-# DESCRIPTION
-# The present file contains the description of all keywords used
-# by ICS only.
-#
-# SEE ALSO
-# [1] VLT INS sw - Specification - VLT-SPE-ESO-17212-0001
-# [2] VLT INS common sw - slx User Manual - VLT-MAN-ESO-17240-0726
-# [3] Data Interface Control Document - GEN-SPE-ESO-19400-794, 2.0
-#
-# BUGS KNOWN
-#
-#------------------------------------------------------------------------
-Dictionary Name: ESO-VLT-DIC.VNCI_ICS
-Scope: INSTRUMENT
-Source: ESO VLT
-Version Control: $Id: ESO-VLT-DIC.AMBER_ICS,v 1.1.1.1 2008-03-04 14:11:07 agabasch Exp $
-Revision: $Revision: 1.1.1.1 $
-Date: 2001-02-16
-Status: Development
-Description: Based on GEN-SPE-ESO-19400-794, 2.0
-
-Parameter Name: INS ID
-Class: conf-log|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: INS DID
-Class: header
-Context: Instrument
-Type: string
-Value Format: %30s
-Unit:
-Comment Format: Data dictionary for INS.
-Description: Name and version of ESO DID to which INS keywords
- comply to.
-
-Parameter Name: INS 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: INS 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: INS 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.
- HW_SIM: Hardware is simulated on LCU.
-
-Parameter Name: INS MODE
-Class: header|setup
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Instrument mode used.
-Description: Acronym of instrument mode used.
-
-Parameter Name: INS PATH
-Class: header
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Optical path used.
-Description: The optical path within the instrument used for
- this exposure.
-
-#
-# Major Systems
-#
-Parameter Name: INS COMU
-Class: private
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Combiner Unit system.
-Description: Used by the control sw to address all devices in
- this system
-
-Parameter Name: INS ALIU
-Class: private
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Alignment Unit system.
-Description: Used by the control sw to address all devices in
- this system
-
-Parameter Name: INS ARTU
-Class: private
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Artificial Star Unit system.
-Description: Used by the control sw to address all devices in
- this system
-
-Parameter Name: INS LISA
-Class: private
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Infrared camera system.
-Description: Used by the control sw to address all devices in
- this system
-
-#
-# FILT1 LISA filter wheel
-#
-Parameter Name: INS FILTi
-Class: private
-Context: Instrument
-Type: string
-Value Format: %5s
-Unit:
-Comment Format: Filter wheel device.
-Description: Used in connection with ENABLE/DISABLE commands
-
-Parameter Name: INS FILTi IDi
-Class: conf-log|header|setup
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Filter unique id.
-Description: ESO identification number for the filter.
- Format: #n where n is a unique number for the
- observatory.
-
-Parameter Name: INS FILTi NAMEi
-Class: conf-log|header|setup
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Filter common name.
-Description: ESO name for the filter.
- Format: SYSTEM/NAME where the filter system is
- given when applicable, eg BESS for Besselian.
-
-Parameter Name: INS FILTi NO
-Class: header|setup
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Filter wheel position index.
-Description: Index of the selected position of the filter wheel
-
-Parameter Name: INS FILTi ENC
-Class: setup
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Filter wheel absolute encoder position.
-Description: Filter wheel absolute encoder position.
-
-Parameter Name: INS FILTi ENCREL
-Class: setup
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Filter wheel relative encoder position.
-Description: Filter wheel relative encoder position.
-
-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 UNFORSEEN
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Unforeseen event.
-Description: Unforeseen event.
-
-Parameter Name: INS FILTi SWSIM
-Class: header|ops-log
-Context: Instrument
-Type: logical
-Value Format: %c
-Unit:
-Comment Format: If T, function is software simulated.
-Description: Function software simulation.
-
-Parameter Name: INS FILTi TURN
-Class: setup
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Turn 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: Enc/ms
-Comment Format: Turning speed [Enc/ms].
-Description: Speed (default units) the wheel is turned (see TURN).
-
-#
-# FOCU1 Output Optics Off-axis parabola focus
-# FOCU2 Injection B On-axis Parabola focus
-# FOCU3 Injection A On-axis Parabola focus
-# FOCU4 Technical CCD focus
-#
-Parameter Name: INS FOCUi
-Class: private
-Context: Instrument
-Type: string
-Value Format: %5s
-Unit:
-Comment Format: Focus device.
-Description: Used in connection with ENABLE/DISABLE commands
-
-Parameter Name: INS FOCUi NO
-Class: header|setup
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Index of predefined position.
-Description: Index of predefined position
-
-Parameter Name: INS FOCUi NAME
-Class: header|setup
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Name of predefined position.
-Description: Name of predefined position
-
-Parameter Name: INS FOCUi POS
-Class: header|setup
-Context: Instrument
-Type: double
-Value Format: %.3f
-Unit: micron
-Comment Format: Position [micron].
-Description: Position of the element described.
-
-Parameter Name: INS FOCUi ENC
-Class: setup
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Component absolute encoder position.
-Description: Component absolute encoder position.
-
-Parameter Name: INS FOCUi ENCREL
-Class: setup
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Component relative encoder position.
-Description: Component relative encoder position.
-
-Parameter Name: INS FOCUi INIT
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Hardware initialisation.
-Description: Hardware initialisation.
-
-Parameter Name: INS FOCUi MOVE
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Motion execution.
-Description: Motion execution.
-
-Parameter Name: INS FOCUi STOP
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Motion stop.
-Description: Motion stop.
-
-Parameter Name: INS FOCUi UNFORSEEN
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Unforeseen event.
-Description: Unforeseen event.
-
-Parameter Name: INS FOCUi SWSIM
-Class: header|ops-log
-Context: Instrument
-Type: logical
-Value Format: %c
-Unit:
-Comment Format: If T, function is software simulated.
-Description: Function software simulation.
-
-Parameter Name: INS FOCUi LIMIT
-Class: setup
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Move to the limit.
-Description: Move to the lower or upper limit.
-
-Parameter Name: INS FOCUi SPEED
-Class: setup
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit: Enc/ms
-Comment Format: Moving speed [Enc/ms].
-Description: Speed (default units) the motor is moved (see LIMIT).
-
-#
-# TIP1 Output Optics Off-axis parabola tip
-# TIP2 Injection B On-axis Parabola tip
-# TIP3 Injection A On-axis Parabola tip
-#
-Parameter Name: INS TIPi
-Class: private
-Context: Instrument
-Type: string
-Value Format: %5s
-Unit:
-Comment Format: Tip device.
-Description: Used in connection with ENABLE/DISABLE commands
-
-Parameter Name: INS TIPi POS
-Class: header|setup
-Context: Instrument
-Type: double
-Value Format: %.3f
-Unit: mum
-Comment Format: Position [mum].
-Description: Position of the element described.
-
-Parameter Name: INS TIPi ENC
-Class: setup
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Component absolute encoder position.
-Description: Component absolute encoder position.
-
-Parameter Name: INS TIPi ENCREL
-Class: setup
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Component relative encoder position.
-Description: Component relative encoder position.
-
-Parameter Name: INS TIPi INIT
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Hardware initialisation.
-Description: Hardware initialisation.
-
-Parameter Name: INS TIPi MOVE
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Motion execution.
-Description: Motion execution.
-
-Parameter Name: INS TIPi STOP
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Motion stop.
-Description: Motion stop.
-
-Parameter Name: INS TIPi UNFORSEEN
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Unforeseen event.
-Description: Unforeseen event.
-
-Parameter Name: INS TIPi SWSIM
-Class: header|ops-log
-Context: Instrument
-Type: logical
-Value Format: %c
-Unit:
-Comment Format: If T, function is software simulated.
-Description: Function software simulation.
-
-Parameter Name: INS TIPi LIMIT
-Class: setup
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Move to the limit.
-Description: Move to the lower or upper limit.
-
-Parameter Name: INS TIPi SPEED
-Class: setup
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit: Enc/ms
-Comment Format: Moving speed [Enc/ms].
-Description: Speed (default units) the motor is moved (see LIMIT).
-
-#
-# TILT1 Output Optics Off-axis parabola tilt
-# TILT2 Injection B On-axis Parabola tilt
-# TILT3 Injection A On-axis Parabola tilt
-#
-Parameter Name: INS TILTi
-Class: private
-Context: Instrument
-Type: string
-Value Format: %5s
-Unit:
-Comment Format: Tilt device.
-Description: Used in connection with ENABLE/DISABLE commands
-
-Parameter Name: INS TILTi POS
-Class: header|setup
-Context: Instrument
-Type: double
-Value Format: %.3f
-Unit: mum
-Comment Format: Position [mum].
-Description: Position of the element described.
-
-Parameter Name: INS TILTi ENC
-Class: setup
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Component absolute encoder position.
-Description: Component absolute encoder position.
-
-Parameter Name: INS TILTi ENCREL
-Class: setup
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Component relative encoder position.
-Description: Component relative encoder position.
-
-Parameter Name: INS TILTi INIT
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Hardware initialisation.
-Description: Hardware initialisation.
-
-Parameter Name: INS TILTi MOVE
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Motion execution.
-Description: Motion execution.
-
-Parameter Name: INS TILTi STOP
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Motion stop.
-Description: Motion stop.
-
-Parameter Name: INS TILTi UNFORSEEN
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Unforeseen event.
-Description: Unforeseen event.
-
-Parameter Name: INS TILTi SWSIM
-Class: header|ops-log
-Context: Instrument
-Type: logical
-Value Format: %c
-Unit:
-Comment Format: If T, function is software simulated.
-Description: Function software simulation.
-
-Parameter Name: INS TILTi LIMIT
-Class: setup
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Move to the limit.
-Description: Move to the lower or upper limit.
-
-Parameter Name: INS TILTi SPEED
-Class: setup
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit: Enc/ms
-Comment Format: Moving speed [Enc/ms].
-Description: Speed (default units) the motor is moved (see LIMIT).
-
-#
-# ROT1 Output Optics Off-axis parabola rotation
-# ROT2 Polarization A
-# ROT3 Polarization B
-#
-Parameter Name: INS ROTi
-Class: private
-Context: Instrument
-Type: string
-Value Format: %5s
-Unit:
-Comment Format: Rotation device.
-Description: Used in connection with ENABLE/DISABLE commands
-
-Parameter Name: INS ROTi POS
-Class: header|setup
-Context: Instrument
-Type: double
-Value Format: %.4f
-Unit: deg
-Comment Format: Position angle (N=0 E=90) [deg].
-Description: Position angle of the element described.
-
-Parameter Name: INS ROTi POSANG
-Class: header|setup
-Context: Instrument
-Type: double
-Value Format: %.4f
-Unit: deg
-Comment Format: Position angle (N=0 E=90) [deg].
-Description: Position angle of the element described.
-
-Parameter Name: INS ROTi ENC
-Class: setup
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Component absolute encoder position.
-Description: Component absolute encoder position.
-
-Parameter Name: INS ROTi ENCREL
-Class: setup
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Component relative encoder position.
-Description: Component relative encoder position.
-
-Parameter Name: INS ROTi INIT
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Hardware initialisation.
-Description: Hardware initialisation.
-
-Parameter Name: INS ROTi MOVE
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Motion execution.
-Description: Motion execution.
-
-Parameter Name: INS ROTi STOP
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Motion stop.
-Description: Motion stop.
-
-Parameter Name: INS ROTi UNFORSEEN
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Unforeseen event.
-Description: Unforeseen event.
-
-Parameter Name: INS ROTi SWSIM
-Class: header|ops-log
-Context: Instrument
-Type: logical
-Value Format: %c
-Unit:
-Comment Format: If T, function is software simulated.
-Description: Function software simulation.
-
-Parameter Name: INS ROTi TURN
-Class: setup
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Turn right/left.
-Description: Turn device to the right or to the left.
-
-Parameter Name: INS ROTi SPEED
-Class: setup
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit: Enc/ms
-Comment Format: Moving speed [Enc/ms].
-Description: Speed (default units) the motor is moved (see LIMIT).
-
-#
-# MIRR1 Injection A Fast Scan Mirror
-# MIRR2 Technical CCD feed mirrors cart
-#
-Parameter Name: INS MIRRi
-Class: private
-Context: Instrument
-Type: string
-Value Format: %5s
-Unit:
-Comment Format: Mirror device.
-Description: Used in connection with ENABLE/DISABLE commands
-
-Parameter Name: INS MIRRi IDi
-Class: conf-log|header|setup
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Mirror unique ID.
-Description: Name and hardware identification of mirror.
- Format: NAME/SER-NO
- This keyword is included only when mirror is folded in.
-
-Parameter Name: INS MIRRi NO
-Class: header|setup
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Mirror slide position.
-Description: Index of the position of the mirror slide
-
-Parameter Name: INS MIRRi NAMEi
-Class: conf-log|header|setup
-Context: Instrument
-Type: string
-Value Format: %30s
-Unit:
-Comment Format: Mirror common name.
-Description: ESO name for mirror unit.
-
-Parameter Name: INS MIRRi RANGE
-Class: header|setup
-Context: Instrument
-Type: double
-Value Format: %.3f
-Unit: mum
-Comment Format: Data Acq. Total OPD Range [mum].
-Description: Fast piezo Data Acquisition Total OPD Range
-
-Parameter Name: INS MIRRi SPEED
-Class: header|setup
-Context: Instrument
-Type: double
-Value Format: %.3f
-Unit: mum/s
-Comment Format: Data Acq. Fringe Velocity [mum/s].
-Description: Fast piezo Data Acquisition Fringe Velocity
-
-Parameter Name: INS MIRRi NSCAN
-Class: header|setup
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Number of repeated scans
-Description: How many times the mirror has to be moved
- forth an back
-
-Parameter Name: INS MIRRi UTCi
-Class: header
-Context: Instrument
-Type: double
-Value Format: %.8f
-Unit: s
-Comment Format: UTC at batch start/end (%DAYTIM) [s].
-Description: Fast piezo batch start (UTC1) and end (UTC2) time
-
-Parameter Name: INS MIRRi STIF
-Class: setup
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit: %
-Comment Format: Piezo stiffness factor [%].
-Description: Linear form factor from 0=sinus to 100=triangle
-
-Parameter Name: INS MIRRi VOLT
-Class: setup
-Context: Instrument
-Type: double
-Value Format: %.2f
-Unit: V
-Comment Format: Output voltage [V] peak to peak
-Description: Output voltage peak to peak
-
-Parameter Name: INS MIRRi VOFF
-Class: setup
-Context: Instrument
-Type: double
-Value Format: %.2f
-Unit: V
-Comment Format: Output voltage [V] offset
-Description: Output voltage offset
-
-Parameter Name: INS MIRRi FREQ
-Class: setup
-Context: Instrument
-Type: double
-Value Format: %.2f
-Unit: Hz
-Comment Format: Wave frequency [Hz]
-Description: Wave frequency
-
-Parameter Name: INS MIRRi MODE
-Class: setup
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Piezo scan mode
-Description: 0 = No wave (No ACQ)
- 1 = Full Wave ( two Acq ramp per Period)
- 2 = Half wave (one ACQ on Rising slope)
- 3 = Half wave (one ACQ on Falling slope)
-
-Parameter Name: INS MIRRi OPD
-Class: setup
-Context: Instrument
-Type: logical
-Value Format: %c
-Unit:
-Comment Format: If T, wait for OPD status
-Description: T: Next Scan wait for OPD status (Offset sent by LISA)
- F: No use of OPD, no wait status flag
-
-Parameter Name: INS MIRRi LAST
-Class: private
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Number of scans done
-Description: Number of scans done
-
-Parameter Name: INS MIRRi TIME
-Class: private
-Context: Instrument
-Type: double
-Value Format: %.3f
-Unit:
-Comment Format: ACQ Delay
-Description: ACQ Delay
-
-Parameter Name: INS MIRRi ENC
-Class: setup
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Mirror slide absolute encoder position.
-Description: Mirror slide absolute encoder position.
-
-Parameter Name: INS MIRRi ENCREL
-Class: setup
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Mirror slide relative encoder position.
-Description: Mirror slide relative encoder position.
-
-Parameter Name: INS MIRRi INIT
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Hardware initialisation.
-Description: Hardware initialisation.
-
-Parameter Name: INS MIRRi MOVE
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Motion execution.
-Description: Motion execution.
-
-Parameter Name: INS MIRRi START
-Class: ops-log|setup
-Context: Instrument
-Type: logical
-Value Format: %c
-Unit:
-Comment Format: T: Start, F: Stop of batch.
-Description: Start/stop properly of batch.
- Valid: T/F
-
-Parameter Name: INS MIRRi STOP
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Motion stop.
-Description: Motion stop. Stop ina3 immediately safe
-
-Parameter Name: INS MIRRi UNFORSEEN
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Unforeseen event.
-Description: Unforeseen event.
-
-Parameter Name: INS MIRRi SWSIM
-Class: header|ops-log
-Context: Instrument
-Type: logical
-Value Format: %c
-Unit:
-Comment Format: If T, function is software simulated.
-Description: Function software simulation.
-
-Parameter Name: INS MIRRi LIMIT
-Class: setup
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Move to the limit.
-Description: Move to the lower or upper limit.
-
-#
-# OPTI1 Injection B Cart
-# OPTI2 Technical CCD Additional Lens
-# OPTI3 Beam splitter cube ALI1
-# OPTI4 Beam splitter cube ALI5
-# OPTI5 Reference source beam splitter A
-# OPTI6 Reference source beam splitter B
-#
-
-Parameter Name: INS OPTIi
-Class: private
-Context: Instrument
-Type: string
-Value Format: %5s
-Unit:
-Comment Format: General Optical device.
-Description: Used in connection with ENABLE/DISABLE commands
-
-Parameter Name: INS OPTIi TYPEi
-Class: conf-log|header
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: General Optical device Element.
-Description: Kind of optical element described.
-
-Parameter Name: INS OPTIi IDi
-Class: conf-log|header|setup
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: General Optical device unique ID.
-Description: Identification of element mounted on OPTIi.
-
-Parameter Name: INS OPTIi NO
-Class: conf-log|header|setup
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Slot number.
-Description: When OPTIi can mount more than one element, like
- filters on a wheel, this keyword gives the number
- of the slot positioned in the optical axis.
-
-Parameter Name: INS OPTIi NAMEi
-Class: conf-log|header|setup
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: General Optical device common name.
-Description: ESO name of element mounted on OPTIi.
-
-Parameter Name: INS OPTIi POS
-Class: header|setup
-Context: Instrument
-Type: double
-Value Format: %.3f
-Unit: mum
-Comment Format: Position [mum].
-Description: Position of the element described.
-
-Parameter Name: INS OPTIi POSANG
-Class: header|setup
-Context: Instrument
-Type: double
-Value Format: %.3f
-Unit: deg
-Comment Format: Position angle (N=0 E=90) [deg].
-Description: Position angle of the element described.
-
-Parameter Name: INS OPTIi ENC
-Class: setup
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Component absolute encoder position.
-Description: Component absolute encoder position.
-
-Parameter Name: INS OPTIi ENCREL
-Class: setup
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit:
-Comment Format: Component relative encoder position.
-Description: Component relative encoder position.
-
-Parameter Name: INS OPTIi INIT
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Hardware initialisation.
-Description: Hardware initialisation.
-
-Parameter Name: INS OPTIi MOVE
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Motion execution.
-Description: Motion execution.
-
-Parameter Name: INS OPTIi STOP
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Motion stop.
-Description: Motion stop.
-
-Parameter Name: INS OPTIi UNFORSEEN
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Unforeseen event.
-Description: Unforeseen event.
-
-Parameter Name: INS OPTIi SWSIM
-Class: header|ops-log
-Context: Instrument
-Type: logical
-Value Format: %c
-Unit:
-Comment Format: If T, function is software simulated.
-Description: Function software simulation.
-
-Parameter Name: INS OPTIi LIMIT
-Class: setup
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Move to the limit.
-Description: Move to the lower or upper limit.
-
-Parameter Name: INS OPTIi SPEED
-Class: setup
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit: Env/ms
-Comment Format: Moving speed [Env/ms].
-Description: Speed (default units) the motor is moved (see LIMIT).
-
-#
-# LAMP1 Artificial Star Light Source
-#
-Parameter Name: INS LAMPi
-Class: setup
-Context: Instrument
-Type: string
-Value Format: %5s
-Unit:
-Comment Format: Lamp device name.
-Description: Used in connection with ENABLE/DISABLE commands
-
-Parameter Name: INS LAMPi ID
-Class: conf-log|header
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Lamp ID.
-Description: Hardware identification of lamp bulb unit.
-
-Parameter Name: INS LAMPi NAME
-Class: conf-log|header
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Lamp name.
-Description: ESO name for lamp unit. This name is unique for the
- observatory.
-
-Parameter Name: INS LAMPi ST
-Class: header|setup
-Context: Instrument
-Type: logical
-Value Format: %c
-Unit:
-Comment Format: Lamp activated.
-Description: Lamp activated.
-
-Parameter Name: INS LAMPi WAIT
-Class: setup
-Context: Instrument
-Type: integer
-Value Format: %d
-Unit: s
-Comment Format: Max Time [s] to wait for lamp warm-up.
-Description: ICS must check if the lamp is warm.
- If not, it must wait maximum n sec before replying.
- The reply is FAILURE if after this time the
- lamp is NOT warm yet
-
-Parameter Name: INS LAMPi INIT
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Hardware initialisation.
-Description: Hardware initialisation.
-
-Parameter Name: INS LAMPi START
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Lamp turned on.
-Description: Lamp turned on.
-
-Parameter Name: INS LAMPi TIME
-Class: ops-log
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit: s
-Comment Format: Time [s] lamp was on.
-Description: Time [s] lamp was on
-
-Parameter Name: INS LAMPi STOP
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Lamp turned off.
-Description: Lamp turned off.
-
-Parameter Name: INS LAMPi CHANGE
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Lamp changed.
-Description: Lamp has been physically replaced.
- Maintenance operation.
-
-Parameter Name: INS LAMPi UNFORSEEN
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Unforeseen event.
-Description: Unforeseen event.
-
-Parameter Name: INS LAMPi SWSIM
-Class: header|ops-log
-Context: Instrument
-Type: logical
-Value Format: %c
-Unit:
-Comment Format: If T, function is software simulated.
-Description: Function software simulation.
-
-# To address the device in commands such as SIM, ONLINE etc.
-Parameter Name: INS SHUTi
-Class: header|ops-log
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Shutter device
-Description: Shutter device
-
-# 3.2.1 Shutter config. FITS keywords
-#
-Parameter Name: INS SHUTi 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 SHUTi ID
-Class: conf-log|config|header
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Shutter ID.
-Description: Hardware identification of shutter unit.
-
-Parameter Name: INS SHUTi NAME
-Class: conf-log|config|header
-Context: Instrument
-Type: string
-Value Format: %15s
-Unit:
-Comment Format: Shutter name.
-Description: ESO name for shutter unit.
- This name is unique for the observatory.
-
-# 3.2.2 Shutter setup and header FITS keywords
-#
-Parameter Name: INS SHUTi ST
-Class: header|setup
-Context: Instrument
-Type: logical
-Value Format: %c
-Unit:
-Comment Format: Shutter open.
-Description: Shutter open.
-
-# 3.2.3 Shutter operational logs.
-#
-Parameter Name: INS SHUTi INIT
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Shutter initialized.
-Description: Shutter initialized.
-
-Parameter Name: INS SHUTi OPEN
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Shutter opened.
-Description: Shutter opened.
-
-Parameter Name: INS SHUTi TIME
-Class: ops-log
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit: s
-Comment Format: Time [s] shutter was open.
-Description: Time [s] shutter was open.
-
-Parameter Name: INS SHUTi CLOSE
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Shutter closed.
-Description: Shutter closed.
-
-
-# To address the device in commands such as SIM, ONLINE etc.
-Parameter Name: INS SENSORi
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Sensor device
-Description: Sensor device
-
-# 3.11.[12].1 Sensors common config. FITS keywords
-#
-Parameter Name: INS 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: INS SENSORi ID
-Class: 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: INS SENSORi NAME
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Sensor device common name.
-Description: ESO name for the sensor device.
-
-# 3.11.[12].3 Sensors operational logs.
-#
-Parameter Name: INS SENSORi INIT
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Hardware initialisation.
-Description: Hardware initialisation.
-
-#
-# TEMP1 ART3 temperature
-# TEMP2 MONA inside temperature
-# TEMP3 MONA outside temperature
-# TEMP4 VINCI air temperature
-# TEMP5 LEONARDO air temperature
-#
-Parameter Name: INS TEMPi
-Class: private
-Context: Instrument
-Type: string
-Value Format: %5s
-Unit:
-Comment Format: Temperature device.
-Description: Used in connection with ENABLE/DISABLE commands
-
-Parameter Name: INS TEMPi VAL
-Class: header|ops-log
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit: C
-Comment Format: Temperature current value [C].
-Description: Current Temperature of the instrument.
-
-Parameter Name: INS TEMPi REF
-Class: ops-log
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit: C
-Comment Format: Temperature reference value [C].
-Description: Reference Temperature of the instrument.
-
-Parameter Name: INS TEMPi START
-Class: header|ops-log
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit: C
-Comment Format: Temperature at start [C].
-Description: Temperature of the instrument measured at the start
- of the exposure.
-
-Parameter Name: INS TEMP SAMP
-Class: header|ops-log|setup
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit: s
-Comment Format: Temperature sampling time [s].
-Description: Sampling time for temperature.
- Special value: -1 = no temperature sampling
-
-Parameter Name: INS TEMPi ST
-Class: header|ops-log
-Context: Instrument
-Type: logical
-Value Format: %c
-Unit:
-Comment Format: Temperature sensor activated.
-Description: Temperature sensor activated.
-
-Parameter Name: INS TEMPi ID
-Class: conf-log|header|ops-log
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: Temperature sensor ID.
-Description: Temperature sensor ID.
-
-Parameter Name: INS TEMPi NAME
-Class: conf-log|header|ops-log
-Context: Instrument
-Type: string
-Value Format: %30s
-Unit:
-Comment Format: Temperature sensor name.
-Description: ESO name for temperature sensor.
-
-Parameter Name: INS TEMPi STOP
-Class: header|ops-log
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit: C
-Comment Format: Temperature at end [C].
-Description: Temperature of the instrument measured at the end
- of the exposure.
-
-Parameter Name: INS TEMPi MIN
-Class: header|ops-log
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit: C
-Comment Format: Minimum temperature [C].
-Description: Minimum Temperature during the exposure.
-
-Parameter Name: INS TEMPi MAX
-Class: header|ops-log
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit: C
-Comment Format: Maximum temperature [C].
-Description: Maximum Temperature during the exposure.
-
-Parameter Name: INS TEMPi MEAN
-Class: header|ops-log
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit: C
-Comment Format: Average temperature [C].
-Description: Mean Temperature during the exposure.
-
-Parameter Name: INS TEMPi SWSIM
-Class: header|ops-log
-Context: Instrument
-Type: logical
-Value Format: %c
-Unit:
-Comment Format: If T, function is software simulated.
-Description: Function software simulation.
-
-Parameter Name: INS TEMPi INIT
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Hardware initialisation.
-Description: Hardware initialisation.
-
-#
-# Fiber sensors TBD
-# SENS1 VINCI air humidity
-# SENS2 COMA3 position
-# SENS3 COMB3 position
-# SENS4 ALI9 position
-# SENS5 TCCD lens position
-#
-Parameter Name: INS SENSi
-Class: private
-Context: Instrument
-Type: string
-Value Format: %5s
-Unit:
-Comment Format: Auxiliary sensor device.
-Description: Used in connection with ENABLE/DISABLE commands
-
-Parameter Name: INS SENSi VAL
-Class: header|ops-log
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit: C
-Comment Format: Sensor current value [C].
-Description: Current auxiliary sensor value of the instrument.
-
-Parameter Name: INS SENSi STAT
-Class: header|ops-log
-Context: Instrument
-Type: string
-Value Format: %8s
-Unit:
-Comment Format: Digital Sensor current status.
-Description: Digital Sensor current status
-
-Parameter Name: INS SENSi REF
-Class: ops-log
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit: C
-Comment Format: sensor reference value [C].
-Description: Reference sensor value
-
-Parameter Name: INS SENSi START
-Class: header|ops-log
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit:
-Comment Format: sensor value at start.
-Description: sensor value of the instrument measured at the start
- of the exposure.
-
-Parameter Name: INS SENS SAMP
-Class: header|ops-log|setup
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit: s
-Comment Format: Sensors sampling time [s].
-Description: Sampling time for temperature.
- Special value: -1 = no sampling
-
-Parameter Name: INS SENSi ST
-Class: header|ops-log
-Context: Instrument
-Type: logical
-Value Format: %c
-Unit:
-Comment Format: sensor activated.
-Description: sensor activated.
-
-Parameter Name: INS SENSi ID
-Class: conf-log|header|ops-log
-Context: Instrument
-Type: string
-Value Format: %10s
-Unit:
-Comment Format: sensor ID.
-Description: sensor ID.
-
-Parameter Name: INS SENSi NAME
-Class: conf-log|header|ops-log
-Context: Instrument
-Type: string
-Value Format: %30s
-Unit:
-Comment Format: sensor common name.
-Description: ESO name for sensor.
-
-Parameter Name: INS SENSi STOP
-Class: header|ops-log
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit:
-Comment Format: sensor value at end.
-Description: sensor value of the instrument measured at the end
- of the exposure.
-
-Parameter Name: INS SENSi MIN
-Class: header|ops-log
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit:
-Comment Format: Minimum sensor value.
-Description: Minimum sensor value during the exposure.
-
-Parameter Name: INS SENSi MAX
-Class: header|ops-log
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit:
-Comment Format: Maximum sensor value.
-Description: Maximum sensor value during the exposure.
-
-Parameter Name: INS SENSi MEAN
-Class: header|ops-log
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit:
-Comment Format: Average sensor vlaue.
-Description: Mean Sensor value during the exposure.
-
-Parameter Name: INS SENSi INIT
-Class: ops-log
-Context: Instrument
-Type: string
-Value Format: %s
-Unit:
-Comment Format: Hardware initialisation.
-Description: Hardware initialisation.
-
-#
-# ___oOo___
-#
-
-Parameter Name: ISS PUPIL 1U
-Class: header|ops-log
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit:
-Comment Format: Pupil U parameter
-Description: Pupil U parameter
-
-Parameter Name: ISS PUPIL 1V
-Class: header|ops-log
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit:
-Comment Format: Pupil U parameter
-Description: Pupil U parameter
-
-Parameter Name: ISS PUPIL 1W
-Class: header|ops-log
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit:
-Comment Format: Pupil U parameter
-Description: Pupil U parameter
-
-Parameter Name: ISS PUPIL 2U
-Class: header|ops-log
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit:
-Comment Format: Pupil U parameter
-Description: Pupil U parameter
-
-Parameter Name: ISS PUPIL 2V
-Class: header|ops-log
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit:
-Comment Format: Pupil U parameter
-Description: Pupil U parameter
-
-Parameter Name: ISS PUPIL 2W
-Class: header|ops-log
-Context: Instrument
-Type: double
-Value Format: %.1f
-Unit:
-Comment Format: Pupil U parameter
-Description: Pupil U parameter
-
diff --git a/calib/dic/ESO-VLT-DIC.AMBER_OS b/calib/dic/ESO-VLT-DIC.AMBER_OS
deleted file mode 100644
index f483075..0000000
--- a/calib/dic/ESO-VLT-DIC.AMBER_OS
+++ /dev/null
@@ -1,37 +0,0 @@
-#******************************************************************************
-# E.S.O. - VLT project
-#
-# "@(#) $Id: ESO-VLT-DIC.AMBER_OS,v 1.1.1.1 2008-03-04 14:11:07 agabasch Exp $"
-#
-# who when what
-# -------- ---------- ----------------------------------------------
-# alongino 18/05/2000 created
-# alongino 22/08/2000 all previous entries moved in boss dict. (1.15)
-#
-
-#************************************************************************
-# NAME
-# ESO-VLT-DIC.VNCI_OS - Data Interface Dictionary for VINCI OS part
-#
-# DESCRIPTION
-# The present file contains the description of all keywords used
-# by VINCI OS only.
-#
-# SEE ALSO
-# [1] VLT INS sw - Specification - VLT-SPE-ESO-17212-0001
-# [2] VLT INS common sw - slx User Manual - VLT-MAN-ESO-17240-0726
-# [3] Data Interface Control Document - GEN-SPE-ESO-19400-794, 2.0
-#
-# BUGS KNOWN
-#
-#------------------------------------------------------------------------
-Dictionary Name: ESO-VLT-DIC.VNCI_OS
-Scope: INSTRUMENT
-Source: ESO VLT
-Version Control: $Id: ESO-VLT-DIC.AMBER_OS,v 1.1.1.1 2008-03-04 14:11:07 agabasch Exp $
-Revision: $Revision: 1.1.1.1 $
-Date: 2001-02-16
-Status: Development
-Description: VINCI Observation Software (OS) dictionary
-
-# --- oOo ---
diff --git a/calib/gasgano/config/AMBER.prefs b/calib/gasgano/config/AMBER.prefs
deleted file mode 100644
index 3172891..0000000
--- a/calib/gasgano/config/AMBER.prefs
+++ /dev/null
@@ -1,53 +0,0 @@
-# Gasgano Application Properties
-# Date: Thu Mar 08 10:40:16 CET 2007
-AUTO_DISPLAY=false
-CLASSRULE_FILE=/cal/amber/rul/amber.oca
-COMPONENT_FONT=Dialog:14
-CUBE_TO_VIEWER=/scisoft/bin/fv
-CUBE_VIEWER_TYPE=SHELLCOMMAND
-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
-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=CLASSIFICATION:TPL.ID:ORIGFILE:TPL.EXPNO:TPL.NEXP
-DISPLAY_COLUMNS_SIZE=0:0:0:0:0
-FILTER_FILE=gasgano/config/filter.rul
-FITS_TO_VIEWER=/scisoft/bin/fv
-FITS_VIEWER_TYPE=SHELLCOMMAND
-FRAME_BOUNDS=436,160,1148,924
-INSTRUMENT_GROUPING=ISAAC=;FORS1=;FORS2=;UVES=;VIMOS=;NAOS+CONICA=;EFOSC=;CES=;SUSI=;SOFI=;EMMI=;WFI=;VINCI=;MIDI=;AMBER=;
-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=amber_BeamPos=/home/quality/pipelines/amber/lib/esopipes-plugins/amber-4.3.1/amber_BeamPos.so;amber_SciCal=/home/quality/pipelines/amber/lib/esopipes-plugins/amber-4.3.1/amber_SciCal.so;amber_ascii_export=/home/quality/pipelines/amber/lib/esopipes-plugins/amber-4.3.1/amber_ascii_export.so;amber_detector=/home/quality/pipelines/amber/lib/esopipes-plugins/amber-4.3.1/amber_detector.so;amber_p2vm=/home/quality/pipelines/amber/lib/esopipes-plugins/amber-4.3.1/amber_p2vm.so;amber_r [...]
-SCRIPTS_DIR=/home/quality/pipelines/amber/installed/bin
-SHORTEN_FILES_PATH=false
-SHORT_FILENAME=true
-SHOW_EXTENSIONS=true
-TEXTFILE_EXTENSIONS=ascii;paf;longlog;log
-TFITS_TO_VIEWER=/scisoft/bin/fv
-TFITS_VIEWER_TYPE=SKYCAT
-UPDATE_TIMER=0
-VERBOSE_LEVEL=0
diff --git a/calib/gasgano/config/amber.oca b/calib/gasgano/config/amber.oca
deleted file mode 100644
index 5ac0df4..0000000
--- a/calib/gasgano/config/amber.oca
+++ /dev/null
@@ -1,181 +0,0 @@
-if DPR.TYPE like "%3P2V%" and ( DPR.CATG like "%CALIB%" or DPR.CATG like "%SCIENCE%" ) then
-{
- DO.CATG = "AMBER_3P2V";
-}
-if DPR.TYPE like "%WAVE,3TEL%" and ( DPR.CATG like "%CALIB%" or DPR.CATG like "%SCIENCE%" ) then
-{
- DO.CATG = "AMBER_3WAVE";
-}
-if DPR.TYPE like "%2P2V%" and ( DPR.CATG like "%CALIB%" or DPR.CATG like "%SCIENCE%" ) then
-{
- DO.CATG = "AMBER_2P2V";
-}
-if DPR.TYPE like "%WAVE,2TEL%" and ( DPR.CATG like "%CALIB%" or DPR.CATG like "%SCIENCE%" ) then
-{
- DO.CATG = "AMBER_2WAVE";
-}
-
-if DPR.TYPE like "%DARK%" and DPR.TECH like "%INTERFEROMETRY%" and DPR.CATG like "%CALIB%" then
-{
- DO.CATG = "AMBER_DARK_CALIB";
-}
-if DPR.TYPE like "%DARK%" and DPR.TECH like "%INTERFEROMETRY%" and DPR.CATG like "%SCIENCE%" then
-{
- DO.CATG = "AMBER_DARK_SCIENCE";
-}
-if DPR.TYPE like "%OBJECT%" and DPR.CATG like "%SCIENCE%" and DPR.TECH like "%INTERFEROMETRY%" then
-{
- DO.CATG = "AMBER_SCIENCE";
-}
-if DPR.TYPE like "%OBJECT%" and DPR.CATG like "%CALIB%" then
-{
- DO.CATG = "AMBER_CALIB";
-}
-if DPR.TYPE like "%STD%" and DPR.CATG like "%CALIB%" and DPR.TECH like "%INTERFEROMETRY%" then
-{
- DO.CATG = "AMBER_SCIENCE_CALIB";
-}
-if DPR.TYPE like "%SKY%" and DPR.CATG like "%CALIB%" then
-{
- DO.CATG = "AMBER_SKY_CALIB";
-}
-if DPR.TYPE like "%SKY%" and DPR.CATG like "%SCIENCE%" then
-{
- DO.CATG = "AMBER_SKY_SCIENCE";
-}
-if DPR.TYPE like "%P2VM%" and DPR.CATG like "%CALIB%" then
-{
- DO.CATG = "AMBER_P2VM";
-}
-if DPR.TYPE like "%BADPIX%" and DPR.CATG like "%CALIB%" then
-{
- DO.CATG = "AMBER_BADPIX";
-}
-if DPR.TYPE like "%FLATFIELD%" and DPR.CATG like "%CALIB%" then
-{
- DO.CATG = "AMBER_FLATFIELD";
-}
-if ( DPR.TYPE like "%DARK%" or DPR.TYPE like "%DETDARK%" ) and DPR.CATG like "%CALIB%" and DPR.TECH like "%IMAGE%" then
-{
- DO.CATG = "AMBER_DETECTOR_DARK";
-}
-if ( DPR.TYPE like "%FLAT,LAMP%" or DPR.TYPE like "%DETFLAT%" ) and DPR.CATG like "%CALIB%" then
-{
- DO.CATG = "AMBER_DETECTOR_FFM";
-}
-if DPR.TYPE like "%STD%" and ( DPR.CATG like "%CALIB%" or DPR.CATG like "%TEST%" ) and DPR.TECH like "%IMAGE%" then
-{
- DO.CATG = "AMBER_BEAMPOS";
-}
-if ( DPR.CATG like "%CALIB%" or DPR.CATG like "%SCIENCE%" ) and DPR.TYPE like "%COLPOS%" then
-{
- DO.CATG = "AMBER_COLPOS";
-}
-if ( DPR.CATG like "%CALIB%" or DPR.CATG like "%SCIENCE%" ) and ( DPR.TYPE like "%FRNSRC,BASE%" or DPR.TYPE like "%FRNSRC%" or DPR.TYPE like "%FRNSRC,BASE12%" or DPR.TYPE like "%FRNSRC,BASE23%" or DPR.TYPE like "%FRNSRC,BASE31%" or DPR.TYPE like "%FRNSRC,2T%" or DPR.TYPE like "%FRNSRC,3T%" or DPR.TYPE like "%CPTPIST,BASE12%" or DPR.TYPE like "%CPTPIST,BASE23%" or DPR.TYPE like "%CPTPIST,BASE31%" or DPR.TYPE like "%CPTPIST,BAS%" or DPR.TYPE like "%CPTPIST%" ) and DPR.TECH like "%INTERFERO [...]
-{
- DO.CATG = "AMBER_SEARCH";
-}
-if DPR.CATG like "%CALIB%" and ( DPR.TYPE like "%FLUX,2TEL%" or DPR.TYPE like "%FLUX,3TEL%" ) and DPR.TECH like "%INTERFEROMETRY%" then
-{
- DO.CATG = "AMBER_FLUX";
-}
-if ( DPR.CATG like "%CALIB%" or DPR.CATG like "%SCIENCE%" ) and ( DPR.TYPE like "%COHERENC,2TEL%" or DPR.TYPE like "%COHERENC,3TEL%" or DPR.TYPE like "%COHERENC,2T%" or DPR.TYPE like "%COHERENC,3T%" or DPR.TYPE like "%COHERENC%" ) and DPR.TECH like "%INTERFEROMETRY%" then
-{
- DO.CATG = "AMBER_COHER";
-}
-
-if PRO.CATG like "%SCIENCE_REDUCED%" then
-{
- DO.CATG = "SCIENCE_REDUCED";
-}
-if PRO.CATG like "%CALIB_REDUCED%" then
-{
- DO.CATG = "CALIB_REDUCED";
-}
-if PRO.CATG like "%P2VM_REDUCED%" then
-{
- DO.CATG = "P2VM_REDUCED";
-}
-if PRO.CATG like "%DETECTOR_BPM_REDUCED%" then
-{
- DO.CATG = "BADPIX_REDUCED";
-}
-if PRO.CATG like "%DETECTOR_FFM_REDUCED%" then
-{
- DO.CATG = "FLATFIELD_REDUCED";
-}
-if PRO.CATG like "%BEAMPOS_REDUCED%" then
-{
- DO.CATG = "BEAMPOS_REDUCED";
-}
-
-if PRO.CATG like "%AMBER_BADPIX%" then
-{
- DO.CATG = "AMBER_BADPIX";
-}
-if PRO.CATG like "%AMBER_FLATFIELD%" then
-{
- DO.CATG = "AMBER_FLATFIELD";
-}
-
-if PRO.CATG like "%CALIB_DATABASE_J%" then
-{
- DO.CATG = "CALIB_DATABASE_J";
-}
-if PRO.CATG like "%CALIB_DATABASE_H%" then
-{
- DO.CATG = "CALIB_DATABASE_H";
-}
-if PRO.CATG like "%CALIB_DATABASE_K%" then
-{
- DO.CATG = "CALIB_DATABASE_K";
-}
-
-select execute(AMBER_P2VM) from inputFiles where SIG.TEMPLATE == 1 and LF.DO.CATG == "AMBER_2P2V";
-select execute(AMBER_P2VM) from inputFiles where SIG.TEMPLATE == 1 and LF.DO.CATG == "AMBER_2WAVE";
-select execute(AMBER_P2VM) from inputFiles where SIG.TEMPLATE == 1 and LF.DO.CATG == "AMBER_3P2V";
-select execute(AMBER_P2VM) from inputFiles where SIG.TEMPLATE == 1 and LF.DO.CATG == "AMBER_3WAVE";
-select execute(AMBER_SCICAL) from inputFiles where SIG.TEMPLATE == 1 and LF.DO.CATG == "AMBER_CALIB";
-select execute(AMBER_SCICAL) from inputFiles where SIG.TEMPLATE == 1 and LF.DO.CATG == "AMBER_SKY_CALIB";
-select execute(AMBER_SCICAL) from inputFiles where SIG.TEMPLATE == 1 and LF.DO.CATG == "AMBER_DARK_CALIB";
-select execute(AMBER_SCICAL) from inputFiles where SIG.TEMPLATE == 1 and LF.DO.CATG == "AMBER_SCIENCE_CALIB";
-select execute(AMBER_SCICAL) from inputFiles where SIG.TEMPLATE == 1 and LF.DO.CATG == "AMBER_SCIENCE";
-select execute(AMBER_SCICAL) from inputFiles where SIG.TEMPLATE == 1 and LF.DO.CATG == "AMBER_SKY_SCIENCE";
-select execute(AMBER_SCICAL) from inputFiles where SIG.TEMPLATE == 1 and LF.DO.CATG == "AMBER_DARK_SCIENCE";
-select execute(AMBER_BEAMPOS) from inputFiles where SIG.TEMPLATE == 1 and LF.DO.CATG == "AMBER_BEAMPOS";
-select execute(AMBER_DETECTOR) from inputFiles where SIG.TEMPLATE == 1 and LF.DO.CATG == "AMBER_DETECTOR_DARK";
-select execute(AMBER_DETECTOR) from inputFiles where SIG.TEMPLATE == 1 and LF.DO.CATG == "AMBER_DETECTOR_FFM";
-
-action AMBER_DETECTOR
-{
-recipe amber_detector;
-}
-
-action AMBER_BEAMPOS
-{
-recipe amber_BeamPos;
-}
-
-action AMBER_P2VM
-{
-minRet = 1; maxRet = 1;
-select file as AMBER_FLATFIELD from calibFiles where DO.CATG == "AMBER_FLATFIELD";
-minRet = 1; maxRet = 1;
-select file as AMBER_BADPIX from calibFiles where DO.CATG == "AMBER_BADPIX";
-recipe amber_p2vm;
-}
-
-action AMBER_SCICAL
-{
-minRet = 1; maxRet = 1;
-select file as AMBER_FLATFIELD from calibFiles where DO.CATG == "AMBER_FLATFIELD";
-minRet = 1; maxRet = 1;
-select file as AMBER_BADPIX from calibFiles where DO.CATG == "AMBER_BADPIX";
-minRet = 1; maxRet = 1;
-select file as CALIB_DATABASE_J from calibFiles where DO.CATG == "CALIB_DATABASE_J";
-minRet = 1; maxRet = 1;
-select file as CALIB_DATABASE_H from calibFiles where DO.CATG == "CALIB_DATABASE_H";
-minRet = 1; maxRet = 1;
-select file as CALIB_DATABASE_K from calibFiles where DO.CATG == "CALIB_DATABASE_K";
-recipe amber_SciCal;
-}
diff --git a/config.h.in b/config.h.in
deleted file mode 100644
index c99c122..0000000
--- a/config.h.in
+++ /dev/null
@@ -1,152 +0,0 @@
-/* config.h.in. Generated from configure.ac by autoheader. */
-
-/* AMBER binary age */
-#undef AMBER_BINARY_AGE
-
-/* AMBER binary version number */
-#undef AMBER_BINARY_VERSION
-
-/* AMBER interface age */
-#undef AMBER_INTERFACE_AGE
-
-/* AMBER major version number */
-#undef AMBER_MAJOR_VERSION
-
-/* AMBER micro version number */
-#undef AMBER_MICRO_VERSION
-
-/* AMBER minor version number */
-#undef AMBER_MINOR_VERSION
-
-/* Plugin directory tree prefix */
-#undef AMBER_PLUGIN_DIR
-
-/* Absolute path to the plugin directory tree */
-#undef AMBER_PLUGIN_PATH
-
-/* Defined if FFTW (single-precision) is available */
-#undef CPL_FFTWF_INSTALLED
-
-/* Defined if FFTW (normal-precision) is available */
-#undef CPL_FFTW_INSTALLED
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#undef HAVE_DLFCN_H
-
-/* Define if you have the `fits_get_hduaddrll' function */
-#undef HAVE_FITS_GET_HDUADDRLL
-
-/* Define if you have the `fits_get_hduoff' function */
-#undef HAVE_FITS_GET_HDUOFF
-
-/* Define to 1 if you have the `floor' function. */
-#undef HAVE_FLOOR
-
-/* Define if you have the `getpwuid' function */
-#undef HAVE_GETPWUID
-
-/* Define if you have the `getuid' function */
-#undef HAVE_GETUID
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
-/* Define to 1 if you have the `memset' function. */
-#undef HAVE_MEMSET
-
-/* Define to 1 if you have the `pow' function. */
-#undef HAVE_POW
-
-/* Define to 1 if you have <pthread.h>. */
-#undef HAVE_PTHREAD_H
-
-/* 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
-
-/* 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 version of this package. */
-#undef PACKAGE_VERSION
-
-/* Product DID identifier the library complies to */
-#undef PRODUCT_DID
-
-/* Product DID identifier the library complies to */
-#undef QC_DID
-
-/* 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
-
-/* Number of bits in a file offset, on hosts where this is settable. */
-#undef _FILE_OFFSET_BITS
-
-/* Define for large files, on AIX-style hosts. */
-#undef _LARGE_FILES
-
-/* 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
deleted file mode 100755
index b89e1be..0000000
--- a/configure
+++ /dev/null
@@ -1,18799 +0,0 @@
-#! /bin/sh
-# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for AMBER Instrument Pipeline 4.3.1.
-#
-# 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 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
-
-
-
-
-# PATH needs CR
-# 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_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
-if (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
-
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-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.
-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); exit 1; }
-fi
-
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-done
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-LC_ALL=C
-export LC_ALL
-LANGUAGE=C
-export LANGUAGE
-
-# Required to use basename.
-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
-
-
-# Name of the executable.
-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'`
-
-# CDPATH.
-$as_unset CDPATH
-
-
-if test "x$CONFIG_SHELL" = x; then
- if (eval ":") 2>/dev/null; then
- as_have_required=yes
-else
- as_have_required=no
-fi
-
- if test $as_have_required = yes && (eval ":
-(as_func_return () {
- (exit \$1)
-}
-as_func_success () {
- as_func_return 0
-}
-as_func_failure () {
- as_func_return 1
-}
-as_func_ret_success () {
- return 0
-}
-as_func_ret_failure () {
- return 1
-}
-
-exitcode=0
-if as_func_success; then
- :
-else
- exitcode=1
- echo as_func_success failed.
-fi
-
-if as_func_failure; then
- exitcode=1
- echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
- :
-else
- exitcode=1
- echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
- exitcode=1
- echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
- :
-else
- exitcode=1
- echo positional parameters were not saved.
-fi
-
-test \$exitcode = 0) || { (exit 1); exit 1; }
-
-(
- as_lineno_1=\$LINENO
- as_lineno_2=\$LINENO
- test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
- test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
-") 2> /dev/null; then
- :
-else
- as_candidate_shells=
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- case $as_dir in
- /*)
- for as_base in sh bash ksh sh5; do
- as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
- done;;
- esac
-done
-IFS=$as_save_IFS
-
-
- for as_shell in $as_candidate_shells $SHELL; do
- # Try only shells that exist, to save several forks.
- if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
- { ("$as_shell") 2> /dev/null <<\_ASEOF
-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
-
-
-:
-_ASEOF
-}; then
- CONFIG_SHELL=$as_shell
- as_have_required=yes
- if { "$as_shell" 2> /dev/null <<\_ASEOF
-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_func_return () {
- (exit $1)
-}
-as_func_success () {
- as_func_return 0
-}
-as_func_failure () {
- as_func_return 1
-}
-as_func_ret_success () {
- return 0
-}
-as_func_ret_failure () {
- return 1
-}
-
-exitcode=0
-if as_func_success; then
- :
-else
- exitcode=1
- echo as_func_success failed.
-fi
-
-if as_func_failure; then
- exitcode=1
- echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
- :
-else
- exitcode=1
- echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
- exitcode=1
- echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = "$1" ); then
- :
-else
- exitcode=1
- echo positional parameters were not saved.
-fi
-
-test $exitcode = 0) || { (exit 1); exit 1; }
-
-(
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
-
-_ASEOF
-}; then
- break
-fi
-
-fi
-
- done
-
- if test "x$CONFIG_SHELL" != x; then
- for as_var in BASH_ENV ENV
- do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
- done
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
-fi
-
-
- if test $as_have_required = no; then
- echo This script requires a shell more modern than all the
- echo shells that I found on your system. Please install a
- echo modern shell, or manually run the script under such a
- echo shell if you do have one.
- { (exit 1); exit 1; }
-fi
-
-
-fi
-
-fi
-
-
-
-(eval "as_func_return () {
- (exit \$1)
-}
-as_func_success () {
- as_func_return 0
-}
-as_func_failure () {
- as_func_return 1
-}
-as_func_ret_success () {
- return 0
-}
-as_func_ret_failure () {
- return 1
-}
-
-exitcode=0
-if as_func_success; then
- :
-else
- exitcode=1
- echo as_func_success failed.
-fi
-
-if as_func_failure; then
- exitcode=1
- echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
- :
-else
- exitcode=1
- echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
- exitcode=1
- echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
- :
-else
- exitcode=1
- echo positional parameters were not saved.
-fi
-
-test \$exitcode = 0") || {
- echo No shell found that supports shell functions.
- echo Please tell bug-autoconf at gnu.org about your system,
- echo including any error possibly output before this message.
- echo This can help us improve future autoconf versions.
- echo Configuration will now proceed without shell functions.
-}
-
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
-
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line after each line using $LINENO; the second 'sed'
- # does the real work. The second script uses 'N' to pair each
- # line-number line with the line containing $LINENO, and appends
- # trailing '-' during substitution so that $LINENO is not a special
- # case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # scripts with optimization help from Paolo Bonzini. 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
- { (exit 1); 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
-}
-
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
- as_dirname=dirname
-else
- as_dirname=false
-fi
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
--n*)
- case `echo 'x\c'` in
- *c*) ECHO_T=' ';; # ECHO_T is single tab character.
- *) ECHO_C='\c';;
- esac;;
-*)
- ECHO_N='-n';;
-esac
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-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=:
-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'"
-
-
-
-
-# Check that we are running under the correct shell.
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-case X$lt_ECHO in
-X*--fallback-echo)
- # Remove one level of quotation (which was required for Make).
- ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','`
- ;;
-esac
-
-ECHO=${lt_ECHO-echo}
-if test "X$1" = X--no-reexec; then
- # Discard the --no-reexec flag, and continue.
- shift
-elif test "X$1" = X--fallback-echo; then
- # Avoid inline document here, it may be left over
- :
-elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
- # Yippee, $ECHO works!
- :
-else
- # Restart under the correct shell.
- exec $SHELL "$0" --no-reexec ${1+"$@"}
-fi
-
-if test "X$1" = X--fallback-echo; then
- # used as fallback echo
- shift
- cat <<_LT_EOF
-$*
-_LT_EOF
- exit 0
-fi
-
-# 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
-
-if test -z "$lt_ECHO"; then
- if test "X${echo_test_string+set}" != Xset; then
- # find a string as large as possible, as long as the shell can cope with it
- for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
- # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
- if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
- { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
- then
- break
- fi
- done
- fi
-
- if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
- echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
- :
- else
- # The Solaris, AIX, and Digital Unix default echo programs unquote
- # backslashes. This makes it impossible to quote backslashes using
- # echo "$something" | sed 's/\\/\\\\/g'
- #
- # So, first we look for a working echo in the user's PATH.
-
- lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
- for dir in $PATH /usr/ucb; do
- IFS="$lt_save_ifs"
- if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
- test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
- echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
- ECHO="$dir/echo"
- break
- fi
- done
- IFS="$lt_save_ifs"
-
- if test "X$ECHO" = Xecho; then
- # We didn't find a better echo, so look for alternatives.
- if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
- echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
- # This shell has a builtin print -r that does the trick.
- ECHO='print -r'
- elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
- test "X$CONFIG_SHELL" != X/bin/ksh; then
- # If we have ksh, try running configure again with it.
- ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
- export ORIGINAL_CONFIG_SHELL
- CONFIG_SHELL=/bin/ksh
- export CONFIG_SHELL
- exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
- else
- # Try using printf.
- ECHO='printf %s\n'
- if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
- echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
- # Cool, printf works
- :
- elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
- test "X$echo_testing_string" = 'X\t' &&
- echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
- CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
- export CONFIG_SHELL
- SHELL="$CONFIG_SHELL"
- export SHELL
- ECHO="$CONFIG_SHELL $0 --fallback-echo"
- elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
- test "X$echo_testing_string" = 'X\t' &&
- echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
- ECHO="$CONFIG_SHELL $0 --fallback-echo"
- else
- # maybe with a smaller string...
- prev=:
-
- for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
- if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
- then
- break
- fi
- prev="$cmd"
- done
-
- if test "$prev" != 'sed 50q "$0"'; then
- echo_test_string=`eval $prev`
- export echo_test_string
- exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
- else
- # Oops. We lost completely, so just stick with echo.
- ECHO=echo
- fi
- fi
- fi
- fi
- fi
-fi
-
-# Copy echo and quote the copy suitably for passing to libtool from
-# the Makefile, instead of quoting the original, which is used later.
-lt_ECHO=$ECHO
-if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
- lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
-fi
-
-
-
-
-exec 7<&0 </dev/null 6>&1
-
-# Name of the host.
-# hostname on some systems (SVR3.2, 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=
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-# Identity of this package.
-PACKAGE_NAME='AMBER Instrument Pipeline'
-PACKAGE_TARNAME='amber'
-PACKAGE_VERSION='4.3.1'
-PACKAGE_STRING='AMBER Instrument Pipeline 4.3.1'
-PACKAGE_BUGREPORT='usd-help at eso.org'
-
-ac_unique_file="Makefile.am"
-ac_default_prefix=${PIPE_HOME:-/usr/local}
-# 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
-PRODUCT_DID
-all_ldflags
-all_includes
-LIBAMBER
-AMBER_LDFLAGS
-AMBER_INCLUDES
-scriptsdir
-configdir
-pipedocsdir
-privatelibdir
-plugindir
-LIBFFTWF
-FFTWF_LDFLAGS
-FFTWF_INCLUDES
-LIBFFTW
-FFTW_LDFLAGS
-FFTW_INCLUDES
-LIBCFITSIO
-CFITSIO_LDFLAGS
-CFITSIO_INCLUDES
-LIBPTHREAD
-PTHREAD_CFLAGS
-CPL_LDFLAGS
-CPL_INCLUDES
-LIBCPLDFS
-LIBCPLUI
-LIBCPLDRS
-LIBCPLCORE
-LIBCEXT
-CX_LDFLAGS
-CX_INCLUDES
-LIBTOOL_DEPS
-OTOOL64
-OTOOL
-LIPO
-NMEDIT
-DSYMUTIL
-lt_ECHO
-RANLIB
-AR
-OBJDUMP
-NM
-ac_ct_DUMPBIN
-DUMPBIN
-LD
-FGREP
-SED
-LIBTOOL
-PURIFY_FALSE
-PURIFY_TRUE
-PURIFY_CMD
-LATEX
-DOXYGEN
-EGREP
-GREP
-ESO_DEBUG_FLAGS
-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
-AMBER_BINARY_AGE
-AMBER_BINARY_VERSION
-AMBER_INTERFACE_AGE
-AMBER_MICRO_VERSION
-AMBER_MINOR_VERSION
-AMBER_MAJOR_VERSION
-AMBER_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_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_purify
-enable_static
-enable_shared
-with_pic
-enable_fast_install
-with_gnu_ld
-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
-enable_largefile
-with_cfitsio
-with_cfitsio_includes
-with_cfitsio_libs
-enable_cfitsio_test
-with_fftw
-with_fftw_includes
-with_fftw_libs
-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'
-
-
-# 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=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_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
- { (exit 1); exit 1; }; }
- 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_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
- { (exit 1); exit 1; }; }
- 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_echo "$as_me: error: invalid package name: $ac_useropt" >&2
- { (exit 1); exit 1; }; }
- 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_echo "$as_me: error: invalid package name: $ac_useropt" >&2
- { (exit 1); exit 1; }; }
- 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_echo "$as_me: error: unrecognized option: $ac_option
-Try \`$0 --help' for more information." >&2
- { (exit 1); exit 1; }; }
- ;;
-
- *=*)
- ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
- # Reject names that are not valid shell variable names.
- expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
- { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2
- { (exit 1); exit 1; }; }
- 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_echo "$as_me: error: missing argument to $ac_option" >&2
- { (exit 1); exit 1; }; }
-fi
-
-if test -n "$ac_unrecognized_opts"; then
- case $enable_option_checking in
- no) ;;
- fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2
- { (exit 1); exit 1; }; } ;;
- *) $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_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; }
-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_echo "$as_me: error: working directory cannot be determined" >&2
- { (exit 1); exit 1; }; }
-test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
- { $as_echo "$as_me: error: pwd does not report name of working directory" >&2
- { (exit 1); exit 1; }; }
-
-
-# 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_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
- { (exit 1); exit 1; }; }
-fi
-ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
-ac_abs_confdir=`(
- cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2
- { (exit 1); exit 1; }; }
- 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 AMBER Instrument Pipeline 4.3.1 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/amber]
- --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 AMBER Instrument Pipeline 4.3.1:";;
- 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]
- --disable-purify disalbes the check for the PURIFY installation
- --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-largefile omit support for large files
- --disable-cfitsio-test disables checks for the cfitsio library and headers
-
-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-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-cfitsio location where cfitsio is installed
- --with-cfitsio-includes location of the cfitsio header files
- --with-cfitsio-libs location of the cfitsio library
- --with-fftw location where fftw is installed
- --with-fftw-includes location of the fftw header files
- --with-fftw-libs location of the fftw libraries
- --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 C/C++/Objective 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
-
-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
-AMBER Instrument Pipeline configure 4.3.1
-generated by GNU Autoconf 2.63
-
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006, 2007, 2008 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
-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 AMBER Instrument Pipeline $as_me 4.3.1, which was
-generated by GNU Autoconf 2.63. 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) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
- 2)
- ac_configure_args1="$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
- ac_configure_args="$ac_configure_args '$ac_arg'"
- ;;
- esac
- done
-done
-$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
-$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export 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
-
- cat <<\_ASBOX
-## ---------------- ##
-## Cache variables. ##
-## ---------------- ##
-_ASBOX
- 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:$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= ;; #(
- *) $as_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
-
- cat <<\_ASBOX
-## ----------------- ##
-## Output variables. ##
-## ----------------- ##
-_ASBOX
- 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
- cat <<\_ASBOX
-## ------------------- ##
-## File substitutions. ##
-## ------------------- ##
-_ASBOX
- 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
- cat <<\_ASBOX
-## ----------- ##
-## confdefs.h. ##
-## ----------- ##
-_ASBOX
- 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'; { (exit 1); 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
-
-# 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
-
-
-# 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
- ac_site_file1=$CONFIG_SITE
-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 -r "$ac_site_file"; then
- { $as_echo "$as_me:$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"
- 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.
- if test -f "$cache_file"; then
- { $as_echo "$as_me:$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:$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:$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:$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:$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:$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:$LINENO: former value: \`$ac_old_val'" >&5
-$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
- { $as_echo "$as_me:$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.
- *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- esac
- fi
-done
-if $ac_cache_corrupted; then
- { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
- { $as_echo "$as_me:$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_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
-$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
- { (exit 1); exit 1; }; }
-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
-
-
-
-
-
-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_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in admin \"$srcdir\"/admin" >&5
-$as_echo "$as_me: error: cannot find install-sh or install.sh in admin \"$srcdir\"/admin" >&2;}
- { (exit 1); exit 1; }; }
-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_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
-$as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
- { (exit 1); exit 1; }; }
-
-{ $as_echo "$as_me:$LINENO: checking build system type" >&5
-$as_echo_n "checking build system type... " >&6; }
-if test "${ac_cv_build+set}" = set; 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_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
-$as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
- { (exit 1); exit 1; }; }
-ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
- { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
-$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
- { (exit 1); exit 1; }; }
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5
-$as_echo "$ac_cv_build" >&6; }
-case $ac_cv_build in
-*-*-*) ;;
-*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
-$as_echo "$as_me: error: invalid value of canonical build" >&2;}
- { (exit 1); exit 1; }; };;
-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:$LINENO: checking host system type" >&5
-$as_echo_n "checking host system type... " >&6; }
-if test "${ac_cv_host+set}" = set; 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_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
-$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5
-$as_echo "$ac_cv_host" >&6; }
-case $ac_cv_host in
-*-*-*) ;;
-*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
-$as_echo "$as_me: error: invalid value of canonical host" >&2;}
- { (exit 1); exit 1; }; };;
-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:$LINENO: checking target system type" >&5
-$as_echo_n "checking target system type... " >&6; }
-if test "${ac_cv_target+set}" = set; 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_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5
-$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_target" >&5
-$as_echo "$ac_cv_target" >&6; }
-case $ac_cv_target in
-*-*-*) ;;
-*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical target" >&5
-$as_echo "$as_me: error: invalid value of canonical target" >&2;}
- { (exit 1); exit 1; }; };;
-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:$LINENO: checking for a BSD-compatible install" >&5
-$as_echo_n "checking for a BSD-compatible install... " >&6; }
-if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; 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:$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:$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_echo "$as_me:$LINENO: error: unsafe absolute working directory name" >&5
-$as_echo "$as_me: error: unsafe absolute working directory name" >&2;}
- { (exit 1); exit 1; }; };;
-esac
-case $srcdir in
- *[\\\"\#\$\&\'\`$am_lf\ \ ]*)
- { { $as_echo "$as_me:$LINENO: error: unsafe srcdir value: \`$srcdir'" >&5
-$as_echo "$as_me: error: unsafe srcdir value: \`$srcdir'" >&2;}
- { (exit 1); exit 1; }; };;
-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_echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken
-alias in your environment" >&5
-$as_echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken
-alias in your environment" >&2;}
- { (exit 1); exit 1; }; }
- fi
-
- test "$2" = conftest.file
- )
-then
- # Ok.
- :
-else
- { { $as_echo "$as_me:$LINENO: error: newly created file is older than distributed files!
-Check your system clock" >&5
-$as_echo "$as_me: error: newly created file is older than distributed files!
-Check your system clock" >&2;}
- { (exit 1); exit 1; }; }
-fi
-{ $as_echo "$as_me:$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:$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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; 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:$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:$LINENO: result: $STRIP" >&5
-$as_echo "$STRIP" >&6; }
-else
- { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; 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:$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:$LINENO: result: $ac_ct_STRIP" >&5
-$as_echo "$ac_ct_STRIP" >&6; }
-else
- { $as_echo "$as_me:$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:$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:$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 test "${ac_cv_path_mkdir+set}" = set; 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
-
- 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.
- test -d ./--version && rmdir ./--version
- MKDIR_P="$ac_install_sh -d"
- fi
-fi
-{ $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AWK+set}" = set; 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:$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:$LINENO: result: $AWK" >&5
-$as_echo "$AWK" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- test -n "$AWK" && break
-done
-
-{ $as_echo "$as_me:$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 { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; 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:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
- SET_MAKE=
-else
- { $as_echo "$as_me:$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_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
-$as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
- { (exit 1); exit 1; }; }
- 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='amber'
- VERSION='4.3.1'
-
-
-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:$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:$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
-
-
-
-
- unset CDPATH
- # make $PIPE_HOME the default for the installation
-
-
- if test "x$prefix" = "xNONE"; then
- prefix=$ac_default_prefix
- ac_configure_args="$ac_configure_args --prefix $prefix"
- fi
-
- if test "x$exec_prefix" = "xNONE"; then
- exec_prefix=$prefix
- fi
-
-
-
-# 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;
-# }
-
-
- amber_version=`echo "$VERSION" | sed -e 's/[a-z,A-Z].*$//'`
-
- amber_major_version=`echo "$amber_version" | \
- sed 's/\([0-9]*\).\(.*\)/\1/'`
- amber_minor_version=`echo "$amber_version" | \
- sed 's/\([0-9]*\).\([0-9]*\)\(.*\)/\2/'`
- amber_micro_version=`echo "$amber_version" | \
- sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
-
- if test -z "$amber_major_version"; then
- amber_major_version=0
- fi
-
- if test -z "$amber_minor_version"; then
- amber_minor_version=0
- fi
-
- if test -z "$amber_micro_version"; then
- amber_micro_version=0
- fi
-
- AMBER_VERSION="$amber_version"
- AMBER_MAJOR_VERSION=$amber_major_version
- AMBER_MINOR_VERSION=$amber_minor_version
- AMBER_MICRO_VERSION=$amber_micro_version
-
- if test -z ""; then
- AMBER_INTERFACE_AGE=0
- else
- AMBER_INTERFACE_AGE=""
- fi
-
- AMBER_BINARY_AGE=`expr 100 '*' $AMBER_MINOR_VERSION + $AMBER_MICRO_VERSION`
- AMBER_BINARY_VERSION=`expr 10000 '*' $AMBER_MAJOR_VERSION + \
- $AMBER_BINARY_AGE`
-
-
-
-
-
-
-
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define AMBER_MAJOR_VERSION $AMBER_MAJOR_VERSION
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define AMBER_MINOR_VERSION $AMBER_MINOR_VERSION
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define AMBER_MICRO_VERSION $AMBER_MICRO_VERSION
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define AMBER_INTERFACE_AGE $AMBER_INTERFACE_AGE
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define AMBER_BINARY_VERSION $AMBER_BINARY_VERSION
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define AMBER_BINARY_AGE $AMBER_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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; 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:$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:$LINENO: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
- { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; 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:$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:$LINENO: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
-else
- { $as_echo "$as_me:$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:$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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; 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:$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:$LINENO: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
- { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; 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:$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:$LINENO: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
- { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; 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:$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:$LINENO: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
- { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; 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:$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:$LINENO: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
-else
- { $as_echo "$as_me:$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:$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:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }; }
-
-# Provide some information about the compiler.
-$as_echo "$as_me:$LINENO: checking for C compiler version" >&5
-set X $ac_compile
-ac_compiler=$2
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compiler --version >&5") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compiler -v >&5") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compiler -V >&5") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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:$LINENO: checking for C compiler default output file name" >&5
-$as_echo_n "checking for C compiler default output file name... " >&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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link_default") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; 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
-
-{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5
-$as_echo "$ac_file" >&6; }
-if test -z "$ac_file"; then
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: C compiler cannot create executables
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }; }
-fi
-
-ac_exeext=$ac_cv_exeext
-
-# Check that the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-$as_echo_n "checking whether the C compiler works... " >&6; }
-# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
- if { ac_try='./$ac_file'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- cross_compiling=no
- else
- if test "$cross_compiling" = maybe; then
- cross_compiling=yes
- else
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }; }
- fi
- fi
-fi
-{ $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
-ac_clean_files=$ac_clean_files_save
-# Check that the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-$as_echo_n "checking whether we are cross compiling... " >&6; }
-{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5
-$as_echo "$cross_compiling" >&6; }
-
-{ $as_echo "$as_me:$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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; 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:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }; }
-fi
-
-rm -f conftest$ac_cv_exeext
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-$as_echo "$ac_cv_exeext" >&6; }
-
-rm -f conftest.$ac_ext
-EXEEXT=$ac_cv_exeext
-ac_exeext=$EXEEXT
-{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5
-$as_echo_n "checking for suffix of object files... " >&6; }
-if test "${ac_cv_objext+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; 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:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }; }
-fi
-
-rm -f conftest.$ac_cv_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-$as_echo "$ac_cv_objext" >&6; }
-OBJEXT=$ac_cv_objext
-ac_objext=$OBJEXT
-{ $as_echo "$as_me:$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 test "${ac_cv_c_compiler_gnu+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-#ifndef __GNUC__
- choke me
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_compiler_gnu=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- 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:$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:$LINENO: checking whether $CC accepts -g" >&5
-$as_echo_n "checking whether $CC accepts -g... " >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; 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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_prog_cc_g=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- CFLAGS=""
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_c_werror_flag=$ac_save_c_werror_flag
- CFLAGS="-g"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_prog_cc_g=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-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:$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:$LINENO: checking for $CC option to accept ISO C89" >&5
-$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_prog_cc_c89=no
-ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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"
- 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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_prog_cc_c89=$ac_arg
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-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:$LINENO: result: none needed" >&5
-$as_echo "none needed" >&6; } ;;
- xno)
- { $as_echo "$as_me:$LINENO: result: unsupported" >&5
-$as_echo "unsupported" >&6; } ;;
- *)
- CC="$CC $ac_cv_prog_cc_c89"
- { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
-$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
-esac
-
-
-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:$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:$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:$LINENO: checking dependency style of $depcc" >&5
-$as_echo_n "checking dependency style of $depcc... " >&6; }
-if test "${am_cv_CC_dependencies_compiler_type+set}" = set; 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:$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:$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 test "${ac_cv_prog_CPP+set}" = set; 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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Broken: fails on valid input.
-continue
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether nonexistent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- # Broken: success on invalid input.
-continue
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f 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:$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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Broken: fails on valid input.
-continue
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether nonexistent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- # Broken: success on invalid input.
-continue
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- :
-else
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }; }
-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:$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:$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 { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- 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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); };
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; 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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- 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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); };
- 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:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-cat >>confdefs.h <<\_ACEOF
-#define NO_MINUS_C_MINUS_O 1
-_ACEOF
-
-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:$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:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no, using $LN_S" >&5
-$as_echo "no, using $LN_S" >&6; }
-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:$LINENO: checking whether debugging code should be created" >&5
-$as_echo_n "checking whether debugging code should be created... " >&6; }
-if test "${eso_cv_enable_debug+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- eso_cv_enable_debug=$eso_enable_debug
-fi
-{ $as_echo "$as_me:$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:$LINENO: checking whether $CC supports -g3" >&5
-$as_echo_n "checking whether $CC supports -g3... " >&6; }
-if { as_var=eso_cv_prog_cc_$flag; eval "test \"\${$as_var+set}\" = set"; }; 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
-ac_res=`eval 'as_val=${'eso_cv_prog_cc_$flag'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$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:$LINENO: checking whether $CC supports -ggdb" >&5
-$as_echo_n "checking whether $CC supports -ggdb... " >&6; }
-if { as_var=eso_cv_prog_cc_$flag; eval "test \"\${$as_var+set}\" = set"; }; 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
-ac_res=`eval 'as_val=${'eso_cv_prog_cc_$flag'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$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:$LINENO: checking whether $CC supports -O0" >&5
-$as_echo_n "checking whether $CC supports -O0... " >&6; }
-if { as_var=eso_cv_prog_cc_$flag; eval "test \"\${$as_var+set}\" = set"; }; 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
-ac_res=`eval 'as_val=${'eso_cv_prog_cc_$flag'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$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:$LINENO: checking whether $CC supports -rdynamic" >&5
-$as_echo_n "checking whether $CC supports -rdynamic... " >&6; }
-if { as_var=eso_cv_prog_cc_$flag; eval "test \"\${$as_var+set}\" = set"; }; 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
-ac_res=`eval 'as_val=${'eso_cv_prog_cc_$flag'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$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:$LINENO: checking whether $CC supports -Wall" >&5
-$as_echo_n "checking whether $CC supports -Wall... " >&6; }
-if { as_var=eso_cv_prog_cc_$flag; eval "test \"\${$as_var+set}\" = set"; }; 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
-ac_res=`eval 'as_val=${'eso_cv_prog_cc_$flag'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$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:$LINENO: checking whether $CC supports -W" >&5
-$as_echo_n "checking whether $CC supports -W... " >&6; }
-if { as_var=eso_cv_prog_cc_$flag; eval "test \"\${$as_var+set}\" = set"; }; 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
-ac_res=`eval 'as_val=${'eso_cv_prog_cc_$flag'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$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:$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 test "${ac_cv_path_GREP+set}" = set; 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
- ac_count=`expr $ac_count + 1`
- 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_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
- { (exit 1); exit 1; }; }
- fi
-else
- ac_cv_path_GREP=$GREP
-fi
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
-$as_echo "$ac_cv_path_GREP" >&6; }
- GREP="$ac_cv_path_GREP"
-
-
-{ $as_echo "$as_me:$LINENO: checking for egrep" >&5
-$as_echo_n "checking for egrep... " >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; 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
- ac_count=`expr $ac_count + 1`
- 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_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
- { (exit 1); exit 1; }; }
- fi
-else
- ac_cv_path_EGREP=$EGREP
-fi
-
- fi
-fi
-{ $as_echo "$as_me:$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:$LINENO: checking whether strict compiler options should be used" >&5
-$as_echo_n "checking whether strict compiler options should be used... " >&6; }
-if test "${eso_cv_enable_strict+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- eso_cv_enable_strict=$eso_enable_strict
-fi
-{ $as_echo "$as_me:$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:$LINENO: checking whether $CC supports -std=c99" >&5
-$as_echo_n "checking whether $CC supports -std=c99... " >&6; }
-if { as_var=eso_cv_prog_cc_$flag; eval "test \"\${$as_var+set}\" = set"; }; 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
-ac_res=`eval 'as_val=${'eso_cv_prog_cc_$flag'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$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:$LINENO: checking whether $CC supports -pedantic" >&5
-$as_echo_n "checking whether $CC supports -pedantic... " >&6; }
-if { as_var=eso_cv_prog_cc_$flag; eval "test \"\${$as_var+set}\" = set"; }; 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
-ac_res=`eval 'as_val=${'eso_cv_prog_cc_$flag'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$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:$LINENO: checking whether $CC supports -fno-builtin" >&5
-$as_echo_n "checking whether $CC supports -fno-builtin... " >&6; }
-if { as_var=eso_cv_prog_cc_$flag; eval "test \"\${$as_var+set}\" = set"; }; 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
-ac_res=`eval 'as_val=${'eso_cv_prog_cc_$flag'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_DOXYGEN+set}" = set; 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:$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:$LINENO: result: $DOXYGEN" >&5
-$as_echo "$DOXYGEN" >&6; }
-else
- { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_LATEX+set}" = set; 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:$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:$LINENO: result: $LATEX" >&5
-$as_echo "$LATEX" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-
- if test -z "${DOXYGEN}"; then
- DOXYGEN=":"
- fi
-
- if test -z "${LATEX}"; then
- LATEX=":"
- fi
-
-
-
-#
-# Check for purify
-#
-
-
- { $as_echo "$as_me:$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:$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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_PURIFY_CMD+set}" = set; 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:$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:$LINENO: result: $PURIFY_CMD" >&5
-$as_echo "$PURIFY_CMD" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- if test "$PURIFY_CMD" = "NONE" ; then
- { $as_echo "$as_me:$LINENO: WARNING: Disabling purify support" >&5
-$as_echo "$as_me: WARNING: Disabling purify support" >&2;}
- enable_purify=no
- fi
- else
- { $as_echo "$as_me:$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
-
-
-
-# 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:$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.2.6b'
-macro_revision='1.3017'
-
-
-
-
-
-
-
-
-
-
-
-
-
-ltmain="$ac_aux_dir/ltmain.sh"
-
-{ $as_echo "$as_me:$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 test "${ac_cv_path_SED+set}" = set; 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
- $as_unset ac_script || 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
- ac_count=`expr $ac_count + 1`
- 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_echo "$as_me:$LINENO: error: no acceptable sed could be found in \$PATH" >&5
-$as_echo "$as_me: error: no acceptable sed could be found in \$PATH" >&2;}
- { (exit 1); exit 1; }; }
- fi
-else
- ac_cv_path_SED=$SED
-fi
-
-fi
-{ $as_echo "$as_me:$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:$LINENO: checking for fgrep" >&5
-$as_echo_n "checking for fgrep... " >&6; }
-if test "${ac_cv_path_FGREP+set}" = set; 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
- ac_count=`expr $ac_count + 1`
- 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_echo "$as_me:$LINENO: error: no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-$as_echo "$as_me: error: no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
- { (exit 1); exit 1; }; }
- fi
-else
- ac_cv_path_FGREP=$FGREP
-fi
-
- fi
-fi
-{ $as_echo "$as_me:$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:$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:$LINENO: checking for GNU ld" >&5
-$as_echo_n "checking for GNU ld... " >&6; }
-else
- { $as_echo "$as_me:$LINENO: checking for non-GNU ld" >&5
-$as_echo_n "checking for non-GNU ld... " >&6; }
-fi
-if test "${lt_cv_path_LD+set}" = set; 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:$LINENO: result: $LD" >&5
-$as_echo "$LD" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-test -z "$LD" && { { $as_echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
-$as_echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
- { (exit 1); exit 1; }; }
-{ $as_echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
-$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
-if test "${lt_cv_prog_gnu_ld+set}" = set; 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:$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:$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 test "${lt_cv_path_NM+set}" = set; 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:$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 "$ac_tool_prefix"; then
- for ac_prog in "dumpbin -symbols" "link -dump -symbols"
- 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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_DUMPBIN+set}" = set; 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:$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:$LINENO: result: $DUMPBIN" >&5
-$as_echo "$DUMPBIN" >&6; }
-else
- { $as_echo "$as_me:$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 -symbols" "link -dump -symbols"
-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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; 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:$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:$LINENO: result: $ac_ct_DUMPBIN" >&5
-$as_echo "$ac_ct_DUMPBIN" >&6; }
-else
- { $as_echo "$as_me:$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:$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
-
-
- if test "$DUMPBIN" != ":"; then
- NM="$DUMPBIN"
- fi
-fi
-test -z "$NM" && NM=nm
-
-
-
-
-
-
-{ $as_echo "$as_me:$LINENO: checking the name lister ($NM) interface" >&5
-$as_echo_n "checking the name lister ($NM) interface... " >&6; }
-if test "${lt_cv_nm_interface+set}" = set; 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:5848: $ac_compile\"" >&5)
- (eval "$ac_compile" 2>conftest.err)
- cat conftest.err >&5
- (eval echo "\"\$as_me:5851: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
- (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
- cat conftest.err >&5
- (eval echo "\"\$as_me:5854: 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:$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:$LINENO: checking the maximum length of command line arguments" >&5
-$as_echo_n "checking the maximum length of command line arguments... " >&6; }
-if test "${lt_cv_sys_max_cmd_len+set}" = set; 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;
- ;;
-
- 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"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
- = "XX$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:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
-$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
-else
- { $as_echo "$as_me:$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:$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"}, \
- = c,a/b,, \
- && eval 'test $(( 1 + 1 )) -eq 2 \
- && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
- && xsi_shell=yes
-{ $as_echo "$as_me:$LINENO: result: $xsi_shell" >&5
-$as_echo "$xsi_shell" >&6; }
-
-
-{ $as_echo "$as_me:$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:$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:$LINENO: checking for $LD option to reload object files" >&5
-$as_echo_n "checking for $LD option to reload object files... " >&6; }
-if test "${lt_cv_ld_reload_flag+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- lt_cv_ld_reload_flag='-r'
-fi
-{ $as_echo "$as_me:$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
- 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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OBJDUMP+set}" = set; 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:$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:$LINENO: result: $OBJDUMP" >&5
-$as_echo "$OBJDUMP" >&6; }
-else
- { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; 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:$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:$LINENO: result: $ac_ct_OBJDUMP" >&5
-$as_echo "$ac_ct_OBJDUMP" >&6; }
-else
- { $as_echo "$as_me:$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:$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:$LINENO: checking how to recognize dependent libraries" >&5
-$as_echo_n "checking how to recognize dependent libraries... " >&6; }
-if test "${lt_cv_deplibs_check_method+set}" = set; 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.
- if ( 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
- lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
- 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
- ;;
-
-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]) 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)
- 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:$LINENO: result: $lt_cv_deplibs_check_method" >&5
-$as_echo "$lt_cv_deplibs_check_method" >&6; }
-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}ar", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ar; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AR+set}" = set; 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}ar"
- $as_echo "$as_me:$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:$LINENO: result: $AR" >&5
-$as_echo "$AR" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_AR"; then
- ac_ct_AR=$AR
- # Extract the first word of "ar", so it can be a program name with args.
-set dummy ar; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_AR+set}" = set; 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="ar"
- $as_echo "$as_me:$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:$LINENO: result: $ac_ct_AR" >&5
-$as_echo "$ac_ct_AR" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_ct_AR" = x; then
- AR="false"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$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
-else
- AR="$ac_cv_prog_AR"
-fi
-
-test -z "$AR" && AR=ar
-test -z "$AR_FLAGS" && AR_FLAGS=cru
-
-
-
-
-
-
-
-
-
-
-
-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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; 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:$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:$LINENO: result: $STRIP" >&5
-$as_echo "$STRIP" >&6; }
-else
- { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; 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:$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:$LINENO: result: $ac_ct_STRIP" >&5
-$as_echo "$ac_ct_STRIP" >&6; }
-else
- { $as_echo "$as_me:$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:$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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_RANLIB+set}" = set; 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:$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:$LINENO: result: $RANLIB" >&5
-$as_echo "$RANLIB" >&6; }
-else
- { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; 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:$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:$LINENO: result: $ac_ct_RANLIB" >&5
-$as_echo "$ac_ct_RANLIB" >&6; }
-else
- { $as_echo "$as_me:$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:$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
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-# 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:$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 test "${lt_cv_sys_global_symbol_pipe+set}" = set; 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
-
- # 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:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- # Now try to grab the symbols.
- nlist=conftest.nm
- if { (eval echo "$as_me:$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:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && 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
-#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. */
-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_save_LIBS="$LIBS"
- lt_save_CFLAGS="$CFLAGS"
- LIBS="conftstm.$ac_objext"
- CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
- if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && test -s conftest${ac_exeext}; then
- pipe_works=yes
- fi
- LIBS="$lt_save_LIBS"
- CFLAGS="$lt_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:$LINENO: result: failed" >&5
-$as_echo "failed" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: ok" >&5
-$as_echo "ok" >&6; }
-fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-# 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:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; 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 7049 "configure"' > conftest.$ac_ext
- if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; 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:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; 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:$LINENO: checking whether the C compiler needs -belf" >&5
-$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
-if test "${lt_cv_cc_needs_belf+set}" = set; 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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- 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
- lt_cv_cc_needs_belf=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- lt_cv_cc_needs_belf=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- 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:$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:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; 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"
-
-
- 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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_DSYMUTIL+set}" = set; 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:$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:$LINENO: result: $DSYMUTIL" >&5
-$as_echo "$DSYMUTIL" >&6; }
-else
- { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; 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:$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:$LINENO: result: $ac_ct_DSYMUTIL" >&5
-$as_echo "$ac_ct_DSYMUTIL" >&6; }
-else
- { $as_echo "$as_me:$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:$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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_NMEDIT+set}" = set; 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:$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:$LINENO: result: $NMEDIT" >&5
-$as_echo "$NMEDIT" >&6; }
-else
- { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; 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:$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:$LINENO: result: $ac_ct_NMEDIT" >&5
-$as_echo "$ac_ct_NMEDIT" >&6; }
-else
- { $as_echo "$as_me:$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:$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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_LIPO+set}" = set; 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:$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:$LINENO: result: $LIPO" >&5
-$as_echo "$LIPO" >&6; }
-else
- { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; 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:$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:$LINENO: result: $ac_ct_LIPO" >&5
-$as_echo "$ac_ct_LIPO" >&6; }
-else
- { $as_echo "$as_me:$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:$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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OTOOL+set}" = set; 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:$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:$LINENO: result: $OTOOL" >&5
-$as_echo "$OTOOL" >&6; }
-else
- { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; 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:$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:$LINENO: result: $ac_ct_OTOOL" >&5
-$as_echo "$ac_ct_OTOOL" >&6; }
-else
- { $as_echo "$as_me:$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:$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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OTOOL64+set}" = set; 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:$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:$LINENO: result: $OTOOL64" >&5
-$as_echo "$OTOOL64" >&6; }
-else
- { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; 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:$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:$LINENO: result: $ac_ct_OTOOL64" >&5
-$as_echo "$ac_ct_OTOOL64" >&6; }
-else
- { $as_echo "$as_me:$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:$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:$LINENO: checking for -single_module linker flag" >&5
-$as_echo_n "checking for -single_module linker flag... " >&6; }
-if test "${lt_cv_apple_cc_single_mod+set}" = set; 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:$LINENO: result: $lt_cv_apple_cc_single_mod" >&5
-$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
- { $as_echo "$as_me:$LINENO: checking for -exported_symbols_list linker flag" >&5
-$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
-if test "${lt_cv_ld_exported_symbols_list+set}" = set; 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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- 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
- lt_cv_ld_exported_symbols_list=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- lt_cv_ld_exported_symbols_list=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
- LDFLAGS="$save_LDFLAGS"
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_ld_exported_symbols_list" >&5
-$as_echo "$lt_cv_ld_exported_symbols_list" >&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" != ":"; then
- _lt_dsymutil='~$DSYMUTIL $lib || :'
- else
- _lt_dsymutil=
- fi
- ;;
- esac
-
-
-{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-$as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_header_stdc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- 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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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
-rm -f 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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- :
-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
-
-( exit $ac_status )
-ac_cv_header_stdc=no
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-$as_echo "$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
-
-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`
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-
-#include <$ac_header>
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- eval "$as_ac_Header=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_Header=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = 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
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-
-#include <$ac_header>
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- eval "$as_ac_Header=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_Header=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 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:$LINENO: checking for objdir" >&5
-$as_echo_n "checking for objdir... " >&6; }
-if test "${lt_cv_objdir+set}" = set; 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:$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
-
-# Sed substitution that helps us do robust quoting. It backslashifies
-# 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'
-
-# 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 "X$cc_temp" | $Xsed -e 's%.*/%%' -e "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:$LINENO: checking for ${ac_tool_prefix}file" >&5
-$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
-if test "${lt_cv_path_MAGIC_CMD+set}" = set; 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:$LINENO: result: $MAGIC_CMD" >&5
-$as_echo "$MAGIC_CMD" >&6; }
-else
- { $as_echo "$as_me:$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:$LINENO: checking for file" >&5
-$as_echo_n "checking for file... " >&6; }
-if test "${lt_cv_path_MAGIC_CMD+set}" = set; 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:$LINENO: result: $MAGIC_CMD" >&5
-$as_echo "$MAGIC_CMD" >&6; }
-else
- { $as_echo "$as_me:$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
- lt_prog_compiler_no_builtin_flag=' -fno-builtin'
-
- { $as_echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
-$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
-if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; 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:8610: $lt_compile\"" >&5)
- (eval "$lt_compile" 2>conftest.err)
- ac_status=$?
- cat conftest.err >&5
- echo "$as_me:8614: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/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:$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=
-
-{ $as_echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
-$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
-
- 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'
- ;;
-
- 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
- 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)
- 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'
- ;;
- pgcc* | pgf77* | pgf90* | pgf95*)
- # 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*)
- # IBM XL C 8.0/Fortran 10.1 on PPC
- lt_prog_compiler_wl='-Wl,'
- lt_prog_compiler_pic='-qpic'
- lt_prog_compiler_static='-qstaticlink'
- ;;
- *)
- case `$CC -V 2>&1 | sed 5q` in
- *Sun\ C*)
- # Sun C 5.9
- lt_prog_compiler_pic='-KPIC'
- lt_prog_compiler_static='-Bstatic'
- lt_prog_compiler_wl='-Wl,'
- ;;
- *Sun\ F*)
- # 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=''
- ;;
- 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*)
- 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:$LINENO: result: $lt_prog_compiler_pic" >&5
-$as_echo "$lt_prog_compiler_pic" >&6; }
-
-
-
-
-
-
-#
-# Check to make sure the PIC flag actually works.
-#
-if test -n "$lt_prog_compiler_pic"; then
- { $as_echo "$as_me:$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 test "${lt_cv_prog_compiler_pic_works+set}" = set; 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:8949: $lt_compile\"" >&5)
- (eval "$lt_compile" 2>conftest.err)
- ac_status=$?
- cat conftest.err >&5
- echo "$as_me:8953: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/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:$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:$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 test "${lt_cv_prog_compiler_static_works+set}" = set; 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 "X$_lt_linker_boilerplate" | $Xsed -e '/^$/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:$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:$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 test "${lt_cv_prog_compiler_c_o+set}" = set; 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:9054: $lt_compile\"" >&5)
- (eval "$lt_compile" 2>out/conftest.err)
- ac_status=$?
- cat out/conftest.err >&5
- echo "$as_me:9058: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/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:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
-$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
-
-
-
-
-
-
- { $as_echo "$as_me:$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 test "${lt_cv_prog_compiler_c_o+set}" = set; 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:9109: $lt_compile\"" >&5)
- (eval "$lt_compile" 2>out/conftest.err)
- ac_status=$?
- cat out/conftest.err >&5
- echo "$as_me:9113: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/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:$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:$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:$LINENO: result: $hard_links" >&5
-$as_echo "$hard_links" >&6; }
- if test "$hard_links" = no; then
- { $as_echo "$as_me:$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:$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
- if test "$with_gnu_ld" = 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
- *\ [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.9.1, 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 modify your PATH
-*** so that a non-GNU linker is found, and then restart.
-
-_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'
- 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/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
-
- 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
- ;;
-
- 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)
- 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=
- 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; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
- tmp_addflag=' $pic_flag'
- ;;
- pgf77* | pgf90* | pgf95*) # 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; $ECHO \"$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]*) # IBM XL C 8.0 on PPC (deal with xlf below)
- tmp_sharedflag='-qmkshrobj'
- tmp_addflag= ;;
- 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; $ECHO \"$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*)
- # 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 $compiler_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 $compiler_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 $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'
- 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 $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
- ;;
-
- 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 $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
-
- 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
- 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")) && (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.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- 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
-
-lt_aix_libpath_sed='
- /Import File Strings/,/^$/ {
- /^0/ {
- s/^0 *\(.*\)$/\1/
- p
- }
- }'
-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 "$aix_libpath"; then
- aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; 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 $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; 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.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- 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
-
-lt_aix_libpath_sed='
- /Import File Strings/,/^$/ {
- /^0/ {
- s/^0 *\(.*\)$/\1/
- p
- }
- }'
-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 "$aix_libpath"; then
- aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; 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'
- # Exported symbols can be pulled into shared objects from archives
- whole_archive_flag_spec='$convenience'
- 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.
- 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 `$ECHO "X$deplibs" | $Xsed -e '\''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'
- fix_srcfile_path='`cygpath -w "$srcfile"`'
- enable_shared_with_static_runtimes=yes
- ;;
-
- darwin* | rhapsody*)
-
-
- archive_cmds_need_lc=no
- hardcode_direct=no
- hardcode_automatic=yes
- hardcode_shlibpath_var=unsupported
- whole_archive_flag_spec=''
- 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=echo
- 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 -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 -fPIC ${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 -a "$with_gnu_ld" = no; then
- archive_cmds='$CC -shared -fPIC ${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 -a "$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 -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- *)
- archive_cmds='$CC -shared -fPIC ${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'
- ;;
- *)
- archive_cmds='$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
- 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 $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${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.
- save_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
- cat >conftest.$ac_ext <<_ACEOF
-int foo(void) {}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- 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
- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
-
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
- LDFLAGS="$save_LDFLAGS"
- else
- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -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" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${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" && $ECHO "X-set_version $verstring" | $Xsed` -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} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${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" && $ECHO "X-set_version $verstring" | $Xsed` -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 "X-set_version $verstring" | $Xsed` -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 ${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 ${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:$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:$LINENO: checking whether -lc should be explicitly linked in" >&5
-$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
- $RM conftest*
- echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-
- if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } 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:$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:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
- then
- archive_cmds_need_lc=no
- else
- archive_cmds_need_lc=yes
- fi
- allow_undefined_flag=$lt_save_allow_undefined_flag
- else
- cat conftest.err 1>&5
- fi
- $RM conftest*
- { $as_echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
-$as_echo "$archive_cmds_need_lc" >&6; }
- ;;
- esac
- fi
- ;;
-esac
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- { $as_echo "$as_me:$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
- lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
- if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
- # 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 -e 's/;/ /g'`
- else
- lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
- fi
- # 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; }
-}'`
- sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
-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=`$ECHO "X$lib" | $Xsed -e '\''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,$host_os in
- yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
- 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="/usr/lib /lib/w32api /lib /usr/local/lib"
- ;;
- mingw* | cegcc*)
- # MinGW DLLs use traditional 'lib' prefix
- soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
- sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
- if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
- # It is most probably a Windows format PATH printed by
- # mingw gcc, but we are running on Cygwin. Gcc prints its search
- # path with ; separators, and with drive letters. We can handle the
- # drive letters (cygwin fileutils understands them), so leave them,
- # especially as we might pass files found there to a mingw objdump,
- # which wouldn't understand a cygwinified path. Ahh.
- 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
- ;;
- 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
- ;;
-
- *)
- library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
- ;;
- esac
- dynamic_linker='Win32 ld.exe'
- # 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
- ;;
-
-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'
- ;;
-
-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)
- 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
- save_LDFLAGS=$LDFLAGS
- save_libdir=$libdir
- eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
- LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- 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
- if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then
- shlibpath_overrides_runpath=yes
-fi
-
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
- LDFLAGS=$save_LDFLAGS
- libdir=$save_libdir
-
- # 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;/^$/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:$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:$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:$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:$LINENO: checking for dlopen in -ldl" >&5
-$as_echo_n "checking for dlopen in -ldl... " >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldl $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- 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_cv_lib_dl_dlopen=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_lib_dl_dlopen=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = x""yes; 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
-
- ;;
-
- *)
- { $as_echo "$as_me:$LINENO: checking for shl_load" >&5
-$as_echo_n "checking for shl_load... " >&6; }
-if test "${ac_cv_func_shl_load+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define shl_load to an innocuous variant, in case <limits.h> declares shl_load.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define shl_load innocuous_shl_load
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char shl_load (); 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 shl_load
-
-/* 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 ();
-/* 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_shl_load || defined __stub___shl_load
-choke me
-#endif
-
-int
-main ()
-{
-return shl_load ();
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- 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_cv_func_shl_load=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_func_shl_load=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
-$as_echo "$ac_cv_func_shl_load" >&6; }
-if test "x$ac_cv_func_shl_load" = x""yes; then
- lt_cv_dlopen="shl_load"
-else
- { $as_echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
-$as_echo_n "checking for shl_load in -ldld... " >&6; }
-if test "${ac_cv_lib_dld_shl_load+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldld $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- 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_cv_lib_dld_shl_load=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_lib_dld_shl_load=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$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" = x""yes; then
- lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
-else
- { $as_echo "$as_me:$LINENO: checking for dlopen" >&5
-$as_echo_n "checking for dlopen... " >&6; }
-if test "${ac_cv_func_dlopen+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define dlopen innocuous_dlopen
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char dlopen (); 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 dlopen
-
-/* 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 ();
-/* 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_dlopen || defined __stub___dlopen
-choke me
-#endif
-
-int
-main ()
-{
-return dlopen ();
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- 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_cv_func_dlopen=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_func_dlopen=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
-$as_echo "$ac_cv_func_dlopen" >&6; }
-if test "x$ac_cv_func_dlopen" = x""yes; then
- lt_cv_dlopen="dlopen"
-else
- { $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-$as_echo_n "checking for dlopen in -ldl... " >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldl $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- 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_cv_lib_dl_dlopen=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_lib_dl_dlopen=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = x""yes; then
- lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
-else
- { $as_echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
-$as_echo_n "checking for dlopen in -lsvld... " >&6; }
-if test "${ac_cv_lib_svld_dlopen+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsvld $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- 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_cv_lib_svld_dlopen=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_lib_svld_dlopen=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
-$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
-if test "x$ac_cv_lib_svld_dlopen" = x""yes; then
- lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
-else
- { $as_echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
-$as_echo_n "checking for dld_link in -ldld... " >&6; }
-if test "${ac_cv_lib_dld_dld_link+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldld $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- 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_cv_lib_dld_dld_link=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_lib_dld_dld_link=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$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" = x""yes; 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:$LINENO: checking whether a program can dlopen itself" >&5
-$as_echo_n "checking whether a program can dlopen itself... " >&6; }
-if test "${lt_cv_dlopen_self+set}" = set; 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 11912 "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
-
-void fnord() { int i=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;
- /* dlclose (self); */
- }
- else
- puts (dlerror ());
-
- return status;
-}
-_LT_EOF
- if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && 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:$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:$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 test "${lt_cv_dlopen_self_static+set}" = set; 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 12008 "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
-
-void fnord() { int i=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;
- /* dlclose (self); */
- }
- else
- puts (dlerror ());
-
- return status;
-}
-_LT_EOF
- if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && 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:$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:$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:$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:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
- else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
- fi
- ;;
- *)
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
- ;;
- esac
-fi
-
-
-
-
-
-
-
-
-
-
-
-
- # Report which library types will actually be built
- { $as_echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
-$as_echo_n "checking if libtool supports shared libraries... " >&6; }
- { $as_echo "$as_me:$LINENO: result: $can_build_shared" >&5
-$as_echo "$can_build_shared" >&6; }
-
- { $as_echo "$as_me:$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:$LINENO: result: $enable_shared" >&5
-$as_echo "$enable_shared" >&6; }
-
- { $as_echo "$as_me:$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:$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:$LINENO: checking for pow in -lm" >&5
-$as_echo_n "checking for pow in -lm... " >&6; }
-if test "${ac_cv_lib_m_pow+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lm $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- 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_cv_lib_m_pow=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_lib_m_pow=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_m_pow" >&5
-$as_echo "$ac_cv_lib_m_pow" >&6; }
-if test "x$ac_cv_lib_m_pow" = x""yes; then
- LIBS="$LIBS -lm"
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for socket in -lsocket" >&5
-$as_echo_n "checking for socket in -lsocket... " >&6; }
-if test "${ac_cv_lib_socket_socket+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsocket $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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 socket ();
-int
-main ()
-{
-return socket ();
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- 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_cv_lib_socket_socket=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_lib_socket_socket=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5
-$as_echo "$ac_cv_lib_socket_socket" >&6; }
-if test "x$ac_cv_lib_socket_socket" = x""yes; then
- LIBS="$LIBS -lsocket"
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for inet_ntoa in -lnsl" >&5
-$as_echo_n "checking for inet_ntoa in -lnsl... " >&6; }
-if test "${ac_cv_lib_nsl_inet_ntoa+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lnsl $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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 inet_ntoa ();
-int
-main ()
-{
-return inet_ntoa ();
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- 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_cv_lib_nsl_inet_ntoa=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_lib_nsl_inet_ntoa=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_inet_ntoa" >&5
-$as_echo "$ac_cv_lib_nsl_inet_ntoa" >&6; }
-if test "x$ac_cv_lib_nsl_inet_ntoa" = x""yes; then
- LIBS="$LIBS -lnsl"
-fi
-
-
-# Checks for header files.
-{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-$as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_header_stdc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- 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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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
-rm -f 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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- :
-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
-
-( exit $ac_status )
-ac_cv_header_stdc=no
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-$as_echo "$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
-
-fi
-
-
-for ac_header in string.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- ( cat <<\_ASBOX
-## ------------------------------- ##
-## Report this to usd-help at eso.org ##
-## ------------------------------- ##
-_ASBOX
- ) | sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-# Checks for typedefs, structures, and compiler characteristics.
-{ $as_echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
-$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
-if test "${ac_cv_c_const+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_c_const=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_c_const=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
-$as_echo "$ac_cv_c_const" >&6; }
-if test $ac_cv_c_const = no; then
-
-cat >>confdefs.h <<\_ACEOF
-#define const /**/
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for inline" >&5
-$as_echo_n "checking for inline... " >&6; }
-if test "${ac_cv_c_inline+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_c_inline=no
-for ac_kw in inline __inline__ __inline; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_c_inline=$ac_kw
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-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:$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 memset
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); 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 $ac_func
-
-/* 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 $ac_func ();
-/* 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_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- 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
- eval "$as_ac_var=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-else
- { { $as_echo "$as_me:$LINENO: error: Required function is not available!" >&5
-$as_echo "$as_me: error: Required function is not available!" >&2;}
- { (exit 1); exit 1; }; }
-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
-
-
- { $as_echo "$as_me:$LINENO: checking whether strdup is declared" >&5
-$as_echo_n "checking whether strdup is declared... " >&6; }
-if test "${ac_cv_have_decl_strdup+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <string.h>
-
-int
-main ()
-{
-#ifndef strdup
- (void) strdup;
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_have_decl_strdup=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_have_decl_strdup=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_strdup" >&5
-$as_echo "$ac_cv_have_decl_strdup" >&6; }
-
-
- eso_save_CFLAGS="$CFLAGS"
-
- if test x"$GCC" = xyes; then
- CFLAGS="$CFLAGS -pedantic-errors"
- fi
-
- { $as_echo "$as_me:$LINENO: checking for strdup" >&5
-$as_echo_n "checking for strdup... " >&6; }
-if test "${ac_cv_func_strdup+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define strdup to an innocuous variant, in case <limits.h> declares strdup.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define strdup innocuous_strdup
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char strdup (); 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 strdup
-
-/* 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 strdup ();
-/* 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_strdup || defined __stub___strdup
-choke me
-#endif
-
-int
-main ()
-{
-return strdup ();
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- 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_cv_func_strdup=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_func_strdup=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_strdup" >&5
-$as_echo "$ac_cv_func_strdup" >&6; }
-
-
- 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
- cat >>confdefs.h <<\_ACEOF
-#define HAVE_STRDUP 1
-_ACEOF
-
- 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:$LINENO: checking whether getpwuid is declared" >&5
-$as_echo_n "checking whether getpwuid is declared... " >&6; }
-if test "${ac_cv_have_decl_getpwuid+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <pwd.h>
-
-int
-main ()
-{
-#ifndef getpwuid
- (void) getpwuid;
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_have_decl_getpwuid=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_have_decl_getpwuid=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_getpwuid" >&5
-$as_echo "$ac_cv_have_decl_getpwuid" >&6; }
-
-
- eso_save_CFLAGS="$CFLAGS"
-
- if test x"$GCC" = xyes; then
- CFLAGS="$CFLAGS -pedantic-errors"
- fi
-
- { $as_echo "$as_me:$LINENO: checking for getpwuid" >&5
-$as_echo_n "checking for getpwuid... " >&6; }
-if test "${ac_cv_func_getpwuid+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define getpwuid to an innocuous variant, in case <limits.h> declares getpwuid.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define getpwuid innocuous_getpwuid
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char getpwuid (); 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 getpwuid
-
-/* 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 getpwuid ();
-/* 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_getpwuid || defined __stub___getpwuid
-choke me
-#endif
-
-int
-main ()
-{
-return getpwuid ();
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- 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_cv_func_getpwuid=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_func_getpwuid=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_getpwuid" >&5
-$as_echo "$ac_cv_func_getpwuid" >&6; }
-
-
- 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_getpwuid" = xyes &&
- test x"$ac_cv_func_getpwuid" = xyes; then
- cat >>confdefs.h <<\_ACEOF
-#define HAVE_GETPWUID 1
-_ACEOF
-
- 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:$LINENO: checking whether getuid is declared" >&5
-$as_echo_n "checking whether getuid is declared... " >&6; }
-if test "${ac_cv_have_decl_getuid+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <unistd.h>
-
-int
-main ()
-{
-#ifndef getuid
- (void) getuid;
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_have_decl_getuid=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_have_decl_getuid=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_getuid" >&5
-$as_echo "$ac_cv_have_decl_getuid" >&6; }
-
-
- eso_save_CFLAGS="$CFLAGS"
-
- if test x"$GCC" = xyes; then
- CFLAGS="$CFLAGS -pedantic-errors"
- fi
-
- { $as_echo "$as_me:$LINENO: checking for getuid" >&5
-$as_echo_n "checking for getuid... " >&6; }
-if test "${ac_cv_func_getuid+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define getuid to an innocuous variant, in case <limits.h> declares getuid.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define getuid innocuous_getuid
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char getuid (); 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 getuid
-
-/* 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 getuid ();
-/* 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_getuid || defined __stub___getuid
-choke me
-#endif
-
-int
-main ()
-{
-return getuid ();
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- 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_cv_func_getuid=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_func_getuid=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_getuid" >&5
-$as_echo "$ac_cv_func_getuid" >&6; }
-
-
- 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_getuid" = xyes &&
- test x"$ac_cv_func_getuid" = xyes; then
- cat >>confdefs.h <<\_ACEOF
-#define HAVE_GETUID 1
-_ACEOF
-
- fi
-
-
-
-
-
-# Check for CPL/cfitsio presence and usability
-
-
-
- { $as_echo "$as_me:$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: 13698: $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: 13748: $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_echo "$as_me:$LINENO: error: CPL $cpl_notfound was not found on your system. Please check!" >&5
-$as_echo "$as_me: error: CPL $cpl_notfound was not found on your system. Please check!" >&2;}
- { (exit 1); exit 1; }; }
- else
- { $as_echo "$as_me:$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:$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: 13885: $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: 13941: $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_echo "$as_me:$LINENO: error: libcext $cpl_cext_notfound was not found on your system. Please check!" >&5
-$as_echo "$as_me: error: libcext $cpl_cext_notfound was not found on your system. Please check!" >&2;}
- { (exit 1); exit 1; }; }
- else
- { $as_echo "$as_me:$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:$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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
- #include <cxutils.h>
-
-int
-main ()
-{
-
- cx_program_set_name("MyProgram");
-
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- 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
- cpl_cext_is_usable="yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- cpl_cext_is_usable="no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-
- { $as_echo "$as_me:$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_echo "$as_me:$LINENO: error: Linking with libcext failed! Please check architecture!" >&5
-$as_echo "$as_me: error: Linking with libcext failed! Please check architecture!" >&2;}
- { (exit 1); exit 1; }; }
- fi
-
- else
-
- { $as_echo "$as_me:$LINENO: result: disabled" >&5
-$as_echo "disabled" >&6; }
- { $as_echo "$as_me:$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:$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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
- #include <cpl.h>
-
-int
-main ()
-{
-
- cpl_init(CPL_INIT_DEFAULT);
-
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- 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
- cpl_is_usable="yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- cpl_is_usable="no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-
- { $as_echo "$as_me:$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_echo "$as_me:$LINENO: error: Linking with CPL failed! Please check architecture!" >&5
-$as_echo "$as_me: error: Linking with CPL failed! Please check architecture!" >&2;}
- { (exit 1); exit 1; }; }
- fi
-
- else
-
- { $as_echo "$as_me:$LINENO: result: disabled" >&5
-$as_echo "disabled" >&6; }
- { $as_echo "$as_me:$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 whether --enable-largefile was given.
-if test "${enable_largefile+set}" = set; then
- enableval=$enable_largefile;
-fi
-
-if test "$enable_largefile" != no; then
-
- { $as_echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5
-$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
-if test "${ac_cv_sys_largefile_CC+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_sys_largefile_CC=no
- if test "$GCC" != yes; then
- ac_save_CC=$CC
- while :; do
- # IRIX 6.2 and later do not support large files by default,
- # so use the C compiler's -n32 option if that helps.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
- We can't simply define LARGE_OFF_T to be 9223372036854775807,
- since some C++ compilers masquerading as C compilers
- incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
- int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
- && LARGE_OFF_T % 2147483647 == 1)
- ? 1 : -1];
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
- 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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext
- CC="$CC -n32"
- 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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_sys_largefile_CC=' -n32'; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext
- break
- done
- CC=$ac_save_CC
- rm -f conftest.$ac_ext
- fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5
-$as_echo "$ac_cv_sys_largefile_CC" >&6; }
- if test "$ac_cv_sys_largefile_CC" != no; then
- CC=$CC$ac_cv_sys_largefile_CC
- fi
-
- { $as_echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5
-$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
-if test "${ac_cv_sys_file_offset_bits+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- while :; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
- We can't simply define LARGE_OFF_T to be 9223372036854775807,
- since some C++ compilers masquerading as C compilers
- incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
- int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
- && LARGE_OFF_T % 2147483647 == 1)
- ? 1 : -1];
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_sys_file_offset_bits=no; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#define _FILE_OFFSET_BITS 64
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
- We can't simply define LARGE_OFF_T to be 9223372036854775807,
- since some C++ compilers masquerading as C compilers
- incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
- int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
- && LARGE_OFF_T % 2147483647 == 1)
- ? 1 : -1];
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_sys_file_offset_bits=64; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- ac_cv_sys_file_offset_bits=unknown
- break
-done
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5
-$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
-case $ac_cv_sys_file_offset_bits in #(
- no | unknown) ;;
- *)
-cat >>confdefs.h <<_ACEOF
-#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
-_ACEOF
-;;
-esac
-rm -rf conftest*
- if test $ac_cv_sys_file_offset_bits = unknown; then
- { $as_echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5
-$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
-if test "${ac_cv_sys_large_files+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- while :; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
- We can't simply define LARGE_OFF_T to be 9223372036854775807,
- since some C++ compilers masquerading as C compilers
- incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
- int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
- && LARGE_OFF_T % 2147483647 == 1)
- ? 1 : -1];
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_sys_large_files=no; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#define _LARGE_FILES 1
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
- We can't simply define LARGE_OFF_T to be 9223372036854775807,
- since some C++ compilers masquerading as C compilers
- incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
- int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
- && LARGE_OFF_T % 2147483647 == 1)
- ? 1 : -1];
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_sys_large_files=1; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- ac_cv_sys_large_files=unknown
- break
-done
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5
-$as_echo "$ac_cv_sys_large_files" >&6; }
-case $ac_cv_sys_large_files in #(
- no | unknown) ;;
- *)
-cat >>confdefs.h <<_ACEOF
-#define _LARGE_FILES $ac_cv_sys_large_files
-_ACEOF
-;;
-esac
-rm -rf conftest*
- fi
-fi
-
-
-
-
-
-
-
- flag=`echo pthread | sed 'y%.=/+-%___p_%'`
- { $as_echo "$as_me:$LINENO: checking whether $CC supports -pthread" >&5
-$as_echo_n "checking whether $CC supports -pthread... " >&6; }
-if { as_var=eso_cv_prog_cc_$flag; eval "test \"\${$as_var+set}\" = set"; }; 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 -pthread -c conftest.$ac_ext 2>&1`"
- if test -z "$try_compile"; then
- try_link="`$CC -pthread -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
-ac_res=`eval 'as_val=${'eso_cv_prog_cc_$flag'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
- if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then
- :
-
- else
- :
-
- fi
-
-
- { $as_echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5
-$as_echo_n "checking for pthread_create in -lpthread... " >&6; }
-if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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 pthread_create ();
-int
-main ()
-{
-return pthread_create ();
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- 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_cv_lib_pthread_pthread_create=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_lib_pthread_pthread_create=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_create" >&5
-$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; }
-if test "x$ac_cv_lib_pthread_pthread_create" = x""yes; then
- eso_threads_have_libpthread=yes
-else
- eso_threads_have_libpthread=no
-fi
-
-
- if test "${ac_cv_header_pthread_h+set}" = set; then
- { $as_echo "$as_me:$LINENO: checking for pthread.h" >&5
-$as_echo_n "checking for pthread.h... " >&6; }
-if test "${ac_cv_header_pthread_h+set}" = set; then
- $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5
-$as_echo "$ac_cv_header_pthread_h" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking pthread.h usability" >&5
-$as_echo_n "checking pthread.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <pthread.h>
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking pthread.h presence" >&5
-$as_echo_n "checking pthread.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <pthread.h>
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: pthread.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: pthread.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: pthread.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: pthread.h: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: pthread.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: pthread.h: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: pthread.h: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: pthread.h: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: pthread.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: pthread.h: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: pthread.h: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: pthread.h: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: pthread.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: pthread.h: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: pthread.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: pthread.h: in the future, the compiler will take precedence" >&2;}
- ( cat <<\_ASBOX
-## ------------------------------- ##
-## Report this to usd-help at eso.org ##
-## ------------------------------- ##
-_ASBOX
- ) | sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for pthread.h" >&5
-$as_echo_n "checking for pthread.h... " >&6; }
-if test "${ac_cv_header_pthread_h+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_header_pthread_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5
-$as_echo "$ac_cv_header_pthread_h" >&6; }
-
-fi
-if test "x$ac_cv_header_pthread_h" = x""yes; then
- eso_threads_have_pthread_h=yes
-else
- eso_threads_have_pthread_h=no
-fi
-
-
-
- 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
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_PTHREAD_H 1
-_ACEOF
-
- 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
-
- if test "${eso_cv_threads_posix_header+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- eso_cv_threads_posix_header=$eso_threads_have_pthread_h
-fi
-
- if test "${eso_cv_threads_posix_lib+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- eso_cv_threads_posix_lib=$eso_threads_have_libpthread
-fi
-
- if test "${eso_cv_threads_posix_flags+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- eso_cv_threads_posix_flags=$eso_cv_prog_cc_pthread
-fi
-
- if test "${eso_cv_threads_posix+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- eso_cv_threads_posix=$eso_threads_posix
-fi
-
-
-
-
-
-
-
-
-
-
-
- cpl_cfitsio_check_version="3.310"
- cpl_cfitsio_check_header="fitsio.h"
- cpl_cfitsio_check_lib="libcfitsio.a"
-
- cpl_cfitsio_incdirs=""
- cpl_cfitsio_libdirs=""
- cpl_cfitsio_includes=""
- cpl_cfitsio_libraries=""
-
-
-# Check whether --with-cfitsio was given.
-if test "${with_cfitsio+set}" = set; then
- withval=$with_cfitsio;
- cpl_with_cfitsio=$withval
-
-fi
-
-
-
-# Check whether --with-cfitsio-includes was given.
-if test "${with_cfitsio_includes+set}" = set; then
- withval=$with_cfitsio_includes; cpl_with_cfitsio_includes=$withval
-fi
-
-
-
-# Check whether --with-cfitsio-libs was given.
-if test "${with_cfitsio_libs+set}" = set; then
- withval=$with_cfitsio_libs; cpl_with_cfitsio_libs=$withval
-fi
-
-
- # Check whether --enable-cfitsio-test was given.
-if test "${enable_cfitsio_test+set}" = set; then
- enableval=$enable_cfitsio_test; cpl_enable_cfitsio_test=$enableval
-else
- cpl_enable_cfitsio_test=yes
-fi
-
-
-
- # We need libpthread for the folloing tests
-
- if test -z "$LIBPTHREAD"; then
- { { $as_echo "$as_me:$LINENO: error: POSIX thread library was not found on your system! Please check!" >&5
-$as_echo "$as_me: error: POSIX thread library was not found on your system! Please check!" >&2;}
- { (exit 1); exit 1; }; }
- fi
-
-
- { $as_echo "$as_me:$LINENO: checking for cfitsio" >&5
-$as_echo_n "checking for cfitsio... " >&6; }
-
- 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
-
-
- cpl_cfitsio_includes=no
-
- for i in $cpl_cfitsio_incdirs; do
- for j in $cpl_cfitsio_check_header; do
-
- echo "configure: 15025: $i/$j" >&5
-
- if test -r "$i/$j"; then
- echo "taking that" >&5
- cpl_cfitsio_includes=$i
- break 2
- fi
- done
- done
-
-
-
- # 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
-
-
- cpl_cfitsio_libraries=no
-
- for i in $cpl_cfitsio_libdirs; do
- for j in $cpl_cfitsio_check_lib; do
-
- echo "configure: 15079: $i/$j" >&5
-
- if test -r "$i/$j"; then
- echo "taking that" >&5
- cpl_cfitsio_libraries=$i
- break 2
- fi
- done
- done
-
-
-
- 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
-
- { { $as_echo "$as_me:$LINENO: error: cfitsio $cpl_cfitsio_notfound was not found on your system. Please check!" >&5
-$as_echo "$as_me: error: cfitsio $cpl_cfitsio_notfound was not found on your system. Please check!" >&2;}
- { (exit 1); exit 1; }; }
- else
- { $as_echo "$as_me:$LINENO: result: libraries $cpl_cfitsio_libraries, headers $cpl_cfitsio_includes" >&5
-$as_echo "libraries $cpl_cfitsio_libraries, headers $cpl_cfitsio_includes" >&6; }
- 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
-
- { $as_echo "$as_me:$LINENO: checking whether cfitsio can be used" >&5
-$as_echo_n "checking whether cfitsio 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_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"
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
- #include <fitsio.h>
-
-int
-main ()
-{
-
- float v;
- fits_get_version(&v);
-
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- 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
- cpl_cfitsio_is_usable="yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- cpl_cfitsio_is_usable="no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-
- { $as_echo "$as_me:$LINENO: result: $cpl_cfitsio_is_usable" >&5
-$as_echo "$cpl_cfitsio_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_cfitsio_cflags_save"
- LDFLAGS="$cpl_cfitsio_ldflags_save"
- LIBS="$cpl_cfitsio_libs_save"
-
- if test x"$cpl_cfitsio_is_usable" = xno; then
- { { $as_echo "$as_me:$LINENO: error: Linking with cfitsio failed! Please check architecture!" >&5
-$as_echo "$as_me: error: Linking with cfitsio failed! Please check architecture!" >&2;}
- { (exit 1); exit 1; }; }
- fi
-
-
- # Check cfitsio version
-
- { $as_echo "$as_me:$LINENO: checking for a cfitsio version >= $cpl_cfitsio_check_version" >&5
-$as_echo_n "checking for a cfitsio version >= $cpl_cfitsio_check_version... " >&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_cfitsio_cflags_save="$CFLAGS"
- cpl_cfitsio_ldflags_save="$LDFLAGS"
- cpl_cfitsio_libs_save="$LIBS"
-
- CFLAGS="$CFITSIO_INCLUDES $CFLAGS"
-
- if test "$cross_compiling" = yes; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }; }
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
- #include <stdio.h>
- #include <fitsio.h>
-
-int
-main ()
-{
-
- int vlib = 0;
- int vmin = (int)(1000. * $cpl_cfitsio_check_version + 0.5);
-
- float v = CFITSIO_VERSION;
-
- 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;
-
- ;
- return 0;
-}
-_ACEOF
-rm -f 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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- cpl_cfitsio_version="`cat conftest.out`"
-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
-
-( exit $ac_status )
-
- cpl_cfitsio_version="no";
- cpl_cfitsio_version_found="`cat conftest.out`"
-
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-
- { $as_echo "$as_me:$LINENO: result: $cpl_cfitsio_version" >&5
-$as_echo "$cpl_cfitsio_version" >&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_cfitsio_cflags_save"
- LDFLAGS="$cpl_cfitsio_ldflags_save"
- LIBS="$cpl_cfitsio_libs_save"
-
- if test x"$cpl_cfitsio_version" = xno; then
- { { $as_echo "$as_me:$LINENO: error: Installed cfitsio ($cpl_cfitsio_version_found) is too old. Please update to version $cpl_cfitsio_check_version or newer." >&5
-$as_echo "$as_me: error: Installed cfitsio ($cpl_cfitsio_version_found) is too old. Please update to version $cpl_cfitsio_check_version or newer." >&2;}
- { (exit 1); exit 1; }; }
- fi
-
-
- # Check whether cfitsio has large file support
-
- 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_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"
-
- { $as_echo "$as_me:$LINENO: checking whether cfitsio provides fits_hdu_getoff()" >&5
-$as_echo_n "checking whether cfitsio provides fits_hdu_getoff()... " >&6; }
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
- #include <fitsio.h>
-
-int
-main ()
-{
-
- fitsfile f;
- int sts;
- fits_get_hduoff(&f, NULL, NULL, NULL, &sts);
-
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cpl_cfitsio_have_fits_get_hduoff="yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- cpl_cfitsio_have_fits_get_hduoff="no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
- { $as_echo "$as_me:$LINENO: result: $cpl_cfitsio_have_fits_get_hduoff" >&5
-$as_echo "$cpl_cfitsio_have_fits_get_hduoff" >&6; }
-
- { $as_echo "$as_me:$LINENO: checking whether cfitsio provides fits_get_hduaddrll()" >&5
-$as_echo_n "checking whether cfitsio provides fits_get_hduaddrll()... " >&6; }
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
- #include <fitsio.h>
-
-int
-main ()
-{
-
- fitsfile f;
- int sts;
- fits_get_hduaddrll(&f, NULL, NULL, NULL, &sts);
-
- ;
- return 0;
-}
-_ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cpl_cfitsio_have_fits_get_hduaddrll="yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- cpl_cfitsio_have_fits_get_hduaddrll="no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
- { $as_echo "$as_me:$LINENO: result: $cpl_cfitsio_have_fits_get_hduaddrll" >&5
-$as_echo "$cpl_cfitsio_have_fits_get_hduaddrll" >&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_cfitsio_cflags_save"
- LDFLAGS="$cpl_cfitsio_ldflags_save"
- LIBS="$cpl_cfitsio_libs_save"
-
-
- # Check whether cfitsio is thread-safe
-
- { $as_echo "$as_me:$LINENO: checking whether cfitsio was compiled with thread support" >&5
-$as_echo_n "checking whether cfitsio was compiled with thread support... " >&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_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"
-
- if test "$cross_compiling" = yes; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }; }
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
- #include <fitsio.h>
-
-int
-main ()
-{
-
- if (fits_is_reentrant() == 0) {
- return 1;
- }
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-rm -f 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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- cpl_cfitsio_is_thread_safe=yes
-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
-
-( exit $ac_status )
-cpl_cfitsio_is_thread_safe=no
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-
- { $as_echo "$as_me:$LINENO: result: $cpl_cfitsio_is_thread_safe" >&5
-$as_echo "$cpl_cfitsio_is_thread_safe" >&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_cfitsio_cflags_save"
- LDFLAGS="$cpl_cfitsio_ldflags_save"
- LIBS="$cpl_cfitsio_libs_save"
-
-
- # 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
-
- if test x"$cpl_cfitsio_have_fits_get_hduoff"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_FITS_GET_HDUOFF 1
-_ACEOF
-
- else
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_FITS_GET_HDUADDRLL 1
-_ACEOF
-
- fi
-
- fi
-
- else
- { $as_echo "$as_me:$LINENO: result: disabled" >&5
-$as_echo "disabled" >&6; }
- { $as_echo "$as_me:$LINENO: WARNING: cfitsio checks have been disabled! This package may not build!" >&5
-$as_echo "$as_me: WARNING: cfitsio checks have been disabled! This package may not build!" >&2;}
- CFITSIO_INCLUDES=""
- CFITSIO_LDFLAGS=""
- LIBCFITSIO=""
-
- cpl_cfitsio_is_thread_safe="undefined"
- fi
-
- if test "${cpl_cv_cfitsio_is_thread_safe+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cpl_cv_cfitsio_is_thread_safe=$cpl_cfitsio_is_thread_safe
-fi
-
-
-
-
-
-
-
-
-
- cpl_fftw_check_version="3.3.3"
- 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=""
-
-
-# Check whether --with-fftw was given.
-if test "${with_fftw+set}" = set; then
- withval=$with_fftw;
- cpl_with_fftw=$withval
-
-fi
-
-
-
-# Check whether --with-fftw-includes was given.
-if test "${with_fftw_includes+set}" = set; then
- withval=$with_fftw_includes; cpl_with_fftw_includes=$withval
-fi
-
-
-
-# Check whether --with-fftw-libs was given.
-if test "${with_fftw_libs+set}" = set; then
- withval=$with_fftw_libs; cpl_with_fftw_libs=$withval
-fi
-
-
-
- { $as_echo "$as_me:$LINENO: checking for fftw (normal-precision)" >&5
-$as_echo_n "checking for fftw (normal-precision)... " >&6; }
-
-
- # 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
-
-
- cpl_fftw_includes=no
-
- for i in $cpl_fftw_incdirs; do
- for j in $cpl_fftw_check_header; do
-
- echo "configure: 15704: $i/$j" >&5
-
- if test -r "$i/$j"; then
- echo "taking that" >&5
- cpl_fftw_includes=$i
- break 2
- fi
- done
- done
-
-
-
- # 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
-
-
- cpl_fftw_libraries=no
-
- for i in $cpl_fftw_libdirs; do
- for j in $cpl_fftw_check_lib; do
-
- echo "configure: 15760: $i/$j" >&5
-
- if test -r "$i/$j"; then
- echo "taking that" >&5
- cpl_fftw_libraries=$i
- break 2
- fi
- done
- done
-
-
- 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
-
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
- { $as_echo "$as_me:$LINENO: WARNING: fftw (normal-precision) $cpl_fftw_notfound was not found on your system." >&5
-$as_echo "$as_me: WARNING: fftw (normal-precision) $cpl_fftw_notfound was not found on your system." >&2;}
-
- else
-
- { $as_echo "$as_me:$LINENO: result: libraries $cpl_fftw_libraries, headers $cpl_fftw_includes" >&5
-$as_echo "libraries $cpl_fftw_libraries, headers $cpl_fftw_includes" >&6; }
-
-
- # 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
-
- { $as_echo "$as_me:$LINENO: checking for a fftw (normal-precision) version >= $cpl_fftw_check_version" >&5
-$as_echo_n "checking for a fftw (normal-precision) version >= $cpl_fftw_check_version... " >&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_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"
-
- if test "$cross_compiling" = yes; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }; }
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <fftw3.h>
-
-int
-main ()
-{
-
- 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;
-
- ;
- return 0;
-}
-_ACEOF
-rm -f 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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- cpl_fftw_version="`cat conftest.out`"
-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
-
-( exit $ac_status )
-
- cpl_fftw_version="no";
- cpl_fftw_version_found="`cat conftest.out`"
-
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-
- { $as_echo "$as_me:$LINENO: result: $cpl_fftw_version" >&5
-$as_echo "$cpl_fftw_version" >&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_fftw_cflags_save"
- LDFLAGS="$cpl_fftw_ldflags_save"
- LIBS="$cpl_fftw_libs_save"
-
- if test x"$cpl_fftw_version" = xno; then
-
- { $as_echo "$as_me:$LINENO: WARNING: Installed normal-precision fftw ($cpl_fftw_version_found) is too old" >&5
-$as_echo "$as_me: WARNING: Installed normal-precision fftw ($cpl_fftw_version_found) is too old" >&2;}
-
- FFTW_INCLUDES=""
- FFTW_LDFLAGS=""
- LIBFFTW=""
-
- else
-
-cat >>confdefs.h <<_ACEOF
-#define CPL_FFTW_INSTALLED 1
-_ACEOF
-
- fi
-
-
-
-
-
- fi
-
-
- # Check for single-precision fftw
-
- { $as_echo "$as_me:$LINENO: checking for fftw (single-precision)" >&5
-$as_echo_n "checking for fftw (single-precision)... " >&6; }
-
-
- cpl_fftwf_libraries=no
-
- for i in $cpl_fftw_libdirs; do
- for j in $cpl_fftwf_check_lib; do
-
- echo "configure: 15991: $i/$j" >&5
-
- if test -r "$i/$j"; then
- echo "taking that" >&5
- cpl_fftwf_libraries=$i
- break 2
- fi
- done
- done
-
-
- 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
-
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
- { $as_echo "$as_me:$LINENO: WARNING: fftw (single-precision) $cpl_fftw_notfound was not found on your system." >&5
-$as_echo "$as_me: WARNING: fftw (single-precision) $cpl_fftw_notfound was not found on your system." >&2;}
-
- else
-
- { $as_echo "$as_me:$LINENO: result: libraries $cpl_fftwf_libraries, headers $cpl_fftw_includes" >&5
-$as_echo "libraries $cpl_fftwf_libraries, headers $cpl_fftw_includes" >&6; }
-
-
- # 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
-
- { $as_echo "$as_me:$LINENO: checking for a fftw (single-precision) version >= $cpl_fftw_check_version" >&5
-$as_echo_n "checking for a fftw (single-precision) version >= $cpl_fftw_check_version... " >&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_fftw_cflags_save="$CFLAGS"
- cpl_fftw_ldflags_save="$LDFLAGS"
- cpl_fftw_libs_save="$LIBS"
-
- CFLAGS="$FFTWF_INCLUDES $CFLAGS"
- LDFLAGS="$FFTWF_LDFLAGS $LDFLAGS"
- LIBS="$LIBFFTWF"
-
- if test "$cross_compiling" = yes; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }; }
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <fftw3.h>
-
-int
-main ()
-{
-
- 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;
-
- ;
- return 0;
-}
-_ACEOF
-rm -f 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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- cpl_fftwf_version="`cat conftest.out`"
-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
-
-( exit $ac_status )
-
- cpl_fftwf_version="no";
- cpl_fftwf_version_found="`cat conftest.out`"
-
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-
- { $as_echo "$as_me:$LINENO: result: $cpl_fftwf_version" >&5
-$as_echo "$cpl_fftwf_version" >&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_fftw_cflags_save"
- LDFLAGS="$cpl_fftw_ldflags_save"
- LIBS="$cpl_fftw_libs_save"
-
- if test x"$cpl_fftwf_version" = xno; then
-
- { $as_echo "$as_me:$LINENO: WARNING: Installed single-precision fftw ($cpl_fftw_version_found) is too old!" >&5
-$as_echo "$as_me: WARNING: Installed single-precision fftw ($cpl_fftw_version_found) is too old!" >&2;}
-
- FFTWF_INCLUDES=""
- FFTWF_LDFLAGS=""
- LIBFFTWF=""
-
- else
-
-cat >>confdefs.h <<_ACEOF
-#define CPL_FFTWF_INSTALLED 1
-_ACEOF
-
- fi
-
-
-
-
-
- fi
-
-
-
-
-
- if test -z "$plugindir"; then
- plugindir='${libdir}/esopipes-plugins/${PACKAGE}-${VERSION}'
- fi
-
- if test -z "$privatelibdir"; then
- privatelibdir='${libdir}/${PACKAGE}-${VERSION}'
- fi
-
- htmldir='${datadir}/doc/esopipes/${PACKAGE}-${VERSION}/html'
-
- if test -z "$pipedocsdir"; then
- pipedocsdir='${datadir}/doc/esopipes/${PACKAGE}-${VERSION}/'
- fi
-
- if test -z "$configdir"; then
- configdir='${datadir}/${PACKAGE}/config'
- fi
-
- if test -z "$scriptsdir"; then
- scriptsdir='${datadir}/esopipes/${PACKAGE}-${VERSION}/scripts'
- fi
-
-
-
-
-
-
-
-
-
- # Define a preprocesor symbol for the plugin search paths
-
-
-cat >>confdefs.h <<_ACEOF
-#define AMBER_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 AMBER_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:$LINENO: checking for extra includes" >&5
-$as_echo_n "checking for extra includes... " >&6; }
- if test "${eso_cv_with_extra_includes+set}" = set; 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:$LINENO: result: added" >&5
-$as_echo "added" >&6; }
- else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
- fi
-
-
- { $as_echo "$as_me:$LINENO: checking for extra libs" >&5
-$as_echo_n "checking for extra libs... " >&6; }
- if test "${eso_cv_with_extra_libs+set}" = set; 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:$LINENO: result: added" >&5
-$as_echo "added" >&6; }
- else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
- fi
-
-
-
-
- # Symbols for package include file and library search paths
-
- AMBER_INCLUDES='-I$(top_srcdir)/amber'
- AMBER_LDFLAGS='-L$(top_builddir)/amber'
-
- all_includes='$(AMBER_INCLUDES) $(CPL_INCLUDES) $(CX_INCLUDES) $(EXTRA_INCLUDES)'
- all_ldflags='$(AMBER_LDFLAGS) $(CPL_LDFLAGS) $(CX_LDFLAGS) $(EXTRA_LDFLAGS)'
-
- # Library aliases
-
- LIBAMBER='$(top_builddir)/amber/libamber.la'
-
- # Substitute the defined symbols
-
-
-
-
-
-
- # Check for CPL and user defined libraries
-
-
-
- all_includes='$(AMBER_INCLUDES) $(CPL_INCLUDES) $(CX_INCLUDES) $(EXTRA_INCLUDES)'
- all_ldflags='$(AMBER_LDFLAGS) $(CPL_LDFLAGS) $(CX_LDFLAGS) $(EXTRA_LDFLAGS)'
-
-
-
-
-
-
-
- if test -n "PRODUCT_DID" || test -n "ESO-VLT-DIC.PRO-1.15"; then
-
-cat >>confdefs.h <<_ACEOF
-#define PRODUCT_DID "ESO-VLT-DIC.PRO-1.15"
-_ACEOF
-
-
- fi
-
-
-
-
- if test -n "QC_DID" || test -n "ESO-VLT-DIC.AMBER_QC-0.1"; then
-
-cat >>confdefs.h <<_ACEOF
-#define QC_DID "ESO-VLT-DIC.AMBER_QC-0.1"
-_ACEOF
-
-
- fi
-
-
-
-{ $as_echo "$as_me:$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:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-cat >>confdefs.h <<\_ACEOF
-#define WITH_DMALLOC 1
-_ACEOF
-
- LIBS="$LIBS -ldmalloc"
- LDFLAGS="$LDFLAGS -g"
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-
-#AC_CONFIG_SUBDIRS(fftw)
-
-ac_config_files="$ac_config_files Makefile Makefile.purify doxygen/Doxyfile amber/Makefile recipes/Makefile scripts/Makefile regtests/Makefile regtests/tests/Makefile 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:$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= ;; #(
- *) $as_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
- test "x$cache_file" != "x/dev/null" &&
- { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5
-$as_echo "$as_me: updating cache $cache_file" >&6;}
- cat confcache >$cache_file
- else
- { $as_echo "$as_me:$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=
-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.
- ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
- ac_ltlibobjs="$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_echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
-fi
-if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
- { { $as_echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"AMDEP\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
-fi
-if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
- { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
-fi
-if test -z "${PURIFY_TRUE}" && test -z "${PURIFY_FALSE}"; then
- { { $as_echo "$as_me:$LINENO: error: conditional \"PURIFY\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"PURIFY\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
-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:$LINENO: creating $CONFIG_STATUS" >&5
-$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
-cat >$CONFIG_STATUS <<_ACEOF || ac_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}
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_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
-
-
-
-
-# PATH needs CR
-# 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_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
-if (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
-
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-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.
-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); exit 1; }
-fi
-
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-done
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-LC_ALL=C
-export LC_ALL
-LANGUAGE=C
-export LANGUAGE
-
-# Required to use basename.
-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
-
-
-# Name of the executable.
-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'`
-
-# CDPATH.
-$as_unset CDPATH
-
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
-
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line after each line using $LINENO; the second 'sed'
- # does the real work. The second script uses 'N' to pair each
- # line-number line with the line containing $LINENO, and appends
- # trailing '-' during substitution so that $LINENO is not a special
- # case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # scripts with optimization help from Paolo Bonzini. 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
- { (exit 1); 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
-}
-
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
- as_dirname=dirname
-else
- as_dirname=false
-fi
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
--n*)
- case `echo 'x\c'` in
- *c*) ECHO_T=' ';; # ECHO_T is single tab character.
- *) ECHO_C='\c';;
- esac;;
-*)
- ECHO_N='-n';;
-esac
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-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=:
-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
-
-# 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 AMBER Instrument Pipeline $as_me 4.3.1, which was
-generated by GNU Autoconf 2.63. 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 from templates according to the
-current configuration.
-
-Usage: $0 [OPTION]... [FILE]...
-
- -h, --help print this help, then exit
- -V, --version print version number and configuration settings, 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 <bug-autoconf at gnu.org>."
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-ac_cs_version="\\
-AMBER Instrument Pipeline config.status 4.3.1
-configured by $0, generated by GNU Autoconf 2.63,
- with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
-
-Copyright (C) 2008 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=$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 ;;
- --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"` ;;
- esac
- CONFIG_FILES="$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
- CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'"
- ac_need_defaults=false;;
- --he | --h)
- # Conflict between --help and --header
- { $as_echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2
- { (exit 1); exit 1; }; };;
- --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_echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2
- { (exit 1); exit 1; }; } ;;
-
- *) ac_config_targets="$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 "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`'
-enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`'
-macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`'
-macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`'
-pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`'
-enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`'
-host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`'
-host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`'
-host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`'
-build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`'
-build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`'
-build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`'
-SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`'
-Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`'
-GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`'
-EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`'
-FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`'
-LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`'
-NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`'
-LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`'
-max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`'
-ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`'
-exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`'
-lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`'
-lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`'
-lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`'
-reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`'
-reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`'
-deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`'
-file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`'
-AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`'
-AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`'
-STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`'
-RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`'
-old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`'
-CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`'
-compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`'
-GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
-objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`'
-SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`'
-ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`'
-MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`'
-need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`'
-DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`'
-NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`'
-LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`'
-OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`'
-OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`'
-libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`'
-shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`'
-enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`'
-export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
-whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
-compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`'
-allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
-no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`'
-inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`'
-link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`'
-fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`'
-always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`'
-export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
-include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
-prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`'
-variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`'
-need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
-need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`'
-version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`'
-runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`'
-shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
-shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`'
-libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`'
-library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`'
-soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`'
-postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`'
-sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
-sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`'
-enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`'
-enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`'
-enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`'
-old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`'
-striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`'
-
-LTCC='$LTCC'
-LTCFLAGS='$LTCFLAGS'
-compiler='$compiler_DEFAULT'
-
-# Quote evaled strings.
-for var in SED \
-GREP \
-EGREP \
-FGREP \
-LD \
-NM \
-LN_S \
-lt_SP2NL \
-lt_NL2SP \
-reload_flag \
-OBJDUMP \
-deplibs_check_method \
-file_magic_cmd \
-AR \
-AR_FLAGS \
-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 \
-SHELL \
-ECHO \
-lt_prog_compiler_no_builtin_flag \
-lt_prog_compiler_wl \
-lt_prog_compiler_pic \
-lt_prog_compiler_static \
-lt_cv_prog_compiler_c_o \
-need_locks \
-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 \
-fix_srcfile_path \
-exclude_expsyms \
-include_expsyms \
-file_list_spec \
-variables_saved_for_relink \
-libname_spec \
-library_names_spec \
-soname_spec \
-finish_eval \
-old_striplib \
-striplib; do
- case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
- *[\\\\\\\`\\"\\\$]*)
- eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$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 \
-postinstall_cmds \
-postuninstall_cmds \
-finish_cmds \
-sys_lib_search_path_spec \
-sys_lib_dlsearch_path_spec; do
- case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
- *[\\\\\\\`\\"\\\$]*)
- eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
- ;;
- *)
- eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
- ;;
- esac
-done
-
-# Fix-up fallback echo if it was mangled by the above quoting rules.
-case \$lt_ECHO in
-*'\\\$0 --fallback-echo"') lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\`
- ;;
-esac
-
-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" ;;
- "amber/Makefile") CONFIG_FILES="$CONFIG_FILES amber/Makefile" ;;
- "recipes/Makefile") CONFIG_FILES="$CONFIG_FILES recipes/Makefile" ;;
- "scripts/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/Makefile" ;;
- "regtests/Makefile") CONFIG_FILES="$CONFIG_FILES regtests/Makefile" ;;
- "regtests/tests/Makefile") CONFIG_FILES="$CONFIG_FILES regtests/tests/Makefile" ;;
- "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
-
- *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
-$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
- { (exit 1); exit 1; }; };;
- 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=
- trap 'exit_status=$?
- { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
-' 0
- trap '{ (exit 1); exit 1; }' 1 2 13 15
-}
-# Create a (secure) tmp directory for tmp files.
-
-{
- tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
- test -n "$tmp" && test -d "$tmp"
-} ||
-{
- tmp=./conf$$-$RANDOM
- (umask 077 && mkdir "$tmp")
-} ||
-{
- $as_echo "$as_me: cannot create a temporary directory in ." >&2
- { (exit 1); exit 1; }
-}
-
-# 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='
'
-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 {' >"$tmp/subs1.awk" &&
-_ACEOF
-
-
-{
- echo "cat >conf$$subs.awk <<_ACEOF" &&
- echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
- echo "_ACEOF"
-} >conf$$subs.sh ||
- { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
- { (exit 1); exit 1; }; }
-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_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
- { (exit 1); exit 1; }; }
-
- 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_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
- { (exit 1); exit 1; }; }
- 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 >>"\$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 >>"\$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 < "$tmp/subs1.awk" > "$tmp/subs.awk" \
- || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5
-$as_echo "$as_me: error: could not setup config files machinery" >&2;}
- { (exit 1); exit 1; }; }
-_ACEOF
-
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ 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[ ]*=/{
-s/:*\$(srcdir):*/:/
-s/:*\${srcdir}:*/:/
-s/:*@srcdir@:*/:/
-s/^\([^=]*=[ ]*\):*/\1/
-s/:*$//
-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 >"$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_t=`sed -n "/$ac_delim/p" confdefs.h`
- if test -z "$ac_t"; then
- break
- elif $ac_last_try; then
- { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;}
- { (exit 1); exit 1; }; }
- 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_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5
-$as_echo "$as_me: error: could not setup config headers machinery" >&2;}
- { (exit 1); exit 1; }; }
-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_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5
-$as_echo "$as_me: error: invalid tag $ac_tag" >&2;}
- { (exit 1); exit 1; }; };;
- :[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="$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_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
-$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;}
- { (exit 1); exit 1; }; };;
- esac
- case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
- ac_file_inputs="$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:$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 >"$tmp/stdin" \
- || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
- { (exit 1); exit 1; }; } ;;
- 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"
- case $as_dir in #(
- -*) as_dir=./$as_dir;;
- esac
- test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
- 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_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
- { (exit 1); exit 1; }; }; }
- 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:$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 "$tmp/subs.awk" >$tmp/out \
- || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
- { (exit 1); exit 1; }; }
-
-test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
- { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
- { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
- { $as_echo "$as_me:$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 "$tmp/stdin"
- case $ac_file in
- -) cat "$tmp/out" && rm -f "$tmp/out";;
- *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
- esac \
- || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
- { (exit 1); exit 1; }; }
- ;;
- :H)
- #
- # CONFIG_HEADER
- #
- if test x"$ac_file" != x-; then
- {
- $as_echo "/* $configure_input */" \
- && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
- } >"$tmp/config.h" \
- || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
- { (exit 1); exit 1; }; }
- if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
- { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5
-$as_echo "$as_me: $ac_file is unchanged" >&6;}
- else
- rm -f "$ac_file"
- mv "$tmp/config.h" "$ac_file" \
- || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
- { (exit 1); exit 1; }; }
- fi
- else
- $as_echo "/* $configure_input */" \
- && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
- || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5
-$as_echo "$as_me: error: could not create -" >&2;}
- { (exit 1); exit 1; }; }
- 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:$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
- case $as_dir in #(
- -*) as_dir=./$as_dir;;
- esac
- test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
- 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_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
- { (exit 1); exit 1; }; }; }
- # 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 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
-
-# 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
-
-# How to create reloadable object files.
-reload_flag=$lt_reload_flag
-reload_cmds=$lt_reload_cmds
-
-# 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
-
-# The archiver.
-AR=$lt_AR
-AR_FLAGS=$lt_AR_FLAGS
-
-# 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
-
-# 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
-
-# The name of the directory that contains temporary libtool files.
-objdir=$objdir
-
-# Shell to use when invoking shell scripts.
-SHELL=$lt_SHELL
-
-# An echo program that does not interpret backslashes.
-ECHO=$lt_ECHO
-
-# 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
-
-# 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
-
-# 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
-
-# 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
-
-# How to pass a linker flag through the compiler.
-wl=$lt_lt_prog_compiler_wl
-
-# Additional compiler flags for building library objects.
-pic_flag=$lt_lt_prog_compiler_pic
-
-# 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
-
-# Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path=$lt_fix_srcfile_path
-
-# 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
-
-# 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 '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
- || (rm -f "$cfgfile"; exit 1)
-
- case $xsi_shell in
- yes)
- cat << \_LT_EOF >> "$cfgfile"
-
-# 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 ()
-{
- case ${1} in
- */*) func_dirname_result="${1%/*}${2}" ;;
- * ) func_dirname_result="${3}" ;;
- esac
-}
-
-# func_basename file
-func_basename ()
-{
- func_basename_result="${1##*/}"
-}
-
-# 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 ()
-{
- case ${1} in
- */*) func_dirname_result="${1%/*}${2}" ;;
- * ) func_dirname_result="${3}" ;;
- esac
- func_basename_result="${1##*/}"
-}
-
-# 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_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}"}
-}
-
-# func_opt_split
-func_opt_split ()
-{
- func_opt_split_opt=${1%%=*}
- func_opt_split_arg=${1#*=}
-}
-
-# func_lo2o object
-func_lo2o ()
-{
- case ${1} in
- *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
- *) func_lo2o_result=${1} ;;
- esac
-}
-
-# func_xform libobj-or-source
-func_xform ()
-{
- func_xform_result=${1%.*}.lo
-}
-
-# func_arith arithmetic-term...
-func_arith ()
-{
- func_arith_result=$(( $* ))
-}
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
- func_len_result=${#1}
-}
-
-_LT_EOF
- ;;
- *) # Bourne compatible functions.
- cat << \_LT_EOF >> "$cfgfile"
-
-# 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 ()
-{
- # Extract subdirectory from the argument.
- func_dirname_result=`$ECHO "X${1}" | $Xsed -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 file
-func_basename ()
-{
- func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
-}
-
-
-# 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 "X${3}" \
- | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
- *) func_stripname_result=`$ECHO "X${3}" \
- | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
- esac
-}
-
-# sed scripts:
-my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
-my_sed_long_arg='1s/^-[^=]*=//'
-
-# func_opt_split
-func_opt_split ()
-{
- func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
- func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
-}
-
-# func_lo2o object
-func_lo2o ()
-{
- func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
-}
-
-# func_xform libobj-or-source
-func_xform ()
-{
- func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'`
-}
-
-# func_arith arithmetic-term...
-func_arith ()
-{
- func_arith_result=`expr "$@"`
-}
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
- func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
-}
-
-_LT_EOF
-esac
-
-case $lt_shell_append in
- yes)
- cat << \_LT_EOF >> "$cfgfile"
-
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
- eval "$1+=\$2"
-}
-_LT_EOF
- ;;
- *)
- cat << \_LT_EOF >> "$cfgfile"
-
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
- eval "$1=\$$1\$2"
-}
-
-_LT_EOF
- ;;
- esac
-
-
- sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
- || (rm -f "$cfgfile"; exit 1)
-
- mv -f "$cfgfile" "$ofile" ||
- (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
- chmod +x "$ofile"
-
- ;;
-
- esac
-done # for ac_tag
-
-
-{ (exit 0); exit 0; }
-_ACEOF
-chmod +x $CONFIG_STATUS
-ac_clean_files=$ac_clean_files_save
-
-test $ac_write_fail = 0 ||
- { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;}
- { (exit 1); exit 1; }; }
-
-
-# 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 || { (exit 1); exit 1; }
-fi
-if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
- { $as_echo "$as_me:$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
deleted file mode 100644
index 8db44b0..0000000
--- a/configure.ac
+++ /dev/null
@@ -1,104 +0,0 @@
-# Process this file with autoconf to produce a configure script.
-
-AC_INIT([AMBER Instrument Pipeline], [4.3.1], [usd-help at eso.org], [amber])
-AC_PREREQ([2.59])
-
-AC_CONFIG_SRCDIR([Makefile.am])
-AC_CONFIG_AUX_DIR([admin])
-
-AC_CANONICAL_HOST
-AC_CANONICAL_TARGET
-
-AM_INIT_AUTOMAKE
-AC_CONFIG_HEADERS([config.h])
-
-AM_MAINTAINER_MODE
-
-AMBER_SET_PREFIX(${PIPE_HOME:-/usr/local})
-
-# 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;
-# }
-
-AMBER_SET_VERSION_INFO([$VERSION])
-
-# Checks for programs.
-AC_PROG_CC
-AC_PROG_CPP
-AM_PROG_CC_C_O
-AC_PROG_LN_S
-
-ESO_ENABLE_DEBUG(no)
-ESO_ENABLE_STRICT(no)
-ESO_PROG_CC_FLAG([fno-builtin], [CFLAGS="$CFLAGS -fno-builtin"])
-
-ESO_CHECK_DOCTOOLS
-
-#
-# Check for purify
-#
-CHECK_PURIFY
-
-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"])
-AC_CHECK_LIB(socket, socket, [LIBS="$LIBS -lsocket"])
-AC_CHECK_LIB(nsl, inet_ntoa, [LIBS="$LIBS -lnsl"])
-
-# 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 memset],[],
- [AC_MSG_ERROR([Required function is not available!])])
-ESO_FUNC_STRDUP
-ESO_FUNC_GETPWUID
-ESO_FUNC_GETUID
-
-# Check for CPL/cfitsio presence and usability
-
-CPL_CHECK_LIBS
-CPL_CHECK_CFITSIO([3.310])
-CPL_CHECK_FFTW([3.3.3])
-
-AMBER_SET_PATHS
-AMBER_CREATE_SYMBOLS
-
-AMBER_SET_DID(PRODUCT_DID, [ESO-VLT-DIC.PRO-1.15])
-AMBER_SET_DID(QC_DID, [ESO-VLT-DIC.AMBER_QC-0.1])
-
-AM_WITH_DMALLOC
-
-
-#AC_CONFIG_SUBDIRS(fftw)
-
-AC_CONFIG_FILES(Makefile
- Makefile.purify
- doxygen/Doxyfile
- amber/Makefile
- recipes/Makefile
- scripts/Makefile
- regtests/Makefile
- regtests/tests/Makefile
- tests/Makefile)
-AC_OUTPUT
diff --git a/doxygen/Doxyfile.in b/doxygen/Doxyfile.in
deleted file mode 100644
index 005072e..0000000
--- a/doxygen/Doxyfile.in
+++ /dev/null
@@ -1,221 +0,0 @@
-# @configure_input@
-# Doxyfile 1.3.8
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = "amber Pipeline Reference Manual"
-PROJECT_NUMBER = @VERSION@
-OUTPUT_DIRECTORY = ..
-CREATE_SUBDIRS = NO
-OUTPUT_LANGUAGE = English
-USE_WINDOWS_ENCODING = NO
-BRIEF_MEMBER_DESC = YES
-REPEAT_BRIEF = YES
-ABBREVIATE_BRIEF =
-ALWAYS_DETAILED_SEC = NO
-INLINE_INHERITED_MEMB = NO
-FULL_PATH_NAMES = NO
-STRIP_FROM_PATH =
-STRIP_FROM_INC_PATH =
-SHORT_NAMES = NO
-JAVADOC_AUTOBRIEF = NO
-MULTILINE_CPP_IS_BRIEF = NO
-DETAILS_AT_TOP = NO
-INHERIT_DOCS = YES
-DISTRIBUTE_GROUP_DOC = NO
-TAB_SIZE = 4
-ALIASES =
-OPTIMIZE_OUTPUT_FOR_C = YES
-OPTIMIZE_OUTPUT_JAVA = NO
-SUBGROUPING = YES
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-EXTRACT_ALL = NO
-EXTRACT_PRIVATE = NO
-EXTRACT_STATIC = NO
-EXTRACT_LOCAL_CLASSES = NO
-EXTRACT_LOCAL_METHODS = NO
-HIDE_UNDOC_MEMBERS = YES
-HIDE_UNDOC_CLASSES = YES
-HIDE_FRIEND_COMPOUNDS = NO
-HIDE_IN_BODY_DOCS = NO
-INTERNAL_DOCS = NO
-CASE_SENSE_NAMES = YES
-HIDE_SCOPE_NAMES = YES
-SHOW_INCLUDE_FILES = YES
-INLINE_INFO = NO
-SORT_MEMBER_DOCS = YES
-SORT_BRIEF_DOCS = NO
-SORT_BY_SCOPE_NAME = NO
-GENERATE_TODOLIST = NO
-GENERATE_TESTLIST = NO
-GENERATE_BUGLIST = YES
-GENERATE_DEPRECATEDLIST= YES
-ENABLED_SECTIONS =
-MAX_INITIALIZER_LINES = 30
-SHOW_USED_FILES = YES
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET = NO
-WARNINGS = YES
-WARN_IF_UNDOCUMENTED = NO
-WARN_IF_DOC_ERROR = YES
-WARN_FORMAT =
-WARN_LOGFILE =
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = ../doxygen \
- ../amber \
- ../recipes
-FILE_PATTERNS = *.dox \
- *.h \
- *.c \
- *.cpp
-RECURSIVE = YES
-EXCLUDE =
-EXCLUDE_SYMLINKS = NO
-EXCLUDE_PATTERNS = */CVS/* \
- */test/* \
- */tests/*
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS =
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH = .
-INPUT_FILTER =
-FILTER_PATTERNS =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER = YES
-INLINE_SOURCES = NO
-STRIP_CODE_COMMENTS = YES
-REFERENCED_BY_RELATION = YES
-REFERENCES_RELATION = YES
-VERBATIM_HEADERS = YES
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX = YES
-COLS_IN_ALPHA_INDEX = 3
-IGNORE_PREFIX =
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML = YES
-HTML_OUTPUT = html
-HTML_FILE_EXTENSION = .html
-HTML_HEADER = header.html
-HTML_FOOTER = footer.html
-HTML_STYLESHEET = amber.css
-HTML_ALIGN_MEMBERS = YES
-GENERATE_HTMLHELP = NO
-CHM_FILE =
-HHC_LOCATION =
-GENERATE_CHI = NO
-BINARY_TOC = NO
-TOC_EXPAND = NO
-DISABLE_INDEX = YES
-ENUM_VALUES_PER_LINE = 4
-GENERATE_TREEVIEW = NO
-TREEVIEW_WIDTH = 250
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-GENERATE_LATEX = NO
-LATEX_OUTPUT = latex
-LATEX_CMD_NAME = latex
-MAKEINDEX_CMD_NAME = makeindex
-COMPACT_LATEX = NO
-PAPER_TYPE = a4wide
-EXTRA_PACKAGES =
-LATEX_HEADER =
-PDF_HYPERLINKS = NO
-USE_PDFLATEX = NO
-LATEX_BATCHMODE = NO
-LATEX_HIDE_INDICES = NO
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF = NO
-RTF_OUTPUT = rtf
-COMPACT_RTF = NO
-RTF_HYPERLINKS = NO
-RTF_STYLESHEET_FILE =
-RTF_EXTENSIONS_FILE =
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN = NO
-MAN_OUTPUT = man
-MAN_EXTENSION =
-MAN_LINKS = NO
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML = NO
-XML_OUTPUT = xml
-XML_SCHEMA =
-XML_DTD =
-XML_PROGRAMLISTING = YES
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF = NO
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-GENERATE_PERLMOD = NO
-PERLMOD_LATEX = NO
-PERLMOD_PRETTY = YES
-PERLMOD_MAKEVAR_PREFIX =
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = NO
-EXPAND_ONLY_PREDEF = NO
-SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-TAGFILES =
-GENERATE_TAGFILE =
-ALLEXTERNALS = NO
-EXTERNAL_GROUPS = YES
-PERL_PATH =
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS = YES
-HIDE_UNDOC_RELATIONS = NO
-HAVE_DOT = NO
-CLASS_GRAPH = YES
-COLLABORATION_GRAPH = YES
-UML_LOOK = NO
-TEMPLATE_RELATIONS = YES
-INCLUDE_GRAPH = YES
-INCLUDED_BY_GRAPH = YES
-CALL_GRAPH = NO
-GRAPHICAL_HIERARCHY = NO
-DOT_IMAGE_FORMAT = png
-DOT_PATH =
-DOTFILE_DIRS =
-MAX_DOT_GRAPH_WIDTH = 1024
-MAX_DOT_GRAPH_HEIGHT = 1024
-MAX_DOT_GRAPH_DEPTH = 0
-GENERATE_LEGEND = YES
-DOT_CLEANUP = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
-#---------------------------------------------------------------------------
-SEARCHENGINE = NO
diff --git a/m4macros/cpl.m4 b/m4macros/cpl.m4
deleted file mode 100644
index 956b580..0000000
--- a/m4macros/cpl.m4
+++ /dev/null
@@ -1,1435 +0,0 @@
-# CPL_CHECK_CFITSIO(version)
-#---------------------------
-# Checks for the cfitsio library and header files.
-AC_DEFUN([CPL_CHECK_CFITSIO],
-[
-
- AC_REQUIRE([AC_SYS_LARGEFILE])
- 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"
-
- 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 = CFITSIO_VERSION;
-
- 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 was compiled with thread 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"
-
- AC_RUN_IFELSE([AC_LANG_PROGRAM(
- [[
- #include <fitsio.h>
- ]],
- [
- if (fits_is_reentrant() == 0) {
- return 1;
- }
-
- return 0;
- ])],
- [cpl_cfitsio_is_thread_safe=yes],
- [cpl_cfitsio_is_thread_safe=no])
-
- AC_MSG_RESULT([$cpl_cfitsio_is_thread_safe])
-
- AC_LANG_POP(C)
-
- CFLAGS="$cpl_cfitsio_cflags_save"
- LDFLAGS="$cpl_cfitsio_ldflags_save"
- LIBS="$cpl_cfitsio_libs_save"
-
-
- # 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
-
- 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
-
- 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"
- fi
-
- 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 FFTW 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
deleted file mode 100644
index 7753b13..0000000
--- a/m4macros/eso.m4
+++ /dev/null
@@ -1,1105 +0,0 @@
-# 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_PROG_CC_ATTRIBUTE(VARIANT1, [VARIANT2], [CODE], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-#----------------------------------------------------------------------------------------------
-AC_DEFUN([ESO_PROG_CC_ATTRIBUTE],
-[
-
- AC_CACHE_CHECK([if $CC supports __attribute__(( ifelse([$2], , [$1], [$2]) ))],
- AS_TR_SH([eso_cv_prog_cc_attribute_$1]),
- [
- eso_save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS"
-
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([$3])],
- [eval "AS_TR_SH([eso_cv_prog_cc_attribute_$1])='yes'"],
- [eval "AS_TR_SH([eso_cv_prog_cc_attribute_$1])='no'"])
- CFLAGS="$eso_save_CFLAGS"
- ])
-
- if eval "test x\$AS_TR_SH([eso_cv_prog_cc_attribute_$1]) = xyes"; then
- :
- $4
- else
- :
- $5
- fi
-
-])
-
-
-# ESO_PROG_CC_ATTRIBUTE_VISIBILITY(ARG, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-#--------------------------------------------------------------------------------
-AC_DEFUN([ESO_PROG_CC_ATTRIBUTE_VISIBILITY],
-[
-
- ESO_PROG_CC_ATTRIBUTE([visibility_$1], [visibility("$1")],
- [void __attribute__((visibility("$1"))) $1_function() { }],
- [$2], [$3])
-
-])
-
-
-# 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/libtool.m4 b/m4macros/libtool.m4
deleted file mode 100644
index 671cde1..0000000
--- a/m4macros/libtool.m4
+++ /dev/null
@@ -1,7360 +0,0 @@
-# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
-#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-# 2006, 2007, 2008 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 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 56 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_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
-
-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 "X$cc_temp" | $Xsed -e 's%.*/%%' -e "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
-_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_CMD_RELOAD])dnl
-m4_require([_LT_CHECK_MAGIC_METHOD])dnl
-m4_require([_LT_CMD_OLD_ARCHIVE])dnl
-m4_require([_LT_CMD_GLOBAL_SYMBOLS])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
-_LT_PROG_ECHO_BACKSLASH
-
-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
-
-# Sed substitution that helps us do robust quoting. It backslashifies
-# 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'
-
-# 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_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 "X$][$1" | $Xsed -e "$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 "X$<var>" | $Xsed -e "$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'
-
-# Quote evaled strings.
-for var in lt_decl_all_varnames([[ \
-]], lt_decl_quote_varnames); do
- case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
- *[[\\\\\\\`\\"\\\$]]*)
- eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$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 "X\\\\\$\$var"\` in
- *[[\\\\\\\`\\"\\\$]]*)
- eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
- ;;
- *)
- eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
- ;;
- esac
-done
-
-# Fix-up fallback echo if it was mangled by the above quoting rules.
-case \$lt_ECHO in
-*'\\\[$]0 --fallback-echo"')dnl "
- lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\`
- ;;
-esac
-
-_LT_OUTPUT_LIBTOOL_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])
-cat >"$CONFIG_LT" <<_LTEOF
-#! $SHELL
-# Generated by $as_me.
-# Run this file to recreate a libtool stub with the current configuration.
-
-lt_cl_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_LTEOF
-
-cat >>"$CONFIG_LT" <<\_LTEOF
-AS_SHELL_SANITIZE
-_AS_PREPARE
-
-exec AS_MESSAGE_FD>&1
-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) 2008 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.
-if test "$no_create" != yes; then
- 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)
-fi
-])# 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 '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
- || (rm -f "$cfgfile"; exit 1)
-
- _LT_PROG_XSI_SHELLFNS
-
- sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
- || (rm -f "$cfgfile"; exit 1)
-
- 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)])
-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], [])
-
-
-# _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"
- ])
- 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" != ":"; 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
- _LT_TAGVAR(whole_archive_flag_spec, $1)=''
- _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=echo
- _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
-# -----------------------
-# 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.
-m4_defun([_LT_SYS_MODULE_PATH_AIX],
-[m4_require([_LT_DECL_SED])dnl
-AC_LINK_IFELSE(AC_LANG_PROGRAM,[
-lt_aix_libpath_sed='
- /Import File Strings/,/^$/ {
- /^0/ {
- s/^0 *\(.*\)$/\1/
- p
- }
- }'
-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 "$aix_libpath"; then
- aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi],[])
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
-])# _LT_SYS_MODULE_PATH_AIX
-
-
-# _LT_SHELL_INIT(ARG)
-# -------------------
-m4_define([_LT_SHELL_INIT],
-[ifdef([AC_DIVERSION_NOTICE],
- [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
- [AC_DIVERT_PUSH(NOTICE)])
-$1
-AC_DIVERT_POP
-])# _LT_SHELL_INIT
-
-
-# _LT_PROG_ECHO_BACKSLASH
-# -----------------------
-# Add some code to the start of the generated configure script which
-# will find an echo command which doesn't interpret backslashes.
-m4_defun([_LT_PROG_ECHO_BACKSLASH],
-[_LT_SHELL_INIT([
-# Check that we are running under the correct shell.
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-case X$lt_ECHO in
-X*--fallback-echo)
- # Remove one level of quotation (which was required for Make).
- ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
- ;;
-esac
-
-ECHO=${lt_ECHO-echo}
-if test "X[$]1" = X--no-reexec; then
- # Discard the --no-reexec flag, and continue.
- shift
-elif test "X[$]1" = X--fallback-echo; then
- # Avoid inline document here, it may be left over
- :
-elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
- # Yippee, $ECHO works!
- :
-else
- # Restart under the correct shell.
- exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
-fi
-
-if test "X[$]1" = X--fallback-echo; then
- # used as fallback echo
- shift
- cat <<_LT_EOF
-[$]*
-_LT_EOF
- exit 0
-fi
-
-# 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
-
-if test -z "$lt_ECHO"; then
- if test "X${echo_test_string+set}" != Xset; then
- # find a string as large as possible, as long as the shell can cope with it
- for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
- # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
- if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
- { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
- then
- break
- fi
- done
- fi
-
- if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
- echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
- :
- else
- # The Solaris, AIX, and Digital Unix default echo programs unquote
- # backslashes. This makes it impossible to quote backslashes using
- # echo "$something" | sed 's/\\/\\\\/g'
- #
- # So, first we look for a working echo in the user's PATH.
-
- lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
- for dir in $PATH /usr/ucb; do
- IFS="$lt_save_ifs"
- if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
- test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
- echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
- ECHO="$dir/echo"
- break
- fi
- done
- IFS="$lt_save_ifs"
-
- if test "X$ECHO" = Xecho; then
- # We didn't find a better echo, so look for alternatives.
- if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
- echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
- # This shell has a builtin print -r that does the trick.
- ECHO='print -r'
- elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
- test "X$CONFIG_SHELL" != X/bin/ksh; then
- # If we have ksh, try running configure again with it.
- ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
- export ORIGINAL_CONFIG_SHELL
- CONFIG_SHELL=/bin/ksh
- export CONFIG_SHELL
- exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
- else
- # Try using printf.
- ECHO='printf %s\n'
- if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
- echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
- # Cool, printf works
- :
- elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
- test "X$echo_testing_string" = 'X\t' &&
- echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
- CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
- export CONFIG_SHELL
- SHELL="$CONFIG_SHELL"
- export SHELL
- ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
- elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
- test "X$echo_testing_string" = 'X\t' &&
- echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
- ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
- else
- # maybe with a smaller string...
- prev=:
-
- for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
- if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
- then
- break
- fi
- prev="$cmd"
- done
-
- if test "$prev" != 'sed 50q "[$]0"'; then
- echo_test_string=`eval $prev`
- export echo_test_string
- exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
- else
- # Oops. We lost completely, so just stick with echo.
- ECHO=echo
- fi
- fi
- fi
- fi
- fi
-fi
-
-# Copy echo and quote the copy suitably for passing to libtool from
-# the Makefile, instead of quoting the original, which is used later.
-lt_ECHO=$ECHO
-if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
- lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
-fi
-
-AC_SUBST(lt_ECHO)
-])
-_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
-_LT_DECL([], [ECHO], [1],
- [An echo program that does not interpret backslashes])
-])# _LT_PROG_ECHO_BACKSLASH
-
-
-# _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 __oline__ "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_CMD_OLD_ARCHIVE
-# -------------------
-m4_defun([_LT_CMD_OLD_ARCHIVE],
-[AC_CHECK_TOOL(AR, ar, false)
-test -z "$AR" && AR=ar
-test -z "$AR_FLAGS" && AR_FLAGS=cru
-_LT_DECL([], [AR], [1], [The archiver])
-_LT_DECL([], [AR_FLAGS], [1])
-
-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
-_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_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:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
- (eval "$lt_compile" 2>conftest.err)
- ac_status=$?
- cat conftest.err >&AS_MESSAGE_LOG_FD
- echo "$as_me:__oline__: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/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 "X$_lt_linker_boilerplate" | $Xsed -e '/^$/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;
- ;;
-
- 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"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
- = "XX$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 __oline__ "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
-
-void fnord() { int i=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;
- /* 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:__oline__: $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:__oline__: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/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
-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
- lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
- if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
- # 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 -e 's/;/ /g'`
- else
- lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
- fi
- # 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; }
-}'`
- sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
-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=`$ECHO "X$lib" | $Xsed -e '\''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,$host_os in
- yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
- 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="/usr/lib /lib/w32api /lib /usr/local/lib"
- ;;
- mingw* | cegcc*)
- # MinGW DLLs use traditional 'lib' prefix
- soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
- sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
- if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
- # It is most probably a Windows format PATH printed by
- # mingw gcc, but we are running on Cygwin. Gcc prints its search
- # path with ; separators, and with drive letters. We can handle the
- # drive letters (cygwin fileutils understands them), so leave them,
- # especially as we might pass files found there to a mingw objdump,
- # which wouldn't understand a cygwinified path. Ahh.
- 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
- ;;
- 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
- ;;
-
- *)
- library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
- ;;
- esac
- dynamic_linker='Win32 ld.exe'
- # 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
- ;;
-
-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'
- ;;
-
-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)
- 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
- 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],
- [shlibpath_overrides_runpath=yes])])
- LDFLAGS=$save_LDFLAGS
- libdir=$save_libdir
-
- # 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;/^$/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([], [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
-
-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
- 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_DECL([], [reload_flag], [1], [How to create reloadable object files])dnl
-_LT_DECL([], [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.
- if ( 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
- lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
- 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
- ;;
-
-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]) 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)
- 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_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_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.
- AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :)
- 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:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
- (eval "$ac_compile" 2>conftest.err)
- cat conftest.err >&AS_MESSAGE_LOG_FD
- (eval echo "\"\$as_me:__oline__: $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:__oline__: 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_LIB_M
-# --------
-# check for math library
-AC_DEFUN([LT_LIB_M],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-LIBM=
-case $host in
-*-*-beos* | *-*-cygwin* | *-*-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
- _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
-
- _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([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
-
- # 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
-#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. */
-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_save_LIBS="$LIBS"
- lt_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_save_LIBS"
- CFLAGS="$lt_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
-
-_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_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)=
-
-AC_MSG_CHECKING([for $compiler option to produce PIC])
-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)=
- ;;
- 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
- ;;
- 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)
- 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*)
- # IBM XL 8.0 on PPC
- _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*)
- # 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'
- ;;
-
- 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
- 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)
- 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'
- ;;
- pgcc* | pgf77* | pgf90* | pgf95*)
- # 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*)
- # IBM XL C 8.0/Fortran 10.1 on PPC
- _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)='-Wl,'
- ;;
- *Sun\ F*)
- # 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)=''
- ;;
- 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*)
- _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_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
-_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
- [How to pass a linker flag through the compiler])
-
-#
-# 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])
-
-#
-# 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_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'
- 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
- 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")) && ([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*)
- _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
- ;;
- *)
- _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
- ;;
- esac
- _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
-], [
- 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
- if test "$with_gnu_ld" = 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
- *\ [[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.9.1, 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 modify your PATH
-*** so that a non-GNU linker is found, and then restart.
-
-_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(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/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
-
- 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
- ;;
-
- 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)
- 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=
- 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; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
- tmp_addflag=' $pic_flag'
- ;;
- pgf77* | pgf90* | pgf95*) # 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; $ECHO \"$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]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
- tmp_sharedflag='-qmkshrobj'
- tmp_addflag= ;;
- 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; $ECHO \"$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*)
- # 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 $compiler_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 $compiler_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 $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'
- 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 $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
- ;;
-
- 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 $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
-
- 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
- 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")) && ([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
- _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 $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; 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
- _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'
- # Exported symbols can be pulled into shared objects from archives
- _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
- _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.
- _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 `$ECHO "X$deplibs" | $Xsed -e '\''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(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
- _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
- ;;
-
- 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 -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 -fPIC ${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 -a "$with_gnu_ld" = no; then
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${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 -a "$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 -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- *)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${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'
- ;;
- *)
- _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 $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${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.
- save_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
- AC_LINK_IFELSE(int foo(void) {},
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
- )
- LDFLAGS="$save_LDFLAGS"
- else
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -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" && $ECHO "X-set_version $verstring" | $Xsed` -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" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${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" && $ECHO "X-set_version $verstring" | $Xsed` -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} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${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" && $ECHO "X-set_version $verstring" | $Xsed` -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 "X-set_version $verstring" | $Xsed` -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 ${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 ${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_MSG_CHECKING([whether -lc should be explicitly linked in])
- $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_TAGVAR(archive_cmds_need_lc, $1)=no
- else
- _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*
- AC_MSG_RESULT([$_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([], [fix_srcfile_path], [1],
- [Fix the shell variable $srcfile for the compiler])
-_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([], [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_PROG_CXX
-# ------------
-# Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++
-# compiler, we have our own version here.
-m4_defun([_LT_PROG_CXX],
-[
-pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes])
-AC_PROG_CXX
-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
-popdef([AC_MSG_ERROR])
-])# _LT_PROG_CXX
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([_LT_PROG_CXX], [])
-
-
-# _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],
-[AC_REQUIRE([_LT_PROG_CXX])dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_EGREP])dnl
-
-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(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_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++"}
- 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 -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -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 "\-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
- _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 $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; 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
- _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'
- # Exported symbols can be pulled into shared objects from archives
- _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
- _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*)
- # _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(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
- ;;
- 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*)
- ;;
-
- 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; $ECHO "X$list" | $Xsed'
- ;;
- *)
- if test "$GXX" = yes; then
- _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${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; $ECHO "X$list" | $Xsed'
- ;;
- *)
- 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 -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- *)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${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" && $ECHO "X-set_version $verstring" | $Xsed` -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 -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
- else
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -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)
- 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; $ECHO "X$list" | $Xsed'
-
- _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 | $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 | $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 | $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 | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
- ;;
- *) # Version 6 will 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; $ECHO \"$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=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
- ;;
- xl*)
- # 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; $ECHO \"$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='echo'
-
- # 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=echo
- 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" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -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" && $ECHO "X-set_version $verstring" | $Xsed` -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 "X-set_version $verstring" | $Xsed` -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=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
- ;;
- *)
- 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" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
- ;;
- *)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${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 "\-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*)
- # 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='echo'
-
- # 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 -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 -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 "\-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 "\-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(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
- 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_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
-# 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
-])
-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 $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
- else
- prev=
- fi
-
- if test "$pre_test_object_deps_done" = no; then
- case $p 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
- ;;
-
- *.$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
-
-# 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*)
- # 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_PROG_F77
-# ------------
-# Since AC_PROG_F77 is broken, in that it returns the empty string
-# if there is no fortran compiler, we have our own version here.
-m4_defun([_LT_PROG_F77],
-[
-pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes])
-AC_PROG_F77
-if test -z "$F77" || test "X$F77" = "Xno"; then
- _lt_disable_F77=yes
-fi
-popdef([AC_MSG_ERROR])
-])# _LT_PROG_F77
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([_LT_PROG_F77], [])
-
-
-# _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_REQUIRE([_LT_PROG_F77])dnl
-AC_LANG_PUSH(Fortran 77)
-
-_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(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
- CC=${F77-"f77"}
- 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"
-fi # test "$_lt_disable_F77" != yes
-
-AC_LANG_POP
-])# _LT_LANG_F77_CONFIG
-
-
-# _LT_PROG_FC
-# -----------
-# Since AC_PROG_FC is broken, in that it returns the empty string
-# if there is no fortran compiler, we have our own version here.
-m4_defun([_LT_PROG_FC],
-[
-pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes])
-AC_PROG_FC
-if test -z "$FC" || test "X$FC" = "Xno"; then
- _lt_disable_FC=yes
-fi
-popdef([AC_MSG_ERROR])
-])# _LT_PROG_FC
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([_LT_PROG_FC], [])
-
-
-# _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_REQUIRE([_LT_PROG_FC])dnl
-AC_LANG_PUSH(Fortran)
-
-_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(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
- CC=${FC-"f95"}
- 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"
-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_GCC=$GCC
-GCC=yes
-CC=${GCJ-"gcj"}
-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
-
-## 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"
-])# _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_GCC=$GCC
-GCC=
-CC=${RC-"windres"}
-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"
-])# _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_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"}, \
- = c,a/b,, \
- && 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_XSI_SHELLFNS
-# ---------------------
-# Bourne and XSI compatible variants of some useful shell functions.
-m4_defun([_LT_PROG_XSI_SHELLFNS],
-[case $xsi_shell in
- yes)
- cat << \_LT_EOF >> "$cfgfile"
-
-# 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 ()
-{
- case ${1} in
- */*) func_dirname_result="${1%/*}${2}" ;;
- * ) func_dirname_result="${3}" ;;
- esac
-}
-
-# func_basename file
-func_basename ()
-{
- func_basename_result="${1##*/}"
-}
-
-# 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 ()
-{
- case ${1} in
- */*) func_dirname_result="${1%/*}${2}" ;;
- * ) func_dirname_result="${3}" ;;
- esac
- func_basename_result="${1##*/}"
-}
-
-# 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_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}"}
-}
-
-# func_opt_split
-func_opt_split ()
-{
- func_opt_split_opt=${1%%=*}
- func_opt_split_arg=${1#*=}
-}
-
-# func_lo2o object
-func_lo2o ()
-{
- case ${1} in
- *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
- *) func_lo2o_result=${1} ;;
- esac
-}
-
-# func_xform libobj-or-source
-func_xform ()
-{
- func_xform_result=${1%.*}.lo
-}
-
-# func_arith arithmetic-term...
-func_arith ()
-{
- func_arith_result=$(( $[*] ))
-}
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
- func_len_result=${#1}
-}
-
-_LT_EOF
- ;;
- *) # Bourne compatible functions.
- cat << \_LT_EOF >> "$cfgfile"
-
-# 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 ()
-{
- # Extract subdirectory from the argument.
- func_dirname_result=`$ECHO "X${1}" | $Xsed -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 file
-func_basename ()
-{
- func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
-}
-
-dnl func_dirname_and_basename
-dnl A portable version of this function is already defined in general.m4sh
-dnl so there is no need for it here.
-
-# 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 "X${3}" \
- | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
- *) func_stripname_result=`$ECHO "X${3}" \
- | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
- esac
-}
-
-# sed scripts:
-my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q'
-my_sed_long_arg='1s/^-[[^=]]*=//'
-
-# func_opt_split
-func_opt_split ()
-{
- func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
- func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
-}
-
-# func_lo2o object
-func_lo2o ()
-{
- func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
-}
-
-# func_xform libobj-or-source
-func_xform ()
-{
- func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'`
-}
-
-# func_arith arithmetic-term...
-func_arith ()
-{
- func_arith_result=`expr "$[@]"`
-}
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
- func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len`
-}
-
-_LT_EOF
-esac
-
-case $lt_shell_append in
- yes)
- cat << \_LT_EOF >> "$cfgfile"
-
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
- eval "$[1]+=\$[2]"
-}
-_LT_EOF
- ;;
- *)
- cat << \_LT_EOF >> "$cfgfile"
-
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
- eval "$[1]=\$$[1]\$[2]"
-}
-
-_LT_EOF
- ;;
- esac
-])
diff --git a/m4macros/ltoptions.m4 b/m4macros/ltoptions.m4
deleted file mode 100644
index 34151a3..0000000
--- a/m4macros/ltoptions.m4
+++ /dev/null
@@ -1,368 +0,0 @@
-# Helper functions for option handling. -*- 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 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], [0], [Assembler program])dnl
-
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl
-
-test -z "$OBJDUMP" && OBJDUMP=objdump
-_LT_DECL([], [OBJDUMP], [0], [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
deleted file mode 100644
index 9000a05..0000000
--- a/m4macros/ltsugar.m4
+++ /dev/null
@@ -1,123 +0,0 @@
-# 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
deleted file mode 100644
index f3c5309..0000000
--- a/m4macros/ltversion.m4
+++ /dev/null
@@ -1,23 +0,0 @@
-# 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.
-
-# Generated from ltversion.in.
-
-# serial 3017 ltversion.m4
-# This file is part of GNU Libtool
-
-m4_define([LT_PACKAGE_VERSION], [2.2.6b])
-m4_define([LT_PACKAGE_REVISION], [1.3017])
-
-AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.2.6b'
-macro_revision='1.3017'
-_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
deleted file mode 100644
index 637bb20..0000000
--- a/m4macros/lt~obsolete.m4
+++ /dev/null
@@ -1,92 +0,0 @@
-# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
-#
-# Copyright (C) 2004, 2005, 2007 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 4 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_RC], [AC_DEFUN([AC_LIBTOOL_RC])])
-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])])
diff --git a/m4macros/purify.m4 b/m4macros/purify.m4
deleted file mode 100644
index 0d080bf..0000000
--- a/m4macros/purify.m4
+++ /dev/null
@@ -1,27 +0,0 @@
-# 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
deleted file mode 100644
index ec8cf53..0000000
--- a/recipes/Makefile.am
+++ /dev/null
@@ -1,114 +0,0 @@
-## 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 = Makefile.in
-
-endif
-
-
-#FFTW_INCLUDES = -I$(top_srcdir)/fftw/fftw
-#RFFTW_INCLUDES = -I$(top_srcdir)/fftw/rfftw
-
-AM_CPPFLAGS = $(all_includes) $(CFITSIO_INCLUDES) $(FFTW_INCLUDES)
-AM_LDFLAGS = $(CPL_LDFLAGS)
-
-noinst_HEADERS =
-
-plugin_LTLIBRARIES = amber_spectral_calibration.la amber_p2vm.la amber_raw_to_fitsimage.la amber_SciCal.la amber_selector.la amber_detector.la amber_BeamPos.la amber_ascii_export.la amber_trf.la amber_calibrate.la amber_oimerge.la
-
-amber_p2vm_la_SOURCES = amber_p2vm.c
-
-amber_p2vm_la_LIBADD = $(LIBAMBER) $(LIBCPLCORE) $(LIBCPLDFS) $(LIBCPLUI)
-amber_p2vm_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-amber_p2vm_la_DEPENDENCIES = $(LIBAMBER)
-
-
-amber_spectral_calibration_la_SOURCES = amber_spectral_calibration.c
-
-amber_spectral_calibration_la_LIBADD = $(LIBAMBER) $(LIBCPLCORE) $(LIBCPLDFS) $(LIBCPLUI)
-amber_spectral_calibration_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-amber_spectral_calibration_la_DEPENDENCIES = $(LIBAMBER)
-
-
-amber_raw_to_fitsimage_la_SOURCES = amber_raw_to_fitsimage.c
-
-amber_raw_to_fitsimage_la_LIBADD = $(LIBAMBER) $(LIBCPLCORE) $(LIBCPLDFS) $(LIBCPLUI)
-amber_raw_to_fitsimage_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-amber_raw_to_fitsimage_la_DEPENDENCIES = $(LIBAMBER)
-
-amber_SciCal_la_SOURCES = amber_SciCal.c
-
-amber_SciCal_la_LIBADD = $(LIBAMBER) $(LIBCPLCORE) $(LIBCPLDFS) $(LIBCPLUI)
-amber_SciCal_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-amber_SciCal_la_DEPENDENCIES = $(LIBAMBER)
-
-amber_selector_la_SOURCES = amber_selector.c
-
-amber_selector_la_LIBADD = $(LIBAMBER) $(LIBCPLCORE) $(LIBCPLDFS) $(LIBCPLUI)
-amber_selector_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-amber_selector_la_DEPENDENCIES = $(LIBAMBER)
-
-#amber_divider_la_SOURCES = amber_divider.c
-#
-#amber_divider_la_LIBADD = $(LIBAMBER) $(LIBCPLCORE) $(LIBCPLDFS) $(LIBCPLUI)
-#amber_divider_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-#amber_divider_la_DEPENDENCIES = $(LIBAMBER)
-
-amber_detector_la_SOURCES = amber_detector.c
-
-amber_detector_la_LIBADD = $(LIBAMBER) $(LIBCPLCORE) $(LIBCPLDFS) $(LIBCPLUI)
-amber_detector_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-amber_detector_la_DEPENDENCIES = $(LIBAMBER)
-
-amber_BeamPos_la_SOURCES = amber_BeamPos.c
-
-amber_BeamPos_la_LIBADD = $(LIBAMBER) $(LIBCPLCORE) $(LIBCPLDFS) $(LIBCPLUI)
-amber_BeamPos_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-amber_BeamPos_la_DEPENDENCIES = $(LIBAMBER)
-
-amber_ascii_export_la_SOURCES = amber_ascii_export.c
-
-amber_ascii_export_la_LIBADD = $(LIBAMBER) $(LIBCPLCORE) $(LIBCPLDFS) $(LIBCPLUI)
-amber_ascii_export_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-amber_ascii_export_la_DEPENDENCIES = $(LIBAMBER)
-
-amber_trf_la_SOURCES = amber_trf.c
-
-amber_trf_la_LIBADD = $(LIBAMBER) $(LIBCPLCORE) $(LIBCPLDFS) $(LIBCPLUI)
-amber_trf_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-amber_trf_la_DEPENDENCIES = $(LIBAMBER)
-
-amber_calibrate_la_SOURCES = amber_calibrate.c
-
-amber_calibrate_la_LIBADD = $(LIBAMBER) $(LIBCPLCORE) $(LIBCPLDFS) $(LIBCPLUI)
-amber_calibrate_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-amber_calibrate_la_DEPENDENCIES = $(LIBAMBER)
-
-amber_oimerge_la_SOURCES = amber_oimerge.c
-amber_oimerge_la_LIBADD = $(LIBAMBER) $(LIBCPLCORE) $(LIBCPLDFS) $(LIBCPLUI)
-amber_oimerge_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-amber_oimerge_la_DEPENDENCIES = $(LIBAMBER)
-
diff --git a/recipes/Makefile.in b/recipes/Makefile.in
deleted file mode 100644
index 6310e06..0000000
--- a/recipes/Makefile.in
+++ /dev/null
@@ -1,733 +0,0 @@
-# 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/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/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_amber_BeamPos_la_OBJECTS = amber_BeamPos.lo
-amber_BeamPos_la_OBJECTS = $(am_amber_BeamPos_la_OBJECTS)
-amber_BeamPos_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(amber_BeamPos_la_LDFLAGS) $(LDFLAGS) -o $@
-am_amber_SciCal_la_OBJECTS = amber_SciCal.lo
-amber_SciCal_la_OBJECTS = $(am_amber_SciCal_la_OBJECTS)
-amber_SciCal_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(amber_SciCal_la_LDFLAGS) $(LDFLAGS) -o $@
-am_amber_ascii_export_la_OBJECTS = amber_ascii_export.lo
-amber_ascii_export_la_OBJECTS = $(am_amber_ascii_export_la_OBJECTS)
-amber_ascii_export_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(amber_ascii_export_la_LDFLAGS) $(LDFLAGS) -o $@
-am_amber_calibrate_la_OBJECTS = amber_calibrate.lo
-amber_calibrate_la_OBJECTS = $(am_amber_calibrate_la_OBJECTS)
-amber_calibrate_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(amber_calibrate_la_LDFLAGS) $(LDFLAGS) -o $@
-am_amber_detector_la_OBJECTS = amber_detector.lo
-amber_detector_la_OBJECTS = $(am_amber_detector_la_OBJECTS)
-amber_detector_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(amber_detector_la_LDFLAGS) $(LDFLAGS) -o $@
-am_amber_oimerge_la_OBJECTS = amber_oimerge.lo
-amber_oimerge_la_OBJECTS = $(am_amber_oimerge_la_OBJECTS)
-amber_oimerge_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(amber_oimerge_la_LDFLAGS) $(LDFLAGS) -o $@
-am_amber_p2vm_la_OBJECTS = amber_p2vm.lo
-amber_p2vm_la_OBJECTS = $(am_amber_p2vm_la_OBJECTS)
-amber_p2vm_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(amber_p2vm_la_LDFLAGS) $(LDFLAGS) -o $@
-am_amber_raw_to_fitsimage_la_OBJECTS = amber_raw_to_fitsimage.lo
-amber_raw_to_fitsimage_la_OBJECTS = \
- $(am_amber_raw_to_fitsimage_la_OBJECTS)
-amber_raw_to_fitsimage_la_LINK = $(LIBTOOL) --tag=CC \
- $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
- $(AM_CFLAGS) $(CFLAGS) $(amber_raw_to_fitsimage_la_LDFLAGS) \
- $(LDFLAGS) -o $@
-am_amber_selector_la_OBJECTS = amber_selector.lo
-amber_selector_la_OBJECTS = $(am_amber_selector_la_OBJECTS)
-amber_selector_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(amber_selector_la_LDFLAGS) $(LDFLAGS) -o $@
-am_amber_spectral_calibration_la_OBJECTS = \
- amber_spectral_calibration.lo
-amber_spectral_calibration_la_OBJECTS = \
- $(am_amber_spectral_calibration_la_OBJECTS)
-amber_spectral_calibration_la_LINK = $(LIBTOOL) --tag=CC \
- $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
- $(AM_CFLAGS) $(CFLAGS) \
- $(amber_spectral_calibration_la_LDFLAGS) $(LDFLAGS) -o $@
-am_amber_trf_la_OBJECTS = amber_trf.lo
-amber_trf_la_OBJECTS = $(am_amber_trf_la_OBJECTS)
-amber_trf_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(amber_trf_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 = $(amber_BeamPos_la_SOURCES) $(amber_SciCal_la_SOURCES) \
- $(amber_ascii_export_la_SOURCES) $(amber_calibrate_la_SOURCES) \
- $(amber_detector_la_SOURCES) $(amber_oimerge_la_SOURCES) \
- $(amber_p2vm_la_SOURCES) $(amber_raw_to_fitsimage_la_SOURCES) \
- $(amber_selector_la_SOURCES) \
- $(amber_spectral_calibration_la_SOURCES) \
- $(amber_trf_la_SOURCES)
-DIST_SOURCES = $(amber_BeamPos_la_SOURCES) $(amber_SciCal_la_SOURCES) \
- $(amber_ascii_export_la_SOURCES) $(amber_calibrate_la_SOURCES) \
- $(amber_detector_la_SOURCES) $(amber_oimerge_la_SOURCES) \
- $(amber_p2vm_la_SOURCES) $(amber_raw_to_fitsimage_la_SOURCES) \
- $(amber_selector_la_SOURCES) \
- $(amber_spectral_calibration_la_SOURCES) \
- $(amber_trf_la_SOURCES)
-HEADERS = $(noinst_HEADERS)
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMBER_BINARY_AGE = @AMBER_BINARY_AGE@
-AMBER_BINARY_VERSION = @AMBER_BINARY_VERSION@
-AMBER_INCLUDES = @AMBER_INCLUDES@
-AMBER_INTERFACE_AGE = @AMBER_INTERFACE_AGE@
-AMBER_LDFLAGS = @AMBER_LDFLAGS@
-AMBER_MAJOR_VERSION = @AMBER_MAJOR_VERSION@
-AMBER_MICRO_VERSION = @AMBER_MICRO_VERSION@
-AMBER_MINOR_VERSION = @AMBER_MINOR_VERSION@
-AMBER_VERSION = @AMBER_VERSION@
-AMTAR = @AMTAR@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFITSIO_INCLUDES = @CFITSIO_INCLUDES@
-CFITSIO_LDFLAGS = @CFITSIO_LDFLAGS@
-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@
-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@
-FFTWF_INCLUDES = @FFTWF_INCLUDES@
-FFTWF_LDFLAGS = @FFTWF_LDFLAGS@
-FFTW_INCLUDES = @FFTW_INCLUDES@
-FFTW_LDFLAGS = @FFTW_LDFLAGS@
-FGREP = @FGREP@
-GREP = @GREP@
-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@
-LIBAMBER = @LIBAMBER@
-LIBCEXT = @LIBCEXT@
-LIBCFITSIO = @LIBCFITSIO@
-LIBCPLCORE = @LIBCPLCORE@
-LIBCPLDFS = @LIBCPLDFS@
-LIBCPLDRS = @LIBCPLDRS@
-LIBCPLUI = @LIBCPLUI@
-LIBFFTW = @LIBFFTW@
-LIBFFTWF = @LIBFFTWF@
-LIBOBJS = @LIBOBJS@
-LIBPTHREAD = @LIBPTHREAD@
-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@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PRODUCT_DID = @PRODUCT_DID@
-PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
-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_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@
-lt_ECHO = @lt_ECHO@
-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@
-scriptsdir = @scriptsdir@
-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@
-AUTOMAKE_OPTIONS = 1.8 foreign
-DISTCLEANFILES = *~
- at MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = Makefile.in
-
-#FFTW_INCLUDES = -I$(top_srcdir)/fftw/fftw
-#RFFTW_INCLUDES = -I$(top_srcdir)/fftw/rfftw
-AM_CPPFLAGS = $(all_includes) $(CFITSIO_INCLUDES) $(FFTW_INCLUDES)
-AM_LDFLAGS = $(CPL_LDFLAGS)
-noinst_HEADERS =
-plugin_LTLIBRARIES = amber_spectral_calibration.la amber_p2vm.la amber_raw_to_fitsimage.la amber_SciCal.la amber_selector.la amber_detector.la amber_BeamPos.la amber_ascii_export.la amber_trf.la amber_calibrate.la amber_oimerge.la
-amber_p2vm_la_SOURCES = amber_p2vm.c
-amber_p2vm_la_LIBADD = $(LIBAMBER) $(LIBCPLCORE) $(LIBCPLDFS) $(LIBCPLUI)
-amber_p2vm_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-amber_p2vm_la_DEPENDENCIES = $(LIBAMBER)
-amber_spectral_calibration_la_SOURCES = amber_spectral_calibration.c
-amber_spectral_calibration_la_LIBADD = $(LIBAMBER) $(LIBCPLCORE) $(LIBCPLDFS) $(LIBCPLUI)
-amber_spectral_calibration_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-amber_spectral_calibration_la_DEPENDENCIES = $(LIBAMBER)
-amber_raw_to_fitsimage_la_SOURCES = amber_raw_to_fitsimage.c
-amber_raw_to_fitsimage_la_LIBADD = $(LIBAMBER) $(LIBCPLCORE) $(LIBCPLDFS) $(LIBCPLUI)
-amber_raw_to_fitsimage_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-amber_raw_to_fitsimage_la_DEPENDENCIES = $(LIBAMBER)
-amber_SciCal_la_SOURCES = amber_SciCal.c
-amber_SciCal_la_LIBADD = $(LIBAMBER) $(LIBCPLCORE) $(LIBCPLDFS) $(LIBCPLUI)
-amber_SciCal_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-amber_SciCal_la_DEPENDENCIES = $(LIBAMBER)
-amber_selector_la_SOURCES = amber_selector.c
-amber_selector_la_LIBADD = $(LIBAMBER) $(LIBCPLCORE) $(LIBCPLDFS) $(LIBCPLUI)
-amber_selector_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-amber_selector_la_DEPENDENCIES = $(LIBAMBER)
-
-#amber_divider_la_SOURCES = amber_divider.c
-#
-#amber_divider_la_LIBADD = $(LIBAMBER) $(LIBCPLCORE) $(LIBCPLDFS) $(LIBCPLUI)
-#amber_divider_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-#amber_divider_la_DEPENDENCIES = $(LIBAMBER)
-amber_detector_la_SOURCES = amber_detector.c
-amber_detector_la_LIBADD = $(LIBAMBER) $(LIBCPLCORE) $(LIBCPLDFS) $(LIBCPLUI)
-amber_detector_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-amber_detector_la_DEPENDENCIES = $(LIBAMBER)
-amber_BeamPos_la_SOURCES = amber_BeamPos.c
-amber_BeamPos_la_LIBADD = $(LIBAMBER) $(LIBCPLCORE) $(LIBCPLDFS) $(LIBCPLUI)
-amber_BeamPos_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-amber_BeamPos_la_DEPENDENCIES = $(LIBAMBER)
-amber_ascii_export_la_SOURCES = amber_ascii_export.c
-amber_ascii_export_la_LIBADD = $(LIBAMBER) $(LIBCPLCORE) $(LIBCPLDFS) $(LIBCPLUI)
-amber_ascii_export_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-amber_ascii_export_la_DEPENDENCIES = $(LIBAMBER)
-amber_trf_la_SOURCES = amber_trf.c
-amber_trf_la_LIBADD = $(LIBAMBER) $(LIBCPLCORE) $(LIBCPLDFS) $(LIBCPLUI)
-amber_trf_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-amber_trf_la_DEPENDENCIES = $(LIBAMBER)
-amber_calibrate_la_SOURCES = amber_calibrate.c
-amber_calibrate_la_LIBADD = $(LIBAMBER) $(LIBCPLCORE) $(LIBCPLDFS) $(LIBCPLUI)
-amber_calibrate_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-amber_calibrate_la_DEPENDENCIES = $(LIBAMBER)
-amber_oimerge_la_SOURCES = amber_oimerge.c
-amber_oimerge_la_LIBADD = $(LIBAMBER) $(LIBCPLCORE) $(LIBCPLDFS) $(LIBCPLUI)
-amber_oimerge_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-amber_oimerge_la_DEPENDENCIES = $(LIBAMBER)
-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
-amber_BeamPos.la: $(amber_BeamPos_la_OBJECTS) $(amber_BeamPos_la_DEPENDENCIES)
- $(amber_BeamPos_la_LINK) -rpath $(plugindir) $(amber_BeamPos_la_OBJECTS) $(amber_BeamPos_la_LIBADD) $(LIBS)
-amber_SciCal.la: $(amber_SciCal_la_OBJECTS) $(amber_SciCal_la_DEPENDENCIES)
- $(amber_SciCal_la_LINK) -rpath $(plugindir) $(amber_SciCal_la_OBJECTS) $(amber_SciCal_la_LIBADD) $(LIBS)
-amber_ascii_export.la: $(amber_ascii_export_la_OBJECTS) $(amber_ascii_export_la_DEPENDENCIES)
- $(amber_ascii_export_la_LINK) -rpath $(plugindir) $(amber_ascii_export_la_OBJECTS) $(amber_ascii_export_la_LIBADD) $(LIBS)
-amber_calibrate.la: $(amber_calibrate_la_OBJECTS) $(amber_calibrate_la_DEPENDENCIES)
- $(amber_calibrate_la_LINK) -rpath $(plugindir) $(amber_calibrate_la_OBJECTS) $(amber_calibrate_la_LIBADD) $(LIBS)
-amber_detector.la: $(amber_detector_la_OBJECTS) $(amber_detector_la_DEPENDENCIES)
- $(amber_detector_la_LINK) -rpath $(plugindir) $(amber_detector_la_OBJECTS) $(amber_detector_la_LIBADD) $(LIBS)
-amber_oimerge.la: $(amber_oimerge_la_OBJECTS) $(amber_oimerge_la_DEPENDENCIES)
- $(amber_oimerge_la_LINK) -rpath $(plugindir) $(amber_oimerge_la_OBJECTS) $(amber_oimerge_la_LIBADD) $(LIBS)
-amber_p2vm.la: $(amber_p2vm_la_OBJECTS) $(amber_p2vm_la_DEPENDENCIES)
- $(amber_p2vm_la_LINK) -rpath $(plugindir) $(amber_p2vm_la_OBJECTS) $(amber_p2vm_la_LIBADD) $(LIBS)
-amber_raw_to_fitsimage.la: $(amber_raw_to_fitsimage_la_OBJECTS) $(amber_raw_to_fitsimage_la_DEPENDENCIES)
- $(amber_raw_to_fitsimage_la_LINK) -rpath $(plugindir) $(amber_raw_to_fitsimage_la_OBJECTS) $(amber_raw_to_fitsimage_la_LIBADD) $(LIBS)
-amber_selector.la: $(amber_selector_la_OBJECTS) $(amber_selector_la_DEPENDENCIES)
- $(amber_selector_la_LINK) -rpath $(plugindir) $(amber_selector_la_OBJECTS) $(amber_selector_la_LIBADD) $(LIBS)
-amber_spectral_calibration.la: $(amber_spectral_calibration_la_OBJECTS) $(amber_spectral_calibration_la_DEPENDENCIES)
- $(amber_spectral_calibration_la_LINK) -rpath $(plugindir) $(amber_spectral_calibration_la_OBJECTS) $(amber_spectral_calibration_la_LIBADD) $(LIBS)
-amber_trf.la: $(amber_trf_la_OBJECTS) $(amber_trf_la_DEPENDENCIES)
- $(amber_trf_la_LINK) -rpath $(plugindir) $(amber_trf_la_OBJECTS) $(amber_trf_la_LIBADD) $(LIBS)
-
-mostlyclean-compile:
- -rm -f *.$(OBJEXT)
-
-distclean-compile:
- -rm -f *.tab.c
-
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amber_BeamPos.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amber_SciCal.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amber_ascii_export.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amber_calibrate.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amber_detector.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amber_oimerge.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amber_p2vm.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amber_raw_to_fitsimage.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amber_selector.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amber_spectral_calibration.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amber_trf.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/amber_BeamPos.c b/recipes/amber_BeamPos.c
deleted file mode 100644
index b5faa3e..0000000
--- a/recipes/amber_BeamPos.c
+++ /dev/null
@@ -1,1298 +0,0 @@
-/* $Id: amber_BeamPos.c,v 1.20 2013-09-16 14:56:43 agabasch Exp $
- *
- * This file is part of the AMBER 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: agabasch $
- * $Date: 2013-09-16 14:56:43 $
- * $Revision: 1.20 $
- * $Name: not supported by cvs2svn $
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-/*-----------------------------------------------------------------------------
- Includes
- -----------------------------------------------------------------------------*/
-
-#include <math.h>
-#include <cpl.h>
-#include <string.h>
-
-#include "amdrs.h"
-#include "amber_dfs.h"
-
-/* PAF file and QC log */
-#include "giqclog.h"
-/* #include "giutils.h" */
-
-
-
-/*
-static int errorType;
-static int pistonType;
-static int iBinningOfFrames;
-*/
-int iProductNumber;
-char szFilenameProduct[512];
-char szFilenameSCIENCE[150][512]; /* 3 bands * 50 raw frames = 150 products */
-int isFrameScience[150];
-cpl_frame * pframeSCIENCE[150];
-
-cpl_parameterlist * gparlist;
-cpl_frameset * gframelist;
-/* cpl_propertylist * pHeader; */
-
-FILE * pFITSFile;
-
-#ifdef OLD_STUFF
- amdlibERROR_MSG errMsg;
-static amdlibRAW_DATA rawData; /* = {NULL}; */
- amdlibSCIENCE_DATA sky; /* = {NULL}; */
- amdlibSCIENCE_DATA scienceData; /* = {NULL}; */
- amdlibP2VM_MATRIX p2vm; /* = {NULL}; */
- amdlibPHOTOMETRY photometry; /* = {NULL}; */
- amdlibWAVELENGTH wave; /* = {NULL}; */
- amdlibPISTON opd; /* = {NULL}; */
- amdlibOI_TARGET target; /* = {NULL}; */
- amdlibOI_ARRAY array; /* = {NULL}; */
- amdlibVIS vis; /* = {NULL}; */
- amdlibVIS2 vis2; /* = {NULL}; */
- amdlibVIS3 vis3; /* = {NULL}; */
- amdlibSCIENCE_DATA *skyPtr;
- amdlibSCIENCE_DATA *sciencePtr;
- amdlibWAVEDATA waveData;
-#endif
-
- amdlibERROR_MSG errMsg;
-static amdlibRAW_DATA rawData = {NULL};
- amdlibSCIENCE_DATA sky = {NULL};
- amdlibSCIENCE_DATA scienceData = {NULL};
- amdlibP2VM_MATRIX p2vm = {NULL};
- amdlibPHOTOMETRY photometry = {NULL}, imdPhot = {NULL};
- amdlibWAVELENGTH wave = {NULL}, imdWave = {NULL};
- amdlibPISTON opd = {NULL}, imdOpd = {NULL};
- amdlibOI_TARGET target = {NULL};
- amdlibOI_ARRAY array = {NULL};
- amdlibVIS vis = {NULL}, imdVis = {NULL};
- amdlibVIS2 vis2 = {NULL}, imdVis2 = {NULL};
- amdlibVIS3 vis3 = {NULL}, imdVis3 = {NULL};
- amdlibSCIENCE_DATA *skyPtr;
- amdlibSCIENCE_DATA *sciencePtr;
- amdlibWAVEDATA waveData;
-
- int band;
-
-
-/*-----------------------------------------------------------------------------
- Functions prototypes
- -----------------------------------------------------------------------------*/
-
-/* cpl related */
-static int amber_BeamPos_create(cpl_plugin *) ;
-static int amber_BeamPos_exec(cpl_plugin *) ;
-static int amber_BeamPos_destroy(cpl_plugin *) ;
-static int amber_BeamPos(cpl_parameterlist *, cpl_frameset *) ;
-
-/* amdlib */
-int amdlibIsJHKMode(amdlibRAW_DATA *data);
-amdlibCOMPL_STAT amdlibExplodeJHKScienceData (amdlibSCIENCE_DATA *srcScienceData,
- amdlibSCIENCE_DATA *dstScienceData,
- amdlibERROR_MSG errMsg);
-cpl_propertylist * BeamPosCreateProductHeader(const char * fctid,
- char * szRawFile, cpl_frame * pFrameProduct);
-void GetPrefix(int iFrame, char * szPrefix);
-
-/*-----------------------------------------------------------------------------
- Static variables
- -----------------------------------------------------------------------------*/
-
-/*
-static struct {
- Inputs
- int bool_option ;
- char str_option[512] ;
-
- Outputs
- double qc_param ;
-} amber_BeamPos_config ;
-*/
-
-static char amber_BeamPos_man[] =
-"This recipe calculates the Beam's x position, y position, flux and size in x and y\n"
-"\n";
-
-/*-----------------------------------------------------------------------------
- Functions code
- -----------------------------------------------------------------------------*/
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Append the properties in one list to another
- @param self The PAF propertylist to append to
- @param other The propertylist whose elements are copied or NULL
- @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error
-
- If other is NULL or empty nothing happens
-
- Comments are copied as well, but it is (currently) undefined how this works
- for non-unique properties.
-
- In addition the hierarchical keys will be changed according to the PAF rules:
-
- No ESO as first part
- No blank separator but a .
- */
-/*----------------------------------------------------------------------------*/
-static cpl_error_code amber_propertylist_append(cpl_propertylist * self,
- const cpl_propertylist * other)
-{
-
- int i, c;
- char szPAF[2048];
- char szTMP[2048];
-
- if (other == NULL) return CPL_ERROR_NONE;
-
- /*visir_assure_code(self, CPL_ERROR_NULL_INPUT);*/
-
- for (i=0; i < cpl_propertylist_get_size(other); i++)
- {
- const cpl_property * prop = cpl_propertylist_get((cpl_propertylist *)
- other, i);
- const char * name = cpl_property_get_name(prop);
- /*const char * comment = cpl_property_get_comment(prop);*/
-
- cpl_error_code err;
-
- /* Change the key to PAF syntax */
- strcpy( szPAF, name );
-
- /* Get rid of ESO (HAR, what a joke!) */
- if( !strncmp( szPAF, "ESO", 3 ) )
- {
- strcpy( szTMP, &szPAF[4] );
- strcpy( szPAF, szTMP );
- }
-
- /* Substitute spaces by points (YEAH!) */
- for( c=0; c<(int)strlen(szPAF); c++ )
- if( szPAF[c] == ' ' )
- szPAF[c] = '.';
-
- strcpy( (char *)name, szPAF );
-
- /* Append prop to self */
-
- switch (cpl_property_get_type(prop)) {
- case CPL_TYPE_CHAR:
- err = cpl_propertylist_append_char(self, name,
- cpl_property_get_char(prop));
- case CPL_TYPE_BOOL:
- err = cpl_propertylist_append_bool(self, name,
- cpl_property_get_bool(prop));
- break;
- case CPL_TYPE_INT:
- err = cpl_propertylist_append_int(self, name,
- cpl_property_get_int(prop));
- break;
- case CPL_TYPE_LONG:
- err = cpl_propertylist_append_long(self, name,
- cpl_property_get_long(prop));
- break;
- case CPL_TYPE_FLOAT:
- err = cpl_propertylist_append_float(self, name,
- cpl_property_get_float(prop));
- break;
- case CPL_TYPE_DOUBLE:
- err = cpl_propertylist_append_double(self, name,
- cpl_property_get_double(prop));
- break;
- case CPL_TYPE_STRING:
- err = cpl_propertylist_append_string(self, name,
- cpl_property_get_string(prop));
- break;
-
- /* Avoid compiler warnings but do nothing */
- case CPL_TYPE_FLAG_ARRAY:
- case CPL_TYPE_INVALID:
- case CPL_TYPE_UCHAR:
- case CPL_TYPE_UINT:
- case CPL_TYPE_ULONG:
- case CPL_TYPE_POINTER:
- case CPL_TYPE_FLOAT_COMPLEX:
- case CPL_TYPE_DOUBLE_COMPLEX:
- case CPL_TYPE_UNSPECIFIED:
- /*case CPL_TYPE_COMPLEX: not anymode in CPL 3.0 */
- break;
- /*default:
- visir_assure_code(0, CPL_ERROR_UNSUPPORTED_MODE);*/
- }
-
- /*visir_assure_code(!err, err);
-
- if (comment && cpl_propertylist_set_comment(self, name, comment))
- visir_assure_code(0, cpl_error_get_code());*/
- }
-
- return CPL_ERROR_NONE;
-}
-
-
-cpl_propertylist * BeamPosCreateProductHeader( const char * fctid, char * szRawFile, cpl_frame * pFrameProduct )
-{
- int iStatus = 0;
- char szMessage[1024];
-
- cpl_frameset * frameSetTmp;
- cpl_frame * frameTmp;
- cpl_propertylist * pHeader;
-
- /* For DFS fill Header function later */;
-/* pHeader = cpl_propertylist_new(); */
-
- /*
- * Create the Product file, start with filling the header
- *
- * Attention: for the time of this workaround for cpl 3D tables the amdlib must
- * be patched to NOT create OWN files, but APPEND to existing ones!!
- *
- * see comment below
- *
- */
-
-
- /*
- * Workaround for cpl_dfs_setup_product_header picking the wrong Header in this CPL release and
- * also might pick the wrong in the future! It uses the first RAW frame, but this recipe can handle
- * many raw frames. Hence:
- *
- * Read the Header of the RAW file to be written as a product and send it to the function
- */
- pHeader = cpl_propertylist_load( szRawFile, 0 );
-
- /* Create a set of frames with just this frame, so header will be correct */
- frameSetTmp = cpl_frameset_new();
- frameTmp = cpl_frame_new();
-
- cpl_frame_set_filename( frameTmp, szRawFile );
- cpl_frame_set_type( frameTmp, CPL_FRAME_TYPE_TABLE );
- cpl_frame_set_tag( frameTmp, "AMBER_BEAMPOS" );
- cpl_frame_set_group( frameTmp, CPL_FRAME_GROUP_RAW );
- cpl_frame_set_level( frameTmp, CPL_FRAME_LEVEL_NONE );
- cpl_frameset_insert( frameSetTmp, frameTmp );
-
- /* Add the necessary DFS fits header information to the product */
-#if defined CPL_VERSION_CODE && CPL_VERSION_CODE >= CPL_VERSION(4, 8, 0)
- if( cpl_dfs_setup_product_header( pHeader,
- pFrameProduct,
- frameSetTmp,
- gparlist,
- "amber_BeamPos", /* const char * recid, */
- PACKAGE "/" PACKAGE_VERSION, /* const char * pipeline_id, */
- "AMBER", /* const char * dictionary_id */
- NULL
- ) != CPL_ERROR_NONE )
- {
- /* Error */
- sprintf( szMessage, "Error in setting up the product header." );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = 16;
- }
-#else
- if( cpl_dfs_setup_product_header( pHeader,
- pFrameProduct,
- frameSetTmp,
- gparlist,
- "amber_BeamPos", /* const char * recid, */
- PACKAGE "/" PACKAGE_VERSION, /* const char * pipeline_id, */
- "AMBER" /* const char * dictionary_id */
- ) != CPL_ERROR_NONE )
- {
- /* Error */
- sprintf( szMessage, "Error in setting up the product header." );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = 16;
- }
-
-#endif
-
- /* Destroy tmpFrameset and implicitly its contents */
- cpl_frameset_delete( frameSetTmp );
- /*cpl_frame_delete( frameTmp );*/
-
- return pHeader;
-}
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Calculate statistics on image subwindow
- @param pImage background subtracted image of type CPL_TYPE_FLOAT,
- containing no bad pixels
- @param threshold only pixels above this level will contribute to the
- computation
- @param llx lower left corner (x), inclusive, FITS convention
- @param lly lower left corner (y), inclusive, FITS convention
- @param urx upper right corner (x), inclusive, FITS convention
- @param ury upper right corner (y), inclusive, FITS convention
- @param cx (output) centroid (x)
- @param cy (output) centroid (y)
- @param sigma_x (output) standard deviation wrt to 1st axis
- @param sigma_y (output) standard deviation wrt to 2nd axis
- @param flux (output) integrated flux
- @param angle (output) angle of rotation of the object axis. Of the
- two possible object axes (90 deg difference), this
- returned angle is always the one closest to the x-axis
- @return zero if and only if okay
-
- */
-/*----------------------------------------------------------------------------*/
-static int get_centroid_stdev_flux_angle( const cpl_image *pImage,
- double threshold,
- int llx, int lly,
- int urx, int ury,
- double *cx, double *cy,
- double *sigma_x, double *sigma_y,
- double *flux, double *angle, double *peakflux )
-{
- const char *fctid = "get_centroid_stdev_flux_angle";
-
- double pi = 3.1415926535897932384626433832795;
-
- const float *data = cpl_image_get_data_float_const( pImage );
- int nx = cpl_image_get_size_x( pImage );
- double s, sx, sy;
- double Ixx, Iyy, Ixy, I1, I2;
- int x, y;
-
-
- cpl_bivector* result_iqefit;
-
- /* Get centroid, flux */
- s = 0;
- sx = 0;
- sy = 0;
- for (y = lly - 1; y < ury - 1; y++)
- {
- for (x = llx - 1; x < urx - 1; x++)
- {
- float pixel = data[x + y*nx];
-
- if (pixel > threshold)
- {
- s += pixel;
- sx += pixel*x;
- sy += pixel*y;
- }
- }
- }
-
- if (s <= 0)
- {
- cpl_msg_warning( fctid, "Integrated flux is non-positive: %g",
- s );
- return 1;
- }
-
- *flux = s;
- *cx = sx/s;
- *cy = sy/s;
-
-/*
- #####################################
- Fits a 2D Gauss to the beam and derives the peak flux
-*/
-
-/* result_iqefit=cpl_bivector_new(7); */
- result_iqefit=cpl_image_iqe(pImage,llx,lly,urx,ury);
- *peakflux=cpl_vector_get(cpl_bivector_get_x(result_iqefit), 5);
- cpl_bivector_delete(result_iqefit);
-/*
- ######################################
-*/
-
- /* Rather than assuming any particular shape of the beam (e.g. Gaussian),
- compute the moment of inertia (in the CM system)
-
- I = [ Ixx Ixy ] where
- [ Iyx Iyy ]
-
- Ixx = sum_i flux_i x_i^2
- Iyy = sum_i flux_i y_i^2
- Ixy = - sum_i flux_i x_i y_i,
-
- and find a rotation, so that the two moments are minimal/maximal,
- i.e. write I as
-
- I = C * [ Ix'x' 0 ] * C^T
- [ 0 Iy'y' ]
-
- where C is the rotation matrix relating the object principal
- axes to the coordinate axes, and Ix'x' and Iy'y' are the
- moments with respect to the object axes.
- */
-
- Ixx = 0;
- Iyy = 0;
- Ixy = 0;
- for (y = lly - 1; y < ury - 1; y++)
- {
- for (x = llx - 1; x < urx - 1; x++)
- {
- float pixel = data[x + y*nx];
-
- if (pixel > threshold)
- {
- Ixx += pixel*(x-*cx)*(x-*cx);
- Iyy += pixel*(y-*cy)*(y-*cy);
- Ixy -= pixel*(x-*cx)*(y-*cy);
- }
- }
- }
-
- /* Get eigenvalues Ix'x' and Iy'y' as solutions to
- * (Ixx - lambda)*(Iyy - lambda) - Ixy^2 = 0
- */
- I1 = (Ixx+Iyy)/2.0 + sqrt( (Ixx-Iyy)*(Ixx-Iyy)/4.0 + Ixy*Ixy);
- I2 = (Ixx+Iyy)/2.0 - sqrt( (Ixx-Iyy)*(Ixx-Iyy)/4.0 + Ixy*Ixy);
-
- /* No need to compute C, just get the angle of rotation.
- eigenvector = (cos(angle), -sin(angle)) is
- solution to
- (Ixx - lambda)*cos(angle) + Ixy*(-sin(angle)) = 0
- => sin(angle)/cos(angle) = (Ixx - lambda)/Ixy */
-
- *angle = atan2(Ixx - I1, Ixy); /* in [-pi; pi] */
-
- /* Mirror angle to [-pi/2 ; pi/2] */
- if (*angle >= pi/2) *angle -= pi;
- if (*angle <= -pi/2) *angle += pi;
-
- /* By convention, get the angle which is within pi/4 of the
- x-axis. The output sigma_x is the stdev wrt this axis */
- if (*angle <= -pi/4)
- {
- *angle += pi/2;
- *sigma_x = sqrt(I2/(*flux));
- *sigma_y = sqrt(I1/(*flux));
- }
- else if (- pi/4 <= *angle && *angle <= pi/4)
- {
- /* angle ok */
- *sigma_x = sqrt(I1/(*flux));
- *sigma_y = sqrt(I2/(*flux));
- }
- else if (pi/4 <= *angle)
- {
- *angle -= pi/2;
- *sigma_x = sqrt(I2/(*flux));
- *sigma_y = sqrt(I1/(*flux));
- }
-
- /* Convert to FITS */
- *cx += 1;
- *cy += 1;
-
-
-
-
-
-
- return 0;
-}
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Apply n x m median filter
- @param pImage image containing the beam, must be of
- @param xwindow window width, should be an odd number
- @param ywindow window height, should be an odd number
- @return The median filtered image which must be deallocated using
- cpl_image_delete()
-
- The function is a workaround for cpl_image_filter_median()
- supporting kernels no larger than 7x7
- */
-/*----------------------------------------------------------------------------*/
-static cpl_image *
-image_filter_median( const cpl_image *image, int xwindow, int ywindow )
-{
- int nx = cpl_image_get_size_x(image);
- int ny = cpl_image_get_size_y(image);
- cpl_image *result = cpl_image_new( nx, ny, CPL_TYPE_FLOAT );
- int x, y;
-
- if (result == NULL)
- {
- return NULL;
- }
-
- for (y = 1; y <= ny; y++)
- for (x = 1; x <= nx; x++)
- {
- double median;
- int llx = x - (xwindow - 1) / 2;
- int lly = y - (ywindow - 1) / 2;
- int urx = x + (xwindow - 1) / 2;
- int ury = y + (ywindow - 1) / 2;
- if (llx < 1) llx = 1;
- if (lly < 1) lly = 1;
- if (urx > nx) urx = nx;
- if (ury > ny) ury = ny;
- median = cpl_image_get_median_window( image,
- llx, lly,
- urx, ury );
-
- cpl_image_set( result, x, y, median );
- }
-
- return result;
-}
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Calculates a Beamposition, Beamsize and Beamflux from a given Image
- @param pImage image containing the beam, must be of
- type CPL_TYPE_FLOAT and contain no bad pixels
- @param dPosX (output) beam centroid position (x)
- @param dPosY (output) beam centroid position (y)
- @param dSizeX (output) beam FWHM wrt 1st beam principal axis (the one
- most aligned with x)
- @param dSizeY (output) beam FWHM wrt 2nd beam principal axis (the one
- most aligned with y)
- @param dFlux (output) integrated flux
- @param dAngle (output) angle of rotation (degrees) of the beam. Of the
- two possible axes (90 deg difference), this is always
- the angle of the beam axis closest to the x-axis
- @return Non-0 in case of errors
-
- The cpl_error_code must not already be set when calling the function.
-
- Failure codes
- 1 : cpl_error_code was set
- 2, 3, 4: illegal input
- 5 : too few/faint pixels to compute centroid/FWHM
- 6 : unexpected error
-
- The function
- - Subtracts the background using a the minimum
- of a (image_width, 1) median filter and a (1, image_height)
- median filter at each pixel
- - Subtracts the background using a 1 x n median filter
- - Filters out isolated hot/cold areas using a smaller median filter
- - Computes centroid and FWHM of pixels above threshold
- (iteratively, reducing the window size for each iteration)
-
- Assumptions
- - The beam is somewhat wider (in x) than 3-4 pixels
- - The beam is no higher (in y) than ~30 pixels
- - Beam pixels are brighter than 5 ADU (relative to local background)
-*/
-/*----------------------------------------------------------------------------*/
-static int CalculateQCParams( const cpl_image * pImage,
- double * dPosX, double * dPosY,
- double * dSizeX, double * dSizeY,
- double * dFlux, double * dAngle, double *dPeakFlux )
-{
- const char *fctid = "CalculateQCParams";
-
- int median_filter_x = 7; /* for filtering out isolated hot/cold pixels,
- must be less than double beam width,
- larger than 5 (which has proven not to work),
- should be an odd number
- */
- int median_filter_y = 61; /* for measuring the local background,
- must be larger than the double beam height, or
- the beam itself would be subtracted,
- should be an odd number
- */
- double threshold_min = 5.0; /* minimum beam pixel value */
-
- double kappa_flux = 3.0; /* to distinguish background/beam pixels */
- double kappa_w = 2.0; /* for window size clipping */
- int min_window_y = 10; /* stop iterating if window ... */
- int min_window_x = 10; /* ... reached this size */
- double pi = 3.1415926535897932384626433832795;
-
- int iStatus = 0;
-
- if ( cpl_error_get_code() != CPL_ERROR_NONE )
- {
- cpl_msg_error( fctid, "Error code is set: %s", cpl_error_get_message() );
- return 1;
- }
- if ( pImage == NULL )
- {
- cpl_msg_error( fctid, "Null input" );
- return 2;
- }
- else if ( cpl_image_get_type(pImage) != CPL_TYPE_FLOAT )
- {
- cpl_msg_error( fctid, "Invalid image type" );
- return 3;
- }
- else if ( cpl_image_count_rejected( pImage ) != 0 )
- {
- cpl_msg_error( fctid, "Image has bad pixels" );
- return 4;
- }
- else
- {
- double stdev_x;
- double stdev_y;
- int debug = 0; /* Save intermediate images to /tmp ? */
- int nx = cpl_image_get_size_x( pImage );
- int ny = cpl_image_get_size_y( pImage );
- int llx = 1;
- int lly = 1;
- int urx = nx;
- int ury = ny;
- int llx_old, lly_old, urx_old, ury_old;
- cpl_matrix *kernel_7x1 = NULL;
- cpl_image *background = NULL;
- cpl_image *pFiltered = NULL;
- cpl_image *temp = NULL;
-
- kernel_7x1 = cpl_matrix_new( 1, median_filter_x );
- /* The order of arguments is (ywindow, xwindow) */
-
- cpl_matrix_fill( kernel_7x1, 1.0 );
-
- /* Create, subtract background
- Two components: 1. related to overlapping channels/chips
- aligned with image rows/columns
- 2. local variations
- */
- background = image_filter_median( pImage, 2*nx, 1 );
- temp = image_filter_median( pImage, 1, 2*ny );
-
- /* Set b := min(b, t) = b + ((t-b) < 0) ? t-b : 0
- at each pixel */
- cpl_image_subtract ( temp, background );
- cpl_image_threshold( temp, -(DBL_MAX), 0, 0, 0 ); /* Set positive -> 0 */
- cpl_image_add ( background, temp);
- cpl_image_delete( temp );
-
- pFiltered = cpl_image_subtract_create( pImage, background );
-
- if (debug) cpl_image_save( pFiltered , "/tmp/backsub1.fits",
- CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_DEFAULT );
-
- /* Measure, subtract local background */
- cpl_image_delete( background );
- background = image_filter_median( pFiltered, 1, median_filter_y );
- cpl_image_subtract( pFiltered, background );
-
- if (debug) cpl_image_save( pFiltered , "/tmp/backsub2.fits",
- CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_DEFAULT );
- if (debug) cpl_image_save( background, "/tmp/back.fits" ,
- CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_DEFAULT );
-
- /* Filter out hot/cold pixels */
- temp = pFiltered;
- pFiltered = cpl_image_filter_median( temp, kernel_7x1 );
- cpl_image_delete( temp );
-
- if (debug) cpl_image_save( pFiltered , "/tmp/backsub2_filtered.fits",
- CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_DEFAULT );
-
- do {
- double noise;
- double threshold;
-
- /* Estimate background noise = RMS =
- sqrt( median_xy (P_xy - background )^2 )
- */
-
- temp = cpl_image_power_create( pFiltered, 2.0 );
- noise = sqrt( cpl_image_get_median_window( temp,
- llx, lly,
- urx, ury ) );
- cpl_image_delete( temp );
-
- threshold = kappa_flux * noise;
- if (threshold < threshold_min)
- {
- threshold = threshold_min;
- }
-
- cpl_msg_info( fctid, "Current window = (%d, %d) - (%d, %d)",
- llx, lly, urx, ury );
-
- cpl_msg_info( fctid, "Background = %g +- %g ; Threshold = %g",
- cpl_image_get_mean_window( background,
- llx, lly,
- urx, ury ),
- noise, threshold );
-
- if ( get_centroid_stdev_flux_angle( pFiltered,
- threshold,
- llx, lly,
- urx, ury,
- dPosX, dPosY,
- &stdev_x, &stdev_y,
- dFlux,
- dAngle,
- dPeakFlux ) != 0)
- {
- cpl_matrix_delete( kernel_7x1 );
- cpl_image_delete( pFiltered );
- cpl_image_delete( background );
- cpl_error_reset();
- return 5;
- }
- else
- {
- cpl_msg_info( fctid, "x = %g", *dPosX );
- cpl_msg_info( fctid, "y = %g", *dPosY );
- cpl_msg_info( fctid, "dx = %g", stdev_x );
- cpl_msg_info( fctid, "dy = %g", stdev_y );
- cpl_msg_info( fctid, "dx / dy = %g",
- stdev_x / ((stdev_y != 0) ? stdev_y : 1.0));
- cpl_msg_info( fctid, "angle = %g degrees", (*dAngle/pi)*180);
- }
-
- llx_old = llx;
- lly_old = lly;
- urx_old = urx;
- ury_old = ury;
-
- llx = (*dPosX - kappa_w * stdev_x);
- lly = (*dPosY - kappa_w * stdev_y);
- urx = (*dPosX + kappa_w * stdev_x);
- ury = (*dPosY + kappa_w * stdev_y);
- if (llx < llx_old) llx = llx_old;
- if (lly < lly_old) lly = lly_old;
- if (urx > urx_old) urx = urx_old;
- if (ury > ury_old) ury = ury_old;
-
- /* While window size decreased,
- and window not too small */
- } while ((llx > llx_old || lly > lly_old || urx < urx_old || ury < ury_old)
- &&
- (ury - lly > min_window_y && urx - llx > min_window_x) );
-
- cpl_matrix_delete( kernel_7x1 );
- cpl_image_delete( background );
- cpl_image_delete( pFiltered );
-
- /* Convert from stdev to FWHM */
- {
- double TWOSQRT2LN2 = 2.35482004503095; /* valid for a gaussian shape */
- *dSizeX = TWOSQRT2LN2 * stdev_x;
- *dSizeY = TWOSQRT2LN2 * stdev_y;
- }
- /* Convert to degrees */
- *dAngle *= 180/pi;
-
- /* Draw a cross at the inferred beam position
- (for debugging, the input image should not change)
- {
- int i;
- for (i = *dPosX - *dSizeX; i <= *dPosX + *dSizeX; i++)
- {
- cpl_image_set( pImage, i, (int) (*dPosY + 0.5), 0 );
- }
-
- for (i = *dPosY - *dSizeY; i <= *dPosY + *dSizeY; i++)
- {
- cpl_image_set( pImage, (int) (*dPosX + 0.5), i, 0 );
- }
- }
- */
- }
-
- if (cpl_error_get_code() != CPL_ERROR_NONE)
- {
- /* Should not happen */
- cpl_error_reset();
- iStatus = 6;
- }
-
- return iStatus;
-}
-
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Creates a proper prefix for QC parameters for a particular file
- @param
- @return
-
- This function is exported.
- */
-/*----------------------------------------------------------------------------*/
-void GetPrefix( int iFrame, char * szPrefix )
-{
- //strcpy( szPrefix, "ESO QC REFPIX " );
- strcpy( szPrefix, "ESO QC REFPIX " );
-
- switch( iFrame )
- {
- case 1:
- strcat( szPrefix, "CLDSTP " );
- break;
- case 2:
- strcat( szPrefix, "A K " );
- break;
- case 3:
- strcat( szPrefix, "B K " );
- break;
- case 4:
- strcat( szPrefix, "C K " );
- break;
- case 5:
- strcat( szPrefix, "A H " );
- break;
- case 6:
- strcat( szPrefix, "B H " );
- break;
- case 7:
- strcat( szPrefix, "C H " );
- break;
- case 8:
- strcat( szPrefix, "A J " );
- break;
- case 9:
- strcat( szPrefix, "B J " );
- break;
- case 10:
- strcat( szPrefix, "C J " );
- break;
- case 11:
- strcat( szPrefix, "BCD A K " );
- break;
- case 12:
- strcat( szPrefix, "BCD B K " );
- break;
- case 13:
- strcat( szPrefix, "BCD C K " );
- break;
- case 14:
- strcat( szPrefix, "BCD A H " );
- break;
- case 15:
- strcat( szPrefix, "BCD B H " );
- break;
- case 16:
- strcat( szPrefix, "BCD C H " );
- break;
- case 17:
- strcat( szPrefix, "BCD A J " );
- break;
- case 18:
- strcat( szPrefix, "BCD B J " );
- break;
- case 19:
- strcat( szPrefix, "BCD C J " );
- break;
- case 20:
- strcat( szPrefix, "OUTF A " );
- break;
- case 21:
- strcat( szPrefix, "OUTF B " );
- break;
- case 22:
- strcat( szPrefix, "OUTF C " );
- break;
-
-
- default:
- strcat( szPrefix, "UNKNOWN" );
- }
-
-}
-
-/*----------------------------------------------------------------------------*/
-/**
- @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,
- AMBER_BINARY_VERSION,
- CPL_PLUGIN_TYPE_RECIPE,
- "amber_BeamPos",
- "AMBER Beam Monitoring Recipe",
- amber_BeamPos_man,
- "Tom Licha",
- PACKAGE_BUGREPORT,
- "GP",
- amber_BeamPos_create,
- amber_BeamPos_exec,
- amber_BeamPos_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 amber_BeamPos_create(cpl_plugin * plugin)
-{
- cpl_recipe * recipe = (cpl_recipe *)plugin ;
- cpl_parameter * p ;
-
- /* Create the parameters list in the cpl_recipe object */
- recipe->parameters = cpl_parameterlist_new() ;
-
- /* 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 amber_BeamPos_exec(cpl_plugin * plugin)
-{
- cpl_recipe * recipe = (cpl_recipe *)plugin ;
- return amber_BeamPos(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 amber_BeamPos_destroy(cpl_plugin * plugin)
-{
- cpl_recipe * recipe = (cpl_recipe *)plugin ;
- 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 amber_BeamPos(
- cpl_parameterlist * parlist,
- cpl_frameset * framelist)
-{
- /* CPL structures */
- cpl_frame * cur_frame;
-/* cpl_parameter * cur_param; */
-
-
- char szMessage[1024];
- char szPrefix[1024];
-
- char szProduct[1024];
- cpl_frame * pFrameProduct = NULL;
- cpl_image * pImage = NULL;
-
- char szQCParameter[1024];
- const char * pszARCFILE;
- char * pszFilename;
- char * pszFileTag;
-
- int iStatus = 0;
-/* int i;*/
- int iFrameCount = 0;
-
- /* QC Params */
- double dPosX = 0;
- double dPosY = 0;
- double dSizeX = 0;
- double dSizeY = 0;
- double dFlux = 0;
- double dPeakFlux = 0;
- double dAngle = 0;
- double dPosX0 = 0.; /* for CLDSTP */
- double dPosY0 = 0.; /* for CLDSTP */
- double dOffsetX=0.;
- double dOffsetY=0.;
-
- AmPaf * qc = NULL;
- cpl_propertylist * qclog = NULL;
- cpl_propertylist * qcFromProduct = NULL;
- cpl_propertylist * qcFromRawfile = NULL;
-
-
-
-
- cpl_propertylist * qc_properties = NULL;
-
- const char * fctid = "amber_BeamPos" ;
-
- cpl_msg_info( fctid, "Start of DataReduction");
- amber_dfs_set_groups(framelist);
- gframelist = framelist;
- gparlist = parlist;
-
- /* For each of the 22 input files create and calculate:
- *
- * re-image of the amber detector out of amber data tables
- * x and y position of the beam
- * flux of the beam
- * size of the beam in x and y
- *
- * This functions assumes that the input files are in the right order of the template 1 of 22 -> 22 of 22
- *
- */
-
- cur_frame = cpl_frameset_get_first( framelist );
-
- while( cur_frame && !iStatus && iFrameCount <22 )
- {
-
- /* iFrameCount++; Count only "good" frames */
-
- /* Get Filename and Classification Tag */
- pszFilename = (char *)cpl_frame_get_filename( cur_frame );
- pszFileTag = (char *)cpl_frame_get_tag( cur_frame );
-
- /* Check Tag and Filename */
- if( pszFilename && pszFileTag )
- {
-
- /* BEAMPOS OBJECT */
- if( !strcmp( pszFileTag, "AMBER_BEAMPOS" ) )
- {
- /* Data Reduction on the highest level possible for amdlib
- *
- * QC Parameters, Image-Analysis done in CPL
- *
- * */
- iFrameCount++; /* Count BEAMPOS-frames only */
-
- sprintf( szMessage, "Frame #%d of 22 [Current execution status=%d]", iFrameCount, iStatus );
- cpl_msg_info( fctid, "%s", szMessage );
-
- if( iStatus == 0 )
- {
- /* Create re-image to /tmp/amber_beampos.fits */
- if( amdlibLoadRawData(pszFilename, &rawData, errMsg) != amdlibSUCCESS )
- {
- sprintf ( szMessage, "Could not load raw data file '%s'", pszFilename );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = 20;
- }
- else
- {
-
- amdlibSaveRawDataToFits( "/tmp/amber_beampos.fits", &rawData, errMsg);
- /* release the memory */
- amdlibReleaseRawData(&rawData);
- }
-
-
- /* Load /tmp/amber_beampos.fits to a cpl_image */
- pImage = cpl_image_load( "/tmp/amber_beampos.fits", CPL_TYPE_FLOAT, 0, 0 );
-
-
- /* Calculate QC Parameters out of cpl_image */
- if( CalculateQCParams( pImage, &dPosX, &dPosY, &dSizeX, &dSizeY, &dFlux, &dAngle, &dPeakFlux) != 0 )
- {
- sprintf( szMessage, "Beam localization failed!" );
- cpl_msg_info( fctid, "%s", szMessage );
- dPosX = 0;
- dPosY = 0;
- dSizeX = 0;
- dSizeY = 0;
- dFlux = 0;
- dPeakFlux = 0;
- dAngle = 0;
- dOffsetX=0;
- dOffsetY=0;
- }
-
- /* Save the CLDSTP Parameter */
- if (iFrameCount==1)
- {
- dPosX0 =dPosX;
- dPosY0 =dPosY;
- }
- dOffsetX=dPosX - dPosX0;
- dOffsetY=dPosY - dPosY0;
-
- /* Create Header and write QC-Parameters */
- GetPrefix( iFrameCount, szPrefix );
- sprintf( szProduct, "amber_beampos_%04d.fits", iFrameCount );
-
- sprintf( szMessage, "%s %s", szProduct, szPrefix );
- cpl_msg_info( fctid, "%s", szMessage );
-
- pFrameProduct = cpl_frame_new();
- cpl_frame_set_filename( pFrameProduct, szProduct );
- cpl_frame_set_type ( pFrameProduct, CPL_FRAME_TYPE_IMAGE );
- cpl_frame_set_tag ( pFrameProduct, "AMBER_BEAMPOS_REDUCED" );
- cpl_frame_set_group ( pFrameProduct, CPL_FRAME_GROUP_PRODUCT );
- cpl_frame_set_level ( pFrameProduct, CPL_FRAME_LEVEL_FINAL );
-
-
- qc_properties = BeamPosCreateProductHeader( fctid, pszFilename, pFrameProduct );
-
- sprintf( szQCParameter, "%sX", szPrefix );
- sprintf( szMessage, "%s = %.2f", szQCParameter, dPosX );
- cpl_msg_info( fctid, "%s", szMessage );
- cpl_propertylist_append_float( qc_properties, szQCParameter, dPosX );
-
- sprintf( szQCParameter, "%sY", szPrefix );
- sprintf( szMessage, "%s = %.2f", szQCParameter, dPosY );
- cpl_msg_info( fctid, "%s", szMessage );
- cpl_propertylist_append_float( qc_properties, szQCParameter, dPosY );
-
-
- sprintf( szQCParameter, "%sSHX", szPrefix );
- sprintf( szMessage, "%s = %.2f", szQCParameter, dOffsetX );
- cpl_msg_info( fctid, "%s", szMessage );
- cpl_propertylist_append_float( qc_properties, szQCParameter, dOffsetX );
-
- sprintf( szQCParameter, "%sSHY", szPrefix );
- sprintf( szMessage, "%s = %.2f", szQCParameter, dOffsetY );
- cpl_msg_info( fctid, "%s", szMessage );
- cpl_propertylist_append_float( qc_properties, szQCParameter, dOffsetY );
-
- sprintf( szQCParameter, "%sSIZX", szPrefix );
- sprintf( szMessage, "%s = %.2f", szQCParameter, dSizeX );
- cpl_msg_info( fctid, "%s", szMessage );
- cpl_propertylist_append_float( qc_properties, szQCParameter, dSizeX );
-
- sprintf( szQCParameter, "%sSIZY", szPrefix );
- sprintf( szMessage, "%s = %.2f", szQCParameter, dSizeY );
- cpl_msg_info( fctid, "%s", szMessage );
- cpl_propertylist_append_float( qc_properties, szQCParameter, dSizeY );
-
- sprintf( szQCParameter, "%sFLUX", szPrefix );
- sprintf( szMessage, "%s = %.2f", szQCParameter, dFlux );
- cpl_msg_info( fctid, "%s", szMessage );
- cpl_propertylist_append_float( qc_properties, szQCParameter, dFlux );
-
- sprintf( szQCParameter, "%sPEAKFLUX", szPrefix );
- sprintf( szMessage, "%s = %.2f", szQCParameter, dPeakFlux );
- cpl_msg_info( fctid, "%s", szMessage );
- cpl_propertylist_append_float( qc_properties, szQCParameter, dPeakFlux );
-
- sprintf( szQCParameter, "%sANGLE", szPrefix );
- sprintf( szMessage, "%s = %.2f", szQCParameter, dAngle );
- cpl_msg_info( fctid, "%s", szMessage );
- cpl_propertylist_append_float( qc_properties, szQCParameter, dAngle );
-
- /* Save Product */
- /*sprintf( szMessage, "Saving Product %s %s...", szProduct, szPrefix );
- cpl_msg_info( fctid, "%s", szMessage );*/
-
- /*Adding the JMMC acknowledgements*/
- amber_JMMC_acknowledgement(qc_properties);
-
- cpl_image_save( pImage, szProduct, CPL_BPP_IEEE_FLOAT, qc_properties, CPL_IO_DEFAULT );
- /*sprintf( szMessage, "cpl_frame_insert (\"%s\")", cpl_frame_get_filename(pFrameProduct) ); */
- /*cpl_msg_info( fctid, "%s", szMessage ); */
- cpl_frameset_insert( framelist, pFrameProduct );
-
-
- /*---------------------------------------------------------------------------------------------------------------*/
- /* Writing QC1 Parameters to log */
-
-
- qcFromRawfile= cpl_propertylist_load(pszFilename, 0 );
- qc = amber_qclog_open( iFrameCount-1 );
-
- if( qc )
- {
- qclog = amber_paf_get_properties( qc );
-
- /* Read original ARCFILE entry and copy to PAF-File */
- pszARCFILE = cpl_propertylist_get_string( qcFromRawfile, "ARCFILE" );
-
- /* Add mandatory keys */
- cpl_propertylist_append_string( qclog, "ARCFILE", pszARCFILE );
-
- /* Take the whole header including QC parameters */
- qcFromProduct = qc_properties;
-
- /* copy to PAF */
- amber_propertylist_append( qclog, qcFromProduct);
-
- /* Finished... */
- amber_qclog_close(qc);
-
- } /* if qc */
-
- /*cpl_frame_delete( pFrameProduct ); no, deleted by caller, i.e. ESOREX */
- cpl_image_delete( pImage );
- cpl_propertylist_delete(qc_properties );
- cpl_propertylist_delete(qcFromRawfile);
-
- } /* Status still OK */
- } /* All BEAMPOS frames */
-
-
- } /* Filename and Tag present */
- else
- {
- sprintf( szMessage, "Missing FileName or Tag for Frame #%d", iFrameCount );
- cpl_msg_info( fctid, "%s", szMessage );
- } /* Filename and Tag present */
-
- cur_frame = cpl_frameset_get_next( framelist );
- } /* while more frames */
-
- if( iFrameCount != 22 )
- {
- sprintf( szMessage, "Error: Please input 22 raw files of type AMBER_BEAMPOS", iFrameCount );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = 1;
- }
-
- cpl_msg_info( fctid, "End of DataReduction");
-
- /* there is one remaining, due to a workarround above. Ignore it, ESOREX shall NOT talk about that :) */
- cpl_error_reset();
-
- return iStatus ;
-}
-
-
-
-
-
diff --git a/recipes/amber_SciCal.c b/recipes/amber_SciCal.c
deleted file mode 100644
index f8238ae..0000000
--- a/recipes/amber_SciCal.c
+++ /dev/null
@@ -1,1805 +0,0 @@
-/* $Id: amber_SciCal.c,v 1.49 2013-09-16 14:56:43 agabasch Exp $
- *
- * This file is part of the AMBER 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
- */
-
-
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-/*-----------------------------------------------------------------------------
- Includes
- -----------------------------------------------------------------------------*/
-
-#include <math.h>
-#include <cpl.h>
-#include <string.h>
-#include "amdrs.h"
-#include "amber_qc.h"
-#include "esolibSelector.h"
-#include "esolibTransferfunction.h"
-#include "amber_dfs.h"
-#include "esolibCalibVis.h"
-
-/* PAF file and QC log */
-#include "giqclog.h"
-/* #include "giutils.h" */
-
-#define MAXFILESRAW 5000
-#define MAXFILESPRODUCTS (MAXFILESRAW*3)
-
-
-#define amdlibTYPICAL_RON 10.0
-
-static int errorType;
-static int pistonType;
-static int iBinningOfFrames;
-int iProductNumber;
-
-int i; /*The currently reduced imput frame number */
-char szFilenameProduct[512];
-char ** szFilenameSCIENCE; /* 3 bands * MAXFILESRAW raw frames = MAXFILESPRODUCTS products */
-int * isFrameScience;
-cpl_frame ** pframeSCIENCE;
-
-cpl_parameterlist * gparlist;
-cpl_frameset * gframelist;
-cpl_propertylist * pHeader;
-
-FILE * pFITSFile;
-
-
-amdlibERROR_MSG errMsg;
-static amdlibDARK_DATA dark = {NULL};
-static amdlibRAW_DATA rawData = {NULL};
-amdlibSCIENCE_DATA sky = {NULL};
-amdlibSCIENCE_DATA scienceData = {NULL};
-amdlibP2VM_MATRIX p2vm = {NULL};
-amdlibPHOTOMETRY photometry = {NULL}, imdPhot = {NULL};
-amdlibWAVELENGTH wave = {NULL}, imdWave = {NULL};
-amdlibPISTON opd = {NULL}, imdOpd = {NULL};
-amdlibSPECTRUM spectrum={NULL};
-amdlibOI_TARGET target = {NULL};
-amdlibOI_ARRAY array = {NULL};
-amdlibVIS vis = {NULL}, imdVis = {NULL};
-amdlibVIS2 vis2 = {NULL}, imdVis2 = {NULL};
-amdlibVIS3 vis3 = {NULL}, imdVis3 = {NULL};
-amdlibSCIENCE_DATA *skyPtr;
-amdlibSCIENCE_DATA *sciencePtr;
-amdlibWAVEDATA waveData;
-
-int band;
-
-/*-----------------------------------------------------------------------------
- Functions prototypes
- -----------------------------------------------------------------------------*/
-
-/* cpl related */
-static int amber_SciCal_create(cpl_plugin *) ;
-static int amber_SciCal_exec(cpl_plugin *) ;
-static int amber_SciCal_destroy(cpl_plugin *) ;
-static int amber_SciCal(cpl_parameterlist *, cpl_frameset *) ;
-static void select_frames(cpl_parameterlist *parlist, cpl_frameset * framelist,
- int iProductNumber );
-
-static void get_selection_param(double * x1_pst, double * x2_pst,
- double * x3_pst, int * isScience, cpl_frame * cur_frame);
-
-amdlibCOMPL_STAT amdlibExtractVisESO( const char *badPixelFile,
- const char *flatFieldFile,
- const char *p2vmFile,
- const char *darkFile,
- const char *skyFile,
- const char *inputFile,
- /* const char *outputFile,*/
- const int nbBinning,
- const amdlibERROR_TYPE errorType,
- const amdlibPISTON_ALGORITHM pistonType,
- const amdlibBOOLEAN noCheckP2vmId,
- const char * fctid);
-cpl_propertylist * SciCalCreateProduct( const char * fctid, char * szRawFile );
-
-/* amdlib */
-/*
-int amdlibIsJHKMode(amdlibRAW_DATA *data);
-amdlibCOMPL_STAT amdlibExplodeJHKScienceData (amdlibSCIENCE_DATA *srcScienceData,
- amdlibSCIENCE_DATA *dstScienceData,
- amdlibERROR_MSG errMsg);
- */
-
-
-/*-----------------------------------------------------------------------------
- Static variables
- -----------------------------------------------------------------------------*/
-
-/* static struct { */
-/* /\* Inputs *\/ */
-/* int bool_option ; */
-/* char str_option[512] ; */
-
-/* /\* Outputs *\/ */
-/* double qc_param ; */
-/* } amber_SciCal_config ; */
-
-static char amber_SciCal_man[] =
- "This recipe calculates Visibilities from a Pixel-To-Visibility-Matrix and Raw Files in 2- and 3-Telescope Mode (HL-version)\n"
- "\n";
-
-/*-----------------------------------------------------------------------------
- Functions code
- -----------------------------------------------------------------------------*/
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Append the properties in one list to another
- @param self The PAF propertylist to append to
- @param other The propertylist whose elements are copied or NULL
- @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error
-
- If other is NULL or empty nothing happens
-
- Comments are copied as well, but it is (currently) undefined how this works
- for non-unique properties.
-
- In addition the hierarchical keys will be changed according to the PAF rules:
-
- No ESO as first part
- No blank separator but a .
- */
-/*----------------------------------------------------------------------------*/
-static cpl_error_code amber_propertylist_append(cpl_propertylist * self,
- const cpl_propertylist * other)
-{
-
- int i, c;
- char szPAF[2048];
- char szTMP[2048];
-
- if (other == NULL) return CPL_ERROR_NONE;
-
- /*visir_assure_code(self, CPL_ERROR_NULL_INPUT);*/
-
- for (i=0; i < cpl_propertylist_get_size(other); i++)
- {
- const cpl_property * prop = cpl_propertylist_get((cpl_propertylist *)
- other, i);
- const char * name = cpl_property_get_name(prop);
- /*const char * comment = cpl_property_get_comment(prop);*/
-
- cpl_error_code err;
-
- /* Change the key to PAF syntax */
- strcpy( szPAF, name );
-
- /* Get rid of ESO (HAR, what a joke!) */
- if( !strncmp( szPAF, "ESO", 3 ) )
- {
- strcpy( szTMP, &szPAF[4] );
- strcpy( szPAF, szTMP );
- }
-
- /* Substitute spaces by points (YEAH!) */
- for( c=0; c<(int)strlen(szPAF); c++ )
- if( szPAF[c] == ' ' )
- szPAF[c] = '.';
-
- strcpy( (char *)name, szPAF );
-
- /* Append prop to self */
-
- switch (cpl_property_get_type(prop)) {
- case CPL_TYPE_CHAR:
- err = cpl_propertylist_append_char(self, name,
- cpl_property_get_char(prop));
- case CPL_TYPE_BOOL:
- err = cpl_propertylist_append_bool(self, name,
- cpl_property_get_bool(prop));
- break;
- case CPL_TYPE_INT:
- err = cpl_propertylist_append_int(self, name,
- cpl_property_get_int(prop));
- break;
- case CPL_TYPE_LONG:
- err = cpl_propertylist_append_long(self, name,
- cpl_property_get_long(prop));
- break;
- case CPL_TYPE_FLOAT:
- err = cpl_propertylist_append_float(self, name,
- cpl_property_get_float(prop));
- break;
- case CPL_TYPE_DOUBLE:
- err = cpl_propertylist_append_double(self, name,
- cpl_property_get_double(prop));
- break;
- case CPL_TYPE_STRING:
- err = cpl_propertylist_append_string(self, name,
- cpl_property_get_string(prop));
- break;
-
- /* Avoid compiler warnings but do nothing */
- case CPL_TYPE_FLAG_ARRAY:
- case CPL_TYPE_INVALID:
- case CPL_TYPE_UCHAR:
- case CPL_TYPE_UINT:
- case CPL_TYPE_ULONG:
- case CPL_TYPE_POINTER:
- case CPL_TYPE_FLOAT_COMPLEX:
- case CPL_TYPE_DOUBLE_COMPLEX:
- case CPL_TYPE_UNSPECIFIED:
- /*case CPL_TYPE_COMPLEX: not anymode in CPL 3.0 */
- break;
- /*default:
- visir_assure_code(0, CPL_ERROR_UNSUPPORTED_MODE);*/
- }
-
- /*visir_assure_code(!err, err);
-
- if (comment && cpl_propertylist_set_comment(self, name, comment))
- visir_assure_code(0, cpl_error_get_code());*/
- }
-
- return CPL_ERROR_NONE;
-}
-
-
-cpl_propertylist * SciCalCreateProduct( const char * fctid, char * szRawFile )
- {
- int iStatus = 0;
- char szMessage[1024];
- cpl_table * pTable;
- cpl_propertylist * pTableHeader;
- int iTable;
- int iError;
-
- cpl_frameset * frameSetTmp;
- cpl_frame * frameTmp;
- /*cpl_propertylist * pHeader;*/
-
- /* For DFS fill Header function later */;
- /* pHeader = cpl_propertylist_new(); */
- /*pFrame = cpl_frame_new();*/
-
- /* Now write the OiFile as Productfilename */
- sprintf( szFilenameProduct, "amber_%04d.fits", iProductNumber );
-
-
-
- pframeSCIENCE[iProductNumber] = cpl_frame_new();
-
- if( pframeSCIENCE[iProductNumber] )
- {
- cpl_frame_set_filename( pframeSCIENCE[iProductNumber], szFilenameProduct );
- cpl_frame_set_type( pframeSCIENCE[iProductNumber], CPL_FRAME_TYPE_TABLE );
- if( isFrameScience[i] )
- cpl_frame_set_tag( pframeSCIENCE[iProductNumber], "SCIENCE_REDUCED" );
- else
- cpl_frame_set_tag( pframeSCIENCE[iProductNumber], "CALIB_REDUCED" );
-
- cpl_frame_set_group( pframeSCIENCE[iProductNumber], CPL_FRAME_GROUP_PRODUCT );
- cpl_frame_set_level( pframeSCIENCE[iProductNumber], CPL_FRAME_LEVEL_FINAL );
- }
- else
- {
- cpl_msg_info( fctid, "No memory for product frame." );
- iStatus = 15;
- }
-
- /*
- sprintf( szMessage, "cpl_frame_set (\"%s\")", cpl_frame_get_filename(pframeSCIENCE[iProductNumber]) );
- cpl_msg_info( fctid, "%s", szMessage );
- */
-
- /*
- * Create the Product file, start with filling the header
- *
- * Attention: for the time of this workaround for cpl 3D tables the amdlib must
- * be patched to NOT create OWN files, but APPEND to existing ones!!
- *
- * see comment below
- *
- */
-
-
- /*
- * Workaround for cpl_dfs_setup_product_header picking the wrong Header in this CPL release and
- * also might pick the wrong in the future! It uses the first RAW frame, but this recipe can handle
- * many raw frames. Hence:
- *
- * Read the Header of the RAW file to be written as a product and send it to the function
- */
- pHeader = cpl_propertylist_load( szRawFile, 0 );
- sprintf( szMessage, "Extracting product header from file %s for target named %s [%s].", szRawFile, cpl_propertylist_get_string( pHeader, "ESO OBS NAME" ), cpl_error_get_message() );
- cpl_msg_info( fctid, "%s", szMessage );
-
- /*The ARCFILE is needed for the paf file in the selector and trf products*/
- if (cpl_propertylist_has(pHeader, "ARCFILE") == 1)
- {
- cpl_propertylist_append_string(pHeader,"ESO QC ARC",
- (cpl_propertylist_get_string(pHeader, "ARCFILE")));
- }
-
- /* Create a set of frames with just this frame, so header will be correct */
- frameSetTmp = cpl_frameset_new();
- frameTmp = cpl_frame_new();
-
- cpl_frame_set_filename( frameTmp, szRawFile );
- cpl_frame_set_type( frameTmp, CPL_FRAME_TYPE_TABLE );
- if( isFrameScience[iProductNumber] )
- cpl_frame_set_tag( frameTmp, "AMBER_SCIENCE" );
- else
- cpl_frame_set_tag( frameTmp, "AMBER_CALIB" );
- cpl_frame_set_group( frameTmp, CPL_FRAME_GROUP_RAW );
- cpl_frame_set_level( frameTmp, CPL_FRAME_LEVEL_NONE );
- cpl_frameset_insert( frameSetTmp, frameTmp );
-
-
-
-
- /* Add the necessary DFS fits header information to the product */
-#if defined CPL_VERSION_CODE && CPL_VERSION_CODE >= CPL_VERSION(4, 8, 0)
- if( cpl_dfs_setup_product_header( pHeader,
- pframeSCIENCE[iProductNumber],
- frameSetTmp,
- gparlist,
- "amber_SciCal", /* const char * recid, */
- PACKAGE "/" PACKAGE_VERSION, /* const char * pipeline_id, */
- PRODUCT_DID, /* const char * dictionary_id */
- NULL
- ) != CPL_ERROR_NONE )
- {
- /* Error */
- sprintf( szMessage, "Error in setting up the product header." );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = 16;
- }
-#else
- if( cpl_dfs_setup_product_header( pHeader,
- pframeSCIENCE[iProductNumber],
- frameSetTmp,
- gparlist,
- "amber_SciCal", /* const char * recid, */
- PACKAGE "/" PACKAGE_VERSION, /* const char * pipeline_id, */
- PRODUCT_DID /* const char * dictionary_id */
- ) != CPL_ERROR_NONE )
- {
- /* Error */
- sprintf( szMessage, "Error in setting up the product header." );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = 16;
- }
-#endif
-
-
-
- sprintf( szMessage, "Header from file %s for target named %s [%s].", szRawFile, cpl_propertylist_get_string( pHeader, "ESO OBS NAME" ), cpl_error_get_message() );
- cpl_msg_info( fctid, "%s", szMessage );
-
- /* Destroy tmpFrameset and implicitly its contents */
- cpl_frameset_delete( frameSetTmp );
- /*cpl_frame_delete( frameTmp );*/
-
- /* Write the product including proper DFS header*/
-
- pTable = NULL;
- pTableHeader = NULL;
- iTable = 1;
- iError = CPL_ERROR_NONE;
-
- sprintf( szMessage, "Creating product file%s...", szFilenameProduct );
- cpl_msg_info( fctid, "%s", szMessage );
-
- /*
- * Workaround:
- * CPL cannot handle 3D-tables, hence, write just the header to a fits file and let
- * the amdlibWriteOI just append the data (and not create a whole file as intended by amdlib design
- * see Module amdlibWriteOI.c
- */
-
-
- return pHeader;
- }
-
-amdlibCOMPL_STAT amdlibExtractVisESO( const char *badPixelFile,
- const char *flatFieldFile,
- const char *p2vmFile,
- const char *darkFile,
- const char *skyFile,
- const char *inputFile,
- /* const char *outputFile,*/
- const int nbBinning,
- const amdlibERROR_TYPE errorType,
- const amdlibPISTON_ALGORITHM pistonType,
- const amdlibBOOLEAN noCheckP2vmId,
- const char * fctid
-)
-{
-
-
- char szCommand[1024];
- const char * pszARCFILE;
-
- amdlibCOMPL_STAT Status = amdlibSUCCESS;
-
- int i;
- char szMessage[1024];
-
- amdlibCPT_VIS_OPTIONS visOptions = {nbBinning, errorType, pistonType,
- noCheckP2vmId, amdlibNO_FRAME_SEL, 1.0};
-
-
- /* Product FITS QC header */
- cpl_propertylist * qc_properties = NULL;
- amdlibBAND_DESC *bandDesc;
- int iFrame = 0;
- int iFrame_GT_SNR2 = 0;
- float fFrame_GT_SNR2_Percent = 0.F;
- AmPaf * qc = NULL;
- cpl_propertylist * qclog = NULL;
- cpl_propertylist * qcFromProduct = NULL;
- cpl_propertylist * qcFromRawfile = NULL;
-
-
-
- amdlibLogTrace("amdlibExtractVisESO()\n");
-
-
- /* Load bad pixel map */
- sprintf( szMessage, "Loading BAD PIXEL MAP %s ...", badPixelFile );
- cpl_msg_info( fctid, "%s", szMessage );
-
- if( amdlibLoadBadPixelMap( badPixelFile, errMsg) != amdlibSUCCESS)
- {
- printf ("Could not load bad pixel map '%s'\n", badPixelFile);
- cpl_msg_info( fctid, "%s", errMsg );
- return (amdlibFAILURE);
- }
-
- /* Load flat field map */
- sprintf( szMessage, "Loading FLAT FIELD %s ...", flatFieldFile );
- cpl_msg_info( fctid, "%s", szMessage );
-
- if( amdlibLoadFlatFieldMap( flatFieldFile, errMsg)!=amdlibSUCCESS)
- {
- printf ("Could not load Flat Field file '%s'n", flatFieldFile);
- cpl_msg_info( fctid, "%s", errMsg );
- return (amdlibFAILURE);
- }
-
- /* Load P2VM */
- sprintf( szMessage, "Loading P2VM %s ...", p2vmFile );
- cpl_msg_info( fctid, "%s", szMessage );
-
- if( amdlibLoadP2VM( p2vmFile, &p2vm, errMsg) == amdlibFAILURE)
- {
- printf ("Could not load P2VM file '%s'\n", p2vmFile);
- cpl_msg_info( fctid, "%s", errMsg );
- return (amdlibFAILURE);
- }
-
- /* Retrieve wavedata */
- if( amdlibGetWaveDataFromP2vm( &p2vm, &waveData, errMsg ) != amdlibSUCCESS)
- {
- printf ("Could not get wave data from P2VM file '%s'\n", p2vmFile);
- cpl_msg_info( fctid, "%s", errMsg );
- return (amdlibFAILURE);
- }
-
- /* Load bias file */
- if (strlen(darkFile) != 0)
- {
- sprintf( szMessage, "Loading DARK (BIAS) %s ...\n", darkFile );
- cpl_msg_info( fctid, "%s", szMessage );
-
- if (amdlibLoadRawData(darkFile, &rawData, errMsg) != amdlibSUCCESS)
- {
- cpl_msg_error(cpl_func,"Could not load bias file '%s'", darkFile);
- return (amdlibFAILURE);
- }
- /* Compute pixel bias map */
- sprintf( szMessage, "Computing PIXEL BIAS MAP..." );
- cpl_msg_info( fctid, "%s", szMessage );
-
- if (amdlibGenerateDarkData(&rawData, &dark,
- errMsg) != amdlibSUCCESS)
- {
- printf ("Could not generate pixel bias map\n");
- cpl_msg_info( fctid, "%s", errMsg );
- return (amdlibFAILURE);
- }
- amdlibReleaseRawData(&rawData);
- }
- else
- {
- sprintf( szMessage, "No PIXEL BIAS MAP available due to no DARK file." );
- cpl_msg_info( fctid, "%s", szMessage );
-
- /* Load data file so that the false bias mimics its structure */
- i=6;
- sprintf( szMessage, "Getting PIXEL BIAS MAP from raw %s ...", inputFile );
- cpl_msg_info( fctid, "%s", szMessage );
- if (amdlibLoadRawData(inputFile, &rawData, errMsg) != amdlibSUCCESS)
- {
- sprintf( szMessage, "Could not load raw data file '%s'", inputFile);
- cpl_msg_info( fctid, "%s", errMsg );
- return (amdlibFAILURE);
- }
- amdlibSetDarkData( &rawData, &dark, 0.0, amdlibTYPICAL_RON , errMsg);
- amdlibReleaseRawData(&rawData);
- }
-
- /* Load sky file */
- if (strlen(skyFile) != 0)
- {
- printf ("Loading %s ...\n", skyFile);
- if (amdlibLoadRawData(skyFile, &rawData, errMsg) != amdlibSUCCESS)
- {
- printf ("Could not load sky file '%s'\n", skyFile);
- cpl_msg_info( fctid, "%s", errMsg );
- return (amdlibFAILURE);
- }
- /* Equalize raw data */
- if( amdlibCalibrateRawData( &dark, &rawData, errMsg) !=amdlibSUCCESS )
- {
- cpl_msg_info( fctid, "%s", errMsg );
- return (amdlibFAILURE);
- }
-
- /* Equalize raw map */
- if (amdlibRawData2ScienceData(&rawData, &waveData, &sky, amdlibTRUE, errMsg) != amdlibSUCCESS)
- {
- printf ("Could not get science data\n");
- cpl_msg_info( fctid, "%s", errMsg );
- return (amdlibFAILURE);
- }
- /* if in JHK Mode, split Science Data in rows accordingly */
- skyPtr = &sky;
- amdlibReleaseRawData(&rawData);
-
- }
- else
- {
- sprintf( szMessage, "No SKY will be used...\n" );
- cpl_msg_info( fctid, "%s", szMessage );
- skyPtr = NULL;
- }
-
- /* Load data file */
- sprintf( szMessage, "Loading RawData %s ...", inputFile );
- cpl_msg_info( fctid, "%s", szMessage );
- if (amdlibLoadRawData(inputFile, &rawData, errMsg) != amdlibSUCCESS)
- {
- sprintf( szMessage, "Could not load raw data file '%s'", inputFile );
- cpl_msg_info( fctid, "%s", szMessage );
- cpl_msg_info( fctid, "%s", errMsg );
- return (amdlibFAILURE);
- }
- /* Equalize raw data */
- sprintf( szMessage, "Equalizing Raw Data." );
- cpl_msg_info( fctid, "%s", szMessage );
- if (amdlibCalibrateRawData(&dark, &rawData, errMsg) !=amdlibSUCCESS)
- {
- cpl_msg_info( fctid, "%s", errMsg );
- return (amdlibFAILURE);
- }
-
- /* Retrieve array information from raw data*/
- if (amdlibGetOiArrayFromRawData(&rawData, &array, errMsg) != amdlibSUCCESS)
- {
- sprintf( szMessage, "Warning -- Unable to retrieve OI_ARRAY information from input file");
- cpl_msg_info( fctid, "%s", szMessage );
- amdlibReleaseOiArray(&array);
- }
-
- /* retrieve target information */
- if (amdlibAllocateOiTarget(&target, 1) != amdlibSUCCESS)
- {
- printf ("Could not Allocate Target Structure\n");
- cpl_msg_info( fctid, "%s", szMessage );
- return (amdlibFAILURE);
- }
- if (amdlibGetOiTargetFromRawData(&rawData,&target) != amdlibSUCCESS)
- {
- printf ("Could not Add to Target Structure\n");
- cpl_msg_info( fctid, "%s", szMessage );
- return (amdlibFAILURE);
- }
-
-
- /* Produce science data */
- sprintf( szMessage, "Producing Science Data..." );
- cpl_msg_info( fctid, "%s", szMessage );
-
- if (amdlibRawData2ScienceData(&rawData, &waveData, &scienceData, amdlibFALSE,
- errMsg) != amdlibSUCCESS)
- {
- printf ("Could not get science data");
- cpl_msg_info( fctid, "%s", errMsg );
- return (amdlibFAILURE);
- }
-
- sciencePtr = &scienceData;
- amdlibReleaseRawData(&rawData);
- amdlibReleaseDarkData(&dark);
-
-
- for (band = amdlibJ_BAND; band <= amdlibK_BAND; band++)
- {
- int nbChannels;
-
- sprintf( szMessage, "Working on '%c' band", amdlibBandNumToStr(band));
- cpl_msg_info( fctid, "%s", szMessage );
-
- /* Compute visibilities */
- nbChannels = amdlibComputeVisibilities
- (/* Input */
- sciencePtr, &p2vm, &waveData, band, &visOptions,
- /* Output */
- &imdPhot, &imdVis, &imdVis2, &imdVis3, &imdWave, &imdOpd,
- errMsg);
- if (nbChannels == -1)
- {
- sprintf( szMessage, "Could NOT extract visibilities for '%c' band !", amdlibBandNumToStr(band));
- cpl_msg_info( fctid, "%s", szMessage );
-
- return (amdlibFAILURE);
- }
- else if (nbChannels == 0)
- {
- sprintf( szMessage, "There is no channel for '%c' band", amdlibBandNumToStr(band));
- cpl_msg_info( fctid, "%s", szMessage );
- }
- else
- {
- /* Print results */
- sprintf( szMessage, "Band: %c", amdlibBandNumToStr(band) );
- cpl_msg_info( fctid, "%s", szMessage );
-
- if (vis2.nbBases == 1)
- {
- sprintf( szMessage, " VIS (err)");
- cpl_msg_info( fctid, "%s", szMessage );
-
- sprintf( szMessage, "%12.3f (%8.03g)\n", imdVis2.vis12, imdVis2.sigmaVis12 );
- cpl_msg_info( fctid, "%s", szMessage );
- }
- else
- {
- sprintf( szMessage, "Global Averaged Visibilities Squared (using all Frames):");
- cpl_msg_info( fctid, "%s", szMessage );
-
- sprintf( szMessage, " VIS 12 (err) VIS 23 (err) VIS 31 (err)");
- cpl_msg_info( fctid, "%s", szMessage );
- sprintf( szMessage, "%12.3f(%8.03g) %12.3f(%8.03g) %12.3f(%8.03g)",
- imdVis2.vis12, imdVis2.sigmaVis12, imdVis2.vis12, imdVis2.sigmaVis12, imdVis2.vis31, imdVis2.sigmaVis31 );
- cpl_msg_info( fctid, "%s", szMessage );
- sprintf( szMessage, "AverageClosurePhase (deg)= %8.03g (%8.03g)", imdVis3.averageClosure,imdVis3.averageClosureError );
- cpl_msg_info( fctid, "%s", szMessage );
- } /* 2 Tel or 3 Tel */
-
-#ifdef NEVER_PERFORM_FRAME_SELECTION_USE_AMBER_SELECTOR_AFTERWARDS
- /* If required, perform frame selection */
- if (visOptions->frameSelectionType != amdlibNO_FRAME_SEL)
- {
- amdlibAllocateSelection(&selectedFrames, vis->nbFrames);
- /* Select 'good' frames depending on selection criterion */
- if (amdlibSelectFrames(vis, photometry,
- visOptions->frameSelectionType,
- visOptions->frameSelectionRatio,
- &selectedFrames,
- band, errMsg) != amdlibSUCCESS)
- {
- return -1;
- }
-
- /* Average visibilities, photometries and pistons on good frames */
- if (amdlibAverageVisibilities(photometry,
- vis, vis2, vis3,
- opd, band, wave,
- &selectedFrames, errMsg) != amdlibSUCCESS)
- {
- return -1;
- }
-
- amdlibReleaseSelection(&selectedFrames);
- }
-
- /*return nbChannelsInBand; */
-#endif
-
-
-
-
-
- /*---------------------------------------------------------------------------------------------------------------*/
- /* Creates Product File and sets up DFO compliant Header */
- qc_properties = SciCalCreateProduct( fctid, (char *)inputFile );
-
- /*---------------------------------------------------------------------------------------------------------------*/
- /* Calculating and Writing QC1 Parameters to header */
- cpl_msg_info(fctid, "Computing QC1 parameters ...");
-
- /* Get spectrum */
- if (amdlibGetSpectrumFromScienceData
- (sciencePtr, &waveData, &imdWave,
- &spectrum, errMsg) != amdlibSUCCESS)
- {
- amdlibLogError("Could not get spectrum from science "
- "data");
- amdlibLogErrorDetail(errMsg);
- return amdlibFAILURE;
- }
-
-
- if (nbChannels > 0){
- amber_qc(&imdWave, &imdVis, &imdVis2, &imdVis3, &spectrum, qc_properties,
- "uncal");
- }
-
-
- iFrame = 0;
- iFrame_GT_SNR2 = 0;
- fFrame_GT_SNR2_Percent = 0.F;
-
- sprintf( szMessage, "Number of Frames = %d", imdVis.nbFrames );
- cpl_msg_info( fctid, "%s", szMessage );
-
- /* Count Frames with Fringe SNR greater than 2 */
- for(iFrame = 0; iFrame < imdVis.nbFrames; iFrame++)
- if( imdVis.table[iFrame].frgContrastSnr > 2 )
- iFrame_GT_SNR2++;
-
- /* Calc the Percentage of these Frames */
- fFrame_GT_SNR2_Percent = (float)iFrame_GT_SNR2 / (float)imdVis.nbFrames;
-
- sprintf( szMessage, "QC: %d of %d Frames having SNR greater than 2 = %0.2f percent", iFrame_GT_SNR2, imdVis.nbFrames, fFrame_GT_SNR2_Percent*100.0 );
- cpl_msg_info( fctid, "%s", szMessage );
-
- cpl_propertylist_append_long( qc_properties, "ESO QC FRAMES SELECTED SNRGT2", iFrame_GT_SNR2 );
- cpl_propertylist_set_comment( qc_properties, "ESO QC FRAMES SELECTED SNRGT2", "Frames selected with SNR greater than 2 ");
-
- cpl_propertylist_append_float( qc_properties, "ESO QC FRAMES SELECTED PERCENT", fFrame_GT_SNR2_Percent*100.0 );
- cpl_propertylist_set_comment( qc_properties, "ESO QC FRAMES SELECTED PERCENT", "Frames selected percentage");
-
-
- bandDesc = amdlibGetBandDescription(band);
-
- cpl_propertylist_append_string( qc_properties, "ESO QC BAND", bandDesc->name );
- cpl_propertylist_set_comment( qc_properties, "ESO QC BAND", "wavelength band ");
-
- /* Write the telescope station indices as QC parameters, for later easy plotting etc. */
- cpl_propertylist_append_int( qc_properties, "ESO QC STA1", array.element[0].stationIndex );
- cpl_propertylist_set_comment( qc_properties, "ESO QC STA1", "index of station ");
- cpl_propertylist_append_int( qc_properties, "ESO QC STA2", array.element[1].stationIndex );
- cpl_propertylist_set_comment( qc_properties, "ESO QC STA2", "index of station ");
-
- if( array.nbStations == 3 )
- {
- cpl_propertylist_append_int( qc_properties, "ESO QC STA3", array.element[2].stationIndex );
- cpl_propertylist_set_comment( qc_properties, "ESO QC STA3", "index of station ");
- }
-
- /*Adding the JMMC acknowledgements*/
- amber_JMMC_acknowledgement(pHeader);
-
- if (CPL_ERROR_NONE != cpl_image_save(NULL, szFilenameProduct, CPL_BPP_16_SIGNED, pHeader, CPL_IO_DEFAULT ))
- {
- cpl_msg_error(cpl_func,"Error in cpl_image_save");
- }
-
-
- /*---------------------------------------------------------------------------------------------------------------*/
- /* Writes instrument scientific data */
-
- if (strlen(szFilenameProduct) != 0)
- {
- sprintf ( szMessage, "Now writing Scientific Data to %s...", szFilenameProduct );
- cpl_msg_info( fctid, "%s", szMessage );
-
-
-
-
-
-
-
-
- if( amdlibSaveOiFile( szFilenameProduct, NULL,
- &array, &target,
- &imdPhot, &imdVis, &imdVis2,
- &imdVis3, &imdWave,
- &imdOpd,&spectrum, errMsg
- ) != amdlibSUCCESS)
- {
- Status = amdlibFAILURE;
- sprintf ( szMessage, "ERROR saving Scientific Data to %s.", szFilenameProduct );
- cpl_msg_info( fctid, "%s", szMessage );
-
- }
- else
- {
- sprintf ( szMessage, "Scientific Data %s saved successfully.", szFilenameProduct );
- cpl_msg_info( fctid, "%s", szMessage );
-
- /* Now copy the file to tmp to be able to plot the files after the
- originals are renamed by ESOREX
- */
- //sprintf( szCommand, "cp %s /tmp/%s", szFilenameProduct, szFilenameProduct );
- //system( szCommand );
- }
- } /* if product filname */
-
-
- /*---------------------------------------------------------------------------------------------------------------*/
- /* Writing QC1 Parameters to log */
- qc = NULL;
- qclog = NULL;
- qcFromProduct = NULL;
- qcFromRawfile = NULL;
-
-
- qcFromRawfile= cpl_propertylist_load(inputFile, 0 );
-
- qc = amber_qclog_open(iProductNumber);
-
- if( qc )
- {
- cpl_msg_info(fctid, "QC1 log open ...");
-
- qclog = amber_paf_get_properties( qc );
-
- /* Read original ARCFILE entry and copy to PAF-File */
- pszARCFILE = cpl_propertylist_get_string( qcFromRawfile, "ARCFILE" );
-
- /* Add mandatory keys */
- cpl_propertylist_append_string( qclog, "ARCFILE", pszARCFILE );
-
- /* Read the whole header including QC parameters */
- qcFromProduct = cpl_propertylist_load( szFilenameProduct, 0 );
-
- /* copy to PAF */
- amber_propertylist_append( qclog, qcFromProduct);
- cpl_propertylist_delete(qcFromProduct);
-
- /* Finished... */
- cpl_msg_info(fctid, "QC1 finished.");
- amber_qclog_close(qc);
-
-
- } /* if qc */
-
- cpl_propertylist_delete( qc_properties );
- cpl_propertylist_delete( qcFromRawfile );
- iProductNumber++;
- } /* Write the product */
- } /* all bands */
-
-
- amdlibReleaseScienceData(sciencePtr);
- if (skyPtr != NULL)
- {
- amdlibReleaseScienceData(skyPtr);
- }
- amdlibReleaseP2VM(&p2vm);
- amdlibReleaseVis(&vis);
- amdlibReleaseVis2(&vis2);
- amdlibReleaseVis3(&vis3);
- amdlibReleaseOiArray(&array);
- amdlibReleaseWavelength(&wave);
- amdlibReleasePiston(&opd);
- amdlibReleasePhotometry(&photometry);
- amdlibReleaseOiTarget(&target);
-
- amdlibReleasePhotometry(&imdPhot);
- amdlibReleaseVis(&imdVis);
- amdlibReleaseVis2(&imdVis2);
- amdlibReleaseVis3(&imdVis3);
- amdlibReleaseWavelength(&imdWave);
- amdlibReleasePiston(&imdOpd);
- amdlibReleaseSpectrum(&spectrum);
-
- return (Status);
-}
-
-/*----------------------------------------------------------------------------*/
-/**
- @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,
- AMBER_BINARY_VERSION,
- CPL_PLUGIN_TYPE_RECIPE,
- "amber_SciCal",
- "AMBER Science and Calibration Recipe",
- amber_SciCal_man,
- "Tom Licha",
- PACKAGE_BUGREPORT,
- "GP",
- amber_SciCal_create,
- amber_SciCal_exec,
- amber_SciCal_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 amber_SciCal_create(cpl_plugin * plugin)
-{
- cpl_recipe * recipe = (cpl_recipe *)plugin ;
- cpl_parameter * p ;
-
- /* Create the parameters list in the cpl_recipe object */
- recipe->parameters = cpl_parameterlist_new() ;
-
- /* Fill the parameters list */
-
- /* binning int */
- p = cpl_parameter_new_value("amber.amber_SciCal.int_binning",
- CPL_TYPE_INT, "Number of Frames to be averaged per Visibility", "amber.amber_SciCal", 1 ) ;
- cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "binning") ;
- cpl_parameterlist_append(recipe->parameters, p) ;
-
-
- p = cpl_parameter_new_value("amber.amber_SciCal.selectPlusTrf",
- CPL_TYPE_BOOL, "select good visibilities and try to calculate "
- "the transfer function", "amber.amber_SciCal", TRUE) ;
- cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "selectPlusTrf") ;
- cpl_parameterlist_append(recipe->parameters, p) ;
-
-
- //
- //
- p = cpl_parameter_new_value("amber.amber_SciCal.activate_BEAUTIFY_PISTON", CPL_TYPE_BOOL, "TBD", "amber.amber_SciCal",TRUE);
- cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_BEAUTIFY_PISTON");
- cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.activate_CHISQUARE_LIMIT", CPL_TYPE_BOOL, "TBD", "amber.amber_SciCal",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_CHISQUARE_LIMIT");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.activate_MAX_PISTON_ERROR", CPL_TYPE_BOOL, "TBD", "amber.amber_SciCal",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_MAX_PISTON_ERROR");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.activate_SHIFT_WLENTABLE", CPL_TYPE_BOOL, "TBD", "amber.amber_SciCal",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_SHIFT_WLENTABLE");
- // cpl_parameterlist_append(recipe->parameters, p);
- p = cpl_parameter_new_value("amber.amber_SciCal.activate_MIN_PHOTOMETRY", CPL_TYPE_BOOL, "TBD", "amber.amber_SciCal",TRUE);
- cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_MIN_PHOTOMETRY");
- cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.activate_CORRECT_OPD0", CPL_TYPE_BOOL, "TBD", "amber.amber_SciCal",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_CORRECT_OPD0");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.activate_LINEARIZE_P2VM_PHASE", CPL_TYPE_BOOL, "TBD", "amber.amber_SciCal",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_LINEARIZE_P2VM_PHASE");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.activate_NORMALIZE_P2VM", CPL_TYPE_BOOL, "TBD", "amber.amber_SciCal",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_NORMALIZE_P2VM");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.activate_NO_FUDGE", CPL_TYPE_BOOL, "TBD", "amber.amber_SciCal",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_NO_FUDGE");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.activate_NO_BIAS", CPL_TYPE_BOOL, "TBD", "amber.amber_SciCal",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_NO_BIAS");
- // cpl_parameterlist_append(recipe->parameters, p);
- p = cpl_parameter_new_value("amber.amber_SciCal.activate_DROP", CPL_TYPE_BOOL, "TBD", "amber.amber_SciCal",FALSE);
- cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_DROP");
- cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.activate_NORMALIZE_SPECTRUM", CPL_TYPE_BOOL, "TBD", "amber.amber_SciCal",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_NORMALIZE_SPECTRUM");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.activate_BOXCARSMOOTH_P2VM_PHASE", CPL_TYPE_BOOL, "TBD", "amber.amber_SciCal",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_BOXCARSMOOTH_P2VM_PHASE");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.activate_GAUSSSMOOTH_P2VM_PHASE", CPL_TYPE_BOOL, "TBD", "amber.amber_SciCal",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_GAUSSSMOOTH_P2VM_PHASE");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.activate_AUTO_BADPIXEL", CPL_TYPE_BOOL, "TBD", "amber.amber_SciCal",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_AUTO_BADPIXEL");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.activate_MAX_PISTON_EXCURSION", CPL_TYPE_BOOL, "TBD", "amber.amber_SciCal",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_MAX_PISTON_EXCURSION");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.activate_GLOBAL_PHOTOMETRY", CPL_TYPE_BOOL, "TBD", "amber.amber_SciCal",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_GLOBAL_PHOTOMETRY");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.activate_USE_GAIN", CPL_TYPE_BOOL, "TBD", "amber.amber_SciCal",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_USE_GAIN");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.activate_ZAP_JHK_DISCONTINUTIES", CPL_TYPE_BOOL, "TBD", "amber.amber_SciCal",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_ZAP_JHK_DISCONTINUTIES");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.activate_AUTO_SHIFT_JHK", CPL_TYPE_BOOL, "TBD", "amber.amber_SciCal",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_AUTO_SHIFT_JHK");
- // cpl_parameterlist_append(recipe->parameters, p);
- //
- //
- p = cpl_parameter_new_value("amber.amber_SciCal.value_BEAUTIFY_PISTON", CPL_TYPE_DOUBLE, "TBD", "amber.amber_SciCal",1.0);
- cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_BEAUTIFY_PISTON");
- cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.value_CHISQUARE_LIMIT", CPL_TYPE_DOUBLE, "TBD", "amber.amber_SciCal",0.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_CHISQUARE_LIMIT");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.value_MAX_PISTON_ERROR", CPL_TYPE_DOUBLE, "TBD", "amber.amber_SciCal",0.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_MAX_PISTON_ERROR");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.value_SHIFT_WLENTABLE", CPL_TYPE_DOUBLE, "TBD", "amber.amber_SciCal",0.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_SHIFT_WLENTABLE");
- // cpl_parameterlist_append(recipe->parameters, p);
- p = cpl_parameter_new_value("amber.amber_SciCal.value_MIN_PHOTOMETRY", CPL_TYPE_DOUBLE, "TBD", "amber.amber_SciCal",0.0);
- cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_MIN_PHOTOMETRY");
- cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.value_CORRECT_OPD0", CPL_TYPE_DOUBLE, "TBD", "amber.amber_SciCal",0.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_CORRECT_OPD0");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.value_LINEARIZE_P2VM_PHASE", CPL_TYPE_DOUBLE, "TBD", "amber.amber_SciCal",0.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_LINEARIZE_P2VM_PHASE");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.value_NORMALIZE_P2VM", CPL_TYPE_DOUBLE, "TBD", "amber.amber_SciCal",0.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_NORMALIZE_P2VM");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.value_NO_FUDGE", CPL_TYPE_DOUBLE, "TBD", "amber.amber_SciCal",0.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_NO_FUDGE");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.value_NO_BIAS", CPL_TYPE_DOUBLE, "TBD", "amber.amber_SciCal",0.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_NO_BIAS");
- // cpl_parameterlist_append(recipe->parameters, p);
- p = cpl_parameter_new_value("amber.amber_SciCal.value_DROP", CPL_TYPE_DOUBLE, "TBD", "amber.amber_SciCal",0);
- cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_DROP");
- cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.value_NORMALIZE_SPECTRUM", CPL_TYPE_DOUBLE, "TBD", "amber.amber_SciCal",0.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_NORMALIZE_SPECTRUM");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.value_BOXCARSMOOTH_P2VM_PHASE", CPL_TYPE_DOUBLE, "TBD", "amber.amber_SciCal",0.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_BOXCARSMOOTH_P2VM_PHASE");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.value_GAUSSSMOOTH_P2VM_PHASE", CPL_TYPE_DOUBLE, "TBD", "amber.amber_SciCal",0.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_GAUSSSMOOTH_P2VM_PHASE");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.value_AUTO_BADPIXEL", CPL_TYPE_DOUBLE, "TBD", "amber.amber_SciCal",0.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_AUTO_BADPIXEL");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.value_MAX_PISTON_EXCURSION", CPL_TYPE_DOUBLE, "TBD", "amber.amber_SciCal",0.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_MAX_PISTON_EXCURSION");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.value_GLOBAL_PHOTOMETRY", CPL_TYPE_DOUBLE, "TBD", "amber.amber_SciCal",0.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_GLOBAL_PHOTOMETRY");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.value_USE_GAIN", CPL_TYPE_DOUBLE, "TBD", "amber.amber_SciCal",0.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_USE_GAIN");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.value_ZAP_JHK_DISCONTINUTIES", CPL_TYPE_DOUBLE, "TBD", "amber.amber_SciCal",0.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_ZAP_JHK_DISCONTINUTIES");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_SciCal.value_AUTO_SHIFT_JHK", CPL_TYPE_DOUBLE, "TBD", "amber.amber_SciCal",0.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_AUTO_SHIFT_JHK");
- // 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 amber_SciCal_exec(cpl_plugin * plugin)
-{
- cpl_recipe * recipe = (cpl_recipe *)plugin ;
- return amber_SciCal(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 amber_SciCal_destroy(cpl_plugin * plugin)
-{
- cpl_recipe * recipe = (cpl_recipe *)plugin ;
- 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 amber_SciCal(
- cpl_parameterlist * parlist,
- cpl_frameset * framelist)
-{
- /* CPL structures */
- /* cpl_frameset * cur_set;*/
- cpl_frame * cur_frame;
- cpl_parameter * cur_param;
-
- int selectPlusTrf=0;
- char szMessage[1024];
- char * pszFilename;
- char * pszFileTag;
- char szFilenameOI[512];
-
- char szFilenameP2VM[512];
- char szFilenameSKY[512];
- char szFilenameDARK[512];
- char szFilenameBADPIX[512];
- char szFilenameFLAT[512];
-
- int iStatus = 0;
-
- int iFrameCount = 0;
- int iLoadedFrameCount = 0;
- int iReduction = 0;
- FILE * fpTmp = NULL;
-
- /*int iOnlyWriteOne = 0;*/
-
- const char * fctid = "amber_SciCal" ;
- //FILE * fp = NULL;
- amber_dfs_set_groups(framelist);
-
-
-
- if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_SciCal.activate_BEAUTIFY_PISTON"))) {amdlibSetUserPref(amdlibBEAUTIFY_PISTON, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_SciCal.value_BEAUTIFY_PISTON")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_SciCal.activate_CHISQUARE_LIMIT"))) {amdlibSetUserPref(amdlibCHISQUARE_LIMIT, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_SciCal.value_CHISQUARE_LIMIT")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_SciCal.activate_SHIFT_WLENTABLE"))) {amdlibSetUserPref(amdlibSHIFT_WLENTABLE, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_SciCal.value_SHIFT_WLENTABLE")));}
- if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_SciCal.activate_MIN_PHOTOMETRY"))) {amdlibSetUserPref(amdlibMIN_PHOTOMETRY, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_SciCal.value_MIN_PHOTOMETRY")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_SciCal.activate_CORRECT_OPD0"))) {amdlibSetUserPref(amdlibCORRECT_OPD0, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_SciCal.value_CORRECT_OPD0")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_SciCal.activate_LINEARIZE_P2VM_PHASE"))) {amdlibSetUserPref(amdlibLINEARIZE_P2VM_PHASE, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_SciCal.value_LINEARIZE_P2VM_PHASE")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_SciCal.activate_NORMALIZE_P2VM"))) {amdlibSetUserPref(amdlibNORMALIZE_P2VM, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_SciCal.value_NORMALIZE_P2VM")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_SciCal.activate_NO_FUDGE"))) {amdlibSetUserPref(amdlibNO_FUDGE, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_SciCal.value_NO_FUDGE")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_SciCal.activate_NO_BIAS"))) {amdlibSetUserPref(amdlibNO_BIAS, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_SciCal.value_NO_BIAS")));}
- if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_SciCal.activate_DROP"))) {amdlibSetUserPref(amdlibDROP, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_SciCal.value_DROP")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_SciCal.activate_NORMALIZE_SPECTRUM"))) {amdlibSetUserPref(amdlibNORMALIZE_SPECTRUM, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_SciCal.value_NORMALIZE_SPECTRUM")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_SciCal.activate_BOXCARSMOOTH_P2VM_PHASE"))) {amdlibSetUserPref(amdlibBOXCARSMOOTH_P2VM_PHASE, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_SciCal.value_BOXCARSMOOTH_P2VM_PHASE")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_SciCal.activate_GAUSSSMOOTH_P2VM_PHASE"))) {amdlibSetUserPref(amdlibGAUSSSMOOTH_P2VM_PHASE, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_SciCal.value_GAUSSSMOOTH_P2VM_PHASE")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_SciCal.activate_AUTO_BADPIXEL"))) {amdlibSetUserPref(amdlibAUTO_BADPIXEL, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_SciCal.value_AUTO_BADPIXEL")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_SciCal.activate_GLOBAL_PHOTOMETRY"))) {amdlibSetUserPref(amdlibGLOBAL_PHOTOMETRY, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_SciCal.value_GLOBAL_PHOTOMETRY")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_SciCal.activate_USE_GAIN"))) {amdlibSetUserPref(amdlibUSE_GAIN, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_SciCal.value_USE_GAIN")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_SciCal.activate_ZAP_JHK_DISCONTINUTIES"))) {amdlibSetUserPref(amdlibZAP_JHK_DISCONTINUTIES, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_SciCal.value_ZAP_JHK_DISCONTINUTIES")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_SciCal.activate_AUTO_SHIFT_JHK"))) {amdlibSetUserPref(amdlibAUTO_SHIFT_JHK, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_SciCal.value_AUTO_SHIFT_JHK")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_SciCal.activate_MAX_PISTON_ERROR"))) {amdlibSetUserPref(amdlibMAX_PISTON_ERROR, 1000*cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_SciCal.value_MAX_PISTON_ERROR")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_SciCal.activate_MAX_PISTON_EXCURSION"))) {amdlibSetUserPref(amdlibMAX_PISTON_EXCURSION, 1000*cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_SciCal.value_MAX_PISTON_EXCURSION")));};
-
-
-
-
-
-
- gframelist = framelist;
- gparlist = parlist;
-
- cpl_msg_info( fctid, "Start of DataReduction");
-
- strcpy( szFilenameOI, "OiVisibilities.fits" );
-
- strcpy( szFilenameP2VM, "" );
- strcpy( szFilenameSKY, "" );
- strcpy( szFilenameDARK, "" );
- strcpy( szFilenameBADPIX, "" );
- strcpy( szFilenameFLAT, "" );
-
-
-
- szFilenameSCIENCE = cpl_calloc(MAXFILESPRODUCTS, sizeof(char*));
- isFrameScience= cpl_calloc(MAXFILESPRODUCTS, sizeof(int));
- pframeSCIENCE = cpl_calloc(MAXFILESPRODUCTS, sizeof(cpl_frame*));
-
- for(i=0;i<MAXFILESPRODUCTS;i++)
- {
- szFilenameSCIENCE[i]= cpl_calloc(512, sizeof(char));
- }
-
-
- /* log of the fprint of the amdlib */
-
- //fp = freopen( "amdlib_SciCal.log", "w", stdout );
-
- /* Set some defaults, should be input parameters later! */
- errorType = amdlibSTATISTICAL_ERROR;
- pistonType = amdlibITERATIVE_PHASOR;
- /*pistonType = amdlibUNWRAPPED_PHASE;*/
-
- cur_param = cpl_parameterlist_find( parlist, "amber.amber_SciCal.int_binning" );
- iBinningOfFrames = cpl_parameter_get_int( cur_param );
-
- cur_param=cpl_parameterlist_find(parlist,
- "amber.amber_SciCal.selectPlusTrf");
- selectPlusTrf=cpl_parameter_get_bool(cur_param);
-
-
- if( iBinningOfFrames == 0 )
- iBinningOfFrames = 99999; /* Binning of all Frames */
-
- sprintf ( szMessage, "BINNING of %d frames will be used", iBinningOfFrames );
- cpl_msg_info( fctid, "%s", szMessage );
-
- if( iBinningOfFrames == 1 )
- {
- errorType = amdlibTHEORETICAL_ERROR;
- sprintf ( szMessage, "ERROR BAR calculation with amdlibTHEORETICAL_ERROR will be used for BINNING of 1 frame." );
- cpl_msg_info( fctid, "%s", szMessage );
- }
-
-
- /* BadPix and FlatField P2VM are needed as first Frames - the Rest can be loaded in random Order later */
- cur_frame = cpl_frameset_find( framelist, "AMBER_FLATFIELD" );
-
- if( cur_frame )
- {
- /* Get Filename and Classification Tag */
- pszFilename = (char *)cpl_frame_get_filename( cur_frame );
- pszFileTag = (char *)cpl_frame_get_tag( cur_frame );
-
- strcpy( szFilenameFLAT, pszFilename );
-
- sprintf ( szMessage, "FLAT FIELD identified %s", pszFilename );
- cpl_msg_info( fctid, "%s", szMessage );
- }
-
- cur_frame = cpl_frameset_find( framelist, "AMBER_BADPIX" );
-
- if( cur_frame )
- {
- /* Get Filename and Classification Tag */
- pszFilename = (char *)cpl_frame_get_filename( cur_frame );
- pszFileTag = (char *)cpl_frame_get_tag( cur_frame );
-
- strcpy( szFilenameBADPIX, pszFilename );
-
- sprintf ( szMessage, "BAD PIXEL MAP identified %s", pszFilename );
- cpl_msg_info( fctid, "%s", szMessage );
- }
-
- /* Try to load the optional SKY frame */
- cur_frame = cpl_frameset_find( framelist, "AMBER_SKY" );
-
- if (cur_frame==NULL){
- cur_frame = cpl_frameset_find( framelist, "AMBER_SKY_CALIB" );
- }
-
- if (cur_frame==NULL){
- cur_frame = cpl_frameset_find( framelist, "AMBER_SKY_SCIENCE" );
- }
-
- if( cur_frame )
- {
- /* Get Filename and Classification Tag */
- pszFilename = (char *)cpl_frame_get_filename( cur_frame );
- pszFileTag = (char *)cpl_frame_get_tag( cur_frame );
-
- strcpy( szFilenameSKY, pszFilename );
-
- sprintf ( szMessage, "SKY identified %s", pszFilename );
- cpl_msg_info( fctid, "%s", szMessage );
-
- }
-
-
- /* Loading either 2 or 3 Telescope P2VM */
- cur_frame = cpl_frameset_find( framelist, "AMBER_P2VM" );
-
- if( cur_frame )
- {
- /* Get Filename and Classification Tag */
- pszFilename = (char *)cpl_frame_get_filename( cur_frame );
- pszFileTag = (char *)cpl_frame_get_tag( cur_frame );
-
- strcpy( szFilenameP2VM, pszFilename );
-
- sprintf ( szMessage, "P2VM identified %s", pszFilename );
- cpl_msg_info( fctid, "%s", szMessage );
-
- }
- else
- {
- cur_frame = cpl_frameset_find( framelist, "P2VM_REDUCED" );
-
- if( cur_frame )
- {
- /* Get Filename and Classification Tag */
- pszFilename = (char *)cpl_frame_get_filename( cur_frame );
- pszFileTag = (char *)cpl_frame_get_tag( cur_frame );
-
- strcpy( szFilenameP2VM, pszFilename );
-
- sprintf ( szMessage, "P2VM identified %s", pszFilename );
- cpl_msg_info( fctid, "%s", szMessage );
- }
- }
-
- /*
- In case no P2VM was sent (i.e. during online pipeline run) then
- rely on the latest P2VM from tmp dir
- */
- if( !cur_frame )
- {
- /* PIPELINE will not send the P2VM. Try to load it from tmp */
- strcpy( szFilenameP2VM, "/tmp/current_P2VM.fits" );
-
- fpTmp = fopen( szFilenameP2VM, "r" );
-
- if( fpTmp )
- {
- fclose( fpTmp );
- sprintf ( szMessage, "latest pipeline P2VM identified %s", szFilenameP2VM );
- cpl_msg_info( fctid, "%s", szMessage );
- }
- }
-
- /*
- *
- Walk through the whole Set of Frames SOF and search for SCIENCE, CALIB or DARK
-
- for each OBJECT we will perform a calculation of visibilities and write a product
-
- */
- cur_frame = cpl_frameset_get_first( framelist );
-
- while( cur_frame )
- {
-
-
- iFrameCount++;
-
- /* Get Filename and Classification Tag */
- pszFilename = (char *)cpl_frame_get_filename( cur_frame );
- pszFileTag = (char *)cpl_frame_get_tag( cur_frame );
-
- /* Check Tag and Filename */
- if( pszFilename && pszFileTag )
- {
- sprintf( szMessage, "Frame #%d [Current execution status=%d]", iFrameCount, iStatus );
- cpl_msg_info( fctid, "%s", szMessage );
-
- /* SCIENCE / CALIB DARK */
- if(!strcmp( pszFileTag, "AMBER_DARK" ) ||
- !strcmp( pszFileTag, "AMBER_DARK_SCIENCE" ) ||
- !strcmp( pszFileTag, "AMBER_DARK_CALIB" ))
- {
- /* Use this Dark for the next Data Reduction */
- strcpy( szFilenameDARK, pszFilename );
-
- sprintf ( szMessage, "DARK identified %s", pszFilename );
- cpl_msg_info( fctid, "%s", szMessage );
- iLoadedFrameCount++;
- }
-
-
- if (iReduction >MAXFILESRAW)
- {
-
- cpl_msg_warning(cpl_func, "Currently only %d interferometric frames can be processed",MAXFILESRAW);
- cpl_msg_warning(cpl_func, "Scipping frame: %s", pszFilename);
- cur_frame = cpl_frameset_get_next( framelist );
- continue;
- }
-
-
-
- /* SCIENCE OR SCIENCE_CALIB OBJECT */
- if( !strcmp( pszFileTag, "AMBER_SCIENCE" ) )
- {
- /* Data Reduction on the highest level possible for amdlib, appending DATA to the file with product header */
- if( iStatus == 0 )
- {
- /* Add Filename to List */
- strcpy( szFilenameSCIENCE[iReduction], pszFilename );
- isFrameScience[iReduction] = 1;
- sprintf ( szMessage, "SCIENCE identified %s", pszFilename );
- cpl_msg_info( fctid, "%s", szMessage );
- iReduction++;
- iLoadedFrameCount++;
- } /* Status still OK */
- } /* All SCIENCE frames */
- else if( !strcmp( pszFileTag, "AMBER_SCIENCE_CALIB" ) || !strcmp( pszFileTag, "AMBER_CALIB" ) )
- {
- /* Data Reduction on the highest level possible for amdlib, appending DATA to the file with product header */
- if( iStatus == 0 )
- {
- /* Add Filename to List */
- strcpy( szFilenameSCIENCE[iReduction], pszFilename );
- isFrameScience[iReduction] = 0;
- sprintf ( szMessage, "CALIB identified %s", pszFilename );
- cpl_msg_info( fctid, "%s", szMessage );
- iReduction++;
- iLoadedFrameCount++;
- } /* Status still OK */
- } /* All CALIB frames */
-
-
- } /* Filename and Tag present */
- else
- {
- sprintf( szMessage, "Missing FileName or Tag for Frame #%d", iFrameCount );
- cpl_msg_info( fctid, "%s", szMessage );
- } /* Filename and Tag present */
-
- cur_frame = cpl_frameset_get_next( framelist );
- } /* while more frames */
-
- /* For all existing tmp products create the real products */
- iProductNumber = 0;
-
- for( i=0; i<iReduction && i<MAXFILESRAW; i++ )
- {
- /* This is a science object frame we can reduce the data now */
- sprintf( szMessage, "Reducing %s now... [Status=%d]", szFilenameSCIENCE[i], iStatus );
- cpl_msg_info( fctid, "%s", szMessage );
-
- cpl_msg_info( fctid, "Now calling high level data reduction amdlibExtractVisESO..." );
- if( amdlibExtractVisESO( szFilenameBADPIX, szFilenameFLAT, szFilenameP2VM, szFilenameDARK, szFilenameSKY,
- szFilenameSCIENCE[i], iBinningOfFrames, errorType, pistonType, amdlibTRUE, fctid )
- != amdlibSUCCESS
- )
- {
- sprintf( szMessage, "Error in Extracting Visibilities." );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = 2;
- }
- else
- {
- /* success */
- iStatus = 0;
-
-
- /* CPL Free !!! */
-
- /* pframeSCIENCE[i] will be deleted by Caller */
-
- }
- } /* All Frames to be reduced */
-
- /* 3 bands per reduction */
- for( i=0; i<iProductNumber && i<MAXFILESPRODUCTS; i++ )
- {
- /* Insert this frame, so that caller can rename it to proper DMD product */
- if( pframeSCIENCE[i] )
- {
- sprintf( szMessage, "cpl_frame_insert (\"%s\")", cpl_frame_get_filename(pframeSCIENCE[i]) );
- cpl_msg_info( fctid, "%s", szMessage );
- cpl_frameset_insert( framelist, pframeSCIENCE[i] );
- }
- }
-
- /*run the selctor and try to calculate the transfer function*/
- if(selectPlusTrf==1)
- {
- select_frames(parlist, framelist, iProductNumber);
- }
- /* Close the amdlib logfile */
- //if( fp )
- // fclose( fp );
-
- cpl_msg_info( fctid, "End of DataReduction");
-
- /* there is one remaining, due to a workarround above. Ignore it, ESOREX shall NOT talk about that :) */
- cpl_error_reset();
-
-
- /* Free the memory */
- for(i=0;i<MAXFILESPRODUCTS;i++)
- {
- cpl_free(szFilenameSCIENCE[i]);
- }
- cpl_free(szFilenameSCIENCE);
- cpl_free(isFrameScience);
- cpl_free(pframeSCIENCE);
-
- return iStatus ;
-}
-
-static void select_frames(cpl_parameterlist * parlist, cpl_frameset * framelist,
- int iProductNumber )
-{
- char * outname_selector=NULL;
- cpl_frameset * local_framelist=NULL;
- cpl_frame * local_frame=NULL;
- cpl_frame ** frame_selector_snr=NULL;
- cpl_frame ** frame_selector_pst=NULL;
- cpl_errorstate prestate=0;
- int i=0;
- int status_snr=0;
- int status_pst=0;
- double x1_pst=0.;
- double x2_pst=0.;
- double x3_pst=0.;
- int isScience=1;
- frame_selector_snr = cpl_calloc(MAXFILESPRODUCTS, sizeof(cpl_frame*));
- frame_selector_pst = cpl_calloc(MAXFILESPRODUCTS, sizeof(cpl_frame*));
-
- /*------------------------------------------------------------------------*/
- /*Run the selector*/
- for( i=0; i<iProductNumber && i<MAXFILESPRODUCTS; i++ )
- {
- /* Insert this frame, so that caller can rename it to proper DMD product */
-
- if( pframeSCIENCE[i] )
- {
- local_framelist=cpl_frameset_new();
- local_frame=cpl_frame_duplicate(pframeSCIENCE[i]);
- cpl_frame_set_group(local_frame,CPL_FRAME_GROUP_CALIB);
- cpl_frameset_insert(local_framelist, local_frame);
-
- /*Get the pst selection values and the isScience value*/
- get_selection_param(&x1_pst, &x2_pst, &x3_pst, &isScience,
- pframeSCIENCE[i]);
-
- /*Select according to SNR*/
- outname_selector = cpl_sprintf("snr_filtered_%s",
- cpl_frame_get_filename(pframeSCIENCE[i]));
- status_snr=amber_selector_lib(50, 50, 50, 1,
- "Fringe_SNR_percentage_x",
- cpl_frame_get_filename(pframeSCIENCE[i]),
- outname_selector, isScience,
- local_framelist, parlist, "amber_SciCal");
- if(status_snr==0)
- {
- frame_selector_snr[i]=cpl_frame_duplicate(
- cpl_frameset_get_frame(local_framelist,1));
- cpl_frameset_insert(framelist,frame_selector_snr[i]);
- cpl_frameset_erase_frame(local_framelist,
- cpl_frameset_get_frame(local_framelist,1));
-
- /*------------------------------------------------------------*/
- /*Derive the transfer function*/
- if(isScience==0)
- {
- prestate = cpl_errorstate_get();
- amber_TransferFunction("amber_SciCal", outname_selector,
- parlist, framelist);
- cpl_errorstate_set(prestate);
- /*
- if (!cpl_errorstate_is_equal(prestate)) {
- An error happened
- cpl_errorstate_dump(prestate, CPL_FALSE, NULL);
- }
- */
- }
- /*------------------------------------------------------------*/
- /*Calibrate the Visibilities*/
- if(isScience!=0)
- {
- prestate = cpl_errorstate_get();
- amber_CalibVis("amber_SciCal", outname_selector,
- parlist, framelist);
- cpl_errorstate_set(prestate);
- /*
- if (!cpl_errorstate_is_equal(prestate)) {
- An error happened
- cpl_errorstate_dump(prestate, CPL_FALSE, NULL);
- }
- */
- }
- /*------------------------------------------------------------*/
-
- }
- else
- {
- cpl_msg_warning(cpl_func,"File %s is not complete!",
- outname_selector);
- }
- cpl_free(outname_selector);
-
- /*Select according to PISTON*/
-
- outname_selector = cpl_sprintf("pst_filtered_%s",
- cpl_frame_get_filename(pframeSCIENCE[i]));
- status_pst=amber_selector_lib(x1_pst, x2_pst, x3_pst, 1,
- "Absolute_piston_value_lt_x",
- cpl_frame_get_filename(pframeSCIENCE[i]),
- outname_selector, isScience,
- local_framelist, parlist, "amber_SciCal");
- if(status_pst==0)
- {
- frame_selector_pst[i]=cpl_frame_duplicate(
- cpl_frameset_get_frame(local_framelist,1));
- cpl_frameset_insert(framelist,frame_selector_pst[i]);
- cpl_frameset_erase_frame(local_framelist,
- cpl_frameset_get_frame(local_framelist,1));
-
- /*------------------------------------------------------------*/
- /*Derive the transfer function*/
- if(isScience==0)
- {
- prestate = cpl_errorstate_get();
- amber_TransferFunction("amber_SciCal", outname_selector,
- parlist, framelist);
- cpl_errorstate_set(prestate);
- /*
- if (!cpl_errorstate_is_equal(prestate)) {
- An error happened
- cpl_errorstate_dump(prestate, CPL_FALSE, NULL);
- }
- */
- }
- /*------------------------------------------------------------*/
- /*Calibrate the Visibilities*/
- if(isScience!=0)
- {
- prestate = cpl_errorstate_get();
- amber_CalibVis("amber_SciCal", outname_selector,
- parlist, framelist);
- cpl_errorstate_set(prestate);
- /*
- if (!cpl_errorstate_is_equal(prestate)) {
- An error happened
- cpl_errorstate_dump(prestate, CPL_FALSE, NULL);
- }
- */
- }
- /*------------------------------------------------------------*/
-
- }
- else
- {
- cpl_msg_warning(cpl_func,"File %s is not complete!",
- outname_selector);
- }
- cpl_free(outname_selector);
- cpl_frameset_delete(local_framelist);
-
- }
- }
- cpl_free(frame_selector_snr);
- cpl_free(frame_selector_pst);
- return;
-}
-
-static void get_selection_param(double * x1_pst, double * x2_pst,
- double * x3_pst, int * isScience, cpl_frame * cur_frame)
-{
- cpl_propertylist * plist=NULL;
- cpl_errorstate prestate = cpl_errorstate_get();
- const char * ft_sensor="";
- const char * grat_name="";
- int pro_science=1;
-
- plist = cpl_propertylist_load(cpl_frame_get_filename(cur_frame), 0);
-
-
- if (cpl_propertylist_has(plist, "ESO PRO SCIENCE") == 1)
- {
- pro_science=cpl_propertylist_get_bool(plist, "ESO PRO SCIENCE");
- }
- if(!pro_science)
- {
- *isScience=0;
- }
- if (cpl_propertylist_has(plist, "ESO DEL FT SENSOR") == 1)
- {
- ft_sensor=cpl_propertylist_get_string(plist, "ESO DEL FT SENSOR");
- }
- if (cpl_propertylist_has(plist, "ESO INS GRAT1 NAME") == 1)
- {
- grat_name=cpl_propertylist_get_string(plist, "ESO INS GRAT1 NAME");
- }
-
-
-
- if (!cpl_errorstate_is_equal(prestate)) {
- cpl_msg_warning(cpl_func,"Unable to determine the values for x1, x2, "
- "and x3 from the file");
- cpl_msg_warning(cpl_func,"Using default values of 0.0002 !!!");
- *x1_pst=0.0002;
- *x2_pst=0.0002;
- *x3_pst=0.0002;
- cpl_error_reset();
- if(plist!=NULL)
- {
- cpl_propertylist_delete(plist);
- }
- return;
- }
-
- if (strcmp(ft_sensor,"FINITO")==0)
- {
- if (strcmp(grat_name,"PRISM")==0)
- {
- *x1_pst=0.000020;
- *x2_pst=0.000020;
- *x3_pst=0.000020;
- }
- if (strcmp(grat_name,"GHR")==0)
- {
- *x1_pst=0.000200;
- *x2_pst=0.000200;
- *x3_pst=0.000200;
- }
- if (strcmp(grat_name,"GMR")==0)
- {
- *x1_pst=0.000200;
- *x2_pst=0.000200;
- *x3_pst=0.000200;
- }
- }
- else if (strcmp(ft_sensor,"NONE")==0)
- {
- if (strcmp(grat_name,"PRISM")==0)
- {
- *x1_pst=0.000040;
- *x2_pst=0.000040;
- *x3_pst=0.000040;
- }
- if (strcmp(grat_name,"GHR")==0)
- {
- *x1_pst=0.000400;
- *x2_pst=0.000400;
- *x3_pst=0.000400;
- }
- if (strcmp(grat_name,"GMR")==0)
- {
- *x1_pst=0.000400;
- *x2_pst=0.000400;
- *x3_pst=0.000400;
- }
- }
- else
- {
- cpl_msg_warning(cpl_func,"Unable to determine the values for x1, x2, "
- "and x3 from the file");
- cpl_msg_warning(cpl_func,"Using default values of 0.0002 !!!");
- *x1_pst=0.0002;
- *x2_pst=0.0002;
- *x3_pst=0.0002;
- cpl_error_reset();
- }
-
- if(plist!=NULL)
- {
- cpl_propertylist_delete(plist);
- }
- cpl_msg_info(cpl_func,"Using X1=%f, X2=%f, and X3=%f meter for the "
- "selection on the Piston", *x1_pst, *x1_pst, *x1_pst);
- cpl_msg_info(cpl_func,"isScience is: %d", *isScience);
-
-
- return;
-}
-
diff --git a/recipes/amber_ascii_export.c b/recipes/amber_ascii_export.c
deleted file mode 100644
index cdc6359..0000000
--- a/recipes/amber_ascii_export.c
+++ /dev/null
@@ -1,920 +0,0 @@
-/* $Id: amber_ascii_export.c,v 1.9 2013-09-16 14:56:43 agabasch Exp $
- *
- * This file is part of the AMBER 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: agabasch $
- * $Date: 2013-09-16 14:56:43 $
- * $Revision: 1.9 $
- * $Name: not supported by cvs2svn $
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-/* AMDLIB usage switch */
-#define USE_AMDLIB YES
-
-/*-----------------------------------------------------------------------------
- Includes
- -----------------------------------------------------------------------------*/
-
-#include <math.h>
-#include <cpl.h>
-
-#include "amdrs.h"
-
- /* AMBER structures */
- amdlibINS_CFG insCfg;
- amdlibOI_ARRAY array;
- amdlibOI_TARGET target;
- amdlibPHOTOMETRY photometry;
- amdlibVIS vis;
- amdlibVIS2 vis2;
- amdlibVIS3 vis3;
- amdlibWAVELENGTH wave;
- amdlibPISTON pst;
- amdlibSPECTRUM spectrum={NULL};
- amdlibERROR_MSG errMsg;
-
- double *tmpArray[amdlibNBASELINE];
- double threshold[amdlibNBASELINE];
-
- /* CPL data */
- cpl_frame * pFrame;
- cpl_propertylist * pHeader;
-
- cpl_parameterlist * gparlist;
- cpl_frameset * gframelist;
-
- FILE * pFITSFile;
-
- const char * expMethod1 = "Export SNR, Vis2";
- const char * expMethod2 = "Export Vis2, UV";
- const char * expMethod3 = "Export Clos.Ph.";
- const char * expMethod4 = "Yorick, 3T";
- //const char * selMethod5 = "Flux_percentage_x";
- //const char * selMethod6 = "Exclude_Frames_by_ASCII_File";
- //const char * selMethod7 = "Include_Frames_by_ASCII_File";
- //const char * selMethod8 = "IO-Test_no_filtering";
-
-
-/*-----------------------------------------------------------------------------
- Functions prototypes
- -----------------------------------------------------------------------------*/
-
-static int amber_ascii_export_create(cpl_plugin *) ;
-static int amber_ascii_export_exec(cpl_plugin *) ;
-static int amber_ascii_export_destroy(cpl_plugin *) ;
-static int amber_ascii_export(cpl_parameterlist *, cpl_frameset *) ;
-
-
-/*-----------------------------------------------------------------------------
- Static variables
- -----------------------------------------------------------------------------*/
-
-static struct {
- /* Inputs */
- int bool_option ;
- char str_option[512] ;
-
- /* Outputs */
- double qc_param ;
-} amber_ascii_export_config ;
-
-static char amber_ascii_export_man[] =
-"This recipe exports data stored in an AMBER OI product into ASCII files, two export methods are present\n"
-"\n";
-
-/*-----------------------------------------------------------------------------
- Functions code
- -----------------------------------------------------------------------------*/
-
-#define amdlib_OI_REVISION 1 /*Current revision number*/
-#define amdlibNM_TO_M 1e-9 /* conversion nanometers to meters */
-
-/** Usefull macro to error when reading/writing IO6FITS file */
-#define amdlibOiReturnError(routine,msg) \
- fits_get_errstatus(status, (char*)fitsioMsg); \
- amdlibError("%s(): %s - %s\n", routine, msg, fitsioMsg); \
- sprintf(errMssg, "%s(): %s - %s", routine, msg, fitsioMsg); \
- return (amdlibFAILURE)
-
-
-
-/*----------------------------------------------------------------------------*/
-/**
- @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,
- AMBER_BINARY_VERSION,
- CPL_PLUGIN_TYPE_RECIPE,
- "amber_ascii_export",
- "AMBER frame data to ASCII export",
- amber_ascii_export_man,
- "Klara Shabun",
- "kshabun at eso.org",
- "GP",
- amber_ascii_export_create,
- amber_ascii_export_exec,
- amber_ascii_export_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 amber_ascii_export_create(cpl_plugin * plugin)
-{
- cpl_recipe * recipe = (cpl_recipe *)plugin ;
- cpl_parameter * p ;
-
- /* Create the parameters list in the cpl_recipe object */
- recipe->parameters = cpl_parameterlist_new() ;
-
- /* Fill the parameters list */
-
-
- /* Selection Method */
- p = cpl_parameter_new_enum( "amber.amber_ascii_export.export_method",
- CPL_TYPE_STRING,
- "Export methods",
- "amber.amber_ascii_export",
- expMethod1, 4,
- expMethod1, expMethod2, expMethod3, expMethod4 );
-
- cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "export-method") ;
- cpl_parameterlist_append(recipe->parameters, p) ;
-
- /* selection threshold float */
- /* p = cpl_parameter_new_value("amber.amber_ascii_export.selection_x",
- CPL_TYPE_DOUBLE, "X Value", "amber.amber_ascii_export", 2.0 ) ;
- cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "X") ;
- 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 amber_ascii_export_exec(cpl_plugin * plugin)
-{
- cpl_recipe * recipe = (cpl_recipe *)plugin ;
- return amber_ascii_export(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 amber_ascii_export_destroy(cpl_plugin * plugin)
-{
- cpl_recipe * recipe = (cpl_recipe *)plugin ;
- 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 amber_ascii_export(
- cpl_parameterlist * parlist,
- cpl_frameset * framelist)
-{
-
- /* CPL structures */
- cpl_frameset * cur_set;
- cpl_frame * cur_frame;
- cpl_parameter * cur_param;
-
- char szMessage[1024];
- char szFilnameOI[1024];
- char szFileName[1024];
- char szProductfile[1024];
- char szASCII1[1024];
- char szASCII2[1024];
- char szASCII3[1024];
- char szMethod[1024];
- char szCommand[1024];
- char szBuffer[1024];
- char szLine[4096];
- char szRA[15];
- char szDEC[15];
- char szRDB[1024];
- char szFDATE[30];
- char * pszFilename;
- char * pszFileTag;
- FILE * fp1 = NULL;
- FILE * fp2 = NULL;
- FILE * fp3 = NULL;
-
-/* cpl_frame * pFrame;
- cpl_propertylist * pHeader;*/
-
- gframelist = framelist;
- gparlist = parlist;
-
- int iStatus = 0;
- int iIsScience = -1; /* neither SCIENCE or CALIB */
- int base = 0;
- int iInclude = 0;
- int iSelFrame = 0;
- int iAverage = 0;
- int iFramesLeft = 0;
- int iFrameIsGood = 0;
- int iFrameCount = 0;
-
- double fThreshold = 0.F;
-
- cur_set = NULL;
- cur_frame = NULL;
- pszFilename = NULL;
- pszFileTag = NULL;
-
- amdlibSELECTION selectedFrames;
-
-
- const char * fctid = "amber_ascii_export";
- strcpy( szProductfile, "amber_filtered.fits" );
-
- /* Read the parameters */
- // cur_param = cpl_parameterlist_find( parlist, "amber.amber_ascii_export.selection_x" );
- // fThreshold = cpl_parameter_get_double( cur_param );
- cur_param = cpl_parameterlist_find( parlist, "amber.amber_ascii_export.export_method" );
- strcpy( szMethod, cpl_parameter_get_string( cur_param ) );
-
- sprintf ( szMessage, "Using Method: %s", szMethod );
- cpl_msg_info( fctid, "%s", szMessage );
-
-
- cpl_msg_info( fctid, "Start of DataReduction");
-
-
-
- cur_frame = cpl_frameset_get_first( framelist );
-
- while( cur_frame )
- {
-
- iFrameCount++;
-
- /* Get Filename and Classification Tag */
- pszFilename = (char *)cpl_frame_get_filename( cur_frame );
- pszFileTag = (char *)cpl_frame_get_tag( cur_frame );
-
- /* Check Tag and Filename */
- if( pszFilename && pszFileTag )
- {
- sprintf( szMessage, "Frame #%d [Current execution status=%d]", iFrameCount, iStatus );
- cpl_msg_info( fctid, "%s", szMessage );
-
-
-
- /* SCIENCE OR SCIENCE_CALIB OBJECT */
- if( !strcmp( pszFileTag, "SCIENCE_REDUCED" ) || !strcmp( pszFileTag, "SCIENCE_REDUCED_FILTERED" ) || !strcmp( pszFileTag, "SCIENCE_CALIBRATED" ) )
- {
- /* This is a SCIENCE frame */
- iIsScience = 1;
- strcpy( szFilnameOI, pszFilename );
- } /* All SCIENCE frames */
- else if( !strcmp( pszFileTag, "CALIB_REDUCED" ) || !strcmp( pszFileTag, "CALIB_REDUCED_FILTERED" ) )
- {
- /* This is a CALIB frame */
- iIsScience = 0;
- strcpy( szFilnameOI, pszFilename );
- } /* All CALIB frames */
-
-
-
-
-
-
- /* Searching for SCIENCE_REDUCED */
-// cur_frame = cpl_frameset_find( framelist, "SCIENCE_REDUCED" );
-// if( cur_frame )
- // {
- /* This is a SCIENCE frame */
-// iIsScience = 1;
-// strcpy( szFilnameOI, (char *)cpl_frame_get_filename( cur_frame ) );
-// }
-
- /* Searching for CALIB_REDUCED */
-// cur_frame = cpl_frameset_find( framelist, "CALIB_REDUCED" );
-
-// if( cur_frame )
-// {
- /* This is a CALIB frame */
-// iIsScience = 0;
- // strcpy( szFilnameOI, (char *)cpl_frame_get_filename( cur_frame ) );
-// }
-
- /* Searching for SCIENCE_REDUCED_FILTERED */
-// cur_frame = cpl_frameset_find( framelist, "SCIENCE_REDUCED_FILTERED" );
-// if( cur_frame )
-// {
- /* This is a SCIENCE frame */
-// iIsScience = 1;
-// strcpy( szFilnameOI, (char *)cpl_frame_get_filename( cur_frame ) );
-// }
-
- /* Searching for CALIB_REDUCED_FILTERED */
-// cur_frame = cpl_frameset_find( framelist, "CALIB_REDUCED_FILTERED" );
-
-// if( cur_frame )
-// {
- /* This is a CALIB frame */
- // iIsScience = 0;
- // strcpy( szFilnameOI, (char *)cpl_frame_get_filename( cur_frame ) );
- // }
-
-
-
-
- if( iIsScience != -1 )
- {
- amdlibClearInsCfg(&insCfg);
- /*if( amdlibLoadOiFile( szFilnameOI, &insCfg, &array, &target, &photometry,
- &vis, &vis2, &vis3, &wave, &pst, errMsg ) == amdlibSUCCESS )
-
-
- amdlib NEVER returns amdlibSUCCESS here?!?
- */
-
- iStatus = amdlibLoadOiFile( szFilnameOI, &insCfg, &array, &target, &photometry, &vis, &vis2, &vis3, &wave, &pst, &spectrum, errMsg );
-
- /*sprintf( szMessage, "%d", iStatus );
- cpl_msg_info( fctid, "%s", szMessage );*/
-
-
-
- /* //ammyorick!!!!!!!!!!!!!!!!!->amdlibGetVis(&vis)
-
- newVis = amdlibVIS();
-
- newVis.table = &array(amdlibVIS_TABLE_ENTRY, vis->nbBases, vis->nbFrames);
-
- for (base = 1; base <= vis->nbBases; base++)
- {
- for (frame = 1; frame <= vis->nbFrames; frame++)
- {
- (*newVis.table)(base,frame).vis =
- &array(amdlibCOMPLEX, vis->nbWlen);
-
- (*newVis.table)(base,frame).sigma2Vis =
- &array(amdlibCOMPLEX, vis->nbWlen);
-
- (*newVis.table)(base,frame).visCovRI =
- &array(double, vis->nbWlen);
- }
- }
-
- */
-
- /* Fill Header function */;
-/* pHeader = cpl_propertylist_new(); */
- pHeader = cpl_propertylist_load( szFilnameOI, 0 );
-
- sprintf( szMessage, "Extracting product header from file %s for target named %s [%s].", szFilnameOI, cpl_propertylist_get_string( pHeader, "ESO OBS NAME" ), cpl_error_get_message() );
- cpl_msg_info( fctid, "%s", szMessage );
-
- sprintf( szMessage, "Target observed on %s [%s].", cpl_propertylist_get_string( pHeader, "DATE-OBS" ), cpl_error_get_message() );
- cpl_msg_info( fctid, "%s", szMessage );
-
-
-
- /* 1 seems to be a warning ?!? */
- if( iStatus == amdlibSUCCESS || iStatus == 1 )
- {
-
- /* Reset to OK - no error */
- iStatus = 0;
-
-
- sprintf ( szMessage, "Status: %d for input file %s [%s]", iStatus, szFilnameOI, errMsg );
- cpl_msg_info( fctid, "%s", szMessage );
-
- /* Count number of frames */
- int iTotal = vis.nbFrames * vis.nbBases;
- sprintf( szMessage, "Number of Frames = %d giving %d Visibilities", iTotal / vis.nbBases, iTotal );
- cpl_msg_info( fctid, "%s", szMessage );
-
- /* Count frames for Photometry and Piston */
-
- sprintf( szMessage, "Photometry: %d / Piston: %d", photometry.nbFrames, pst.nbFrames );
- cpl_msg_info( fctid, "%s", szMessage );
-
-
- /* Count Frames with Fringe SNR greater than xxx */
- int iFrame = 0;
- int iFittingFrame = 0;
- double dLowSNR = 99999999.9;
- double dHighSNR = 0;
- double dFringeSNR = 0;
- int bFrameOK = 0;
- int iFDate = 0;
- int iFName = 0;
-
- /* Setup the default Options for Storing and Frame Selection */
- amdlibCPT_VIS_OPTIONS visOptions = { 1, amdlibSTATISTICAL_ERROR, amdlibUNWRAPPED_PHASE,
- 1, amdlibNO_FRAME_SEL, fThreshold };
-
- amdlibBAND band = amdlibK_BAND;
-
- /* Test the band */
- band = amdlibGetBand(wave.wlen[0]);
-
- /*
- if (amdlibGetBand(wave.wlen[wave.nbWlen-1]) != band)
- {
- sprintf ( szMessage, "Sorry, frame selection is only possible for one band. This data contains more than one band" );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = 666;
- }
- */
-
- /* strcpy( szASCII, "/tmp/amber_export_test.txt" );
-
- ft = fopen( szASCII, "wt" );
- if( ft )
- {
- sprintf( szLine, vis.table[0].vis)
- fputs( szLine, ft );
- fclose( ft );
- }
-*/
-
- sprintf(szFDATE, cpl_propertylist_get_string( pHeader, "DATE-OBS" ));
-
- strcpy( szFileName, szFilnameOI);
-
- while (szFDATE[iFDate] != '\0')
- {
- if (szFDATE[iFDate] == ':')
- szFDATE[iFDate] = '-';
- iFDate++;
- }
-
- sprintf ( szMessage, "New datetime format: %s", szFDATE);
- cpl_msg_info( fctid, "%s", szMessage );
-
-
- while (szFileName[iFName] != '\0')
- {
- if (szFileName[iFName] == ':')
- szFileName[iFName] = '-';
- iFName++;
- }
-
- sprintf ( szMessage, "New filename format: %s", szFileName);
- cpl_msg_info( fctid, "%s", szMessage );
-
-
-
- if( vis.nbBases == 1 )
- {
- sprintf( szBuffer, "%s_export_%s.txt", szFDATE, cpl_propertylist_get_string( pHeader, "ESO QC BAND" ) );
- strcpy( szASCII1, szBuffer );
- }
- else if ( !strcmp( szMethod, expMethod3 ) )
- {
- sprintf( szBuffer, "%s_%s_cph.txt", szFDATE, cpl_propertylist_get_string( pHeader, "ESO QC BAND" ) );
- strcpy( szASCII1, szBuffer );
- }
- else if ( !strcmp( szMethod, expMethod4 ) )
- {
- sprintf( szBuffer, "%s_y.txt", szFDATE );
- strcpy( szASCII1, szBuffer );
-
- sprintf ( szMessage, "Yorick filename format: %s", szBuffer);
- cpl_msg_info( fctid, "%s", szMessage );
-
-
-
- }
- else
- {
- sprintf( szBuffer, "%s_%s1.txt", szFDATE, cpl_propertylist_get_string( pHeader, "ESO QC BAND" ) );
- strcpy( szASCII1, szBuffer );
- sprintf( szBuffer, "%s_%s2.txt", szFDATE, cpl_propertylist_get_string( pHeader, "ESO QC BAND" ) );
- strcpy( szASCII2, szBuffer );
- sprintf( szBuffer, "%s_%s3.txt", szFDATE, cpl_propertylist_get_string( pHeader, "ESO QC BAND" ) );
- strcpy( szASCII3, szBuffer );
- }
- // strcpy( szASCII, "/tmp/amber_export.txt" );
-
- /* Variables */
- double fVisibility = 0;
- double fVisModul = 0;
- int iTest = 0;
- int iBase = 0;
- int iWlen = 0;
-
- /* Open the ASCII file */
- if( vis.nbBases == 1 )
- fp1 = fopen( szASCII1, "wt" );
- else if ( !strcmp( szMethod, expMethod3 ) || !strcmp( szMethod, expMethod4 ) )
- {
- fp1 = fopen( szASCII1, "wt" );
-
- sprintf ( szMessage, "Yorick file %s opened", szASCII1);
- cpl_msg_info( fctid, "%s", szMessage );
-
-
- }
- else
- {
- fp1 = fopen( szASCII1, "wt" );
- fp2 = fopen( szASCII2, "wt" );
- fp3 = fopen( szASCII3, "wt" );
- }
-
-#ifdef ONE_VIS_PER_LINE
- if( fp )
- {
- /*----------------------------------------------------------------------------------------*/
- /* Loop through frames and export several values */
- for (iFrame = 0; iFrame < vis.nbFrames && !iStatus; iFrame++)
- {
- /*for (base = 0; base < vis.nbBases; base++)*/
- {
- /* vis.table[iFrame].frgContrastSnr; */
- // fVisibility = vis.table[iFrame].vis->re + vis.table[iFrame].vis->im;
-
- fVisModul = sqrt( pow(vis.table[iFrame].vis->re,2) + pow(vis.table[iFrame].vis->im,2) );
-
- /* Create one line of output */
- sprintf( szLine, "%d\t %0.3f\t %0.5f\t %0.5f\t %0.5f\t %0.5f\t %d %d %f \n",
- iFrame,
- vis.table[iFrame].frgContrastSnr,
- vis.table[iFrame].vis->re,
- vis.table[iFrame].vis->im,
- fVisibility,
- fVisModul,
- vis.table[iFrame].stationIndex[0],
- vis.table[iFrame].stationIndex[1],
- vis.table[iFrame].time);
-
- fputs( szLine, fp );
- }
- } /* all frames */
-
-
- fclose( fp );
- } /* if file */
-#endif
-
- if( fp1 )
- {
- /*----------------------------------------------------------------------------------------*/
-
- /* Create a file header*/
-
- strcpy( szRDB, cpl_propertylist_get_comment( pHeader, "RA" ));
- strncpy( szRA, szRDB, 11);
- szRA[11]='\0';
- strcpy( szRDB, cpl_propertylist_get_comment( pHeader, "DEC" ));
- strncpy( szDEC, szRDB, 11);
- szDEC[11]='\0';
-
-
- if( vis.nbBases == 1 )
- {
- sprintf( szLine, "OBS\t OBJECT\t RA\t DEC\t UT\t LST\t PBL12\n");
- fputs( szLine, fp1 );
- }
- else
- {
- sprintf( szLine, "OBS\t OBJECT\t RA\t DEC\t UT\t LST\t PBL%d%d\t PBL%d%d\t PBL%d%d \n",
- vis.table[0].stationIndex[0],
- vis.table[0].stationIndex[1],
- vis.table[1].stationIndex[0],
- vis.table[1].stationIndex[1],
- vis.table[2].stationIndex[0],
- vis.table[2].stationIndex[1]);
-
- if ( !strcmp( szMethod, expMethod3 ) || !strcmp( szMethod, expMethod4 ) )
- fputs( szLine, fp1 );
- else
- {
- fputs( szLine, fp1 );
- fputs( szLine, fp2 );
- fputs( szLine, fp3 );
- }
- }
-
- if( vis.nbBases == 1 )
- {
- sprintf( szLine, "%s\t %s\t %s\t %s\t %s\t %s\t %0.3f\n", cpl_propertylist_get_string( pHeader, "ESO OBS NAME" ), cpl_propertylist_get_string( pHeader, "ESO OBS TARG NAME" ), szRA, szDEC, cpl_propertylist_get_string( pHeader, "UT"), cpl_propertylist_get_string( pHeader, "ST"), cpl_propertylist_get_double( pHeader, "ESO ISS PBL12 START") );
- fputs( szLine, fp1 );
- }
- else
- {
- sprintf( szLine, "%s\t %s\t %s\t %s\t %s\t %s\t %0.3f\t %0.3f\t %0.3f\n", cpl_propertylist_get_string( pHeader, "ESO OBS NAME" ), cpl_propertylist_get_string( pHeader, "ESO OBS TARG NAME" ), szRA, szDEC, cpl_propertylist_get_string( pHeader, "UT"), cpl_propertylist_get_string( pHeader, "ST"), sqrt(pow(vis.table[0].uCoord,2)+pow(vis.table[0].vCoord,2)), sqrt(pow(vis.table[1].uCoord,2)+pow(vis.table[1].vCoord,2)), sqrt(pow(vis.table[2].uCoord,2)+pow(vis.table[2].vCoord,2)) );
-
- if ( !strcmp( szMethod, expMethod3 ) || !strcmp( szMethod, expMethod4 ) )
- fputs( szLine, fp1 );
- else
- {
- fputs( szLine, fp1 );
- fputs( szLine, fp2 );
- fputs( szLine, fp3 );
- }
-
- }
-
- /* Selection methods */
- if( !strcmp( szMethod, expMethod1 ) ) /* Method 1: Vis, Vis2 output*/
- {
- sprintf( szLine, "\t iFrame\t \t SNR\t \t iWlen\t \t Wlen\t \t Vis2\n");
- }
- else /* Method 2: Vis, UV output */
- if( !strcmp( szMethod, expMethod2 ) )
- {
- sprintf( szLine, "iFrame\t iVF\t Base\t LST\t SNR\t uCoord\t vCoord\t PBL\t iWlen\t Wlen\t VisMod\t VisMod^2\t Vis2\n");
- }
- else /* Method 3: Closure phases output */
- if( !strcmp( szMethod, expMethod3 ) )
- {
- sprintf( szLine, "iFrame\t LST\t SNR\t iWlen\t Wlen\t CPAmp\t CPPhi\t CPAv\n");
- }
- else /* Method 4: Yorick products output */
- if( !strcmp( szMethod, expMethod4 ) )
- {
- sprintf( szLine, "iWlen\t Wlen\t sqVis1\t sqVisErr1\t sqVis2\t sqVisErr2\t sqVis3\t sqVisErr3\t CP\t CPErr\n");
- }
-
- if( vis.nbBases == 1 )
- fputs( szLine, fp1 );
- else if ( !strcmp( szMethod, expMethod3 ) || !strcmp( szMethod, expMethod4 ) )
- {
- fputs( szLine, fp1 );
- }
- else
- {
- fputs( szLine, fp1 );
- fputs( szLine, fp2 );
- fputs( szLine, fp3 );
- }
-
-
-
-
-
- if( !strcmp( szMethod, expMethod4 ) )
- {
-
- for (iWlen = 0; iWlen < vis.nbWlen; iWlen++)
- {
-
- /* Create one line of output */
- sprintf( szLine, "%d\t %0.5f\t %0.5f\t %0.5f\t %0.5f\t %0.5f\t %0.5f\t %0.5f\t %0.5f\t %0.5f\n",
- iWlen,
- wave.wlen[iWlen]/1000,
- vis2.table[0].vis2[iWlen],
- vis2.table[0].vis2Error[iWlen],
- vis2.table[1].vis2[iWlen],
- vis2.table[1].vis2Error[iWlen],
- vis2.table[2].vis2[iWlen],
- vis2.table[2].vis2Error[iWlen],
- vis3.table[0].vis3Phi[iWlen], //Closure Phase phase
- vis3.table[0].vis3PhiError[iWlen] );
-
- fputs( szLine, fp1 );
-
- } /* iWlen */
-
- }
- else
- {
- /* Loop through frames and export 3 Bases per Line - old; now only in columns */
- for (iFrame = 0; iFrame < vis.nbFrames && !iStatus; /*iFrame+=3*/ iFrame++)
- {
- for (iBase = 0; iBase < vis.nbBases; iBase++)
- {
- if( vis.nbBases == 1 )
- iTest = iFrame;
- else
- iTest = iFrame*3+iBase;
-
-
- for (iWlen = 0; iWlen < vis.nbWlen; iWlen++)
- {
-
- fVisModul = sqrt( pow(vis.table[iTest].vis[iWlen].re,2) + pow(vis.table[iTest].vis[iWlen].im,2) );
- //fVisModul = sqrt( pow(vis.table[iTest].vis->re,2) + pow(vis.table[iTest].vis->im,2) );
-
-
- /* Selection methods */
- if( !strcmp( szMethod, expMethod1 ) ) /* Method 1: Vis, Vis2 output*/
- {
- /* Create one line of output */
- sprintf( szLine, "\t %d\t \t %0.3f\t \t %d\t \t %0.5f\t \t %0.5f\n",
- iFrame,
- vis.table[iTest].frgContrastSnr,
- iWlen,
- wave.wlen[iWlen]/1000,
- vis2.table[iTest].vis2[iWlen] );
- }
- else /* Method 2: Vis, UV output */
- if( !strcmp( szMethod, expMethod2 ) )
- {
- /* Create one line of output */
- sprintf( szLine, "%d\t %d\t %d %d\t %0.3f\t %0.5f\t %0.5f\t %0.5f\t %0.5f\t %d\t %0.5f\t %0.5f\t %0.5f\t %0.5f\n",
- iFrame,
- iTest,
- vis.table[iTest].stationIndex[0],
- vis.table[iTest].stationIndex[1],
- vis.table[iTest].time,
- vis.table[iTest].frgContrastSnr,
- vis.table[iTest].uCoord,
- vis.table[iTest].vCoord,
- sqrt(pow(vis.table[iTest].uCoord,2)+pow(vis.table[iTest].vCoord,2)),
- iWlen,
- wave.wlen[iWlen]/1000,
- fVisModul,
- pow(fVisModul,2),
- vis2.table[iTest].vis2[iWlen] );
- }
- else /* Method 3: Closure phases output */
- if( !strcmp( szMethod, expMethod3 ) )
- {
-
- if( iBase > 0 )
- break;
-
- /* Create one line of output */
- sprintf( szLine, "%d\t %0.3f\t %0.5f\t %d\t %0.5f\t %0.5f\t %0.5f\t %0.5f\n",
- iFrame,
- //vis.table[iFrame].stationIndex[0],
- //vis.table[iFrame].stationIndex[1],
- vis.table[iFrame].time,
- vis.table[iFrame].frgContrastSnr,
- iWlen,
- wave.wlen[iWlen]/1000,
- vis3.table[iFrame].vis3Amplitude[iWlen], //ClPh amplitude
- vis3.table[iFrame].vis3Phi[iWlen], //ClPh phase
- vis3.averageClosure);
- }
-
-
-
-
- if( vis.nbBases == 1 )
- fputs( szLine, fp1 );
- else if ( !strcmp( szMethod, expMethod3 ) )
- {
- fputs( szLine, fp1 );
-
- }
- else
- {
- switch ( iBase )
- {
- case 0 : fputs( szLine, fp1 );
- break;
- case 1 : fputs( szLine, fp2 );
- break;
- case 2 : fputs( szLine, fp3 );
- break;
- }
- }
-
-
- } /* iWlen */
- } /* iBase */
- } /* all frames */
-
- } /* else if expMethod4 */
-
- if( vis.nbBases == 1 )
- fclose( fp1 );
- else if ( !strcmp( szMethod, expMethod3 ) || !strcmp( szMethod, expMethod4 ) )
- {
- fclose( fp1 );
- }
- else
- {
- fclose( fp1 );
- fclose( fp2 );
- fclose( fp3 );
- }
- } /* if file */
-
- cpl_propertylist_delete( pHeader );
-
- }
- else
- {
- /* not an AMBER file */
- iStatus = 2;
- sprintf ( szMessage, "ERROR: Cannot read [%s]. OI table structure is not from AMBER or the file has been corrupted. [%s]", szFilnameOI, errMsg );
- cpl_msg_info( fctid, "%s", szMessage );
- }
- }
- else /* found fitting frame ? */
- {
- /* no fitting frame */
- iStatus = 1;
- sprintf ( szMessage, "ERROR: Current file doesn't contain SCIENCE_REDUCED or CALIB_REDUCED." );
- cpl_msg_info( fctid, "%s", szMessage );
- }
-
-
-
- } /* Filename and Tag present */
- else
- {
- sprintf( szMessage, "Missing FileName or Tag for Frame #%d", iFrameCount );
- cpl_msg_info( fctid, "%s", szMessage );
- } /* Filename and Tag present */
-
- /* release memory */
- amdlibReleaseOiArray(&array);
- amdlibReleaseOiTarget(&target);
- amdlibReleasePhotometry(&photometry);
- amdlibReleaseVis(&vis);
- amdlibReleaseVis2(&vis2);
- amdlibReleaseVis3(&vis3);
- amdlibReleaseWavelength(&wave);
- amdlibReleaseSpectrum(&spectrum);
- amdlibReleasePiston(&pst);
-
-
- cur_frame = cpl_frameset_get_next( framelist );
-
-} /* while more frames */
-
-
-
- // if( pFrame && !iStatus )
- // {
- /*
- sprintf( szMessage, "cpl_frame_insert [%s]", cpl_frame_get_filename(pFrame ) );
- cpl_msg_info( fctid, "%s", szMessage );
- */
- // cpl_frameset_insert( framelist, pFrame );
- // }
-
- /*
- sprintf ( szMessage, "Status: %d for %s", iStatus, szProductfile );
- cpl_msg_info( fctid, "%s", szMessage );
- */
-
- cpl_msg_info( fctid, "End of DataReduction");
-
- cpl_error_reset();
-
- return iStatus;
-}
diff --git a/recipes/amber_calibrate.c b/recipes/amber_calibrate.c
deleted file mode 100644
index 7a022cc..0000000
--- a/recipes/amber_calibrate.c
+++ /dev/null
@@ -1,327 +0,0 @@
-/* This file is part of the AMBER 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
- */
-
-
-/*
- * amber_calibrate.c
- *
- * Created on: Nov 6, 2009
- * Author: agabasch
- */
-
-/*-----------------------------------------------------------------------------
- Includes
- -----------------------------------------------------------------------------*/
-#include <config.h>
-#include <cpl.h>
-#include "amber_dfs.h"
-#include "string.h"
-#include "esolibCalibVis.h"
-/*-----------------------------------------------------------------------------
- Private function prototypes
- -----------------------------------------------------------------------------*/
-static int amber_calibrate_create(cpl_plugin *);
-static int amber_calibrate_exec(cpl_plugin *);
-static int amber_calibrate_destroy(cpl_plugin *);
-static int amber_calibrate(cpl_frameset *, cpl_parameterlist *);
-
-/*-----------------------------------------------------------------------------
- Static variables
- -----------------------------------------------------------------------------*/
-
-static char amber_calibrate_man[] =
- "This recipe calculates calibrated squared visibilities and closure "
- "phases \n"
- "\n"
- "Input files:\n\n"
- " DO category: Type: Explanation: Required: \n"
- " SCIENCE_REDUCED Products Science frame \n"
- " or Y\n"
- " SCIENCE_REDUCED_FILTERED Products Science frame \n\n"
- " AMBER_TRF_J Calib J-Band transfer function \n"
- " and/or \n"
- " AMBER_TRF_H Calib H-Band transfer function Y\n"
- " and/or \n"
- " AMBER_TRF_K Calib K-Band transfer function \n"
- "Output files:\n\n"
- " DO category: Data type: Explanation:\n"
- " SCIENCE_CALIBRATED calibrated (vis2) OI-fits file \n\n";
-
-/*-----------------------------------------------------------------------------
- Function code
- -----------------------------------------------------------------------------*/
-
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Build the list of available plugins, for this module.
- @param list the plugin list
- @return 0 if everything is ok, 1 otherwise
- @note Only this function is exported
-
- Create the recipe instance and make it available to the application using the
- interface.
- */
-/*----------------------------------------------------------------------------*/
-int cpl_plugin_get_info(cpl_pluginlist * list)
-{
- cpl_recipe * recipe = cpl_calloc(1, sizeof *recipe );
- cpl_plugin * plugin = &recipe->interface;
-
- if (cpl_plugin_init(plugin,
- CPL_PLUGIN_API,
- AMBER_BINARY_VERSION,
- CPL_PLUGIN_TYPE_RECIPE,
- "amber_calibrate",
- "AMBER Derives calibrated visibilities",
- amber_calibrate_man,
- "Armin Gabasch",
- PACKAGE_BUGREPORT,
- "GPL",
- amber_calibrate_create,
- amber_calibrate_exec,
- amber_calibrate_destroy)) {
- cpl_msg_error(cpl_func, "Plugin initialization failed");
- (void)cpl_error_set_where(cpl_func);
- return 1;
- }
-
- if (cpl_pluginlist_append(list, plugin)) {
- cpl_msg_error(cpl_func, "Error adding plugin to list");
- (void)cpl_error_set_where(cpl_func);
- return 1;
- }
-
- 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 amber_calibrate_create(cpl_plugin * plugin)
-{
- cpl_recipe * recipe;
- /*cpl_parameter * p;*/
-
- /* Do not create the recipe if an error code is already set */
- if (cpl_error_get_code() != CPL_ERROR_NONE) {
- cpl_msg_error(cpl_func, "%s():%d: An error is already set: %s",
- cpl_func, __LINE__, cpl_error_get_where());
- return (int)cpl_error_get_code();
- }
-
- if (plugin == NULL) {
- cpl_msg_error(cpl_func, "Null plugin");
- cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
- }
-
- /* Verify plugin type */
- if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
- cpl_msg_error(cpl_func, "Plugin is not a recipe");
- cpl_ensure_code(0, (int)CPL_ERROR_TYPE_MISMATCH);
- }
-
- /* Get the recipe */
- recipe = (cpl_recipe *)plugin;
-
- /* Create the parameters list in the cpl_recipe object */
- recipe->parameters = cpl_parameterlist_new();
- if (recipe->parameters == NULL) {
- cpl_msg_error(cpl_func, "Parameter list allocation failed");
- cpl_ensure_code(0, (int)CPL_ERROR_ILLEGAL_OUTPUT);
- }
-
- /* Fill the parameters list */
-
-
- return 0;
-}
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Execute the plugin instance given by the interface
- @param plugin the plugin
- @return 0 if everything is ok
- */
-/*----------------------------------------------------------------------------*/
-static int amber_calibrate_exec(cpl_plugin * plugin)
-{
-
- cpl_recipe * recipe;
- int recipe_status;
- cpl_errorstate initial_errorstate = cpl_errorstate_get();
-
- /* Return immediately if an error code is already set */
- if (cpl_error_get_code() != CPL_ERROR_NONE) {
- cpl_msg_error(cpl_func, "%s():%d: An error is already set: %s",
- cpl_func, __LINE__, cpl_error_get_where());
- return (int)cpl_error_get_code();
- }
-
- if (plugin == NULL) {
- cpl_msg_error(cpl_func, "Null plugin");
- cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
- }
-
- /* Verify plugin type */
- if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
- cpl_msg_error(cpl_func, "Plugin is not a recipe");
- cpl_ensure_code(0, (int)CPL_ERROR_TYPE_MISMATCH);
- }
-
- /* Get the recipe */
- recipe = (cpl_recipe *)plugin;
-
- /* Verify parameter and frame lists */
- if (recipe->parameters == NULL) {
- cpl_msg_error(cpl_func, "Recipe invoked with NULL parameter list");
- cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
- }
- if (recipe->frames == NULL) {
- cpl_msg_error(cpl_func, "Recipe invoked with NULL frame set");
- cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
- }
-
- /* Invoke the recipe */
- recipe_status = amber_calibrate(recipe->frames, recipe->parameters);
-
- /* Ensure DFS-compliance of the products */
- if (cpl_dfs_update_product_header(recipe->frames)) {
- if (!recipe_status) recipe_status = (int)cpl_error_get_code();
- }
-
- if (!cpl_errorstate_is_equal(initial_errorstate)) {
- /* Dump the error history since recipe execution start.
- At this point the recipe cannot recover from the error */
- cpl_errorstate_dump(initial_errorstate, CPL_FALSE, NULL);
- }
-
- return recipe_status;
-}
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Destroy what has been created by the 'create' function
- @param plugin the plugin
- @return 0 if everything is ok
- */
-/*----------------------------------------------------------------------------*/
-static int amber_calibrate_destroy(cpl_plugin * plugin)
-{
- cpl_recipe * recipe;
-
- if (plugin == NULL) {
- cpl_msg_error(cpl_func, "Null plugin");
- cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
- }
-
- /* Verify plugin type */
- if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
- cpl_msg_error(cpl_func, "Plugin is not a recipe");
- cpl_ensure_code(0, (int)CPL_ERROR_TYPE_MISMATCH);
- }
-
- /* Get the recipe */
- recipe = (cpl_recipe *)plugin;
-
- cpl_parameterlist_delete(recipe->parameters);
-
- return 0;
-}
-/*----------------------------------------------------------------------------*/
-/**
- @brief Interpret the command line options and execute the data processing
- @param frameset the frames list
- @param parlist the parameters list
- @return 0 if everything is ok
- */
-/*----------------------------------------------------------------------------*/
-static int amber_calibrate(cpl_frameset * frameset, cpl_parameterlist * parlist)
-{
- cpl_errorstate prestate=0;
- cpl_frame * cur_frame=NULL;
- int frameset_orig_length=0;
- int i=0;
- prestate = cpl_errorstate_get();
-
- amber_dfs_set_groups(frameset);
-
- frameset_orig_length=cpl_frameset_get_size(frameset);
-
-
- if (!frameset_orig_length)
- {
- cpl_msg_error(cpl_func,"No file found in the SOF!!");
- return -1;
- }
-
- if(cpl_frameset_find( frameset, "SCIENCE_REDUCED" )==NULL &&
- cpl_frameset_find( frameset, "SCIENCE_REDUCED_FILTERED")==NULL )
- {
- cpl_msg_error(cpl_func,"No file tagged SCIENCE_REDUCED or "
- "SCIENCE_REDUCED_FILTERED found in the SOF!!");
- return -1;
- }
-
- for(i=0; i<frameset_orig_length; i++){
- cur_frame=cpl_frameset_get_frame(frameset,i);
- if (!strcmp(cpl_frame_get_tag(cur_frame), "SCIENCE_REDUCED"))
- {
- amber_CalibVis("amber_calibrate",
- cpl_frame_get_filename(cur_frame), parlist, frameset);
- }
-
- else if (!strcmp(cpl_frame_get_tag(cur_frame),
- "SCIENCE_REDUCED_FILTERED"))
- {
- amber_CalibVis("amber_calibrate",
- cpl_frame_get_filename(cur_frame), parlist, frameset);
- }
-
- }
-
- /*
-
- Get first valid frame
- cur_frame = cpl_frameset_find( frameset, "SCIENCE_REDUCED" );
- if (cur_frame==NULL)
- {
- cur_frame = cpl_frameset_find( frameset, "SCIENCE_REDUCED_FILTERED" );
- }
-
-
-
- amber_TransferFunction("amber_calibrate",cpl_frame_get_filename(cur_frame),
- parlist, frameset);
- */
-
- if (!cpl_errorstate_is_equal(prestate)){
- /*cpl_errorstate_dump(prestate, CPL_FALSE, NULL);*/
- return cpl_error_set_message(cpl_func, cpl_error_get_code(),
- "Recipe failed");
-
-
- }
- return 0;
-
-}
diff --git a/recipes/amber_detector.c b/recipes/amber_detector.c
deleted file mode 100644
index 4077fef..0000000
--- a/recipes/amber_detector.c
+++ /dev/null
@@ -1,1681 +0,0 @@
-/* $Id: amber_detector.c,v 1.16 2013-09-16 14:56:43 agabasch Exp $
- *
- * This file is part of the AMBER Pipeline
- * Copyright (C) 2002,iFrom03 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: agabasch $
- * $Date: 2013-09-16 14:56:43 $
- * $Revision: 1.16 $
- * $Name: not supported by cvs2svn $
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-/* AMDLIB usage switch */
-#define USE_AMDLIB YES
-
-/*-----------------------------------------------------------------------------
- Includes
- -----------------------------------------------------------------------------*/
-
-#include <math.h>
-#include <cpl.h>
-#include <string.h>
-#include "amdrs.h"
-
-#include "amdms.h" /* amdms library detector calibration */
-
-/* PAF file and QC log */
-#include "giqclog.h"
-/* #include "giutils.h" */
-
-#ifdef USE_AMDLIB
-
-/* amdlib structures */
-amdlibERROR_MSG errMsg;
-amdlibBAD_PIXEL_MAP badPixels;
-amdlibFLAT_FIELD_MAP flatField;
-amdlibP2VM_INPUT_DATA p2vmData;
-amdlibP2VM_MATRIX p2vm;
-
-#endif
-
-cpl_parameterlist * gparlist;
-cpl_frameset * gframelist;
-cpl_propertylist * pHeader;
-
-
-/*-----------------------------------------------------------------------------
- Functions prototypes
- -----------------------------------------------------------------------------*/
-
-static int amber_detector_create(cpl_plugin *) ;
-static int amber_detector_exec(cpl_plugin *) ;
-static int amber_detector_destroy(cpl_plugin *) ;
-static int amber_detector(cpl_parameterlist *, cpl_frameset *) ;
-cpl_propertylist * DetectorCreateProductHeader( const char * fctid,
- char * szRawFile, cpl_frame * pFrameProduct );
-
-/*-----------------------------------------------------------------------------
- Static variables
- -----------------------------------------------------------------------------*/
-
-/*
-static struct {
- Inputs
- int bool_option ;
- char str_option[512] ;
-
- Outputs
- double qc_param ;
-} amber_detector_config ;
- */
-
-static char amber_detector_man[] =
- "This recipe is creating the master flatfield and the bad pixel map\n"
- "\n";
-
-/*-----------------------------------------------------------------------------
- Functions code
- -----------------------------------------------------------------------------*/
-
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Append the properties in one list to another
- @param self The PAF propertylist to append to
- @param other The propertylist whose elements are copied or NULL
- @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error
-
- If other is NULL or empty nothing happens
-
- Comments are copied as well, but it is (currently) undefined how this works
- for non-unique properties.
-
- In addition the hierarchical keys will be changed according to the PAF rules:
-
- No ESO as first part
- No blank separator but a .
- */
-/*----------------------------------------------------------------------------*/
-static cpl_error_code amber_propertylist_append(cpl_propertylist * self,
- const cpl_propertylist * other)
-{
-
- int i, c;
- char szPAF[2048];
- char szTMP[2048];
-
- if (other == NULL) return CPL_ERROR_NONE;
-
- /*visir_assure_code(self, CPL_ERROR_NULL_INPUT);*/
-
- for (i=0; i < cpl_propertylist_get_size(other); i++)
- {
- const cpl_property * prop = cpl_propertylist_get((cpl_propertylist *)
- other, i);
- const char * name = cpl_property_get_name(prop);
- /*const char * comment = cpl_property_get_comment(prop);*/
-
- cpl_error_code err;
-
- /* Change the key to PAF syntax */
- strcpy( szPAF, name );
-
- /* Get rid of ESO (HAR, what a joke!) */
- if( !strncmp( szPAF, "ESO", 3 ) )
- {
- strcpy( szTMP, &szPAF[4] );
- strcpy( szPAF, szTMP );
- }
-
- /* Substitute spaces by points (YEAH!) */
- for( c=0; c<(int)strlen(szPAF); c++ )
- if( szPAF[c] == ' ' )
- szPAF[c] = '.';
-
- strcpy( (char *)name, szPAF );
-
- /* Append prop to self */
-
- switch (cpl_property_get_type(prop)) {
- case CPL_TYPE_CHAR:
- err = cpl_propertylist_append_char(self, name,
- cpl_property_get_char(prop));
- case CPL_TYPE_BOOL:
- err = cpl_propertylist_append_bool(self, name,
- cpl_property_get_bool(prop));
- break;
- case CPL_TYPE_INT:
- err = cpl_propertylist_append_int(self, name,
- cpl_property_get_int(prop));
- break;
- case CPL_TYPE_LONG:
- err = cpl_propertylist_append_long(self, name,
- cpl_property_get_long(prop));
- break;
- case CPL_TYPE_FLOAT:
- err = cpl_propertylist_append_float(self, name,
- cpl_property_get_float(prop));
- break;
- case CPL_TYPE_DOUBLE:
- err = cpl_propertylist_append_double(self, name,
- cpl_property_get_double(prop));
- break;
- case CPL_TYPE_STRING:
- err = cpl_propertylist_append_string(self, name,
- cpl_property_get_string(prop));
- break;
-
- /* Avoid compiler warnings but do nothing */
- case CPL_TYPE_FLAG_ARRAY:
- case CPL_TYPE_INVALID:
- case CPL_TYPE_UCHAR:
- case CPL_TYPE_UINT:
- case CPL_TYPE_ULONG:
- case CPL_TYPE_POINTER:
- case CPL_TYPE_FLOAT_COMPLEX:
- case CPL_TYPE_DOUBLE_COMPLEX:
- case CPL_TYPE_UNSPECIFIED:
- /*case CPL_TYPE_COMPLEX: not anymode in CPL 3.0 */
- break;
- /*default:
- visir_assure_code(0, CPL_ERROR_UNSUPPORTED_MODE);*/
- }
-
- /*visir_assure_code(!err, err);
-
- if (comment && cpl_propertylist_set_comment(self, name, comment))
- visir_assure_code(0, cpl_error_get_code());*/
- }
-
- return CPL_ERROR_NONE;
-}
-
-
-cpl_propertylist * DetectorCreateProductHeader( const char * fctid, char * szRawFile, cpl_frame * pFrameProduct )
-{
- int iStatus = 0;
- char szMessage[1024];
-
- cpl_frameset * frameSetTmp;
- cpl_frame * frameTmp;
- /*cpl_propertylist * pHeader;*/
-
- /* For DFS fill Header function later */;
- /* pHeader = cpl_propertylist_new(); */
-
- /*
- * Create the Product file, start with filling the header
- *
- * Attention: for the time of this workaround for cpl 3D tables the amdlib must
- * be patched to NOT create OWN files, but APPEND to existing ones!!
- *
- * see comment below
- *
- */
-
-
- /*
- * Workaround for cpl_dfs_setup_product_header picking the wrong Header in this CPL release and
- * also might pick the wrong in the future! It uses the first RAW frame, but this recipe can handle
- * many raw frames. Hence:
- *
- * Read the Header of the RAW file to be written as a product and send it to the function
- */
- pHeader = cpl_propertylist_load( szRawFile, 0 );
-
- /* Create a set of frames with just this frame, so header will be correct */
- frameSetTmp = cpl_frameset_new();
- frameTmp = cpl_frame_new();
-
- cpl_frame_set_filename( frameTmp, szRawFile );
- cpl_frame_set_type( frameTmp, CPL_FRAME_TYPE_TABLE );
- cpl_frame_set_tag( frameTmp, "AMBER_DETECTOR" );
- cpl_frame_set_group( frameTmp, CPL_FRAME_GROUP_RAW );
- cpl_frame_set_level( frameTmp, CPL_FRAME_LEVEL_NONE );
- cpl_frameset_insert( frameSetTmp, frameTmp );
-
- /* Add the necessary DFS fits header information to the product */
-#if defined CPL_VERSION_CODE && CPL_VERSION_CODE >= CPL_VERSION(4, 8, 0)
- if( cpl_dfs_setup_product_header( pHeader,
- pFrameProduct,
- frameSetTmp,
- gparlist,
- "amber_detector", /* const char * recid, */
- PACKAGE "/" PACKAGE_VERSION, /* const char * pipeline_id, */
- "AMBER", /* const char * dictionary_id */
- NULL
- ) != CPL_ERROR_NONE )
- {
- /* Error */
- sprintf( szMessage, "Error in setting up the product header." );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = 16;
- }
-#else
- if( cpl_dfs_setup_product_header( pHeader,
- pFrameProduct,
- frameSetTmp,
- gparlist,
- "amber_detector", /* const char * recid, */
- PACKAGE "/" PACKAGE_VERSION, /* const char * pipeline_id, */
- "AMBER" /* const char * dictionary_id */
- ) != CPL_ERROR_NONE )
- {
- /* Error */
- sprintf( szMessage, "Error in setting up the product header." );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = 16;
- }
-#endif
- /* Destroy tmpFrameset and implicitly its contents */
- cpl_frameset_delete( frameSetTmp );
- /*cpl_frame_delete( frameTmp );*/
-
- return pHeader;
-}
-
-/*----------------------------------------------------------------------------*/
-/**
- @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,
- AMBER_BINARY_VERSION,
- CPL_PLUGIN_TYPE_RECIPE,
- "amber_detector",
- "AMBER raw data detector",
- amber_detector_man,
- "Tom Licha",
- PACKAGE_BUGREPORT,
- "GP",
- amber_detector_create,
- amber_detector_exec,
- amber_detector_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 amber_detector_create(cpl_plugin * plugin)
-{
- cpl_recipe * recipe = (cpl_recipe *)plugin ;
- cpl_parameter * p ;
-
- /* Create the parameters list in the cpl_recipe object */
- recipe->parameters = cpl_parameterlist_new() ;
-
- /* Fill the parameters list */
-#ifdef USE_PARAMETERS_HERE
- /* --stropt */
- p = cpl_parameter_new_value("amber.amber_detector.str_option",
- CPL_TYPE_STRING, "the string option", "amber.amber_detector",NULL);
- cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "stropt") ;
- cpl_parameterlist_append(recipe->parameters, p) ;
-
-#endif
- /* binning int */
- p = cpl_parameter_new_value("amber.amber_detector.int_maxframes",
- CPL_TYPE_INT, "maximum Frames to be processed", "amber.amber_detector", 500 ) ;
- cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "maxFrames") ;
- 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 amber_detector_exec(cpl_plugin * plugin)
-{
- cpl_recipe * recipe = (cpl_recipe *)plugin ;
- return amber_detector(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 amber_detector_destroy(cpl_plugin * plugin)
-{
- cpl_recipe * recipe = (cpl_recipe *)plugin ;
- 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 amber_detector(
- cpl_parameterlist * parlist,
- cpl_frameset * framelist)
-{
-
- /* CPL structures */
- /* cpl_frameset * cur_set=NULL;*/
- cpl_frame * cur_frame=NULL;
- cpl_parameter * cur_param;
-
- char szMessage[1024];
- char * pszFilename=NULL;
- char * pszFileTag=NULL;
-
- /*
- cpl_frame * pFrame = NULL;
- cpl_propertylist * pHeader = NULL;
- */
- cpl_propertylist * pCValues = NULL;
-
- cpl_frame * pFrameBPM = NULL;
- /* cpl_frame * pFrameFFM = NULL;*/
-
- int iStatus = 0;
- int iFrameCountDark = 0;
- int iFrameCountFlat = 0;
-
-
-
- int i = 0;
-
- int iBadPix = 0;
- int iGoodPix = 0;
- double dBadRatio = 0.F;
-
- int iMaxFrames = 0;
-
- char szInputDark[7][1024];
- char szInputFlat[7][1024];
- char szProduct[1024];
-
- const char * pszARCFILE;
-
- char szTemp[1024];
- int iFrom = 0;
- int iTo = 0;
- /* amdsm control structures */
- amdmsALGO_STAT_ENV * statEnv = NULL;
- amdmsALGO_PROPERTIES_ENV * ppEnv = NULL;
- amdmsALGO_BAD_PIXEL_ENV * badpixelEnv = NULL;
- amdmsFITS_FLAGS flags;
- const char * fctid = "amber_detector";
-
- /*
- cur_set = NULL;
- cur_frame = NULL;
- pszFilename = NULL;
- pszFileTag = NULL;
- */
-
- cpl_propertylist * qc_properties = NULL;
- cpl_image * pImage = NULL;
- AmPaf * qc = NULL;
- cpl_propertylist * qclog = NULL;
- cpl_propertylist * qcFromProduct = NULL;
- cpl_propertylist * qcFromRawfile = NULL;
-
- amber_dfs_set_groups(framelist);
- cur_param = cpl_parameterlist_find( parlist, "amber.amber_detector.int_maxframes" );
- iMaxFrames = cpl_parameter_get_int( cur_param );
-
- /* This variable will control how many frames are taken into account.
- * It should be >= 500 to get highest precision and not smaller than 21
- * because the first 20 frames will be skipped anyway due to the readout
- * mode of the detector */
-
- iFrom = 20;
- iTo = iFrom + iMaxFrames;
-
-
-
-
- cpl_msg_info( fctid, "Start of DataReduction");
-
-
-
-
- sprintf( szMessage, "Using frames from %d to %d", iFrom, iTo );
- cpl_msg_info( fctid, "%s", szMessage );
-
-
- /*
- Walk through the whole Set of Frames SOF and search for DETECTOR_FFM and DETECTOR_DARK
- Seven of each are needed
- */
- cur_frame = cpl_frameset_get_first( framelist );
-
-
-
- while( cur_frame )
- {
- /* Get Filename and Classification Tag */
- pszFilename = (char *)cpl_frame_get_filename( cur_frame );
- pszFileTag = (char *)cpl_frame_get_tag( cur_frame );
-
-
- /* Check Tag and Filename */
- if( pszFilename && pszFileTag )
- {
- /* DETECTOR_FFM */
- if( iFrameCountFlat < 7 && !strcmp( pszFileTag, "AMBER_DETECTOR_FFM" ) )
- {
-
- strcpy( szInputFlat[iFrameCountFlat], pszFilename );
- iFrameCountFlat++;
-
- sprintf( szMessage, "DETECTOR_FFM %d %s", iFrameCountFlat, pszFilename );
- cpl_msg_info( fctid, "%s", szMessage );
- }
-
- /* DETECTOR_DARK */
- if( iFrameCountDark < 7 && !strcmp( pszFileTag, "AMBER_DETECTOR_DARK" ) )
- {
-
- strcpy( szInputDark[iFrameCountDark], pszFilename );
- iFrameCountDark++;
-
- sprintf( szMessage, "DETECTOR_DARK %d %s", iFrameCountDark, pszFilename );
- cpl_msg_info( fctid, "%s", szMessage );
- }
- }
-
- /* Get next frame from SOF */
- cur_frame = cpl_frameset_get_next( framelist );
-
- } /* while more frames */
-
- if( iFrameCountFlat!=7 || iFrameCountDark!=7 )
- {
- iStatus = 1;
-
- sprintf( szMessage, "Found %d of DARK and %d of FLAT frames.", iFrameCountDark, iFrameCountFlat );
- cpl_msg_info( fctid, "%s", szMessage );
- sprintf( szMessage, "Error: Please input 7 of each." );
- cpl_msg_info( fctid, "%s", szMessage );
- }
-
- if( !iStatus )
- {
- /*------------------------------------------------------------------------------------------------------------*/
- /* Generating particle event maps, electronic bias maps, pixel bias maps, and pixel statistics maps for darks */
- for( i=0; i<7 && !iStatus; i++ )
- {
- sprintf( szMessage, "amdmsCreateStatisticsAlgo for Darks #%d", i+1 );
- cpl_msg_info( fctid, "%s", szMessage );
-
- amdmsCreateStatisticsAlgo( &statEnv );
-
- statEnv->cf = 4.70; /* gain factor */
- statEnv->events.peFlag = amdmsTRUE; /* variance limits for particle event */
- statEnv->events.peLimit = 72.; /* variance limits for particle event: (40e-/Gain)^2 */
- statEnv->ebNIter = 5; /* limits for electronic bias calculation */
- statEnv->ebLower = 50; /* limits for electronic bias calculation */
- statEnv->ebUpper = 50; /* limits for electronic bias calculation */
- statEnv->ebHFlag = amdmsTRUE; /* in both directions */
- statEnv->ebVFlag = amdmsTRUE; /* in both directions */
-
- statEnv->env.detNX = 512; /* detector width in pixels */
- statEnv->env.detNY = 512; /* detector height in pixels */
-
- statEnv->env.calib.corrFlag = amdmsNO_CORRECTION; /* flags for requested compensations */
-
- /* Filtering */
- statEnv->env.filter.ioiFlag = amdmsTRUE;
- statEnv->env.filter.ioiFrom = iFrom; /* Frames filter */
- statEnv->env.filter.ioiTo = iTo; /* Frames filter */
- statEnv->env.filter.aoiFlag = amdmsTRUE;
- statEnv->env.filter.aoiX = 0;
- statEnv->env.filter.aoiY = 0;
- statEnv->env.filter.aoiWidth = 512;
- statEnv->env.filter.aoiHeight = 512;
-
- sprintf( szMessage, "amdmsAddFileToList: %s", szInputDark[i] );
- cpl_msg_info( fctid, "%s", szMessage );
-
- /* Prepare Input */
- flags.content = amdmsIMAGING_DATA_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(statEnv->env.inFiles), szInputDark[i], flags);
-
- /* Prepare Output */
- sprintf( szTemp, "dark_%01d_pem.fits", i );
- flags.content = amdmsPARTICLE_EVENT_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(statEnv->env.outFiles), szTemp, flags);
-
- sprintf( szTemp, "dark_%01d_ebm.fits", i );
- flags.content = amdmsELECTRONIC_BIAS_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(statEnv->env.outFiles), szTemp, flags);
-
- sprintf( szTemp, "dark_%01d_pbm.fits", i );
- flags.content = amdmsPIXEL_BIAS_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(statEnv->env.outFiles), szTemp, flags);
-
- sprintf( szTemp, "dark_%01d_psm.fits", i );
- flags.content = amdmsPIXEL_STAT_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(statEnv->env.outFiles), szTemp, flags);
-
- sprintf( szMessage, "amdmsDoPixelStatistics" );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = amdmsDoPixelStatistics( statEnv );
- if( iStatus == amdmsSUCCESS )
- iStatus = 0;
-
- sprintf( szMessage, "Generating particle event maps: Status = %d", iStatus );
- cpl_msg_info( fctid, "%s", szMessage );
-
- amdmsDestroyStatisticsAlgo( &statEnv );
- } /* All 7 darks */
-
-
- /*------------------------------------------------------------------------------------------------------------*/
- /* Generating particle event maps, electronic bias maps, pixel bias maps, and pixel statistics maps for flats */
- for( i=0; i<7 && !iStatus; i++ )
- {
- sprintf( szMessage, "amdmsCreateStatisticsAlgo for Flats #%d", i+1 );
- cpl_msg_info( fctid, "%s", szMessage );
-
- amdmsCreateStatisticsAlgo( &statEnv );
-
- statEnv->cf = 4.70; /* gain factor */
- statEnv->events.peFlag = amdmsTRUE; /* variance limits for particle event */
- statEnv->events.peLimit = 453.; /* variance limits for particle event: (100e-/Gain)^2 or greater */
- statEnv->ebNIter = 5; /* limits for electronic bias calculation */
- statEnv->ebLower = 50; /* limits for electronic bias calculation */
- statEnv->ebUpper = 50; /* limits for electronic bias calculation */
- statEnv->ebHFlag = amdmsTRUE; /* in both directions */
- statEnv->ebVFlag = amdmsTRUE; /* in both directions */
-
- statEnv->env.detNX = 512; /* detector width in pixels */
- statEnv->env.detNY = 512; /* detector height in pixels */
-
- statEnv->env.calib.corrFlag = amdmsPIXEL_BIAS_CORRECTION
- | amdmsELECTRONIC_BIAS_CORRECTION; /* flags for requested compensations */
-
- /* Filtering */
- statEnv->env.filter.ioiFlag = amdmsTRUE;
- statEnv->env.filter.ioiFrom = iFrom; /* Frames filter */
- statEnv->env.filter.ioiTo = iTo; /* Frames filter */
- statEnv->env.filter.aoiFlag = amdmsTRUE;
- statEnv->env.filter.aoiX = 0;
- statEnv->env.filter.aoiY = 0;
- statEnv->env.filter.aoiWidth = 512;
- statEnv->env.filter.aoiHeight = 512;
-
- sprintf( szMessage, "amdmsAddFileToList: %s", szInputFlat[i] );
- cpl_msg_info( fctid, "%s", szMessage );
-
- /* Prepare Input */
- flags.content = amdmsIMAGING_DATA_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(statEnv->env.inFiles), szInputFlat[i], flags);
-
-
- /* Prepare Map Input */
- sprintf( szTemp, "dark_%01d_pbm.fits", i );
- flags.content = amdmsPIXEL_BIAS_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(statEnv->env.calib.mapFiles), szTemp, flags );
-
- sprintf( szTemp, "dark_%01d_ebm.fits", i );
- flags.content = amdmsELECTRONIC_BIAS_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(statEnv->env.calib.mapFiles), szTemp, flags );
-
-
-
- /* Prepare Output */
- sprintf( szTemp, "flat_%01d_pem.fits", i );
- flags.content = amdmsPARTICLE_EVENT_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(statEnv->env.outFiles), szTemp, flags);
-
- sprintf( szTemp, "flat_%01d_psm.fits", i );
- flags.content = amdmsPIXEL_STAT_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(statEnv->env.outFiles), szTemp, flags);
-
- sprintf( szTemp, "flat_%01d_pnm.fits", i );
- flags.content = amdmsPHOTON_NOISE_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(statEnv->env.outFiles), szTemp, flags);
-
- sprintf( szMessage, "amdmsDoPixelStatistics" );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = amdmsDoPixelStatistics( statEnv );
- if( iStatus == amdmsSUCCESS )
- iStatus = 0;
- else
- iStatus = 666; /* Error from amdmslib */
-
- sprintf( szMessage, "Generating particle event maps: Status = %d", iStatus );
- cpl_msg_info( fctid, "%s", szMessage );
-
- amdmsDestroyStatisticsAlgo( &statEnv );
- } /* All 7 flats */
-
-
- /*---------------------------------------*/
- /* Generating dark current map for darks */
- if( !iStatus )
- {
- sprintf( szMessage, "amdmsCreatePropertiesAlgo dark current maps for dark" );
- cpl_msg_info( fctid, "%s", szMessage );
-
- amdmsCreatePropertiesAlgo( &ppEnv );
-
- ppEnv->nDelStart = 0; /* definition of data point */
- ppEnv->nDelMiddle = 1; /* definition of data point */
- ppEnv->nDelEnd = 0; /* definition of data point */
-
- ppEnv->env.detNX = 512; /* detector width in pixels */
- ppEnv->env.detNY = 512; /* detector height in pixels */
-
- ppEnv->env.calib.corrFlag = amdmsNO_CORRECTION; /* flags for requested compensations */
-
- /* Filtering */
- ppEnv->env.filter.aoiFlag = amdmsTRUE;
- ppEnv->env.filter.aoiX = 310;
- ppEnv->env.filter.aoiY = 64;
- ppEnv->env.filter.aoiWidth = 50;
- ppEnv->env.filter.aoiHeight = 384;
-
-
- /* Prepare Input (from the seven dark maps from above) */
- for( i=0; i<7; i++ )
- {
- sprintf( szTemp, "dark_%01d_psm.fits", i );
- flags.content = amdmsPIXEL_STAT_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(ppEnv->env.inFiles), szTemp, flags);
- }
-
- /* Prepare Output */
- sprintf( szTemp, "dcm.fits" );
- flags.content = amdmsDARK_CURRENT_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(ppEnv->env.outFiles), szTemp, flags);
-
- sprintf( szMessage, "amdmsDoProperties" );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = amdmsDoProperties( ppEnv );
- if( iStatus == amdmsSUCCESS )
- iStatus = 0;
- else
- iStatus = 666; /* Error from amdmslib */
-
- sprintf( szMessage, "Generating dark current maps for dark: Status = %d", iStatus );
- cpl_msg_info( fctid, "%s", szMessage );
-
- amdmsDestroyPropertiesAlgo( &ppEnv );
- } /* Status still OK */
-
-
- /*--------------------------*/
- /* Generating bad pixel map */
- if( !iStatus )
- {
- /* a) Darks --------------------------------------------------------------------*/
- sprintf( szMessage, " amdmsCreateBadPixelAlgo bad pixel map 1 of 6" );
- cpl_msg_info( fctid, "%s", szMessage );
-
- amdmsCreateBadPixelAlgo( &badpixelEnv );
-
- badpixelEnv->env.detNX = 512; /* detector width in pixels */
- badpixelEnv->env.detNY = 512; /* detector height in pixels */
-
- badpixelEnv->nIter = 1;
-
- badpixelEnv->fuzzyCount = 2;
- badpixelEnv->fuzzyLimit = 1.0;
-
- /* Filtering */
- badpixelEnv->env.filter.aoiFlag = amdmsFALSE;
-
- /*
- badpixelEnv->env.filter.aoiX = 310;
- badpixelEnv->env.filter.aoiY = 64;
- badpixelEnv->env.filter.aoiWidth = 50;
- badpixelEnv->env.filter.aoiHeight = 384;
- */
-
- badpixelEnv->env.calib.corrFlag = amdmsNO_CORRECTION; /* flags for requested compensations */
-
- /* Stripes Setup */
- badpixelEnv->env.stripes.nHStripes = 1;
- badpixelEnv->env.stripes.hStripes[0].pos = 1;
- badpixelEnv->env.stripes.hStripes[0].size = 512;
- badpixelEnv->env.stripes.hStripes[0].flags = amdmsUSE_PS_VAR_PIXEL; /* temporal flux variance */
-
- badpixelEnv->env.stripes.nVStripes = 1;
- badpixelEnv->env.stripes.vStripes[0].pos = 1;
- badpixelEnv->env.stripes.vStripes[0].size = 512;
- badpixelEnv->env.stripes.vStripes[0].flags = amdmsUSE_PS_VAR_PIXEL; /* temporal flux variance */
-
- /* recalculate pos values */
- amdmsRecalcStripes(&(badpixelEnv->env.stripes), 0, 0);
-
- /* Limits */
- badpixelEnv->limits.nLimits = 2;
- badpixelEnv->limits.limits[0].flag = amdmsUSE_PS_VAR_PIXEL; /* temporal flux variance */
- badpixelEnv->limits.limits[0].type = amdmsABS_UPPER_LIMIT; /* bad if value less than limit */
- badpixelEnv->limits.limits[0].value = 0.18; /* (2e-/Gain)^2 */
- badpixelEnv->limits.limits[0].ref = 5.5; /* (11e-/Gain)^2 */
- badpixelEnv->limits.limits[1].flag = amdmsUSE_PS_VAR_PIXEL; /* temporal flux variance */
- badpixelEnv->limits.limits[1].type = amdmsABS_LOWER_LIMIT; /* bad if value greater than limit */
- badpixelEnv->limits.limits[1].value = 255.; /* (75e-/Gain)2 */
- badpixelEnv->limits.limits[1].ref = 5.5; /* (11e-/Gain)^2 */
-
- /* Prepare Input (from the seven dark maps from above) */
- for( i=0; i<7; i++ )
- {
- sprintf( szTemp, "dark_%01d_psm.fits", i );
- flags.content = amdmsPIXEL_STAT_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(badpixelEnv->env.inFiles), szTemp, flags);
- }
-
- /* Prepare Output */
- sprintf( szTemp, "bpm.fits" );
- flags.content = amdmsBAD_PIXEL_CONTENT;
- flags.format = amdmsCUBE_FORMAT;
- flags.type = amdmsBYTE_TYPE;
- amdmsAddFileToList( &(badpixelEnv->env.outFiles), szTemp, flags);
-
- sprintf( szTemp, "bpm_btbl.fits" );
- flags.content = amdmsBAD_PIXEL_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsBYTE_TYPE;
- amdmsAddFileToList( &(badpixelEnv->env.outFiles), szTemp, flags);
-
- sprintf( szMessage, "amdmsDoBadPixel" );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = amdmsDoBadPixel( badpixelEnv );
- if( iStatus == amdmsSUCCESS )
- iStatus = 0;
- else
- iStatus = 666; /* Error from amdmslib */
-
- sprintf( szMessage, "Generating bad pixel maps for dark: Status = %d", iStatus );
- cpl_msg_info( fctid, "%s", szMessage );
-
- amdmsDestroyBadPixelAlgo( &badpixelEnv );
-
- /* b) Flats --------------------------------------------------------------------*/
- sprintf( szMessage, " amdmsCreateBadPixelAlgo bad pixel map 2 of 6" );
- cpl_msg_info( fctid, "%s", szMessage );
-
- amdmsCreateBadPixelAlgo( &badpixelEnv );
-
- badpixelEnv->env.detNX = 512; /* detector width in pixels */
- badpixelEnv->env.detNY = 512; /* detector height in pixels */
-
- badpixelEnv->env.calib.corrFlag = amdmsNO_CORRECTION; /* flags for requested compensations */
-
- /* Filtering */
- badpixelEnv->env.filter.aoiFlag = amdmsTRUE;
- badpixelEnv->env.filter.aoiX = 310;
- badpixelEnv->env.filter.aoiY = 64;
- badpixelEnv->env.filter.aoiWidth = 50;
- badpixelEnv->env.filter.aoiHeight = 384;
-
- /* Stripes Setup */
- badpixelEnv->env.stripes.nHStripes = 1;
- badpixelEnv->env.stripes.hStripes[0].pos = 1;
- badpixelEnv->env.stripes.hStripes[0].size = 512;
- badpixelEnv->env.stripes.hStripes[0].flags = amdmsUSE_PS_VAR_PIXEL; /* temporal flux variance */
-
- badpixelEnv->env.stripes.nVStripes = 1;
- badpixelEnv->env.stripes.vStripes[0].pos = 1;
- badpixelEnv->env.stripes.vStripes[0].size = 16;
- badpixelEnv->env.stripes.vStripes[0].flags = amdmsUSE_PS_VAR_PIXEL; /* temporal flux variance */
-
- /* recalculate pos values */
- amdmsRecalcStripes(&(badpixelEnv->env.stripes), 0, 0);
-
- /* Limits */
- badpixelEnv->limits.nLimits = 2;
- badpixelEnv->limits.limits[0].flag = amdmsUSE_PS_VAR_PIXEL; /* temporal flux variance */
- badpixelEnv->limits.limits[0].type = amdmsABS_UPPER_LIMIT; /* bad if value less than limit */
- badpixelEnv->limits.limits[0].value = 0.18; /* (2e-/Gain)^2 */
- badpixelEnv->limits.limits[0].ref = 5.5; /* (11e-/Gain)^2 */
- badpixelEnv->limits.limits[1].flag = amdmsUSE_PS_VAR_PIXEL; /* temporal flux variance */
- badpixelEnv->limits.limits[1].type = amdmsABS_LOWER_LIMIT; /* bad if value greater than limit */
- badpixelEnv->limits.limits[1].value = 255.; /* (75e-/Gain)^2 */
- badpixelEnv->limits.limits[1].ref = 5.5; /* (11e-/Gain)^2 */
-
-
- /* Prepare Input (from the seven dark maps from above) */
- for( i=0; i<7; i++ )
- {
- sprintf( szTemp, "flat_%01d_psm.fits", i );
- flags.content = amdmsPIXEL_STAT_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(badpixelEnv->env.inFiles), szTemp, flags);
- }
-
- /* Prepare Map Input */
- sprintf( szTemp, "bpm.fits" );
- flags.content = amdmsBAD_PIXEL_CONTENT;
- flags.format = amdmsCUBE_FORMAT;
- flags.type = amdmsBYTE_TYPE;
- amdmsAddFileToList( &(badpixelEnv->env.calib.mapFiles), szTemp, flags );
-
-
- /* Prepare Output */
- sprintf( szTemp, "bpm.fits" );
- flags.content = amdmsBAD_PIXEL_CONTENT;
- flags.format = amdmsCUBE_FORMAT;
- flags.type = amdmsBYTE_TYPE;
- amdmsAddFileToList( &(badpixelEnv->env.outFiles), szTemp, flags);
-
- sprintf( szTemp, "bpm_btbl.fits" );
- flags.content = amdmsBAD_PIXEL_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsBYTE_TYPE;
- amdmsAddFileToList( &(badpixelEnv->env.outFiles), szTemp, flags);
-
- sprintf( szMessage, "amdmsDoBadPixel" );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = amdmsDoBadPixel( badpixelEnv );
- if( iStatus == amdmsSUCCESS )
- iStatus = 0;
- else
- iStatus = 666; /* Error from amdmslib */
-
- sprintf( szMessage, "Generating bad pixel maps for flat: Status = %d", iStatus );
- cpl_msg_info( fctid, "%s", szMessage );
-
- amdmsDestroyBadPixelAlgo( &badpixelEnv );
-
- /* c) ---------------------------------------------------------------------*/
- sprintf( szMessage, " amdmsCreateBadPixelAlgo bad pixel map 3 of 6" );
- cpl_msg_info( fctid, "%s", szMessage );
-
- amdmsCreateBadPixelAlgo( &badpixelEnv );
-
- badpixelEnv->env.detNX = 512; /* detector width in pixels */
- badpixelEnv->env.detNY = 512; /* detector height in pixels */
-
- badpixelEnv->env.calib.corrFlag = amdmsNO_CORRECTION; /* flags for requested compensations */
-
- /* Filtering */
- badpixelEnv->env.filter.aoiFlag = amdmsTRUE;
- badpixelEnv->env.filter.aoiX = 310;
- badpixelEnv->env.filter.aoiY = 64;
- badpixelEnv->env.filter.aoiWidth = 50;
- badpixelEnv->env.filter.aoiHeight = 384;
-
- /* Stripes Setup */
- badpixelEnv->env.stripes.nHStripes = 1;
- badpixelEnv->env.stripes.hStripes[0].pos = 1;
- badpixelEnv->env.stripes.hStripes[0].size = 512;
- badpixelEnv->env.stripes.hStripes[0].flags = amdmsUSE_PHOTON_NOISE;
-
- badpixelEnv->env.stripes.nVStripes = 9;
- badpixelEnv->env.stripes.vStripes[0].pos = 1;
- badpixelEnv->env.stripes.vStripes[0].size = 16;
- badpixelEnv->env.stripes.vStripes[0].flags = amdmsUSE_NOTHING;
- badpixelEnv->env.stripes.vStripes[1].pos = 1;
- badpixelEnv->env.stripes.vStripes[1].size = 34;
- badpixelEnv->env.stripes.vStripes[1].flags = amdmsUSE_NOTHING;
- badpixelEnv->env.stripes.vStripes[2].pos = 1;
- badpixelEnv->env.stripes.vStripes[2].size = 90;
- badpixelEnv->env.stripes.vStripes[2].flags = amdmsUSE_PHOTON_NOISE;
- badpixelEnv->env.stripes.vStripes[3].pos = 1;
- badpixelEnv->env.stripes.vStripes[3].size = 20;
- badpixelEnv->env.stripes.vStripes[3].flags = amdmsUSE_NOTHING;
- badpixelEnv->env.stripes.vStripes[4].pos = 1;
- badpixelEnv->env.stripes.vStripes[4].size = 100;
- badpixelEnv->env.stripes.vStripes[4].flags = amdmsUSE_PHOTON_NOISE;
- badpixelEnv->env.stripes.vStripes[5].pos = 1;
- badpixelEnv->env.stripes.vStripes[5].size = 25;
- badpixelEnv->env.stripes.vStripes[5].flags = amdmsUSE_NOTHING;
- badpixelEnv->env.stripes.vStripes[6].pos = 1;
- badpixelEnv->env.stripes.vStripes[6].size = 85;
- badpixelEnv->env.stripes.vStripes[6].flags = amdmsUSE_PHOTON_NOISE;
- badpixelEnv->env.stripes.vStripes[7].pos = 1;
- badpixelEnv->env.stripes.vStripes[7].size = 50;
- badpixelEnv->env.stripes.vStripes[7].flags = amdmsUSE_NOTHING;
- badpixelEnv->env.stripes.vStripes[8].pos = 1;
- badpixelEnv->env.stripes.vStripes[8].size = 92;
- badpixelEnv->env.stripes.vStripes[8].flags = amdmsUSE_PHOTON_NOISE;
-
- /* recalculate pos values */
- amdmsRecalcStripes(&(badpixelEnv->env.stripes), 0, 0);
-
-
- /* Limits */
- badpixelEnv->limits.nLimits = 2;
- badpixelEnv->limits.limits[0].flag = amdmsUSE_PHOTON_NOISE; /* temporal flux variance */
- badpixelEnv->limits.limits[0].type = amdmsABS_UPPER_LIMIT; /* bad if value less than limit */
- badpixelEnv->limits.limits[0].value = 0.5;
- badpixelEnv->limits.limits[0].ref = 1.0;
- badpixelEnv->limits.limits[1].flag = amdmsUSE_PHOTON_NOISE; /* temporal flux variance */
- badpixelEnv->limits.limits[1].type = amdmsABS_LOWER_LIMIT; /* bad if value greater than limit */
- badpixelEnv->limits.limits[1].value = 2.25;
- badpixelEnv->limits.limits[1].ref = 1.0;
-
-
- /* Prepare Input (from the seven dark maps from above) */
- for( i=0; i<7; i++ )
- {
- sprintf( szTemp, "flat_%01d_pnm.fits", i );
- flags.content = amdmsPHOTON_NOISE_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(badpixelEnv->env.inFiles), szTemp, flags);
- }
-
- /* Prepare Map Input */
- sprintf( szTemp, "bpm.fits" );
- flags.content = amdmsBAD_PIXEL_CONTENT;
- flags.format = amdmsCUBE_FORMAT;
- flags.type = amdmsBYTE_TYPE;
- amdmsAddFileToList( &(badpixelEnv->env.calib.mapFiles), szTemp, flags );
-
-
- /* Prepare Output */
- sprintf( szTemp, "bpm.fits" );
- flags.content = amdmsBAD_PIXEL_CONTENT;
- flags.format = amdmsCUBE_FORMAT;
- flags.type = amdmsBYTE_TYPE;
- amdmsAddFileToList( &(badpixelEnv->env.outFiles), szTemp, flags);
-
- sprintf( szTemp, "bpm_btbl.fits" );
- flags.content = amdmsBAD_PIXEL_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsBYTE_TYPE;
- amdmsAddFileToList( &(badpixelEnv->env.outFiles), szTemp, flags);
-
- sprintf( szMessage, "amdmsDoBadPixel" );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = amdmsDoBadPixel( badpixelEnv );
- if( iStatus == amdmsSUCCESS )
- iStatus = 0;
- else
- iStatus = 666; /* Error from amdmslib */
-
- sprintf( szMessage, "Generating bad pixel maps for flat: Status = %d", iStatus );
- cpl_msg_info( fctid, "%s", szMessage );
-
- amdmsDestroyBadPixelAlgo( &badpixelEnv );
-
- /* d) -----------------------------------------------------------------------*/
- sprintf( szMessage, " amdmsCreateBadPixelAlgo bad pixel map 4 of 6" );
- cpl_msg_info( fctid, "%s", szMessage );
-
- amdmsCreateBadPixelAlgo( &badpixelEnv );
-
- badpixelEnv->env.detNX = 512; /* detector width in pixels */
- badpixelEnv->env.detNY = 512; /* detector height in pixels */
-
- badpixelEnv->env.calib.corrFlag = amdmsNO_CORRECTION; /* flags for requested compensations */
-
- /* Filtering */
- badpixelEnv->env.filter.aoiFlag = amdmsTRUE;
- badpixelEnv->env.filter.aoiX = 310;
- badpixelEnv->env.filter.aoiY = 64;
- badpixelEnv->env.filter.aoiWidth = 50;
- badpixelEnv->env.filter.aoiHeight = 384;
-
- /* Stripes Setup */
- badpixelEnv->env.stripes.nHStripes = 1;
- badpixelEnv->env.stripes.hStripes[0].pos = 1;
- badpixelEnv->env.stripes.hStripes[0].size = 512;
- badpixelEnv->env.stripes.hStripes[0].flags = amdmsUSE_FIT_A1;
-
- badpixelEnv->env.stripes.nVStripes = 1;
- badpixelEnv->env.stripes.vStripes[0].pos = 1;
- badpixelEnv->env.stripes.vStripes[0].size = 512;
- badpixelEnv->env.stripes.vStripes[0].flags = amdmsUSE_FIT_A1;
-
- /* recalculate pos values */
- amdmsRecalcStripes(&(badpixelEnv->env.stripes), 0, 0);
-
- /* Limits */
- badpixelEnv->limits.nLimits = 2;
- badpixelEnv->limits.limits[0].flag = amdmsUSE_FIT_A1;
- badpixelEnv->limits.limits[0].type = amdmsABS_UPPER_LIMIT; /* bad if value less than limit */
- badpixelEnv->limits.limits[0].value = -16.; /* -75e-/Gain */
- badpixelEnv->limits.limits[0].ref = 0.0;
- badpixelEnv->limits.limits[1].flag = amdmsUSE_FIT_A1;
- badpixelEnv->limits.limits[1].type = amdmsABS_LOWER_LIMIT; /* bad if value greater than limit */
- badpixelEnv->limits.limits[1].value = 16.; /* +75e-/Gain */
- badpixelEnv->limits.limits[1].ref = 0.0;
-
- /* Prepare Input */
- sprintf( szTemp, "dcm.fits" );
- flags.content = amdmsDARK_CURRENT_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(badpixelEnv->env.inFiles), szTemp, flags);
-
- /* Prepare Map Input */
- sprintf( szTemp, "bpm.fits" );
- flags.content = amdmsBAD_PIXEL_CONTENT;
- flags.format = amdmsCUBE_FORMAT;
- flags.type = amdmsBYTE_TYPE;
- amdmsAddFileToList( &(badpixelEnv->env.calib.mapFiles), szTemp, flags );
-
-
- /* Prepare Output */
- sprintf( szTemp, "bpm.fits" );
- flags.content = amdmsBAD_PIXEL_CONTENT;
- flags.format = amdmsCUBE_FORMAT;
- flags.type = amdmsBYTE_TYPE;
- amdmsAddFileToList( &(badpixelEnv->env.outFiles), szTemp, flags);
-
- sprintf( szTemp, "bpm_btbl.fits" );
- flags.content = amdmsBAD_PIXEL_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsBYTE_TYPE;
- amdmsAddFileToList( &(badpixelEnv->env.outFiles), szTemp, flags);
-
- sprintf( szMessage, "amdmsDoBadPixel" );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = amdmsDoBadPixel( badpixelEnv );
- if( iStatus == amdmsSUCCESS )
- iStatus = 0;
- else
- iStatus = 666; /* Error from amdmslib */
-
- sprintf( szMessage, "Generating bad pixel maps for flat: Status = %d", iStatus );
- cpl_msg_info( fctid, "%s", szMessage );
-
- amdmsDestroyBadPixelAlgo( &badpixelEnv );
-
- /* e) -----------------------------------------------------------------------*/
- sprintf( szMessage, " amdmsCreateBadPixelAlgo bad pixel map 5 of 6" );
- cpl_msg_info( fctid, "%s", szMessage );
-
- amdmsCreateBadPixelAlgo( &badpixelEnv );
-
- badpixelEnv->env.detNX = 512; /* detector width in pixels */
- badpixelEnv->env.detNY = 512; /* detector height in pixels */
-
- badpixelEnv->env.calib.corrFlag = amdmsNO_CORRECTION; /* flags for requested compensations */
-
- /* Filtering */
- badpixelEnv->env.filter.aoiFlag = amdmsTRUE;
- badpixelEnv->env.filter.aoiX = 310;
- badpixelEnv->env.filter.aoiY = 64;
- badpixelEnv->env.filter.aoiWidth = 50;
- badpixelEnv->env.filter.aoiHeight = 384;
-
- /* Stripes Setup */
- badpixelEnv->env.stripes.nHStripes = 1;
- badpixelEnv->env.stripes.hStripes[0].pos = 1;
- badpixelEnv->env.stripes.hStripes[0].size = 512;
- badpixelEnv->env.stripes.hStripes[0].flags = amdmsUSE_FIT_CHI_SQR;
-
- badpixelEnv->env.stripes.nVStripes = 1;
- badpixelEnv->env.stripes.vStripes[0].pos = 1;
- badpixelEnv->env.stripes.vStripes[0].size = 512;
- badpixelEnv->env.stripes.vStripes[0].flags = amdmsUSE_FIT_CHI_SQR;
-
- /* recalculate pos values */
- amdmsRecalcStripes(&(badpixelEnv->env.stripes), 0, 0);
-
- /* Limits */
- badpixelEnv->limits.nLimits = 1;
- badpixelEnv->limits.limits[0].flag = amdmsUSE_FIT_CHI_SQR;
- badpixelEnv->limits.limits[0].type = amdmsABS_LOWER_LIMIT; /* bad if value greater than limit */
- badpixelEnv->limits.limits[0].value = 5.0;
- badpixelEnv->limits.limits[0].ref = 0.0;
-
-
- /* Prepare Input */
- sprintf( szTemp, "dcm.fits" );
- flags.content = amdmsDARK_CURRENT_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(badpixelEnv->env.inFiles), szTemp, flags);
-
- /* Prepare Map Input */
- sprintf( szTemp, "bpm.fits" );
- flags.content = amdmsBAD_PIXEL_CONTENT;
- flags.format = amdmsCUBE_FORMAT;
- flags.type = amdmsBYTE_TYPE;
- amdmsAddFileToList( &(badpixelEnv->env.calib.mapFiles), szTemp, flags );
-
-
- /* Prepare Output */
- sprintf( szTemp, "bpm.fits" );
- flags.content = amdmsBAD_PIXEL_CONTENT;
- flags.format = amdmsCUBE_FORMAT;
- flags.type = amdmsBYTE_TYPE;
- amdmsAddFileToList( &(badpixelEnv->env.outFiles), szTemp, flags);
-
- sprintf( szTemp, "bpm_btbl.fits" );
- flags.content = amdmsBAD_PIXEL_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsBYTE_TYPE;
- amdmsAddFileToList( &(badpixelEnv->env.outFiles), szTemp, flags);
-
- sprintf( szMessage, "amdmsDoBadPixel" );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = amdmsDoBadPixel( badpixelEnv );
- if( iStatus == amdmsSUCCESS )
- iStatus = 0;
- else
- iStatus = 666; /* Error from amdmslib */
-
- sprintf( szMessage, "Generating bad pixel maps for flat: Status = %d", iStatus );
- cpl_msg_info( fctid, "%s", szMessage );
-
- amdmsDestroyBadPixelAlgo( &badpixelEnv );
-
- /* f) Finish --------------------------------------------------------------------*/
- sprintf( szMessage, " amdmsCreateBadPixelAlgo bad pixel map 6 of 6" );
- cpl_msg_info( fctid, "%s", szMessage );
-
- amdmsCreateBadPixelAlgo( &badpixelEnv );
-
- badpixelEnv->env.detNX = 512; /* detector width in pixels */
- badpixelEnv->env.detNY = 512; /* detector height in pixels */
-
- badpixelEnv->env.calib.corrFlag = amdmsNO_CORRECTION; /* flags for requested compensations */
-
- /* Filtering */
- badpixelEnv->env.filter.aoiFlag = amdmsTRUE;
- badpixelEnv->env.filter.aoiX = 310;
- badpixelEnv->env.filter.aoiY = 64;
- badpixelEnv->env.filter.aoiWidth = 50;
- badpixelEnv->env.filter.aoiHeight = 384;
-
- /* Windowing */
- badpixelEnv->winFlag = amdmsTRUE;
- badpixelEnv->winInnerSize = 2;
- badpixelEnv->winOuterSize = 5;
-
- /* Stripes Setup */
- badpixelEnv->env.stripes.nHStripes = 1;
- badpixelEnv->env.stripes.hStripes[0].pos = 1;
- badpixelEnv->env.stripes.hStripes[0].size = 512;
- badpixelEnv->env.stripes.hStripes[0].flags = amdmsUSE_PS_MEAN_PIXEL;
-
- badpixelEnv->env.stripes.nVStripes = 9;
- badpixelEnv->env.stripes.vStripes[0].pos = 1;
- badpixelEnv->env.stripes.vStripes[0].size = 16;
- badpixelEnv->env.stripes.vStripes[0].flags = amdmsUSE_NOTHING;
- badpixelEnv->env.stripes.vStripes[1].pos = 1;
- badpixelEnv->env.stripes.vStripes[1].size = 34;
- badpixelEnv->env.stripes.vStripes[1].flags = amdmsUSE_NOTHING;
- badpixelEnv->env.stripes.vStripes[2].pos = 1;
- badpixelEnv->env.stripes.vStripes[2].size = 90;
- badpixelEnv->env.stripes.vStripes[2].flags = amdmsUSE_PS_MEAN_PIXEL;
- badpixelEnv->env.stripes.vStripes[3].pos = 1;
- badpixelEnv->env.stripes.vStripes[3].size = 20;
- badpixelEnv->env.stripes.vStripes[3].flags = amdmsUSE_NOTHING;
- badpixelEnv->env.stripes.vStripes[4].pos = 1;
- badpixelEnv->env.stripes.vStripes[4].size = 100;
- badpixelEnv->env.stripes.vStripes[4].flags = amdmsUSE_PS_MEAN_PIXEL;
- badpixelEnv->env.stripes.vStripes[5].pos = 1;
- badpixelEnv->env.stripes.vStripes[5].size = 25;
- badpixelEnv->env.stripes.vStripes[5].flags = amdmsUSE_NOTHING;
- badpixelEnv->env.stripes.vStripes[6].pos = 1;
- badpixelEnv->env.stripes.vStripes[6].size = 85;
- badpixelEnv->env.stripes.vStripes[6].flags = amdmsUSE_PS_MEAN_PIXEL;
- badpixelEnv->env.stripes.vStripes[7].pos = 1;
- badpixelEnv->env.stripes.vStripes[7].size = 50;
- badpixelEnv->env.stripes.vStripes[7].flags = amdmsUSE_NOTHING;
- badpixelEnv->env.stripes.vStripes[8].pos = 1;
- badpixelEnv->env.stripes.vStripes[8].size = 92;
- badpixelEnv->env.stripes.vStripes[8].flags = amdmsUSE_PS_MEAN_PIXEL;
-
- /* recalculate pos values */
- amdmsRecalcStripes(&(badpixelEnv->env.stripes), 0, 0);
-
- /* Limits */
- badpixelEnv->limits.nLimits = 2;
- badpixelEnv->limits.limits[0].flag = amdmsUSE_PS_MEAN_PIXEL;
- badpixelEnv->limits.limits[0].type = amdmsSIGMA_UPPER_LIMIT;
- badpixelEnv->limits.limits[0].value = -5.0;
- badpixelEnv->limits.limits[0].ref = 0.0;
- badpixelEnv->limits.limits[1].flag = amdmsUSE_PS_MEAN_PIXEL;
- badpixelEnv->limits.limits[1].type = amdmsSIGMA_LOWER_LIMIT;
- badpixelEnv->limits.limits[1].value = 5.0;
- badpixelEnv->limits.limits[1].ref = 0.0;
-
-
- /* Prepare Input */
- for( i=0; i<7; i++ )
- {
- sprintf( szTemp, "flat_%01d_psm.fits", i );
- flags.content = amdmsPIXEL_STAT_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(badpixelEnv->env.inFiles), szTemp, flags);
- }
-
- /* Prepare Map Input */
- sprintf( szTemp, "bpm.fits" );
- flags.content = amdmsBAD_PIXEL_CONTENT;
- flags.format = amdmsCUBE_FORMAT;
- flags.type = amdmsBYTE_TYPE;
- amdmsAddFileToList( &(badpixelEnv->env.calib.mapFiles), szTemp, flags );
-
-
- /* Prepare Output */
- sprintf( szTemp, "bpm.fits" );
- flags.content = amdmsBAD_PIXEL_CONTENT;
- flags.format = amdmsCUBE_FORMAT;
- flags.type = amdmsBYTE_TYPE;
- amdmsAddFileToList( &(badpixelEnv->env.outFiles), szTemp, flags);
-
- sprintf( szTemp, "bpm_btbl.fits" );
- flags.content = amdmsBAD_PIXEL_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsBYTE_TYPE;
- amdmsAddFileToList( &(badpixelEnv->env.outFiles), szTemp, flags);
-
- iStatus = amdmsDoBadPixel( badpixelEnv );
- if( iStatus == amdmsSUCCESS )
- iStatus = 0;
- else
- iStatus = 666; /* Error from amdmslib */
-
- sprintf( szMessage, "Final stage -> Generating bad pixel maps for flat: Status = %d", iStatus );
- cpl_msg_info( fctid, "%s", szMessage );
-
-
-
- amdmsDestroyBadPixelAlgo( &badpixelEnv );
-
-
- }
-
- /*----------------------------------------*/
- /* Generating pixel statistic maps for flats */
- for( i=0; i<7 && !iStatus; i++ )
- {
- sprintf( szMessage, "amdmsCreateStatisticsAlgo for Flats #%d", i+1 );
- cpl_msg_info( fctid, "%s", szMessage );
-
- amdmsCreateStatisticsAlgo( &statEnv );
-
- statEnv->cf = 4.70; /* gain factor */
- statEnv->env.detNX = 512; /* detector width in pixels */
- statEnv->env.detNY = 512; /* detector height in pixels */
-
- statEnv->env.calib.corrFlag = amdmsPIXEL_BIAS_CORRECTION
- | amdmsELECTRONIC_BIAS_CORRECTION; /* flags for requested compensations */
-
- /* Filtering */
- statEnv->env.filter.ioiFlag = amdmsTRUE;
- statEnv->env.filter.ioiFrom = iFrom; /* Frames filter */
- statEnv->env.filter.ioiTo = iTo; /* Frames filter */
- statEnv->env.filter.aoiFlag = amdmsTRUE;
- statEnv->env.filter.aoiX = 310;
- statEnv->env.filter.aoiY = 64;
- statEnv->env.filter.aoiWidth = 50;
- statEnv->env.filter.aoiHeight = 384;
-
-
- sprintf( szMessage, "amdmsAddFileToList: %s", szInputFlat[i] );
- cpl_msg_info( fctid, "%s", szMessage );
-
- /* Prepare Input */
- flags.content = amdmsIMAGING_DATA_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(statEnv->env.inFiles), szInputFlat[i], flags);
-
-
- /* Prepare Map Input */
- sprintf( szTemp, "bpm.fits" );
- flags.content = amdmsBAD_PIXEL_CONTENT;
- flags.format = amdmsCUBE_FORMAT;
- flags.type = amdmsBYTE_TYPE;
- amdmsAddFileToList( &(statEnv->env.calib.mapFiles), szTemp, flags );
-
- sprintf( szTemp, "flat_%0d_pem.fits", i );
- flags.content = amdmsPARTICLE_EVENT_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(statEnv->env.calib.mapFiles), szTemp, flags );
-
- sprintf( szTemp, "dark_%0d_pbm.fits", i );
- flags.content = amdmsPIXEL_BIAS_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(statEnv->env.calib.mapFiles), szTemp, flags );
-
- sprintf( szTemp, "dark_%0d_ebm.fits", i );
- flags.content = amdmsELECTRONIC_BIAS_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(statEnv->env.calib.mapFiles), szTemp, flags );
-
-
-
- /* Prepare Output */
- sprintf( szTemp, "flat_%01d_psm.fits", i );
- flags.content = amdmsPIXEL_STAT_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(statEnv->env.outFiles), szTemp, flags);
-
- sprintf( szTemp, "flat_%01d_pnm.fits", i );
- flags.content = amdmsPHOTON_NOISE_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(statEnv->env.outFiles), szTemp, flags);
-
- sprintf( szMessage, "amdmsDoPixelStatistics" );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = amdmsDoPixelStatistics( statEnv );
- if( iStatus == amdmsSUCCESS )
- iStatus = 0;
- else
- iStatus = 666; /* Error from amdmslib */
-
- sprintf( szMessage, "Generating pixel statistics: Status = %d", iStatus );
- cpl_msg_info( fctid, "%s", szMessage );
-
- amdmsDestroyStatisticsAlgo( &statEnv );
- } /* All 7 flats */
-
- /*----------------------------------------*/
- /* Generating flatfield map for expos */
- if( !iStatus )
- {
- sprintf( szMessage, "amdmsCreatePropertiesAlgo flatfield map" );
- cpl_msg_info( fctid, "%s", szMessage );
-
- amdmsCreatePropertiesAlgo( &ppEnv );
-
- ppEnv->nDelStart = 0; /* definition of data point */
- ppEnv->nDelMiddle = 1; /* definition of data point */
- ppEnv->nDelEnd = 0; /* definition of data point */
-
- ppEnv->env.detNX = 512; /* detector width in pixels */
- ppEnv->env.detNY = 512; /* detector height in pixels */
-
- ppEnv->env.calib.corrFlag = amdmsNO_CORRECTION; /* flags for requested compensations */
-
- ppEnv->nuicFlag = amdmsTRUE; /* non uniform illumination compensation */
-
- /* Filtering */
- ppEnv->env.filter.aoiFlag = amdmsTRUE;
- ppEnv->env.filter.aoiX = 310;
- ppEnv->env.filter.aoiY = 64;
- ppEnv->env.filter.aoiWidth = 50;
- ppEnv->env.filter.aoiHeight = 384;
-
- /* Stripes Setup */
- ppEnv->env.stripes.nHStripes = 1;
- ppEnv->env.stripes.hStripes[0].pos = 1;
- ppEnv->env.stripes.hStripes[0].size = 512;
- ppEnv->env.stripes.hStripes[0].flags = amdmsUSE_FLATFIELD;
-
- ppEnv->env.stripes.nVStripes = 9;
- ppEnv->env.stripes.vStripes[0].pos = 1;
- ppEnv->env.stripes.vStripes[0].size = 16;
- ppEnv->env.stripes.vStripes[0].flags = amdmsUSE_NOTHING;
- ppEnv->env.stripes.vStripes[1].pos = 1;
- ppEnv->env.stripes.vStripes[1].size = 34;
- ppEnv->env.stripes.vStripes[1].flags = amdmsUSE_NOTHING;
- ppEnv->env.stripes.vStripes[2].pos = 1;
- ppEnv->env.stripes.vStripes[2].size = 90;
- ppEnv->env.stripes.vStripes[2].flags = amdmsUSE_FLATFIELD;
- ppEnv->env.stripes.vStripes[3].pos = 1;
- ppEnv->env.stripes.vStripes[3].size = 20;
- ppEnv->env.stripes.vStripes[3].flags = amdmsUSE_NOTHING;
- ppEnv->env.stripes.vStripes[4].pos = 1;
- ppEnv->env.stripes.vStripes[4].size = 100;
- ppEnv->env.stripes.vStripes[4].flags = amdmsUSE_FLATFIELD;
- ppEnv->env.stripes.vStripes[5].pos = 1;
- ppEnv->env.stripes.vStripes[5].size = 25;
- ppEnv->env.stripes.vStripes[5].flags = amdmsUSE_NOTHING;
- ppEnv->env.stripes.vStripes[6].pos = 1;
- ppEnv->env.stripes.vStripes[6].size = 85;
- ppEnv->env.stripes.vStripes[6].flags = amdmsUSE_FLATFIELD;
- ppEnv->env.stripes.vStripes[7].pos = 1;
- ppEnv->env.stripes.vStripes[7].size = 50;
- ppEnv->env.stripes.vStripes[7].flags = amdmsUSE_NOTHING;
- ppEnv->env.stripes.vStripes[8].pos = 1;
- ppEnv->env.stripes.vStripes[8].size = 92;
- ppEnv->env.stripes.vStripes[8].flags = amdmsUSE_FLATFIELD;
-
- /* recalculate pos values */
- amdmsRecalcStripes(&(ppEnv->env.stripes), 0, 0);
-
- /* Prepare Input */
- for( i=0; i<7; i++ )
- {
- sprintf( szTemp, "flat_%01d_psm.fits", i );
- flags.content = amdmsPIXEL_STAT_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(ppEnv->env.inFiles), szTemp, flags);
- }
-
- /* Prepare Map Input */
- sprintf( szTemp, "bpm.fits" );
- flags.content = amdmsBAD_PIXEL_CONTENT;
- flags.format = amdmsCUBE_FORMAT;
- flags.type = amdmsBYTE_TYPE;
- amdmsAddFileToList( &(ppEnv->env.calib.mapFiles), szTemp, flags );
-
- /* Prepare Output */
- sprintf( szTemp, "ffm.fits" );
- flags.content = amdmsFLATFIELD_CONTENT;
- flags.format = amdmsCUBE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(ppEnv->env.outFiles), szTemp, flags);
-
- sprintf( szTemp, "ffm_btbl.fits" );
- flags.content = amdmsFLATFIELD_CONTENT;
- flags.format = amdmsTABLE_FORMAT;
- flags.type = amdmsFLOAT_TYPE;
- amdmsAddFileToList( &(ppEnv->env.outFiles), szTemp, flags);
-
-
- sprintf( szMessage, "amdmsDoProperties" );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = amdmsDoProperties( ppEnv );
- if( iStatus == amdmsSUCCESS )
- iStatus = 0;
- else
- iStatus = 666; /* Error from amdmslib */
-
- sprintf( szMessage, "Generating flat field map: Status = %d", iStatus );
- cpl_msg_info( fctid, "%s", szMessage );
-
- amdmsDestroyPropertiesAlgo( &ppEnv );
- }
-
- /*--------------------------------------------*/
- /* Add the two final products to the list for CPL */
- if( !iStatus )
- {
- /* Create DFS Products */
- strcpy( szProduct, "amber_eso_bpm.fits" );
-
- pFrameBPM = cpl_frame_new();
- cpl_frame_set_filename( pFrameBPM, szProduct );
- cpl_frame_set_type ( pFrameBPM, CPL_FRAME_TYPE_IMAGE );
- cpl_frame_set_tag ( pFrameBPM, "AMBER_BADPIX" );
- cpl_frame_set_group ( pFrameBPM, CPL_FRAME_GROUP_PRODUCT );
- cpl_frame_set_level ( pFrameBPM, CPL_FRAME_LEVEL_FINAL );
-
- pImage = cpl_image_load( "bpm.fits", CPL_TYPE_FLOAT, 0, 0 );
- qc_properties = DetectorCreateProductHeader( fctid, szInputDark[0], pFrameBPM );
-
- /* Retrive QC values from header of amdms product */
- pCValues = cpl_propertylist_load( "bpm.fits", 0 );
- if( pCValues )
- {
- iBadPix = cpl_propertylist_get_int( pCValues, "BADPIX" );
- iGoodPix = cpl_propertylist_get_int( pCValues, "GOODPIX" );
- cpl_propertylist_delete( pCValues );
- }
-
-
- /* Add QC parameters */
- sprintf( szMessage, "ESO QC BADPIX = %d", iBadPix );
- cpl_msg_info( fctid, "%s", szMessage );
- cpl_propertylist_append_int( qc_properties, "ESO QC BADPIX", iBadPix );
-
- sprintf( szMessage, "ESO QC GOODPIX = %d", iGoodPix );
- cpl_msg_info( fctid, "%s", szMessage );
- cpl_propertylist_append_int( qc_properties, "ESO QC GOODPIX", iGoodPix );
-
-
- if( iGoodPix )
- {
- dBadRatio = 100.0 * (double)iBadPix / ( (double)iGoodPix + (double)iBadPix );
- }
-
- sprintf( szMessage, "ESO QC BADRATIO = %.2f", dBadRatio );
- cpl_msg_info( fctid, "%s", szMessage );
- cpl_propertylist_append_float( qc_properties, "ESO QC BADRATIO", dBadRatio );
- cpl_propertylist_set_comment( qc_properties, "ESO QC BADRATIO", "Percentage of bad Pixels vs all Pixels");
-
- cpl_image_save( pImage, szProduct, CPL_BPP_IEEE_FLOAT, qc_properties, CPL_IO_DEFAULT );
- cpl_frameset_insert( framelist, pFrameBPM );
- cpl_image_delete( pImage );
-
- /* Writing QC1 Parameters to log */
-
- qcFromRawfile= cpl_propertylist_load(pszFilename, 0 );
- qc = amber_qclog_open( 0 );
-
- if( qc )
- {
- qclog = amber_paf_get_properties( qc );
-
- /* Read original ARCFILE entry and copy to PAF-File */
- pszARCFILE = cpl_propertylist_get_string( qcFromRawfile, "ARCFILE" );
-
- /* Add mandatory keys */
- cpl_propertylist_append_string( qclog, "ARCFILE", pszARCFILE );
-
- /* Take the whole header including QC parameters */
- qcFromProduct = qc_properties;
-
- /* copy to PAF */
- amber_propertylist_append( qclog, qcFromProduct);
-
- /* Finished... */
-
- amber_qclog_close(qc);
-
-
-
-
-
- } /* if qc */
-
- /* Cleanup */
- cpl_propertylist_delete( qc_properties);
- cpl_propertylist_delete( qcFromRawfile);
-
- sprintf( szMessage, "First product is Bad Pixel Map: Status = %d", iStatus );
- cpl_msg_info( fctid, "%s", szMessage );
-
- /*---------------------------------------------------------*/
- strcpy( szProduct, "amber_eso_ffm.fits" );
-
- pFrameBPM = cpl_frame_new();
- cpl_frame_set_filename( pFrameBPM, szProduct );
- cpl_frame_set_type ( pFrameBPM, CPL_FRAME_TYPE_IMAGE );
- cpl_frame_set_tag ( pFrameBPM, "AMBER_FLATFIELD" );
- cpl_frame_set_group ( pFrameBPM, CPL_FRAME_GROUP_PRODUCT );
- cpl_frame_set_level ( pFrameBPM, CPL_FRAME_LEVEL_FINAL );
-
- pImage = cpl_image_load( "ffm.fits", CPL_TYPE_FLOAT, 0, 0 );
- qc_properties = DetectorCreateProductHeader( fctid, szInputFlat[0], pFrameBPM );
- cpl_image_save( pImage, szProduct, CPL_BPP_IEEE_FLOAT, qc_properties, CPL_IO_DEFAULT );
- cpl_frameset_insert( framelist, pFrameBPM );
- cpl_image_delete( pImage );
-
- cpl_propertylist_delete( qc_properties);
-
- sprintf( szMessage, "Second product is Flat Field Map: Status = %d", iStatus );
- cpl_msg_info( fctid, "%s", szMessage );
-
- } /* STatus still OK */
-
-
- }
-
-
- cpl_msg_info( fctid, "End of DataReduction");
-
- cpl_error_reset();
-
- return iStatus;
-}
diff --git a/recipes/amber_oimerge.c b/recipes/amber_oimerge.c
deleted file mode 100644
index 7fdcfc3..0000000
--- a/recipes/amber_oimerge.c
+++ /dev/null
@@ -1,1227 +0,0 @@
-/* This file is part of the AMBER 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
- */
-
-
-/*
- * amber_oimerge.c
- *
- * Created on: June 28, 2010
- * Author: agabasch
- */
-
-/*-----------------------------------------------------------------------------
- Includes
- -----------------------------------------------------------------------------*/
-#include <config.h>
-#include <cpl.h>
-#include "amber_dfs.h"
-#include <string.h>
-#include "fitsio.h"
-/*-----------------------------------------------------------------------------
- Private function prototypes
- -----------------------------------------------------------------------------*/
-static int amber_oimerge_create(cpl_plugin *);
-static int amber_oimerge_exec(cpl_plugin *);
-static int amber_oimerge_destroy(cpl_plugin *);
-static int amber_oimerge(cpl_frameset *, cpl_parameterlist *);
-
-static int amber_oimerge_frameset(cpl_frameset * frameset,
- cpl_parameterlist * parlist, cpl_frameset * frameset_global,
- const char * outfile);
-
-static cpl_error_code amber_merge_extension(cpl_table ** targettable,
- const cpl_frame * cur_frame, const char * extension);
-static cpl_error_code amber_check_framesetconsistency(cpl_frameset * frameset);
-static int amber_compare_OI_ARRAY(const cpl_table * ref_table,
- const cpl_table * table);
-static int amber_compare_OI_WAVELENGTH(const cpl_table * ref_table,
- const cpl_table * table);
-
-static cpl_error_code amber_merge_VISfiles(cpl_frameset * frameset,
- const char * outfile);
-static int cfitsio_main_tabmerge(const char *argv1, const char *argv2);
-
-static int amber_copy_extension(const char * infile , const char * outfile,
- const char * extension_name);
-static int amber_check_tag_oimerge(const cpl_frame * cur_frame);
-static int amber_check_oiconsistency(const cpl_frame * cur_frame);
-
-
-/*-----------------------------------------------------------------------------
- Static variables
- -----------------------------------------------------------------------------*/
-
-static char amber_oimerge_man[] =
- "This recipe merges OI-Fits files\n"
- "\n"
- "Input files:\n\n"
- " DO category: Type: Explanation: Required: \n"
- " SCIENCE_REDUCED Products OI-Fits file \n"
- " or \n"
- " SCIENCE_REDUCED_FILTERED Products OI-Fits file \n"
- " or \n"
- " CALIB_REDUCED Products OI-Fits file \n"
- " or \n"
- " CALIB_REDUCED_FILTERED Products OI-Fits file \n"
- " or Y\n"
- " AMBER_TRF_J Products OI-Fits file \n"
- " or \n"
- " AMBER_TRF_H Products OI-Fits file \n"
- " or \n"
- " AMBER_TRF_K Products OI-Fits file \n"
- " or \n"
- " SCIENCE_CALIBRATED Products OI-Fits file \n\n"
- "Output files:\n\n"
- " DO category: Data type: Explanation: \n"
- " SCIENCE_REDUCED Products: merged OI-fits file \n"
- " or \n"
- " SCIENCE_REDUCED_FILTERED Products: merged OI-fits file \n"
- " or \n"
- " CALIB_REDUCED Products: merged OI-fits file \n"
- " or \n"
- " CALIB_REDUCED_FILTERED Products: merged OI-fits file \n"
- " or Y\n"
- " AMBER_TRF_J Products merged OI-Fits file \n"
- " or \n"
- " AMBER_TRF_H Products merged OI-Fits file \n"
- " or \n"
- " AMBER_TRF_K Products merged OI-Fits file \n"
- " or \n"
- " SCIENCE_CALIBRATED Products: merged OI-fits file \n\n";
-
-/*-----------------------------------------------------------------------------
- Function code
- -----------------------------------------------------------------------------*/
-
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Build the list of available plugins, for this module.
- @param list the plugin list
- @return 0 if everything is ok, 1 otherwise
- @note Only this function is exported
-
- Create the recipe instance and make it available to the application using the
- interface.
- */
-/*----------------------------------------------------------------------------*/
-int cpl_plugin_get_info(cpl_pluginlist * list)
-{
- cpl_recipe * recipe = cpl_calloc(1, sizeof *recipe );
- cpl_plugin * plugin = &recipe->interface;
-
- if (cpl_plugin_init(plugin,
- CPL_PLUGIN_API,
- AMBER_BINARY_VERSION,
- CPL_PLUGIN_TYPE_RECIPE,
- "amber_oimerge",
- "AMBER Merge OI-Fits files",
- amber_oimerge_man,
- "Armin Gabasch",
- PACKAGE_BUGREPORT,
- "GPL",
- amber_oimerge_create,
- amber_oimerge_exec,
- amber_oimerge_destroy)) {
- cpl_msg_error(cpl_func, "Plugin initialization failed");
- (void)cpl_error_set_where(cpl_func);
- return 1;
- }
-
- if (cpl_pluginlist_append(list, plugin)) {
- cpl_msg_error(cpl_func, "Error adding plugin to list");
- (void)cpl_error_set_where(cpl_func);
- return 1;
- }
-
- 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 amber_oimerge_create(cpl_plugin * plugin)
-{
- cpl_recipe * recipe;
- /*cpl_parameter * p;*/
-
- /* Do not create the recipe if an error code is already set */
- if (cpl_error_get_code() != CPL_ERROR_NONE) {
- cpl_msg_error(cpl_func, "%s():%d: An error is already set: %s",
- cpl_func, __LINE__, cpl_error_get_where());
- return (int)cpl_error_get_code();
- }
-
- if (plugin == NULL) {
- cpl_msg_error(cpl_func, "Null plugin");
- cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
- }
-
- /* Verify plugin type */
- if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
- cpl_msg_error(cpl_func, "Plugin is not a recipe");
- cpl_ensure_code(0, (int)CPL_ERROR_TYPE_MISMATCH);
- }
-
- /* Get the recipe */
- recipe = (cpl_recipe *)plugin;
-
- /* Create the parameters list in the cpl_recipe object */
- recipe->parameters = cpl_parameterlist_new();
- if (recipe->parameters == NULL) {
- cpl_msg_error(cpl_func, "Parameter list allocation failed");
- cpl_ensure_code(0, (int)CPL_ERROR_ILLEGAL_OUTPUT);
- }
-
- /* Fill the parameters list */
-
-
- return 0;
-}
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Execute the plugin instance given by the interface
- @param plugin the plugin
- @return 0 if everything is ok
- */
-/*----------------------------------------------------------------------------*/
-static int amber_oimerge_exec(cpl_plugin * plugin)
-{
-
- cpl_recipe * recipe;
- int recipe_status;
- cpl_errorstate initial_errorstate = cpl_errorstate_get();
-
- /* Return immediately if an error code is already set */
- if (cpl_error_get_code() != CPL_ERROR_NONE) {
- cpl_msg_error(cpl_func, "%s():%d: An error is already set: %s",
- cpl_func, __LINE__, cpl_error_get_where());
- return (int)cpl_error_get_code();
- }
-
- if (plugin == NULL) {
- cpl_msg_error(cpl_func, "Null plugin");
- cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
- }
-
- /* Verify plugin type */
- if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
- cpl_msg_error(cpl_func, "Plugin is not a recipe");
- cpl_ensure_code(0, (int)CPL_ERROR_TYPE_MISMATCH);
- }
-
- /* Get the recipe */
- recipe = (cpl_recipe *)plugin;
-
- /* Verify parameter and frame lists */
- if (recipe->parameters == NULL) {
- cpl_msg_error(cpl_func, "Recipe invoked with NULL parameter list");
- cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
- }
- if (recipe->frames == NULL) {
- cpl_msg_error(cpl_func, "Recipe invoked with NULL frame set");
- cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
- }
-
- /* Invoke the recipe */
- recipe_status = amber_oimerge(recipe->frames, recipe->parameters);
-
- /* Ensure DFS-compliance of the products */
- if (cpl_dfs_update_product_header(recipe->frames)) {
- if (!recipe_status) recipe_status = (int)cpl_error_get_code();
- }
-
- if (!cpl_errorstate_is_equal(initial_errorstate)) {
- /* Dump the error history since recipe execution start.
- At this point the recipe cannot recover from the error */
- cpl_errorstate_dump(initial_errorstate, CPL_FALSE, NULL);
- }
-
- return recipe_status;
-}
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Destroy what has been created by the 'create' function
- @param plugin the plugin
- @return 0 if everything is ok
- */
-/*----------------------------------------------------------------------------*/
-static int amber_oimerge_destroy(cpl_plugin * plugin)
-{
- cpl_recipe * recipe;
-
- if (plugin == NULL) {
- cpl_msg_error(cpl_func, "Null plugin");
- cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
- }
-
- /* Verify plugin type */
- if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
- cpl_msg_error(cpl_func, "Plugin is not a recipe");
- cpl_ensure_code(0, (int)CPL_ERROR_TYPE_MISMATCH);
- }
-
- /* Get the recipe */
- recipe = (cpl_recipe *)plugin;
-
- cpl_parameterlist_delete(recipe->parameters);
-
- return 0;
-}
-
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Interpret the command line options and execute the data processing
- @param frameset the frames list
- @param parlist the parameters list
- @return 0 if everything is ok
- */
-/*----------------------------------------------------------------------------*/
-static int amber_oimerge(cpl_frameset * frameset, cpl_parameterlist * parlist)
-{
-
- cpl_frameset * frameset_J=NULL;
- cpl_frameset * frameset_H=NULL;
- cpl_frameset * frameset_K=NULL;
- cpl_propertylist * dummy_propertylist=NULL;
- const char * dummy_string=NULL;
- cpl_frame * cur_frame=NULL;
- int jband=0;
- int hband=0;
- int kband=0;
- cpl_errorstate prestate=0;
- /*
- cpl_errorstate errorstateJ=0;
- cpl_errorstate errorstateH=0;
- cpl_errorstate errorstateK=0;
- cpl_errorstate errorstateALL=0;
- */
-
- amber_dfs_set_groups(frameset);
-
- if(cpl_frameset_find( frameset, "SCIENCE_REDUCED" )==NULL &&
- cpl_frameset_find( frameset, "SCIENCE_REDUCED_FILTERED")==NULL &&
- cpl_frameset_find( frameset, "CALIB_REDUCED" )==NULL &&
- cpl_frameset_find( frameset, "CALIB_REDUCED_FILTERED")==NULL &&
- cpl_frameset_find( frameset, "AMBER_TRF_J")==NULL &&
- cpl_frameset_find( frameset, "AMBER_TRF_H")==NULL &&
- cpl_frameset_find( frameset, "AMBER_TRF_K")==NULL &&
- cpl_frameset_find( frameset, "SCIENCE_CALIBRATED")==NULL)
- {
- cpl_msg_error(cpl_func,"No file tagged SCIENCE_REDUCED, CALIB_REDUCED, "
- "SCIENCE_REDUCED_FILTERED, CALIB_REDUCED_FILTERED. "
- "AMBER_TRF_J, AMBER_TRF_H, or AMBER_TRF_K "
- "found in the SOF!!");
- return -1;
- }
-
-
- frameset_J=cpl_frameset_new();
- frameset_H=cpl_frameset_new();
- frameset_K=cpl_frameset_new();
-
-
- cur_frame=cpl_frameset_get_first(frameset);
-
- /*Looping over frames */
- while(cur_frame)
- {
- dummy_string=NULL;
- dummy_propertylist=
- cpl_propertylist_load(cpl_frame_get_filename(cur_frame),0);
- dummy_string=cpl_propertylist_get_string(dummy_propertylist,
- "ESO QC BAND");
-
- if(dummy_string!=NULL && strcmp(dummy_string,"J")==0){
- jband++;
- cpl_frameset_insert(frameset_J, cpl_frame_duplicate(cur_frame));
- }
- if(dummy_string!=NULL && strcmp(dummy_string,"H")==0){
- hband++;
- cpl_frameset_insert(frameset_H, cpl_frame_duplicate(cur_frame));
- }
- if(dummy_string!=NULL && strcmp(dummy_string,"K")==0){
- kband++;
- cpl_frameset_insert(frameset_K, cpl_frame_duplicate(cur_frame));
- }
- cur_frame=cpl_frameset_get_next(frameset);
- cpl_propertylist_delete(dummy_propertylist);
- }
-
- cpl_msg_info(cpl_func,"%d J-BAND frames found", jband);
- cpl_msg_info(cpl_func,"%d H-BAND frames found", hband);
- cpl_msg_info(cpl_func,"%d K-BAND frames found", kband);
-
-
- prestate = cpl_errorstate_get();
-
-
- if(!cpl_frameset_is_empty(frameset_J))
- {
- cpl_msg_info(cpl_func,"Merging J-Band data. Please wait ...");
- amber_oimerge_frameset(frameset_J, parlist, frameset,
- "merged_J-band.fits");
- }
- //errorstateJ = cpl_errorstate_get();
- cpl_errorstate_set(prestate);
-
-
- if(!cpl_frameset_is_empty(frameset_H))
- {
- cpl_msg_info(cpl_func,"Merging H-Band data. Please wait ...");
- amber_oimerge_frameset(frameset_H, parlist, frameset,
- "merged_H-band.fits");
- }
- //errorstateH = cpl_errorstate_get();
- cpl_errorstate_set(prestate);
-
-
- if(!cpl_frameset_is_empty(frameset_K))
- {
- cpl_msg_info(cpl_func,"Merging K-Band data. Please wait ...");
- amber_oimerge_frameset(frameset_K, parlist, frameset,
- "merged_K-band.fits");
- }
- //errorstateK = cpl_errorstate_get();
- cpl_errorstate_set(prestate);
-
-
- if(cpl_frameset_is_empty(frameset_J) && cpl_frameset_is_empty(frameset_H)
- && cpl_frameset_is_empty(frameset_K) )
- {
- cpl_msg_info(cpl_func,"Trying to merge unknown data. Please wait ...");
-
- amber_oimerge_frameset(frameset, parlist, frameset,
- "merged_unknown.fits");
- }
- /* errorstateALL = cpl_errorstate_get();*/
-
- cpl_errorstate_set(prestate);
-
-
- cpl_frameset_delete(frameset_J);
- cpl_frameset_delete(frameset_H);
- cpl_frameset_delete(frameset_K);
-
- //amber_oimerge_frameset(frameset,parlist);
- return 0;
-}
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Interpret the command line options and execute the data processing
- @param frameset the frames list
- @param parlist the parameters list
- @return 0 if everything is ok
- */
-/*----------------------------------------------------------------------------*/
-static int amber_oimerge_frameset(cpl_frameset * frameset, cpl_parameterlist
- * parlist, cpl_frameset * frameset_global, const char * outfile)
-{
- cpl_errorstate prestate=0;
- const cpl_frame * cur_frame=NULL;
- const cpl_frame * FirstValidFrame=NULL;
- const char * FirstValidTag=NULL;
- const char * FirstValidFilename=NULL;
- cpl_propertylist * PrimaryHeader=NULL;
- cpl_propertylist * tablelist=NULL;
- cpl_propertylist * property_OI_ARRAY=NULL;
- cpl_propertylist * dummy_propertylist=NULL;
- int counter=0;
- cpl_table * table_OI_ARRAY =NULL;
- cpl_table * table_OI_TARGET =NULL;
- cpl_table * table_OI_WAVELENGTH =NULL;
- cpl_table * table_OI_VIS =NULL;
- cpl_table * table_OI_VIS2 =NULL;
- cpl_table * table_OI_T3 =NULL;
- cpl_table * table_AMBER_DATA =NULL;
- cpl_table * table_AMBER_SPECTRUM=NULL;
-
-
-
- prestate = cpl_errorstate_get();
-
-
-
-
- amber_check_framesetconsistency(frameset);
-
- if (!cpl_errorstate_is_equal(prestate)){
- /*cpl_errorstate_dump(prestate, CPL_FALSE, NULL);*/
- return cpl_error_set_message(cpl_func, cpl_error_get_code(),
- "SOF is not consistent");
- }
-
- cur_frame=cpl_frameset_get_first_const(frameset);
- counter=0;
- /*Looping over science_reduced frames */
-
- while(cur_frame)
- {
- /*Checking if the file has all required extension for merging.
- * If not, a warning is issued*/
- if(amber_check_tag_oimerge(cur_frame)){
- if(!amber_check_oiconsistency(cur_frame)){
- cpl_msg_warning(cpl_func,"File %s has not all required "
- "extensions for a clean merging! This file is not "
- "taking into account during the merging process",
- cpl_frame_get_filename(cur_frame));
- }
- }
-
- if(amber_check_tag_oimerge(cur_frame) &&
- amber_check_oiconsistency(cur_frame))
-
- {
- cpl_msg_indent_more();
- cpl_msg_info(cpl_func,"Processing valid frame: %s",
- cpl_frame_get_filename(cur_frame));
- cpl_msg_indent_less();
- if(counter<1){
- /*execute only once*/
- FirstValidFrame =cur_frame;
- FirstValidTag =cpl_frame_get_tag(cur_frame);
- FirstValidFilename=cpl_frame_get_filename(FirstValidFrame);
- //cpl_msg_info(cpl_func,"First valid frame and tag: %s %s",
- // FirstValidFilename,FirstValidTag);
- amber_merge_extension(&table_OI_ARRAY, cur_frame, "OI_ARRAY");
-
- amber_merge_extension(&table_OI_WAVELENGTH, cur_frame,
- "OI_WAVELENGTH");
- counter=1;
- }
- amber_merge_extension(&table_OI_TARGET , cur_frame, "OI_TARGET");
- amber_merge_extension(&table_OI_VIS , cur_frame, "OI_VIS");
- amber_merge_extension(&table_OI_VIS2 , cur_frame, "OI_VIS2");
- amber_merge_extension(&table_OI_T3 , cur_frame, "OI_T3");
- amber_merge_extension(&table_AMBER_DATA , cur_frame, "AMBER_DATA");
- amber_merge_extension(&table_AMBER_SPECTRUM,
- cur_frame, "AMBER_SPECTRUM");
-
- /*
- cpl_msg_info(cpl_func,"Processing frame: %s",
- cpl_frame_get_filename(cur_frame));
- cpl_msg_info(cpl_func,"nrow: %i",
- cpl_table_get_nrow(table_AMBER_SPECTRUM));
- */
-
- }
- cur_frame=cpl_frameset_get_next_const(frameset);
- }
-
- /*According to OI-Fits the FLAG must be of type LOGICAL*/
- cpl_table_set_column_savetype(table_OI_VIS, "FLAG",CPL_TYPE_BOOL);
- cpl_table_set_column_savetype(table_OI_VIS2,"FLAG",CPL_TYPE_BOOL);
- cpl_table_set_column_savetype(table_OI_T3, "FLAG",CPL_TYPE_BOOL);
-
- /* Propertylist to write to the extension */
-
-
- PrimaryHeader=cpl_propertylist_new();
- prestate = cpl_errorstate_get();
-
- /*Try to copy the following header parameters*/
- dummy_propertylist=cpl_propertylist_load(FirstValidFilename,0);
- cpl_propertylist_copy_property(PrimaryHeader,
- dummy_propertylist,"ESO PRO TECH");
- cpl_propertylist_copy_property(PrimaryHeader,
- dummy_propertylist,"ESO PRO SCIENCE");
- cpl_propertylist_copy_property(PrimaryHeader,
- dummy_propertylist,"ESO QC LAMBDA CHAN");
- cpl_propertylist_copy_property(PrimaryHeader,
- dummy_propertylist,"ESO QC LAMBDA MIN");
- cpl_propertylist_copy_property(PrimaryHeader,
- dummy_propertylist,"ESO QC LAMBDA MAX");
- cpl_propertylist_copy_property(PrimaryHeader,
- dummy_propertylist,"ESO QC BAND");
- cpl_propertylist_copy_property(PrimaryHeader,
- dummy_propertylist,"ESO QC STA1");
- cpl_propertylist_copy_property(PrimaryHeader,
- dummy_propertylist,"ESO QC STA2");
- cpl_propertylist_copy_property(PrimaryHeader,
- dummy_propertylist,"ESO QC STA3");
- cpl_propertylist_delete(dummy_propertylist);
-
- cpl_errorstate_set(prestate);
-
- cpl_propertylist_update_string(PrimaryHeader,CPL_DFS_PRO_CATG,FirstValidTag);
-
- /*Adding the JMMC acknowledgements*/
- amber_JMMC_acknowledgement(PrimaryHeader);
-
-
- tablelist= cpl_propertylist_load(FirstValidFilename,
- cpl_fits_find_extension(FirstValidFilename,"OI_ARRAY"));
-
- cpl_dfs_save_table(frameset_global, NULL, parlist, frameset, FirstValidFrame,
- table_OI_ARRAY,
- tablelist, "amber_oimerge",
- PrimaryHeader, NULL,
- PACKAGE "/" PACKAGE_VERSION,
- outfile);
- cpl_propertylist_delete(tablelist);
-
-
- tablelist= cpl_propertylist_load(FirstValidFilename,
- cpl_fits_find_extension(FirstValidFilename, "OI_TARGET"));
- cpl_table_save(table_OI_TARGET,NULL,tablelist,outfile,CPL_IO_EXTEND);
- cpl_propertylist_delete(tablelist);
-
- tablelist= cpl_propertylist_load(FirstValidFilename,
- cpl_fits_find_extension(FirstValidFilename, "OI_WAVELENGTH"));
- cpl_table_save(table_OI_WAVELENGTH,NULL,tablelist,outfile,
- CPL_IO_EXTEND);
- cpl_propertylist_delete(tablelist);
-
-
- /*At the moment cpl_table can not deal with complex types, therefore the
- * following workarround based on cfitsio is used */
-
- /*
- Once cpl_table can handle complex types, comment this in again
- tablelist= cpl_propertylist_load(FirstValidFilename,
- cpl_fits_find_extension(FirstValidFilename, "OI_VIS"));
- cpl_table_save(table_OI_VIS,NULL,tablelist,outfile,CPL_IO_EXTEND);
- cpl_propertylist_delete(tablelist);
- */
-
- amber_merge_VISfiles(frameset, outfile);
-
- tablelist= cpl_propertylist_load(FirstValidFilename,
- cpl_fits_find_extension(FirstValidFilename, "OI_VIS2"));
- cpl_table_save(table_OI_VIS2,NULL,tablelist,outfile,CPL_IO_EXTEND);
- cpl_propertylist_delete(tablelist);
-
- tablelist= cpl_propertylist_load(FirstValidFilename,
- cpl_fits_find_extension(FirstValidFilename, "OI_T3"));
- cpl_table_save(table_OI_T3,NULL,tablelist,outfile,CPL_IO_EXTEND);
- cpl_propertylist_delete(tablelist);
-
- tablelist= cpl_propertylist_load(FirstValidFilename,
- cpl_fits_find_extension(FirstValidFilename, "AMBER_DATA"));
- cpl_table_save(table_AMBER_DATA,NULL,tablelist,outfile,CPL_IO_EXTEND);
- cpl_propertylist_delete(tablelist);
-
- tablelist= cpl_propertylist_load(FirstValidFilename,
- cpl_fits_find_extension(FirstValidFilename, "AMBER_SPECTRUM"));
- cpl_table_save(table_AMBER_SPECTRUM,NULL,tablelist,outfile,
- CPL_IO_EXTEND);
- cpl_propertylist_delete(tablelist);
-
-
- /*
-
- cpl_dfs_save_table(frameset, PrimaryHeader, parlist, frameset, NULL,
- table_OI_T3,
- PrimaryHeader, "amber_oimerge",
- NULL, NULL,
- PACKAGE "/" PACKAGE_VERSION,
- "table_OI_T3.fits");
- */
-
- cpl_propertylist_delete(property_OI_ARRAY);
- cpl_propertylist_delete(PrimaryHeader);
- cpl_table_delete(table_OI_ARRAY);
- cpl_table_delete(table_OI_TARGET);
- cpl_table_delete(table_OI_WAVELENGTH);
- cpl_table_delete(table_OI_VIS);
- cpl_table_delete(table_OI_VIS2);
- cpl_table_delete(table_OI_T3);
- cpl_table_delete(table_AMBER_DATA);
- cpl_table_delete(table_AMBER_SPECTRUM);
-
-
-
-
-
- //cpl_table_dump(table_AMBER_DATA,1,5000000,NULL);
- //cpl_table_save(table_AMBER_DATA,NULL,NULL,"table_AMBER_DATA.fits",0);
-
- if (!cpl_errorstate_is_equal(prestate)){
- /*cpl_errorstate_dump(prestate, CPL_FALSE, NULL);*/
- return cpl_error_set_message(cpl_func, cpl_error_get_code(),
- "Recipe failed");
-
-
- }
- return 0;
-
-}
-
-static cpl_error_code amber_merge_extension(cpl_table ** targettable,
- const cpl_frame * cur_frame, const char * extension)
-{
- int ext_number=0;
- cpl_table * table=NULL;
- //cpl_errorstate prestate=0;
-
- //cpl_msg_info(cpl_func,"AA: %p",targettable);
- //cpl_msg_info(cpl_func,"AA: %p",*targettable);
-
-
- ext_number=cpl_fits_find_extension(cpl_frame_get_filename(cur_frame),
- extension);
- table = cpl_table_load(cpl_frame_get_filename(cur_frame), ext_number, 1);
- if (table == NULL) {
- return cpl_error_set_message(cpl_func, cpl_error_get_code(),
- "Could not load the table");
- cpl_table_dump(table,1,20,NULL);
-
- }
- //cpl_ensure_code(cpl_errorstate_is_equal(prestate), cpl_error_get_code());
- //cpl_table_dump(table,1,20,NULL);
-
- if(*targettable==NULL)
- {
- *targettable=table;
- }
- else{
- cpl_table_insert(*targettable, table, cpl_table_get_nrow(*targettable));
- cpl_table_delete(table);
- }
- /*Free the memory*/
- // cpl_msg_info(cpl_func,"frameAA: %s",cpl_frame_get_filename(cur_frame));
- // cpl_msg_info(cpl_func,"nrowAA: %i",cpl_table_get_nrow(targettable));
- //cpl_table_dump(targettable,1,20,NULL);
-
- /* Propagate error, if any */
- return cpl_error_set(cpl_func, cpl_error_get_code());
-
-
-}
-
-/*----------------------------------------------------------------------------*/
-/**
- * @brief
- * Checks if the frameset is compatible
- *
- * @param table Pointer to the reference table.
- * @param name Pointer to the table.
- * @return CPL_ERROR_NONE or the relevant CPL error code on error
- *
- */
-/*----------------------------------------------------------------------------*/
-
-static cpl_error_code amber_check_framesetconsistency(cpl_frameset * frameset)
-{
- const cpl_frame * cur_frame=NULL;
- cpl_table * table_ref_OI_ARRAY=NULL;
- cpl_table * table_ref_OI_WAVELENGTH=NULL;
- cpl_table * table_OI_ARRAY=NULL;
- cpl_table * table_OI_WAVELENGTH=NULL;
- const cpl_frame * FirstValidFrame=NULL;
- const char * FirstValidTag=NULL;
- const char * FirstValidFilename=NULL;
- int isConsistentARRAY=0;
- int isConsistentWAVELENGTH=0;
-
- //cpl_errorstate prestate=0;
-
- cur_frame=cpl_frameset_get_first_const(frameset);
- /*Looping over science_reduced frames */
- while(cur_frame)
- {
-
- if(amber_check_tag_oimerge(cur_frame) &&
- amber_check_oiconsistency(cur_frame))
- {
- FirstValidFrame =cur_frame;
- FirstValidTag =cpl_frame_get_tag(cur_frame);
- FirstValidFilename=cpl_frame_get_filename(FirstValidFrame);
- break;
- }
- else {
- cur_frame=cpl_frameset_get_next_const(frameset);
- }
- }
- /*Load reference tables*/
-
-
- table_ref_OI_ARRAY=cpl_table_load(FirstValidFilename,
- cpl_fits_find_extension(FirstValidFilename,"OI_ARRAY"), 1);
- if (table_ref_OI_ARRAY == NULL) {
- return cpl_error_set_message(cpl_func, cpl_error_get_code(),
- "Could not load the table OI_ARRAY");
-
- }
-
-
- table_ref_OI_WAVELENGTH=cpl_table_load(FirstValidFilename,
- cpl_fits_find_extension(FirstValidFilename,"OI_WAVELENGTH"), 1);
- if ( table_ref_OI_WAVELENGTH== NULL) {
- cpl_table_delete(table_ref_OI_ARRAY);
- return cpl_error_set_message(cpl_func, cpl_error_get_code(),
- "Could not load the table OI_WAVELENGTH");
-
- }
-
-
- //cpl_ensure_code(cpl_errorstate_is_equal(prestate), cpl_error_get_code());
-
-
- cur_frame=cpl_frameset_get_first_const(frameset);
- /*Looping over reduced frames and compare the tables*/
-
- while(cur_frame)
- {
- if(amber_check_tag_oimerge(cur_frame))
-
- {
- table_OI_ARRAY=cpl_table_load(cpl_frame_get_filename(cur_frame),
- cpl_fits_find_extension(cpl_frame_get_filename(cur_frame),
- "OI_ARRAY"), 1);
- table_OI_WAVELENGTH=cpl_table_load(cpl_frame_get_filename(cur_frame)
- ,cpl_fits_find_extension(cpl_frame_get_filename(cur_frame),
- "OI_WAVELENGTH"), 1);
-
- isConsistentARRAY=
- amber_compare_OI_ARRAY(table_ref_OI_ARRAY,table_OI_ARRAY);
-
- isConsistentWAVELENGTH=
- amber_compare_OI_WAVELENGTH(table_ref_OI_WAVELENGTH,
- table_OI_WAVELENGTH);
-
- if(isConsistentARRAY>0 || isConsistentWAVELENGTH >0)
- {
- cpl_table_delete(table_ref_OI_ARRAY);
- cpl_table_delete(table_ref_OI_WAVELENGTH);
- cpl_table_delete(table_OI_ARRAY);
- cpl_table_delete(table_OI_WAVELENGTH);
- return cpl_error_set_message(cpl_func,
- CPL_ERROR_INCOMPATIBLE_INPUT,
- "SOF contains inconsistent OI-Fits files");
- }
- cpl_table_delete(table_OI_ARRAY);
- cpl_table_delete(table_OI_WAVELENGTH);
-
- }
- cur_frame=cpl_frameset_get_next_const(frameset);
-
- }
-
- cpl_table_delete(table_ref_OI_ARRAY);
- cpl_table_delete(table_ref_OI_WAVELENGTH);
- return cpl_error_set(cpl_func, cpl_error_get_code());
-
-}
-
-/*----------------------------------------------------------------------------*/
-/**
- * @brief
- * Checks if two OI_ARRAY tables are compatible
- *
- * @param table Pointer to the reference table.
- * @param name Pointer to the table.
- *
- */
-/*----------------------------------------------------------------------------*/
-static int amber_compare_OI_ARRAY(const cpl_table * ref_table,
- const cpl_table * table)
-{
-
- int nrow=0;
- int i=0;
-
- const char ** pointer_ref_TEL_NAME=NULL;
- const char ** pointer_TEL_NAME=NULL;
- const char ** pointer_ref_STA_NAME=NULL;
- const char ** pointer_STA_NAME=NULL;
- const int * pointer_ref_STA_INDEX=NULL;
- const int * pointer_STA_INDEX=NULL;
-
-
-
- /*Check if the table structure and length is identical*/
- if (cpl_table_compare_structure(ref_table,table)!=0 ||
- cpl_table_get_nrow(ref_table)!=cpl_table_get_nrow(table))
- {
- return 1;
- cpl_msg_error(cpl_func,"OI_ARRAY table structure differ");
-
- }
-
- nrow=cpl_table_get_nrow(ref_table);
-
- if(!cpl_table_has_column(ref_table,"TEL_NAME") ||
- !cpl_table_has_column(table,"TEL_NAME") ||
- !cpl_table_has_column(ref_table,"STA_NAME") ||
- !cpl_table_has_column(table,"STA_NAME") ||
- !cpl_table_has_column(ref_table,"STA_INDEX") ||
- !cpl_table_has_column(table,"STA_INDEX"))
- {
- cpl_msg_error(cpl_func,"OI_ARRAY table not complete");
- return 1;
- }
- pointer_ref_TEL_NAME=cpl_table_get_data_string_const(ref_table,"TEL_NAME");
- pointer_TEL_NAME =cpl_table_get_data_string_const(table,"TEL_NAME");
-
- pointer_ref_STA_NAME=cpl_table_get_data_string_const(ref_table,"STA_NAME");
- pointer_STA_NAME =cpl_table_get_data_string_const(table,"STA_NAME");
-
- pointer_ref_STA_INDEX=cpl_table_get_data_int_const(ref_table,"STA_INDEX");
- pointer_STA_INDEX =cpl_table_get_data_int_const(table,"STA_INDEX");
-
-
-
- for (i=0; i<nrow;i++)
- {
- /*cpl_msg_error(cpl_func,"STA_INDEX=%d",pointer_ref_STA_INDEX[i]);*/
-
- if(strcmp(pointer_ref_TEL_NAME[i],pointer_TEL_NAME[i])!=0 ||
- strcmp(pointer_ref_STA_NAME[i],pointer_STA_NAME[i])!=0 ||
- pointer_ref_STA_INDEX[i]!=pointer_STA_INDEX[i])
- {
- cpl_msg_error(cpl_func,"OI_ARRAY table differ");
- return 1;
- }
- }
-
-
- return 0;
-
-}
-
-/*----------------------------------------------------------------------------*/
-/**
- * @brief
- * Checks if two OI_WAVELENGTH tables are compatible
- *
- * @param table Pointer to the reference table.
- * @param name Pointer to the table.
- *
- */
-/*----------------------------------------------------------------------------*/
-static int amber_compare_OI_WAVELENGTH(const cpl_table * ref_table,
- const cpl_table * table)
-{
- int nrow=0;
- int i=0;
- const float * pointer_ref_EFF_WAVE=NULL;
- const float * pointer_EFF_WAVE=NULL;
- const float * pointer_ref_EFF_BAND=NULL;
- const float * pointer_EFF_BAND=NULL;
-
-
- /*Check if the table structure and length is identical*/
- if (cpl_table_compare_structure(ref_table,table)!=0 ||
- cpl_table_get_nrow(ref_table)!=cpl_table_get_nrow(table))
- {
- cpl_msg_error(cpl_func,"OI_WAVELENGTH table structure differ");
- return 1;
- }
-
- nrow=cpl_table_get_nrow(ref_table);
-
- if(!cpl_table_has_column(ref_table,"EFF_BAND") ||
- !cpl_table_has_column(table,"EFF_BAND") ||
- !cpl_table_has_column(ref_table,"EFF_WAVE") ||
- !cpl_table_has_column(table,"EFF_WAVE"))
- {
- cpl_msg_error(cpl_func,"OI_WAVELENGTH table not complete");
- return 1;
- }
-
- pointer_ref_EFF_WAVE=cpl_table_get_data_float_const(ref_table,"EFF_WAVE");
- pointer_EFF_WAVE =cpl_table_get_data_float_const(table,"EFF_WAVE");
- pointer_ref_EFF_BAND=cpl_table_get_data_float_const(ref_table,"EFF_BAND");
- pointer_EFF_BAND =cpl_table_get_data_float_const(table,"EFF_BAND");
-
- for (i=0; i<nrow;i++)
- {
- /*cpl_msg_error(cpl_func,"EFF_BAND=%d",pointer_ref_EFF_BAND[i]);*/
-
- if(pointer_ref_EFF_BAND[i]!=pointer_EFF_BAND[i] ||
- pointer_ref_EFF_WAVE[i]!=pointer_EFF_WAVE[i])
- {
- cpl_msg_error(cpl_func,"OI_WAVELENGTH table differ");
- return 1;
- }
- }
-
-
- return 0;
-
-}
-
-static cpl_error_code amber_merge_VISfiles(cpl_frameset * frameset,
- const char * outfile)
-{
-
- const char * argv1=NULL;
- const char * argv2=NULL;
- int extension_OI_VIS=0;
- int counter=0;
- const cpl_frame * cur_frame=NULL;
-
-
-
- cur_frame=cpl_frameset_get_first_const(frameset);
- /*Looping over reduced frames and compare the tables*/
-
- while(cur_frame)
- {
- if(amber_check_tag_oimerge(cur_frame) &&
- amber_check_oiconsistency(cur_frame))
-
- {
-
- extension_OI_VIS=
- cpl_fits_find_extension(cpl_frame_get_filename(cur_frame),
- "OI_VIS");
- //extension_OI_VIS-=1;
-
-
-
- if(counter<1){
- amber_copy_extension(cpl_frame_get_filename(cur_frame),
- outfile, "OI_VIS");
- counter=1;
- }
- else {
-
- argv1=cpl_sprintf("%s+%d", cpl_frame_get_filename(cur_frame),
- extension_OI_VIS);
- argv2=cpl_sprintf("%s+%d", outfile,
- extension_OI_VIS);
- /*
- cpl_msg_info(cpl_func, "argv1: %s",argv1);
- cpl_msg_info(cpl_func, "argv2: %s",argv2);
- */
-
- cfitsio_main_tabmerge(argv1, argv2);
- cpl_free((void *)argv1);
- cpl_free((void *)argv2);
- }
- }
- cur_frame=cpl_frameset_get_next(frameset);
- }
-
- return 0;
-}
-
-
-int cfitsio_main_tabmerge(const char *argv1, const char *argv2)
-{
- fitsfile *infptr, *outfptr; /* FITS file pointers */
- int status = 0; /* CFITSIO status value MUST be initialized to zero! */
- int icol, incols, outcols, intype, outtype, check = 1;
- long inrep, outrep, width, inrows, outrows, ii, jj;
- unsigned char *buffer = 0;
-
- if (0) {
- cpl_msg_info(cpl_func,"Usage: tabmerge infile1[ext][filter] outfile[ext]\n");
- cpl_msg_info(cpl_func,"\n");
- cpl_msg_info(cpl_func,"Merge 2 tables by copying all the rows from the 1st table\n");
- cpl_msg_info(cpl_func,"into the 2nd table. The 2 tables must have identical\n");
- cpl_msg_info(cpl_func,"structure, with the same number of columns with the same\n");
- cpl_msg_info(cpl_func,"datatypes. This program modifies the output file in place,\n");
- cpl_msg_info(cpl_func,"rather than creating a whole new output file.\n");
- cpl_msg_info(cpl_func,"\n");
- cpl_msg_info(cpl_func,"Examples: \n");
- cpl_msg_info(cpl_func,"\n");
- cpl_msg_info(cpl_func,"1. tabmerge intab.fit+1 outtab.fit+2\n");
- cpl_msg_info(cpl_func,"\n");
- cpl_msg_info(cpl_func," merge the table in the 1st extension of intab.fit with\n");
- cpl_msg_info(cpl_func," the table in the 2nd extension of outtab.fit.\n");
- cpl_msg_info(cpl_func,"\n");
- cpl_msg_info(cpl_func,"2. tabmerge 'intab.fit+1[PI > 45]' outab.fits+2\n");
- cpl_msg_info(cpl_func,"\n");
- cpl_msg_info(cpl_func," Same as the 1st example, except only rows that have a PI\n");
- cpl_msg_info(cpl_func," column value > 45 will be merged into the output table.\n");
- cpl_msg_info(cpl_func,"\n");
- return(0);
- }
-
- /* open both input and output files and perform validity checks */
- if ( fits_open_file(&infptr, argv1, READONLY, &status) ||
- fits_open_file(&outfptr, argv2, READWRITE, &status) )
- cpl_msg_info(cpl_func," Couldn't open both files\n");
-
- else if ( fits_get_hdu_type(infptr, &intype, &status) ||
- fits_get_hdu_type(outfptr, &outtype, &status) )
- cpl_msg_info(cpl_func,"couldn't get the type of HDU for the files\n");
-
- else if (intype == IMAGE_HDU)
- cpl_msg_info(cpl_func,"The input HDU is an image, not a table\n");
-
- else if (outtype == IMAGE_HDU)
- cpl_msg_info(cpl_func,"The output HDU is an image, not a table\n");
-
- else if (outtype != intype)
- cpl_msg_info(cpl_func,"Input and output HDUs are not the same type of table.\n");
-
- else if ( fits_get_num_cols(infptr, &incols, &status) ||
- fits_get_num_cols(outfptr, &outcols, &status) )
- cpl_msg_info(cpl_func,"Couldn't get number of columns in the tables\n");
-
- else if ( incols != outcols )
- cpl_msg_info(cpl_func,"Input and output HDUs don't have same # of columns.\n");
-
- else if ( fits_read_key(infptr, TLONG, "NAXIS1", &width, NULL, &status) )
- cpl_msg_info(cpl_func,"Couldn't get width of input table\n");
-
- else if (!(buffer = (unsigned char *) malloc(width)) )
- cpl_msg_info(cpl_func,"memory allocation error\n");
-
- else if ( fits_get_num_rows(infptr, &inrows, &status) ||
- fits_get_num_rows(outfptr, &outrows, &status) )
- cpl_msg_info(cpl_func,"Couldn't get the number of rows in the tables\n");
-
- else {
- /* check that the corresponding columns have the same datatypes */
- for (icol = 1; icol <= incols; icol++) {
- fits_get_coltype(infptr, icol, &intype, &inrep, NULL, &status);
- fits_get_coltype(outfptr, icol, &outtype, &outrep, NULL, &status);
- if (intype != outtype || inrep != outrep) {
- cpl_msg_info(cpl_func,"Column %d is not the same in both tables\n", icol);
- check = 0;
- }
- }
-
- if (check && !status)
- {
- /* insert 'inrows' empty rows at the end of the output table */
- fits_insert_rows(outfptr, outrows, inrows, &status);
-
- for (ii = 1, jj = outrows +1; ii <= inrows; ii++, jj++)
- {
- /* read row from input and write it to the output table */
- fits_read_tblbytes( infptr, ii, 1, width, buffer, &status);
- fits_write_tblbytes(outfptr, jj, 1, width, buffer, &status);
- if (status)break; /* jump out of loop if error occurred */
- }
-
- /* all done; now free memory and close files */
- fits_close_file(outfptr, &status);
- fits_close_file(infptr, &status);
- }
- }
-
- if (buffer)
- free(buffer);
-
- if (status) fits_report_error(stderr, status); /* print any error message */
- return(status);
-}
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief copy/appends an extension of infile to outfile
- @param infile the filename with the extension
- @param outfile the filename to which the extension should be copied
- @param extension_name the name of the extension
- @return 0 if everything is ok
- */
-/*----------------------------------------------------------------------------*/
-
-static int amber_copy_extension(const char * infile , const char * outfile,
- const char * extension_name)
-{
- fitsfile * fptrin=NULL;
- fitsfile * fptrout=NULL;
- int status=0;
-
- fits_open_diskfile(&fptrin, infile, READONLY, &status);
- fits_open_diskfile(&fptrout, outfile, READWRITE, &status);
- fits_movnam_hdu(fptrin, ANY_HDU, (char *)extension_name, 0, &status);
- fits_copy_hdu(fptrin, fptrout, 0, &status);
- fits_close_file(fptrin, &status);
- fits_close_file(fptrout, &status);
-
- if (status != 0){
- cpl_msg_error(cpl_func,
- "A problem occured while copying the EXTENSION: %s",
- extension_name);
- return 1;
- }
- else{
- return 0;
- }
-}
-
-static int amber_check_tag_oimerge(const cpl_frame * cur_frame)
-{
- if(strcmp(cpl_frame_get_tag(cur_frame),
- "SCIENCE_REDUCED")==0 ||
- strcmp(cpl_frame_get_tag(cur_frame),
- "CALIB_REDUCED")==0 ||
- strcmp(cpl_frame_get_tag(cur_frame),
- "SCIENCE_REDUCED_FILTERED")==0 ||
- strcmp(cpl_frame_get_tag(cur_frame),
- "CALIB_REDUCED_FILTERED")==0 ||
- strcmp(cpl_frame_get_tag(cur_frame),
- "AMBER_TRF_J")==0 ||
- strcmp(cpl_frame_get_tag(cur_frame),
- "AMBER_TRF_H")==0 ||
- strcmp(cpl_frame_get_tag(cur_frame),
- "AMBER_TRF_K")==0 ||
- strcmp(cpl_frame_get_tag(cur_frame),
- "SCIENCE_CALIBRATED")==0)
- {
-
- return 1;
- }
- else {
- return 0;
- }
-
-}
-/*----------------------------------------------------------------------------*/
-/**
- @brief checks if all extensions are present in the oifits file
- @param cur_frame frame to be checked for consistency
- @return 1 if everything is ok else 0
- */
-/*----------------------------------------------------------------------------*/
-
-static int amber_check_oiconsistency(const cpl_frame * cur_frame)
-{
-
- if(cpl_fits_find_extension(cpl_frame_get_filename(cur_frame),
- "OI_ARRAY")>0 &&
- cpl_fits_find_extension(cpl_frame_get_filename(cur_frame),
- "OI_WAVELENGTH")>0 &&
- cpl_fits_find_extension(cpl_frame_get_filename(cur_frame),
- "OI_TARGET")>0 &&
- cpl_fits_find_extension(cpl_frame_get_filename(cur_frame),
- "OI_VIS")>0 &&
- cpl_fits_find_extension(cpl_frame_get_filename(cur_frame),
- "OI_VIS2")>0 &&
- /*cpl_fits_find_extension(cpl_frame_get_filename(cur_frame),
- * "OI_T3")>0 &&*/
- cpl_fits_find_extension(cpl_frame_get_filename(cur_frame),
- "AMBER_DATA")>0 &&
- cpl_fits_find_extension(cpl_frame_get_filename(cur_frame),
- "AMBER_SPECTRUM")>0)
- {
-
- return 1;
- }
- else {
- return 0;
- }
-
-}
diff --git a/recipes/amber_p2vm.c b/recipes/amber_p2vm.c
deleted file mode 100644
index c805951..0000000
--- a/recipes/amber_p2vm.c
+++ /dev/null
@@ -1,1771 +0,0 @@
-/* $Id: amber_p2vm.c,v 1.25 2013-09-16 14:56:43 agabasch Exp $
- *
- * This file is part of the AMBER 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: agabasch $
- * $Date: 2013-09-16 14:56:43 $
- * $Revision: 1.25 $
- * $Name: not supported by cvs2svn $
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-/* AMDLIB usage switch */
-#define USE_AMDLIB YES
-
-/*-----------------------------------------------------------------------------
- Includes
- -----------------------------------------------------------------------------*/
-
-#include <math.h>
-#include <cpl.h>
-#include <string.h>
-#include "amdrs.h"
-#include "amdlibProtected.h"
-#include "amber_dfs.h"
-
-/* PAF file and QC log */
-#include "giqclog.h"
-/* #include "giutils.h" */
-
-
-
-/* amdlib structures */
-amdlibERROR_MSG errMsg;
-static amdlibDARK_DATA dark; /* = {NULL}; */
-static amdlibRAW_DATA rawData; /* = {NULL}; */
-amdlibP2VM_INPUT_DATA p2vmData; /* = {NULL}; */
-amdlibP2VM_MATRIX p2vm; /* = {NULL}; */
-amdlibWAVEDATA waveData;
-
-// Offsets after Spectral Calibration
-amdlibDOUBLE off[3]={amdlibOFFSETY_NOT_CALIBRATED,
- amdlibOFFSETY_NOT_CALIBRATED,
- amdlibOFFSETY_NOT_CALIBRATED};
-
-char szFilenameInP2VM[10][1024];
-char szFilenameInWAVE[4][1024];
-
-
-cpl_frame * pframeProduct;
-cpl_parameterlist * gparlist;
-cpl_frameset * gframelist;
-
-/*-----------------------------------------------------------------------------
- Functions prototypes
- -----------------------------------------------------------------------------*/
-
-
-
-static int amber_p2vm_create(cpl_plugin *) ;
-static int amber_p2vm_exec(cpl_plugin *) ;
-static int amber_p2vm_destroy(cpl_plugin *) ;
-static int amber_p2vm(cpl_parameterlist *, cpl_frameset *) ;
-int CreateProduct(const char * fctid, char * szRawFile,
- char * szFilenameProduct, long zeroframes);
-amdlibCOMPL_STAT amdlibComputeP2vm3T_ESO(const char * badPixelFile,
- const char * flatFieldFile,
- const char * biasFile,
- const char * inputFile1,
- const char * inputFile2,
- const char * inputFile3,
- const char * inputFile4,
- const char * inputFile5,
- const char * inputFile6,
- const char * inputFile7,
- const char * inputFile8,
- const char * inputFile9,
- const char * p2vmFile,
- amdlibDOUBLE *newSpectralOffsets,
- const char * fctid);
-amdlibCOMPL_STAT amdlibComputeP2vm2T_ESO(const char * badPixelFile,
- const char * flatFieldFile,
- const char * biasFile,
- const char * inputFile1,
- const char * inputFile2,
- const char * inputFile3,
- const char * inputFile4,
- const char * p2vmFile,
- amdlibDOUBLE *newSpectralOffsets,
- const char * fctid);
-
-
-static long amber_check_zeroframes(cpl_parameterlist * parlist,
- cpl_frameset * framelist);
-
-cpl_error_code amber_p2vm_qc(const char * szFilenameP2VM,
- cpl_propertylist * qclist);
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Append the properties in one list to another
- @param self The PAF propertylist to append to
- @param other The propertylist whose elements are copied or NULL
- @return CPL_ERROR_NONE or the relevant #_cpl_error_code_ on error
-
- If other is NULL or empty nothing happens
-
- Comments are copied as well, but it is (currently) undefined how this works
- for non-unique properties.
-
- In addition the hierarchical keys will be changed according to the PAF rules:
-
- No ESO as first part
- No blank separator but a .
- */
-/*----------------------------------------------------------------------------*/
-static cpl_error_code amber_propertylist_append(cpl_propertylist * self,
- const cpl_propertylist * other)
-{
-
- int i, c;
- char szPAF[2048];
- char szTMP[2048];
-
- if (other == NULL) return CPL_ERROR_NONE;
-
- /*visir_assure_code(self, CPL_ERROR_NULL_INPUT);*/
-
- for (i=0; i < cpl_propertylist_get_size(other); i++)
- {
- const cpl_property * prop = cpl_propertylist_get((cpl_propertylist *)
- other, i);
- const char * name = cpl_property_get_name(prop);
- /*const char * comment = cpl_property_get_comment(prop);*/
-
- cpl_error_code err;
-
- /* Change the key to PAF syntax */
- strcpy( szPAF, name );
-
- /* Get rid of ESO (HAR, what a joke!) */
- if( !strncmp( szPAF, "ESO", 3 ) )
- {
- strcpy( szTMP, &szPAF[4] );
- strcpy( szPAF, szTMP );
- }
-
- /* Substitute spaces by points (YEAH!) */
- for( c=0; c<(int)strlen(szPAF); c++ )
- if( szPAF[c] == ' ' )
- szPAF[c] = '.';
-
- strcpy( (char *)name, szPAF );
-
- /* Append prop to self */
-
- switch (cpl_property_get_type(prop)) {
- case CPL_TYPE_CHAR:
- err = cpl_propertylist_append_char(self, name,
- cpl_property_get_char(prop));
- case CPL_TYPE_BOOL:
- err = cpl_propertylist_append_bool(self, name,
- cpl_property_get_bool(prop));
- break;
- case CPL_TYPE_INT:
- err = cpl_propertylist_append_int(self, name,
- cpl_property_get_int(prop));
- break;
- case CPL_TYPE_LONG:
- err = cpl_propertylist_append_long(self, name,
- cpl_property_get_long(prop));
- break;
- case CPL_TYPE_FLOAT:
- err = cpl_propertylist_append_float(self, name,
- cpl_property_get_float(prop));
- break;
- case CPL_TYPE_DOUBLE:
- err = cpl_propertylist_append_double(self, name,
- cpl_property_get_double(prop));
- break;
- case CPL_TYPE_STRING:
- err = cpl_propertylist_append_string(self, name,
- cpl_property_get_string(prop));
- break;
-
- /* Avoid compiler warnings but do nothing */
- case CPL_TYPE_FLAG_ARRAY:
- case CPL_TYPE_INVALID:
- case CPL_TYPE_UCHAR:
- case CPL_TYPE_UINT:
- case CPL_TYPE_ULONG:
- case CPL_TYPE_POINTER:
- case CPL_TYPE_FLOAT_COMPLEX:
- case CPL_TYPE_DOUBLE_COMPLEX:
- case CPL_TYPE_UNSPECIFIED:
-#if defined CPL_VERSION_CODE && CPL_VERSION_CODE >= CPL_VERSION(5, 2, 0)
- case CPL_TYPE_COMPLEX:
-#endif
- /*case CPL_TYPE_COMPLEX: not anymode in CPL 3.0 */
- break;
- /*default:
- visir_assure_code(0, CPL_ERROR_UNSUPPORTED_MODE);*/
- }
-
- /*visir_assure_code(!err, err);
-
- if (comment && cpl_propertylist_set_comment(self, name, comment))
- visir_assure_code(0, cpl_error_get_code());*/
- }
-
- return CPL_ERROR_NONE;
-}
-
-int CreateProduct(const char * fctid, char * szRawFile,
- char * szFilenameProduct, long zeroframes)
-{
- int iStatus = 0;
- char szMessage[1024];
-
- cpl_propertylist * pHeader;
- /*
- cpl_table * pTable=NULL;
- cpl_propertylist * pTableHeader=NULL;
- int iTable=1;
- int iError=CPL_ERROR_NONE;
- */
-
- /* For DFS fill Header function later */;
- /* pHeader = cpl_propertylist_new(); */
- /*pFrame = cpl_frame_new();*/
-
- pframeProduct = cpl_frame_new();
-
- if( pframeProduct )
- {
- cpl_frame_set_filename( pframeProduct, szFilenameProduct );
- cpl_frame_set_type( pframeProduct, CPL_FRAME_TYPE_TABLE );
- cpl_frame_set_tag( pframeProduct, "P2VM_REDUCED" );
- cpl_frame_set_group( pframeProduct, CPL_FRAME_GROUP_PRODUCT );
- cpl_frame_set_level( pframeProduct, CPL_FRAME_LEVEL_INTERMEDIATE );
- }
- else
- {
- cpl_msg_info( fctid, "No memory for product frame." );
- iStatus = 15;
- }
-
- /*
- * Create the Product file, start with filling the header
- *
- * Attention: for the time of this workaround for cpl 3D tables the amdlib
- * must be patched to NOT create OWN files, but APPEND to existing ones!!
- *
- * see comment below
- *
- */
-
-
- /*
- * Workaround for cpl_dfs_setup_product_header picking the wrong Header in
- * this CPL release and also might pick the wrong in the future! It uses the
- * first RAW frame, but this recipe can handle many raw frames. Hence:
- *
- * Read the Header of the RAW file to be written as a product and send it to
- * the function
- */
- pHeader = cpl_propertylist_load( szRawFile, 0 );
-
-
- sprintf( szMessage, "Extracting Header from file %s.", szRawFile );
- cpl_msg_info( fctid, "%s", szMessage );
-
-
-
-
-
-
-
-
-
- /* Add the necessary DFS fits header information to the product */
-#if defined CPL_VERSION_CODE && CPL_VERSION_CODE >= CPL_VERSION(4, 8, 0)
- if( cpl_dfs_setup_product_header( pHeader,
- pframeProduct, /*pFrame,*/
- gframelist,
- gparlist,
- "amber_p2vm", /* const char * recid, */
- PACKAGE "/" PACKAGE_VERSION, /* const char * pipeline_id, */
- PRODUCT_DID, /* const char * dictionary_id */
- NULL
- ) != CPL_ERROR_NONE )
- {
- /* Error */
- sprintf( szMessage, "Error in setting up the product header." );
- cpl_msg_info( fctid, "%s", szMessage );
- cpl_msg_error(cpl_func,"Error in cpl_dfs_setup_product_header: %s %s",
- cpl_error_get_message(),cpl_error_get_where());
- iStatus = 16;
- }
-#else
- if( cpl_dfs_setup_product_header( pHeader,
- pframeProduct, /*pFrame,*/
- gframelist,
- gparlist,
- "amber_p2vm", /* const char * recid, */
- PACKAGE "/" PACKAGE_VERSION, /* const char * pipeline_id, */
- PRODUCT_DID /* const char * dictionary_id */
- ) != CPL_ERROR_NONE )
- {
- /* Error */
- sprintf( szMessage, "Error in setting up the product header." );
- cpl_msg_info( fctid, "%s", szMessage );
- cpl_msg_error(cpl_func,"Error in cpl_dfs_setup_product_header: %s %s",
- cpl_error_get_message(),cpl_error_get_where());
- iStatus = 16;
- }
-
-#endif
-
-
- /* Write the product including proper DFS header*/
- /*
- cpl_table * pTable=NULL;
- cpl_propertylist * pTableHeader=NULL;
- int iTable=1;
- int iError=CPL_ERROR_NONE;
-
- pTable = NULL;
- pTableHeader = NULL;
- iTable = 1;
- iError = CPL_ERROR_NONE;
- */
-
- sprintf( szMessage, "Creating Product %s...", szFilenameProduct );
- cpl_msg_info( fctid, "%s", szMessage );
-
- /*
- * Workaround:
- * CPL cannot handle 3D-tables, hence, write just the header to a fits file
- * and let the amdlibWriteOI just append the data (and not create a whole
- * file as intended by amdlib design see Module amdlibWriteOI.c
- */
- /* FILE * pFITSFile = NULL;*/
-
- /*----------------------------------------------------------------*/
- /* Update the Spectral Calibration to header DET.P1.OFFSETY a.s.o */
-
- /*In case it has not been calculated then take it from the DET1 P1 OFFSETY*/
- if( off[0] != amdlibOFFSETY_NOT_CALIBRATED )
- {
- cpl_propertylist_update_double( pHeader, "ESO DET1 P1 OFFSETY", off[0]);
- cpl_propertylist_update_double( pHeader, "ESO DET1 P2 OFFSETY", off[1]);
- cpl_propertylist_update_double( pHeader, "ESO DET1 P3 OFFSETY", off[2]);
- }
- else
- {
- off[0] = cpl_propertylist_get_double( pHeader, "ESO DET1 P1 OFFSETY" );
- off[1] = cpl_propertylist_get_double( pHeader, "ESO DET1 P2 OFFSETY" );
- off[2] = cpl_propertylist_get_double( pHeader, "ESO DET1 P3 OFFSETY" );
- }
-
- cpl_propertylist_append_double( pHeader, "ESO QC P1 OFFSETY", off[0] );
- cpl_propertylist_append_double( pHeader, "ESO QC P2 OFFSETY", off[1] );
- cpl_propertylist_append_double( pHeader, "ESO QC P3 OFFSETY", off[2] );
-
- cpl_propertylist_append_long( pHeader, "ESO QC ZEROFRAMES", zeroframes );
-
- /*Adding the JMMC acknowledgements*/
- amber_JMMC_acknowledgement(pHeader);
-
-
- sprintf( szMessage, "Writing Product Header..." );
- cpl_msg_info( fctid, "%s", szMessage );
-
- iStatus = 0;
- if (CPL_ERROR_NONE != cpl_image_save(NULL, szFilenameProduct,
- CPL_BPP_16_SIGNED, pHeader, CPL_IO_DEFAULT ))
- {
- cpl_msg_error(cpl_func,"Error in cpl_image_save");
- iStatus = 666;
- }
-
- cpl_propertylist_delete(pHeader);
-
-
-
- return iStatus;
-}
-
-amdlibCOMPL_STAT amdlibComputeP2vm3T_ESO(const char * badPixelFile,
- const char * flatFieldFile,
- const char * biasFile,
- const char * inputFile1,
- const char * inputFile2,
- const char * inputFile3,
- const char * inputFile4,
- const char * inputFile5,
- const char * inputFile6,
- const char * inputFile7,
- const char * inputFile8,
- const char * inputFile9,
- const char * p2vmFile,
- amdlibDOUBLE *newSpectralOffsets,
- const char * fctid)
-{
-
- char szMessage[1024];
- const char * inputFiles[10];
- int i;
- amdlibBOOLEAN waveDataLoaded = amdlibFALSE;
-
- /* Init list of input files */
- inputFiles[0] = biasFile;
- inputFiles[1] = inputFile1;
- inputFiles[2] = inputFile2;
- inputFiles[3] = inputFile3;
- inputFiles[4] = inputFile4;
- inputFiles[5] = inputFile5;
- inputFiles[6] = inputFile6;
- inputFiles[7] = inputFile7;
- inputFiles[8] = inputFile8;
- inputFiles[9] = inputFile9;
-
- /* If a bad pixel file has been specified */
- sprintf( szMessage, "Loading BAD PIXEL MAP %s ...", badPixelFile );
- cpl_msg_info( fctid, "%s", szMessage );
- if ((badPixelFile != NULL) && (strlen(badPixelFile) != 0))
- {
- /* Load it */
- if( amdlibLoadBadPixelMap(badPixelFile, errMsg) != amdlibSUCCESS)
- {
- printf ("Could not load bad pixel map '%s'\n", badPixelFile);
- printf ("%s\n", errMsg);
- return (amdlibFAILURE);
- }
- }
-
- /* Load flat field map */
- sprintf( szMessage, "Loading FLAT FIELD %s ...", flatFieldFile );
- cpl_msg_info( fctid, "%s", szMessage );
-
- if( (flatFieldFile != NULL) && (strlen(flatFieldFile) != 0))
- {
- if( amdlibLoadFlatFieldMap( flatFieldFile, errMsg) != amdlibSUCCESS)
- {
- printf ("Could not load Flat Field map '%s'\n", flatFieldFile);
- printf ("%s\n", errMsg);
- return (amdlibFAILURE);
- }
- }
-
- /* Check P2VM file name */
- if ((p2vmFile == NULL) || (strlen(p2vmFile) == 0))
- {
- printf ("Invalid name for P2VM file\n");
- return (amdlibFAILURE);
- }
-
-
-
- /* For each input files */
- for (i = 0; i < 10; i++)
- {
- if ((inputFiles[i] == NULL) || (strlen(inputFiles[i]) == 0))
- {
- printf ("Invalid name for %dth input file\n", i+1);
- return (amdlibFAILURE);
- }
-
- /* Load raw data */
- sprintf( szMessage, "Loading P2VM file %s ...", inputFiles[i] );
- cpl_msg_info( fctid, "%s", szMessage );
- if (amdlibLoadRawData(inputFiles[i], &rawData, errMsg) != amdlibSUCCESS)
- {
- printf ("Could not load raw data file '%s'\n", inputFiles[i]);
- printf ("%s\n", errMsg);
- amdlibReleaseRawData(&rawData);
- return (amdlibFAILURE);
- }
-
- if (rawData.frameType == amdlibUNKNOWN_FRAME)
- {
- printf ("Invalid frame type '%d'\n", amdlibUNKNOWN_FRAME);
- amdlibReleaseRawData(&rawData);
- return (amdlibFAILURE);
- }
- else if (rawData.frameType == amdlibDARK_FRAME)
- {
- sprintf( szMessage, "Computing Pixel Bias Map for P2VM file %s ...",
- inputFiles[i] );
- cpl_msg_info( fctid, "%s", szMessage );
-
- /* Compute pixel bias map */
- if (amdlibGenerateDarkData(&rawData, &dark, errMsg)
- != amdlibSUCCESS)
- {
- printf ("Could not generate pixel bias map\n");
- amdlibReleaseDarkData(&dark);
- amdlibReleaseRawData(&rawData);
- return (amdlibFAILURE);
- }
- }
- else
- {
- int p;
-
- sprintf( szMessage, "Equalizing P2VM file %s ...", inputFiles[i] );
- cpl_msg_info( fctid, "%s", szMessage );
-
- /* Equalize raw data */
- if( amdlibCalibrateRawData( &dark, &rawData, errMsg)
- !=amdlibSUCCESS)
- {
- printf ("%s\n", errMsg);
- amdlibReleaseDarkData(&dark);
- amdlibReleaseRawData(&rawData);
- return (amdlibFAILURE);
- }
-
- /* Test if some pixel is saturated */
- if (rawData.dataIsSaturated)
- {
- sprintf( szMessage, "Data in file %s is saturated!",
- inputFiles[i] );
- cpl_msg_info( fctid, "%s", szMessage );
- }
-
- /* Get wave data from the first given file ??? check this -
- * see declaration above !!! */
- if( waveDataLoaded == amdlibFALSE )
- {
- if( amdlibGetWaveDataFromRawData( &rawData, &waveData, errMsg)
- == amdlibFAILURE)
- {
- printf ("%s\n", errMsg);
- amdlibReleaseDarkData(&dark);
- amdlibReleaseRawData(&rawData);
- amdlibReleaseP2vmData(&p2vmData);
- return (amdlibFAILURE);
- }
-
- /* And set new offsets (if given) */
- for (p = 0; p < 3; p++)
- {
- if (newSpectralOffsets[p] != amdlibOFFSETY_NOT_CALIBRATED)
- {
- waveData.photoOffset[p] = newSpectralOffsets[p];
- }
- }
-
- sprintf( szMessage, "Set new spectral Calibration." );
- cpl_msg_info( fctid, "%s", szMessage );
-
- waveDataLoaded = amdlibTRUE;
- }
-
- /* Store calibrated data into P2VM data structure */
- sprintf( szMessage, "Adding P2VM file %s ...", inputFiles[i] );
- cpl_msg_info( fctid, "%s", szMessage );
- if( amdlibAddToP2vmData( &rawData, &waveData, &p2vmData, errMsg)
- != amdlibSUCCESS)
- {
- printf ("%s\n", errMsg);
- amdlibReleaseDarkData(&dark);
- amdlibReleaseRawData(&rawData);
- amdlibReleaseP2vmData(&p2vmData);
- return (amdlibFAILURE);
- }
- }
- amdlibReleaseRawData(&rawData);
- }
- /* End for */
-
- amdlibReleaseDarkData(&dark);
-
-
- /* Compute P2VM */
- sprintf( szMessage, "Computing P2VM ..." );
- cpl_msg_info( fctid, "%s", szMessage );
-
- if( amdlibComputeP2VM( &p2vmData, amdlibP2VM_3T, &waveData, &p2vm, errMsg)
- == amdlibFAILURE)
- {
- printf ("%s\n", errMsg);
- amdlibReleaseP2vmData(&p2vmData);
- amdlibReleaseP2VM(&p2vm);
- return (amdlibFAILURE);
- }
-
- amdlibReleaseP2vmData(&p2vmData);
-
- sprintf( szMessage, "Saving P2VM %s...", p2vmFile );
- cpl_msg_info( fctid, "%s", szMessage );
-
- if( amdlibSaveP2VM( p2vmFile, &p2vm, amdlibP2VM_UNKNOWN_ACC, errMsg)
- == amdlibFAILURE )
- {
- printf ("%s\n", errMsg);
- amdlibReleaseP2VM(&p2vm);
- return (amdlibFAILURE);
- }
-
- amdlibReleaseP2VM(&p2vm);
-
-
- return (amdlibSUCCESS);
-}
-
-amdlibCOMPL_STAT amdlibComputeP2vm2T_ESO(const char * badPixelFile,
- const char * flatFieldFile,
- const char * biasFile,
- const char * inputFile1,
- const char * inputFile2,
- const char * inputFile3,
- const char * inputFile4,
- const char * p2vmFile,
- amdlibDOUBLE *newSpectralOffsets,
- const char * fctid)
-{
-
- char szMessage[1024];
- const char * inputFiles[10];
- int i;
- amdlibBOOLEAN waveDataLoaded = amdlibFALSE;
-
- /* Init list of input files */
- inputFiles[0] = biasFile;
- inputFiles[1] = inputFile1;
- inputFiles[2] = inputFile2;
- inputFiles[3] = inputFile3;
- inputFiles[4] = inputFile4;
-
-
- /* If a bad pixel file has been specified */
- sprintf( szMessage, "Loading BAD PIXEL MAP %s ...", badPixelFile );
- cpl_msg_info( fctid, "%s", szMessage );
- if ((badPixelFile != NULL) && (strlen(badPixelFile) != 0))
- {
- /* Load it */
- if( amdlibLoadBadPixelMap(badPixelFile, errMsg) != amdlibSUCCESS)
- {
- printf ("Could not load bad pixel map '%s'\n", badPixelFile);
- printf ("%s\n", errMsg);
- return (amdlibFAILURE);
- }
- }
-
- /* Load flat field map */
- sprintf( szMessage, "Loading FLAT FIELD %s ...", flatFieldFile );
- cpl_msg_info( fctid, "%s", szMessage );
-
- if( (flatFieldFile != NULL) && (strlen(flatFieldFile) != 0))
- {
- if( amdlibLoadFlatFieldMap( flatFieldFile, errMsg) != amdlibSUCCESS)
- {
- printf ("Could not load Flat Field map '%s'\n", flatFieldFile);
- printf ("%s\n", errMsg);
- return (amdlibFAILURE);
- }
- }
-
- /* Check P2VM file name */
- if ((p2vmFile == NULL) || (strlen(p2vmFile) == 0))
- {
- printf ("Invalid name for P2VM file\n");
- return (amdlibFAILURE);
- }
-
-
-
- /* For each input files */
- for (i = 0; i < 5; i++)
- {
- if ((inputFiles[i] == NULL) || (strlen(inputFiles[i]) == 0))
- {
- printf ("Invalid name for %dth input file\n", i+1);
- return (amdlibFAILURE);
- }
-
- /* Load raw data */
- sprintf( szMessage, "Loading P2VM file %s ...", inputFiles[i] );
- cpl_msg_info( fctid, "%s", szMessage );
- if (amdlibLoadRawData(inputFiles[i], &rawData, errMsg) != amdlibSUCCESS)
- {
- printf ("Could not load raw data file '%s'\n", inputFiles[i]);
- printf ("%s\n", errMsg);
- amdlibReleaseRawData(&rawData);
- return (amdlibFAILURE);
- }
-
- if (rawData.frameType == amdlibUNKNOWN_FRAME)
- {
- printf ("Invalid frame type '%d'\n", amdlibUNKNOWN_FRAME);
- amdlibReleaseRawData(&rawData);
- return (amdlibFAILURE);
- }
- else if (rawData.frameType == amdlibDARK_FRAME)
- {
- sprintf( szMessage, "Computing Pixel Bias Map for P2VM file %s ...",
- inputFiles[i] );
- cpl_msg_info( fctid, "%s", szMessage );
-
- /* Compute pixel bias map */
- if (amdlibGenerateDarkData(&rawData, &dark, errMsg)
- != amdlibSUCCESS)
- {
- printf ("Could not generate pixel bias map\n");
- amdlibReleaseDarkData(&dark);
- amdlibReleaseRawData(&rawData);
- return (amdlibFAILURE);
- }
- }
- else
- {
- int p;
-
- sprintf( szMessage, "Equalizing P2VM file %s ...", inputFiles[i] );
- cpl_msg_info( fctid, "%s", szMessage );
-
- /* Equalize raw data */
- if( amdlibCalibrateRawData( &dark, &rawData, errMsg)
- !=amdlibSUCCESS)
- {
- printf ("%s\n", errMsg);
- amdlibReleaseDarkData(&dark);
- amdlibReleaseRawData(&rawData);
- return (amdlibFAILURE);
- }
-
- /* Test if some pixel is saturated */
- if (rawData.dataIsSaturated)
- {
- sprintf( szMessage, "Data in file %s is saturated!",
- inputFiles[i] );
- cpl_msg_info( fctid, "%s", szMessage );
- }
-
- /* Get wave data from the first given file ??? check this
- * - see declaration above !!! */
- if( waveDataLoaded == amdlibFALSE )
- {
- if( amdlibGetWaveDataFromRawData( &rawData, &waveData, errMsg)
- == amdlibFAILURE)
- {
- printf ("%s\n", errMsg);
- amdlibReleaseDarkData(&dark);
- amdlibReleaseRawData(&rawData);
- amdlibReleaseP2vmData(&p2vmData);
- return (amdlibFAILURE);
- }
-
- /* And set new offsets (if given) */
- for (p = 0; p < 3; p++)
- {
- if (newSpectralOffsets[p] != amdlibOFFSETY_NOT_CALIBRATED)
- {
- waveData.photoOffset[p] = newSpectralOffsets[p];
- }
- }
-
- sprintf( szMessage, "Set new spectral Calibration." );
- cpl_msg_info( fctid, "%s", szMessage );
-
- waveDataLoaded = amdlibTRUE;
- }
-
- /* Store calibrated data into P2VM data structure */
- sprintf( szMessage, "Adding P2VM file %s ...", inputFiles[i] );
- cpl_msg_info( fctid, "%s", szMessage );
- if( amdlibAddToP2vmData( &rawData, &waveData, &p2vmData, errMsg)
- != amdlibSUCCESS)
- {
- printf ("%s\n", errMsg);
- amdlibReleaseDarkData(&dark);
- amdlibReleaseRawData(&rawData);
- amdlibReleaseP2vmData(&p2vmData);
- return (amdlibFAILURE);
- }
- }
- amdlibReleaseRawData(&rawData);
- }
- /* End for */
-
- amdlibReleaseDarkData(&dark);
-
-
- /* Compute P2VM */
- sprintf( szMessage, "Computing P2VM ..." );
- cpl_msg_info( fctid, "%s", szMessage );
-
- if( amdlibComputeP2VM( &p2vmData, amdlibP2VM_2T, &waveData, &p2vm, errMsg)
- == amdlibFAILURE)
- {
- printf ("%s\n", errMsg);
- amdlibReleaseP2vmData(&p2vmData);
- amdlibReleaseP2VM(&p2vm);
- return (amdlibFAILURE);
- }
-
- amdlibReleaseP2vmData(&p2vmData);
-
- sprintf( szMessage, "Saving P2VM %s...", p2vmFile );
- cpl_msg_info( fctid, "%s", szMessage );
-
- if( amdlibSaveP2VM( p2vmFile, &p2vm, amdlibP2VM_UNKNOWN_ACC, errMsg)
- == amdlibFAILURE )
- {
- printf ("%s\n", errMsg);
- amdlibReleaseP2VM(&p2vm);
- return (amdlibFAILURE);
- }
-
- amdlibReleaseP2VM(&p2vm);
-
-
- return (amdlibSUCCESS);
-}
-
-
-
-/*-----------------------------------------------------------------------------
- Static variables
- -----------------------------------------------------------------------------*/
-
-/*
-static struct {
- Inputs
- int bool_option ;
- char str_option[512] ;
-
- Outputs
- double qc_param ;
-} amber_p2vm_config ;
- */
-
-static char amber_p2vm_man[] =
- "This recipe creates a Pixel-To-Visibility-Matrix "
- "for 2- and 3-Telescopes Mode\n"
- "\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,
- AMBER_BINARY_VERSION,
- CPL_PLUGIN_TYPE_RECIPE,
- "amber_p2vm",
- "AMBER Pixel-To-Visibility-Matrix for 2- and 3-Telescopes Mode",
- amber_p2vm_man,
- "Tom Licha",
- PACKAGE_BUGREPORT,
- "GPL",
- amber_p2vm_create,
- amber_p2vm_exec,
- amber_p2vm_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 amber_p2vm_create(cpl_plugin * plugin)
-{
- cpl_recipe * recipe = (cpl_recipe *)plugin ;
- 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();
-
-
- // p = cpl_parameter_new_value("amber.amber_p2vm.activate_BEAUTIFY_PISTON", CPL_TYPE_BOOL, "TBD", "amber.amber_p2vm",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_BEAUTIFY_PISTON");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.activate_CHISQUARE_LIMIT", CPL_TYPE_BOOL, "TBD", "amber.amber_p2vm",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_CHISQUARE_LIMIT");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.activate_MAX_PISTON_ERROR", CPL_TYPE_BOOL, "TBD", "amber.amber_p2vm",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_MAX_PISTON_ERROR");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.activate_SHIFT_WLENTABLE", CPL_TYPE_BOOL, "TBD", "amber.amber_p2vm",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_SHIFT_WLENTABLE");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.activate_MIN_PHOTOMETRY", CPL_TYPE_BOOL, "TBD", "amber.amber_p2vm",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_MIN_PHOTOMETRY");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.activate_CORRECT_OPD0", CPL_TYPE_BOOL, "TBD", "amber.amber_p2vm",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_CORRECT_OPD0");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.activate_LINEARIZE_P2VM_PHASE", CPL_TYPE_BOOL, "TBD", "amber.amber_p2vm",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_LINEARIZE_P2VM_PHASE");
- // cpl_parameterlist_append(recipe->parameters, p);
-
- p = cpl_parameter_new_value("amber.amber_p2vm.activate_NORMALIZE_P2VM", CPL_TYPE_BOOL, "TBD", "amber.amber_p2vm",TRUE);
- cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_NORMALIZE_P2VM");
- cpl_parameterlist_append(recipe->parameters, p);
-
- // p = cpl_parameter_new_value("amber.amber_p2vm.activate_NO_FUDGE", CPL_TYPE_BOOL, "TBD", "amber.amber_p2vm",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_NO_FUDGE");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.activate_NO_BIAS", CPL_TYPE_BOOL, "TBD", "amber.amber_p2vm",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_NO_BIAS");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.activate_DROP", CPL_TYPE_BOOL, "TBD", "amber.amber_p2vm",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_DROP");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.activate_NORMALIZE_SPECTRUM", CPL_TYPE_BOOL, "TBD", "amber.amber_p2vm",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_NORMALIZE_SPECTRUM");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.activate_BOXCARSMOOTH_P2VM_PHASE", CPL_TYPE_BOOL, "TBD", "amber.amber_p2vm",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_BOXCARSMOOTH_P2VM_PHASE");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.activate_GAUSSSMOOTH_P2VM_PHASE", CPL_TYPE_BOOL, "TBD", "amber.amber_p2vm",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_GAUSSSMOOTH_P2VM_PHASE");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.activate_AUTO_BADPIXEL", CPL_TYPE_BOOL, "TBD", "amber.amber_p2vm",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_AUTO_BADPIXEL");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.activate_MAX_PISTON_EXCURSION", CPL_TYPE_BOOL, "TBD", "amber.amber_p2vm",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_MAX_PISTON_EXCURSION");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.activate_GLOBAL_PHOTOMETRY", CPL_TYPE_BOOL, "TBD", "amber.amber_p2vm",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_GLOBAL_PHOTOMETRY");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.activate_USE_GAIN", CPL_TYPE_BOOL, "TBD", "amber.amber_p2vm",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_USE_GAIN");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.activate_ZAP_JHK_DISCONTINUTIES", CPL_TYPE_BOOL, "TBD", "amber.amber_p2vm",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_ZAP_JHK_DISCONTINUTIES");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.activate_AUTO_SHIFT_JHK", CPL_TYPE_BOOL, "TBD", "amber.amber_p2vm",FALSE);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"activate_AUTO_SHIFT_JHK");
- // cpl_parameterlist_append(recipe->parameters, p);
-
-
- // p = cpl_parameter_new_value("amber.amber_p2vm.value_BEAUTIFY_PISTON", CPL_TYPE_DOUBLE, "TBD", "amber.amber_p2vm",1.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_BEAUTIFY_PISTON");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.value_CHISQUARE_LIMIT", CPL_TYPE_DOUBLE, "TBD", "amber.amber_p2vm",0.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_CHISQUARE_LIMIT");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.value_MAX_PISTON_ERROR", CPL_TYPE_DOUBLE, "TBD", "amber.amber_p2vm",0.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_MAX_PISTON_ERROR");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.value_SHIFT_WLENTABLE", CPL_TYPE_DOUBLE, "TBD", "amber.amber_p2vm",0.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_SHIFT_WLENTABLE");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.value_MIN_PHOTOMETRY", CPL_TYPE_DOUBLE, "TBD", "amber.amber_p2vm",0.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_MIN_PHOTOMETRY");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.value_CORRECT_OPD0", CPL_TYPE_DOUBLE, "TBD", "amber.amber_p2vm",0.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_CORRECT_OPD0");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.value_LINEARIZE_P2VM_PHASE", CPL_TYPE_DOUBLE, "TBD", "amber.amber_p2vm",1.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_LINEARIZE_P2VM_PHASE");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.value_NORMALIZE_P2VM", CPL_TYPE_DOUBLE, "TBD", "amber.amber_p2vm",1.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_NORMALIZE_P2VM");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.value_NO_FUDGE", CPL_TYPE_DOUBLE, "TBD", "amber.amber_p2vm",1.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_NO_FUDGE");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.value_NO_BIAS", CPL_TYPE_DOUBLE, "TBD", "amber.amber_p2vm",1.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_NO_BIAS");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.value_DROP", CPL_TYPE_DOUBLE, "TBD", "amber.amber_p2vm",0.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_DROP");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.value_NORMALIZE_SPECTRUM", CPL_TYPE_DOUBLE, "TBD", "amber.amber_p2vm",1.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_NORMALIZE_SPECTRUM");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.value_BOXCARSMOOTH_P2VM_PHASE", CPL_TYPE_DOUBLE, "TBD", "amber.amber_p2vm",0.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_BOXCARSMOOTH_P2VM_PHASE");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.value_GAUSSSMOOTH_P2VM_PHASE", CPL_TYPE_DOUBLE, "TBD", "amber.amber_p2vm",0.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_GAUSSSMOOTH_P2VM_PHASE");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.value_AUTO_BADPIXEL", CPL_TYPE_DOUBLE, "TBD", "amber.amber_p2vm",1.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_AUTO_BADPIXEL");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.value_MAX_PISTON_EXCURSION", CPL_TYPE_DOUBLE, "TBD", "amber.amber_p2vm",0.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_MAX_PISTON_EXCURSION");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.value_GLOBAL_PHOTOMETRY", CPL_TYPE_DOUBLE, "TBD", "amber.amber_p2vm",1.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_GLOBAL_PHOTOMETRY");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.value_USE_GAIN", CPL_TYPE_DOUBLE, "TBD", "amber.amber_p2vm",0.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_USE_GAIN");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.value_ZAP_JHK_DISCONTINUTIES", CPL_TYPE_DOUBLE, "TBD", "amber.amber_p2vm",1.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_ZAP_JHK_DISCONTINUTIES");
- // cpl_parameterlist_append(recipe->parameters, p);
- // p = cpl_parameter_new_value("amber.amber_p2vm.value_AUTO_SHIFT_JHK", CPL_TYPE_DOUBLE, "TBD", "amber.amber_p2vm",1.0);
- // cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"value_AUTO_SHIFT_JHK");
- // cpl_parameterlist_append(recipe->parameters, p);
-
-
- return 0;
-}
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Execute the plugin instance given by the interface
- @param plugin the plugin
- @return 0 if everything is ok
- */
-/*----------------------------------------------------------------------------*/
-static int amber_p2vm_exec(cpl_plugin * plugin)
-{
- /*char szMessage[1024]; */
-
- cpl_recipe * recipe = (cpl_recipe *)plugin ;
-
- /*sprintf( szMessage, "Now calling recipe at [%d] with Frames [%d] and
- * Parameters [%x].", recipe, recipe->frames, recipe->parameters );
- cpl_msg_info("amber_p2vm_exec", szMessage );*/
-
- return amber_p2vm(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 amber_p2vm_destroy(cpl_plugin * plugin)
-{
- cpl_recipe * recipe = (cpl_recipe *)plugin ;
- 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 amber_p2vm(
- cpl_parameterlist * parlist,
- cpl_frameset * framelist)
-{
-
-
- /* CPL structures */
- cpl_frameset * cur_set;
- cpl_frame * cur_frame;
-
- /* FILE * fpWave;*/
- long zeroframes = 0;
- char szMessage[1024];
- /* char szBuffer[1024];*/
- char szFilenameP2VM[1024];
- char szFilenameWave[1024];
- char szCommandline[2048];
- char * pszFilename;
- char * pszFileTag;
- const char * pszARCFILE;
-
- int iStatus = 0;
-
- int i2TelFrames = 0;
- int i3TelFrames = 0;
- int iWriteQC = 0;
-
- char szFilenameBadPix[1024];
- char szFilenameFlat[1024];
- const char * fctid = "amber_p2vm";
- //FILE * fp = NULL;
- /* int s, iPhot;*/
- cpl_errorstate prestate=0;
- cpl_propertylist * applist=NULL;
-
- amdlibDOUBLE spectralOffsets[3]= {amdlibOFFSETY_NOT_CALIBRATED,
- amdlibOFFSETY_NOT_CALIBRATED,
- amdlibOFFSETY_NOT_CALIBRATED};
- AmPaf * qc = NULL;
- cpl_propertylist * qclog = NULL;
- cpl_propertylist * qcFromProduct = NULL;
- cpl_propertylist * qcFromRawfile = NULL;
-
-
- /*Activate and deactivate amdlib parameters here*/
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_p2vm.activate_BEAUTIFY_PISTON"))) {amdlibSetUserPref(amdlibBEAUTIFY_PISTON, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_p2vm.value_BEAUTIFY_PISTON")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_p2vm.activate_CHISQUARE_LIMIT"))) {amdlibSetUserPref(amdlibCHISQUARE_LIMIT, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_p2vm.value_CHISQUARE_LIMIT")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_p2vm.activate_SHIFT_WLENTABLE"))) {amdlibSetUserPref(amdlibSHIFT_WLENTABLE, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_p2vm.value_SHIFT_WLENTABLE")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_p2vm.activate_MIN_PHOTOMETRY"))) {amdlibSetUserPref(amdlibMIN_PHOTOMETRY, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_p2vm.value_MIN_PHOTOMETRY")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_p2vm.activate_CORRECT_OPD0"))) {amdlibSetUserPref(amdlibCORRECT_OPD0, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_p2vm.value_CORRECT_OPD0")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_p2vm.activate_LINEARIZE_P2VM_PHASE"))) {amdlibSetUserPref(amdlibLINEARIZE_P2VM_PHASE, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_p2vm.value_LINEARIZE_P2VM_PHASE")));}
-
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_p2vm.activate_NORMALIZE_P2VM"))) {amdlibSetUserPref(amdlibNORMALIZE_P2VM, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_p2vm.value_NORMALIZE_P2VM")));}
- if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_p2vm.activate_NORMALIZE_P2VM"))) {amdlibSetUserPref(amdlibNORMALIZE_P2VM, 1.0);}
-
-
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_p2vm.activate_NO_FUDGE"))) {amdlibSetUserPref(amdlibNO_FUDGE, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_p2vm.value_NO_FUDGE")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_p2vm.activate_NO_BIAS"))) {amdlibSetUserPref(amdlibNO_BIAS, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_p2vm.value_NO_BIAS")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_p2vm.activate_DROP"))) {amdlibSetUserPref(amdlibDROP, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_p2vm.value_DROP")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_p2vm.activate_NORMALIZE_SPECTRUM"))) {amdlibSetUserPref(amdlibNORMALIZE_SPECTRUM, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_p2vm.value_NORMALIZE_SPECTRUM")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_p2vm.activate_BOXCARSMOOTH_P2VM_PHASE"))) {amdlibSetUserPref(amdlibBOXCARSMOOTH_P2VM_PHASE, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_p2vm.value_BOXCARSMOOTH_P2VM_PHASE")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_p2vm.activate_GAUSSSMOOTH_P2VM_PHASE"))) {amdlibSetUserPref(amdlibGAUSSSMOOTH_P2VM_PHASE, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_p2vm.value_GAUSSSMOOTH_P2VM_PHASE")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_p2vm.activate_AUTO_BADPIXEL"))) {amdlibSetUserPref(amdlibAUTO_BADPIXEL, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_p2vm.value_AUTO_BADPIXEL")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_p2vm.activate_GLOBAL_PHOTOMETRY"))) {amdlibSetUserPref(amdlibGLOBAL_PHOTOMETRY, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_p2vm.value_GLOBAL_PHOTOMETRY")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_p2vm.activate_USE_GAIN"))) {amdlibSetUserPref(amdlibUSE_GAIN, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_p2vm.value_USE_GAIN")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_p2vm.activate_ZAP_JHK_DISCONTINUTIES"))) {amdlibSetUserPref(amdlibZAP_JHK_DISCONTINUTIES, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_p2vm.value_ZAP_JHK_DISCONTINUTIES")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_p2vm.activate_AUTO_SHIFT_JHK"))) {amdlibSetUserPref(amdlibAUTO_SHIFT_JHK, cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_p2vm.value_AUTO_SHIFT_JHK")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_p2vm.activate_MAX_PISTON_ERROR"))) {amdlibSetUserPref(amdlibMAX_PISTON_ERROR, 1000*cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_p2vm.value_MAX_PISTON_ERROR")));}
- //if (cpl_parameter_get_bool(cpl_parameterlist_find(parlist, "amber.amber_p2vm.activate_MAX_PISTON_EXCURSION"))) {amdlibSetUserPref(amdlibMAX_PISTON_EXCURSION, 1000*cpl_parameter_get_double(cpl_parameterlist_find(parlist, "amber.amber_p2vm.value_MAX_PISTON_EXCURSION")));};
-
-
-
- /* save for CreateProduct function */
- gframelist = framelist;
- gparlist = parlist;
-
- /*Set the cpl group*/
- amber_dfs_set_groups(framelist);
-
- cur_set = NULL;
- cur_frame = NULL;
- pszFilename = NULL;
- pszFileTag = NULL;
-
- cpl_msg_info( fctid, "Start of DataReduction");
-
- /* log of the fprint of the amdlib */
-
- //fp = freopen( "amdlib_p2vm.log", "w", stdout );
-
- cpl_msg_info(cpl_func,"Counting bad frames: ...");
- /*Count the number of frames with timeTag of zero*/
- zeroframes=amber_check_zeroframes(parlist, framelist);
- cpl_msg_info(cpl_func,"Zeroframes found: %ld\n", zeroframes);
-
-
-
- /* Product Name (faked) */
- strcpy( szFilenameP2VM, "p2vm_produced_by_amber_p2vm.fits" );
- strcpy( szFilenameWave, "temp_spec_calib.asc" );
-
- strcpy( szFilenameBadPix, "" );
- strcpy( szFilenameFlat , "" );
- memset( szFilenameInP2VM, 0, sizeof( szFilenameInP2VM ) );
- memset( szFilenameInWAVE, 0, sizeof( szFilenameInWAVE ) );
-
- /* Find BadPix and FlatField first Frames */
- cur_frame = cpl_frameset_find( framelist, "AMBER_FLATFIELD" );
-
- if( cur_frame )
- {
- /* Get Filename and Classification Tag */
- pszFilename = (char *)cpl_frame_get_filename( cur_frame );
- pszFileTag = (char *)cpl_frame_get_tag( cur_frame );
-
- strcpy( szFilenameFlat, pszFilename );
-
- sprintf ( szMessage, "FLAT FIELD identified %s", pszFilename );
- cpl_msg_info( fctid, "%s", szMessage );
- }
-
- cur_frame = cpl_frameset_find( framelist, "AMBER_BADPIX" );
-
- if( cur_frame )
- {
- /* Get Filename and Classification Tag */
- pszFilename = (char *)cpl_frame_get_filename( cur_frame );
- pszFileTag = (char *)cpl_frame_get_tag( cur_frame );
-
- strcpy( szFilenameBadPix, pszFilename );
-
- sprintf ( szMessage, "BAD PIXEL MAP identified %s", pszFilename );
- cpl_msg_info( fctid, "%s", szMessage );
- }
-
- /* Do not continue without BADPIX and FALTFIELD */
- if( strlen(szFilenameBadPix)==0 || strlen(szFilenameFlat)==0 )
- {
- iStatus = 2;
- sprintf ( szMessage, "Support Frames needed: AMBER_BADPIX and "
- "AMBER_FLAT." );
- cpl_msg_info( fctid, "%s", szMessage );
-
- /* Close the amdlib logfile */
- //if( fp )
- // fclose( fp );
-
- return iStatus;
- }
-
- /* TEST if 2P2V or 3P2V is present */
- cur_frame = cpl_frameset_find( framelist, "AMBER_3P2V" );
-
- if( !cur_frame )
- {
- cur_frame = cpl_frameset_find( framelist, "AMBER_2P2V" );
-
- if( !cur_frame )
- {
- sprintf (szMessage, "Error: 10 Frames of type AMBER_3P2V are needed"
- " or 5 Frames of type AMBER_2P2V are needed", pszFilename );
- cpl_msg_info( fctid, "%s", szMessage );
-
- iStatus = 666;
- }
- }
-
-
-
- /*
-
- Walk through the whole Set of Frames SOF and search for AMBER_WAVE files
-
- If theses files are present, we will perform a spectral calibration, to
- calculate the pixelshift of the CCD channels.
- */
- sprintf ( szMessage, "Searching for Spectral Calibration (WAVE) Files... "
- "(current status = %d)", iStatus );
- cpl_msg_info( fctid, "%s", szMessage );
-
- cur_frame = cpl_frameset_get_first( framelist );
-
- while( cur_frame && !iStatus )
- {
- /* Get Filename and Classification Tag */
- pszFilename = (char *)cpl_frame_get_filename( cur_frame );
- pszFileTag = (char *)cpl_frame_get_tag( cur_frame );
-
- /* Check Tag and Filename */
- if( pszFilename && pszFileTag )
- {
- /* 3 WAVE (4 needed) */
- if( !strcmp( pszFileTag, "AMBER_3WAVE" ) && i3TelFrames<4 )
- {
- /* Add to Framelist */
- sprintf ( szMessage, "%d. 3WAVE identified %s", i3TelFrames+1,
- pszFilename );
- cpl_msg_info( fctid, "%s", szMessage );
- strcpy( szFilenameInWAVE[i3TelFrames], pszFilename );
- i3TelFrames++;
- }
-
- /* Only use 2-Telescopes files when no 3-Telecopes file
- * arrived yet */
- if( !i3TelFrames )
- {
- /* 2 WAVE (3 needed) */
- if( !strcmp( pszFileTag, "AMBER_2WAVE" ) && i2TelFrames<4 )
- {
- /* Add to Framelist */
- sprintf ( szMessage, "%d. 2WAVE identified %s",
- i2TelFrames+1, pszFilename );
- cpl_msg_info( fctid, "%s", szMessage );
- strcpy( szFilenameInWAVE[i2TelFrames], pszFilename );
- i2TelFrames++;
- }
- }
- }
-
- /* Proceed with next frame */
- cur_frame = cpl_frameset_get_next( framelist );
- } /* while more frames */
-
-
- /* Check, if we can perform the calibration */
- if( i3TelFrames == 4 && !iStatus )
- {
- sprintf (szMessage, "Computing new Spectral Calibration for 3 Telecopes");
- cpl_msg_info( fctid, "%s", szMessage );
-
- /*sprintf ( szMessage, "[%s][%s][%s][%s][%s][%s]",
- * szFilenameBadPix, szFilenameFlat, szFilenameInWAVE[0],
- * szFilenameInWAVE[1], szFilenameInWAVE[2], szFilenameInWAVE[3] );
- cpl_msg_info( fctid, "%s", szMessage ); */
-
-
- if (amdlibComputeSpectralCalibration3T(szFilenameBadPix, szFilenameFlat,
- szFilenameInWAVE[0], szFilenameInWAVE[1], szFilenameInWAVE[2],
- szFilenameInWAVE[3], spectralOffsets)
- != amdlibSUCCESS)
- {
- iStatus = 5;
- sprintf ( szMessage, "Could not compute Spectral Calibration" );
- cpl_msg_info( fctid, "%s", szMessage );
- }
- else
- {
-
- cpl_msg_info(cpl_func,"Computed spectral offsets: ");
- cpl_msg_info(cpl_func,"Photometric 1 = %f, Photometric 2 = %f,"
- " Photometric 3 = %f", spectralOffsets[0],
- spectralOffsets[1], spectralOffsets[2]);
-
- off[0]=floor(spectralOffsets[0]+0.5);
- off[1]=floor(spectralOffsets[1]+0.5);
- off[2]=floor(spectralOffsets[2]+0.5);
-
- cpl_msg_info(cpl_func,"Used (rounded) spectral offsets: ");
- cpl_msg_info(cpl_func,"Photometric 1 = %f, Photometric 2 = %f,"
- " Photometric 3 = %f", off[0], off[1], off[2]);
-
- }
- }
- else if( i2TelFrames == 3 && !iStatus )
- {
- sprintf ( szMessage, "Computing new Spectral Calibration for 2 "
- "Telecopes (%s)...", szFilenameWave );
- cpl_msg_info( fctid, "%s", szMessage );
-
- if (amdlibComputeSpectralCalibration2T(szFilenameBadPix, szFilenameFlat,
- szFilenameInWAVE[0], szFilenameInWAVE[1], szFilenameInWAVE[2],
- spectralOffsets)
- != amdlibSUCCESS)
- {
- iStatus = 5;
- }
- else
- {
-
- cpl_msg_info(cpl_func,"Computed spectral offsets: ");
- cpl_msg_info(cpl_func,"Photometric 1 = %f, Photometric 2 = %f,"
- " Photometric 3 = %f", spectralOffsets[0],
- spectralOffsets[1], spectralOffsets[2]);
-
- off[0]=floor(spectralOffsets[0]+0.5);
- off[1]=floor(spectralOffsets[1]+0.5);
- off[2]=floor(spectralOffsets[2]+0.5);
-
- cpl_msg_info(cpl_func,"Used (rounded) spectral offsets: ");
- cpl_msg_info(cpl_func,"Photometric 1 = %f, Photometric 2 = %f,"
- " Photometric 3 = %f", off[0], off[1], off[2]);
-
- }
- }
- else
- {
- sprintf ( szMessage, "No new Spectral Calibration computed "
- "(no 4 AMBER_WAVE files!). "
- "Using Calibration from DET1-Key in Header." );
- cpl_msg_info( fctid, "%s", szMessage );
- }
-
- /*
-
- Walk through the whole Set of Frames SOF and search for 3P2V or 2P2V files
-
- */
-
- sprintf ( szMessage, "Searching for 3P2V and 2P2V Files..." );
- cpl_msg_info( fctid, "%s", szMessage );
-
- i3TelFrames = 0;
- i2TelFrames = 0;
- cur_frame = cpl_frameset_get_first( framelist );
-
- while( cur_frame )
- {
- /* Get Filename and Classification Tag */
- pszFilename = (char *)cpl_frame_get_filename( cur_frame );
- pszFileTag = (char *)cpl_frame_get_tag( cur_frame );
-
- /* Check Tag and Filename */
- if( pszFilename && pszFileTag )
- {
- /* 3P2V (10 needed) */
- if( !strcmp( pszFileTag, "AMBER_3P2V" ) && i3TelFrames<10 )
- {
- /* Add to Framelist */
- sprintf ( szMessage, "3P2V identified %s", pszFilename );
- cpl_msg_info( fctid, "%s", szMessage );
- strcpy( szFilenameInP2VM[i3TelFrames], pszFilename );
- i3TelFrames++;
- }
-
- /* Only use 2-Telescopes files when no
- * 3-Telecopes file arrived yet */
- if( !i3TelFrames )
- {
- /* 2P2V (5 needed) */
- if( !strcmp( pszFileTag, "AMBER_2P2V" ) && i2TelFrames<5 )
- {
- /* Add to Framelist */
- sprintf ( szMessage, "2P2V identified %s", pszFilename );
- cpl_msg_info( fctid, "%s", szMessage );
- strcpy( szFilenameInP2VM[i2TelFrames], pszFilename );
- i2TelFrames++;
- }
- }
- }
-
- /* Proceed with next frame */
- cur_frame = cpl_frameset_get_next( framelist );
- } /* while more frames */
-
- /* Test Number of Frames and call Data Reduction */
- if( strlen(szFilenameBadPix) && strlen(szFilenameFlat) )
- {
- if( i3TelFrames == 10 )
- {
- strcpy( szFilenameP2VM, "p2vm.fits" );
-
- /* Now make a DMD Product */
- sprintf ( szMessage, "Create file and write header..." );
- cpl_msg_info( fctid, "%s", szMessage );
- CreateProduct(fctid,szFilenameInP2VM[0],szFilenameP2VM,zeroframes);
-
- sprintf ( szMessage, "Now computing P2VM for 3 Telescopes..." );
- cpl_msg_info( fctid, "%s", szMessage );
-
- if(amdlibComputeP2vm3T_ESO(szFilenameBadPix, szFilenameFlat,
- szFilenameInP2VM[0],szFilenameInP2VM[1],szFilenameInP2VM[2],
- szFilenameInP2VM[3],szFilenameInP2VM[4],szFilenameInP2VM[5],
- szFilenameInP2VM[6],szFilenameInP2VM[7],szFilenameInP2VM[8],
- szFilenameInP2VM[9],szFilenameP2VM, off, fctid
- )
- != amdlibSUCCESS
- )
- {
- sprintf ( szMessage, "P2VM not computed due to errors." );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = 4;
- }
- else
- {
- sprintf ( szMessage, "P2VM produced: %s.", szFilenameP2VM );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = 0;
-
- iWriteQC = 1;
-
- cpl_frameset_insert( framelist, pframeProduct );
- }
- }
- else if( i2TelFrames != 5 )
- {
- iStatus = 3;
- sprintf ( szMessage, "10 Frames of type AMBER_3P2V are needed." );
- cpl_msg_info( fctid, "%s", szMessage );
- }
-
- if( i2TelFrames == 5 )
- {
- strcpy( szFilenameP2VM, "p2vm.fits" );
-
- /* Now make a DMD Product */
- sprintf ( szMessage, "Create file and write header..." );
- cpl_msg_info( fctid, "%s", szMessage );
- CreateProduct(fctid,szFilenameInP2VM[0],szFilenameP2VM,zeroframes);
-
- sprintf ( szMessage, "Now computing P2VM for 2 Telescopes..." );
- cpl_msg_info( fctid, "%s", szMessage );
- if( amdlibComputeP2vm2T_ESO( szFilenameBadPix, szFilenameFlat,
- szFilenameInP2VM[0],szFilenameInP2VM[1],szFilenameInP2VM[2],
- szFilenameInP2VM[3],szFilenameInP2VM[4],
- szFilenameP2VM, off, fctid
- )
- != amdlibSUCCESS
- )
- {
- sprintf ( szMessage, "P2VM not computed due to errors." );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = 4;
- }
- else
- {
- sprintf ( szMessage, "P2VM produced: %s.", szFilenameP2VM );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = 0;
-
- iWriteQC = 1;
-
- cpl_frameset_insert( framelist, pframeProduct );
- }
-
- }
- else if( i3TelFrames != 10 )
- {
- iStatus = 3;
- sprintf ( szMessage, "5 Frames of type AMBER_2P2V are needed." );
- cpl_msg_info( fctid, "%s", szMessage );
- }
-
- }
- else
- {
- iStatus = 2;
- sprintf (szMessage,"Support Frames needed: "
- "AMBER_BADPIX and AMBER_FLAT." );
- cpl_msg_info( fctid, "%s", szMessage );
- } /* No Flat of BadPix */
-
- /* Close the amdlib logfile */
- //if( fp )
- // fclose( fp );
-
- prestate = cpl_errorstate_get();
- applist=cpl_propertylist_new();
-
- // Write QC parameter in additional product
- if(iStatus==0){
- if (!amber_p2vm_qc(szFilenameP2VM, applist)) {
- cpl_propertylist_update_string(applist,CPL_DFS_PRO_CATG,"PVM_QC");
- cpl_dfs_save_propertylist(framelist, NULL, parlist, framelist, NULL,
- "amber_p2vm", applist, NULL, PACKAGE "/" PACKAGE_VERSION,
- "amber_p2vm_qc.fits");
- }
-
- }
-
- cpl_propertylist_delete(applist); applist=NULL;
- cpl_errorstate_set(prestate);
-
- if( iWriteQC )
- {
- sprintf ( szMessage, "Writing QC log file." );
- cpl_msg_info( fctid, "%s", szMessage );
-
- /* Reload the file to get the header */
-
-
- qcFromRawfile= cpl_propertylist_load(szFilenameInP2VM[0], 0 );
-
-
-
- qc = amber_qclog_open( 0 );
-
- if( qc )
- {
- qclog = amber_paf_get_properties( qc );
-
- /* Read original ARCFILE entry and copy to PAF-File */
- pszARCFILE = cpl_propertylist_get_string( qcFromRawfile, "ARCFILE");
-
- /* Add mandatory keys */
- cpl_propertylist_append_string( qclog, "ARCFILE", pszARCFILE );
-
- /* Take the whole header including QC parameters */
- qcFromProduct = cpl_propertylist_load ( szFilenameP2VM, 0);
-
- /* copy to PAF */
- amber_propertylist_append( qclog, qcFromProduct);
-
- /* Finished... */
- amber_qclog_close(qc);
- } /* if qc */
-
-
- /* Cleanup */
- cpl_propertylist_delete( qcFromProduct );
- cpl_propertylist_delete( qcFromRawfile);
-
- }
- else
- {
- sprintf ( szMessage, "Error: Could not write QC log file." );
- cpl_msg_info( fctid, "%s", szMessage );
- iStatus = 1;
- }
-
- /* Now copy P2VM also to the temp directory for pipeline usage */
- sprintf( szCommandline, "cp %s /tmp/current_P2VM.fits", szFilenameP2VM );
- system( szCommandline );
-
- cpl_msg_info( fctid, "End of DataReduction");
-
- cpl_error_reset();
-
- return iStatus;
-}
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Derives the minimum and maximum valid wavelength in the p2vm
- @param szFilenameP2VM Name of p2vm file.
- @param qclist cpl_propertylist where the qc values are written
- @return appropriate cpl_error_code
- */
-/*----------------------------------------------------------------------------*/
-cpl_error_code amber_p2vm_qc(const char * szFilenameP2VM,
- cpl_propertylist * qclist){
- cpl_size p2vm_extension=0;
- cpl_table * table=NULL;
- const cpl_array * flag=NULL;
- const cpl_array * eff_wave=NULL;
- cpl_size i=0;
- cpl_propertylist * plist=NULL;
-
- p2vm_extension=cpl_fits_find_extension(szFilenameP2VM, "P2VM");
-
- /* Load extension */
- if((table = cpl_table_load(szFilenameP2VM, p2vm_extension, 1))==NULL)
- {
- cpl_msg_warning(cpl_func, "No suitable table found in file: %s",
- szFilenameP2VM);
- cpl_msg_warning(cpl_func, "Can not write additional QC parameter file");
-
- /* Propagate error, if any */
- return cpl_error_set(cpl_func, cpl_error_get_code());
- }
-
-
- if (cpl_table_has_column(table, "EFF_WAVE") &&
- cpl_table_has_column(table, "FLAG"))
- {
- //extract the arrays
- flag=cpl_table_get_array(table,"FLAG",0);
- eff_wave=cpl_table_get_array(table,"EFF_WAVE",0);
-
- //remove invalid elements
- for(i=0; i<cpl_array_get_size(eff_wave); i++){
- if(cpl_array_get_int(flag, i, NULL) != 1){
- cpl_array_set_invalid((cpl_array *)eff_wave, i);
- cpl_array_set_invalid((cpl_array *)flag, i);
- }
- }
-
- cpl_msg_debug(cpl_func," eff_wave_min: %g eff_wave_max: %g",
- cpl_array_get_min(eff_wave),
- cpl_array_get_max(eff_wave));
- }
- else
- {
- cpl_msg_warning(cpl_func, "No suitable table found in file: %s",
- szFilenameP2VM);
- cpl_table_delete(table); table=NULL;
- /* Propagate error, if any */
- return cpl_error_set(cpl_func, cpl_error_get_code());
-
- }
-
- //Read and add all the other QC parameters written by amdlib
-
- plist=cpl_propertylist_load(szFilenameP2VM, 0);
- cpl_propertylist_copy_property_regexp(qclist, plist, "^ESO QC", 0);
- cpl_propertylist_delete(plist);
-
- cpl_propertylist_update_double(qclist, "ESO QC P2VM LAMBDA MIN",
- cpl_array_get_min(eff_wave));
-
- cpl_propertylist_update_double(qclist, "ESO QC P2VM LAMBDA MAX",
- cpl_array_get_max(eff_wave));
-
- cpl_table_delete(table); table=NULL;
- /* Propagate error, if any */
- return cpl_error_set(cpl_func, cpl_error_get_code());
-}
-
-
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Count the number of frames with no data inside
- @param parlist the parameters list
- @param framelist the frames list
- @return number of frames with no data inside (only values of zero)
- */
-/*----------------------------------------------------------------------------*/
-
-static long amber_check_zeroframes(cpl_parameterlist * parlist,
- cpl_frameset * framelist)
-{
- const cpl_frame * cur_frame= NULL;
- int nbframes= 0;
- int i=0, j=0 ;
- amdlibRAW_DATA rawData_tmp= {NULL};
- long zeroframes=0;
- long zeroframes_per_file=0;
-
- /* Test entries */
- if (parlist == NULL) return -1 ;
- if (framelist == NULL) return -1 ;
-
- /* Initialise */
- nbframes = cpl_frameset_get_size(framelist) ;
- zeroframes=0;
- zeroframes_per_file=0;
-
- /* Loop on the frames and test for zeroframes */
- for (i=0 ; i<nbframes ; i++) {
- cur_frame = cpl_frameset_get_frame_const(framelist, i) ;
-
- if (!strcmp(cpl_frame_get_tag(cur_frame), "AMBER_3P2V") ||
- !strcmp(cpl_frame_get_tag(cur_frame), "AMBER_2P2V"))
- {
- if (amdlibLoadRawData(cpl_frame_get_filename(cur_frame),
- &rawData_tmp, errMsg) != amdlibSUCCESS)
- {
- cpl_msg_warning(cpl_func,"Could not load raw data file '%s'\n",
- cpl_frame_get_filename(cur_frame));
- amdlibReleaseRawData(&rawData_tmp);
- return -1;
- }
- else{
-
- for (j=0 ; j<rawData_tmp.nbFrames ; j++) {
- if(rawData_tmp.timeTag[j]<FLT_EPSILON){
- zeroframes_per_file++;
- }
- }
- }
- zeroframes+=zeroframes_per_file;
- cpl_msg_indent(1);
- cpl_msg_info(cpl_func,"File %s has %ld Zeroframes",
- cpl_frame_get_filename(cur_frame), zeroframes_per_file);
- cpl_msg_indent(-1);
- zeroframes_per_file=0;
-
- amdlibReleaseRawData(&rawData_tmp);
- }
- }
- return zeroframes;
-
-}
diff --git a/recipes/amber_raw_to_fitsimage.c b/recipes/amber_raw_to_fitsimage.c
deleted file mode 100644
index 3da399b..0000000
--- a/recipes/amber_raw_to_fitsimage.c
+++ /dev/null
@@ -1,387 +0,0 @@
-/* $Id: amber_raw_to_fitsimage.c,v 1.17 2013-09-16 14:56:43 agabasch Exp $
- *
- * This file is part of the AMBER 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: agabasch $
- * $Date: 2013-09-16 14:56:43 $
- * $Revision: 1.17 $
- * $Name: not supported by cvs2svn $
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-/* AMDLIB usage switch */
-#define USE_AMDLIB YES
-
-/*-----------------------------------------------------------------------------
- Includes
- -----------------------------------------------------------------------------*/
-
-#include <math.h>
-#include <cpl.h>
-#include <string.h>
-#include "amdrs.h"
-
-#ifdef USE_AMDLIB
-
-/* amdlib structures */
-amdlibERROR_MSG errMsg;
-amdlibBAD_PIXEL_MAP badPixels;
-amdlibFLAT_FIELD_MAP flatField;
-static amdlibRAW_DATA rawData;
-amdlibP2VM_INPUT_DATA p2vmData;
-amdlibP2VM_MATRIX p2vm;
-
-#endif
-
-/*-----------------------------------------------------------------------------
- Functions prototypes
- -----------------------------------------------------------------------------*/
-
-static int amber_raw_to_fitsimage_create(cpl_plugin *) ;
-static int amber_raw_to_fitsimage_exec(cpl_plugin *) ;
-static int amber_raw_to_fitsimage_destroy(cpl_plugin *) ;
-static int amber_raw_to_fitsimage(cpl_parameterlist *, cpl_frameset *) ;
-
-
-/*-----------------------------------------------------------------------------
- Static variables
- -----------------------------------------------------------------------------*/
-
-/*
-static struct {
- Inputs
- int bool_option ;
- char str_option[512] ;
-
- Outputs
- double qc_param ;
-} amber_raw_to_fitsimage_config ;
- */
-
-static char amber_raw_to_fitsimage_man[] =
-"The main purpose of this recipe is to convert the imaging sections of a\n"
-"amber raw files into a fits-cube and a fits-images showing the 5 channels.\n"
-"This recipe is able to process all amber raw files with a DATA column in the\n"
-"IMAGING_DATA extension, i.e. most of the amber raw files. Therefore no\n"
-"special classification tag needs to be given to the SOF. Moreover, the SOF\n"
-"should include only one amber raw file.\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,
- AMBER_BINARY_VERSION,
- CPL_PLUGIN_TYPE_RECIPE,
- "amber_raw_to_fitsimage",
- "AMBER raw data display",
- amber_raw_to_fitsimage_man,
- "Tom Licha",
- PACKAGE_BUGREPORT,
- "GP",
- amber_raw_to_fitsimage_create,
- amber_raw_to_fitsimage_exec,
- amber_raw_to_fitsimage_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 amber_raw_to_fitsimage_create(cpl_plugin * plugin)
-{
- cpl_recipe * recipe = (cpl_recipe *)plugin ;
-
- /* Create the parameters list in the cpl_recipe object */
- recipe->parameters = cpl_parameterlist_new() ;
-
- /* Fill the parameters list */
-
- return 0;
-}
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Execute the plugin instance given by the interface
- @param plugin the plugin
- @return 0 if everything is ok
- */
-/*----------------------------------------------------------------------------*/
-static int amber_raw_to_fitsimage_exec(cpl_plugin * plugin)
-{
- cpl_recipe * recipe = (cpl_recipe *)plugin ;
- return amber_raw_to_fitsimage(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 amber_raw_to_fitsimage_destroy(cpl_plugin * plugin)
-{
- cpl_recipe * recipe = (cpl_recipe *)plugin ;
- cpl_parameterlist_delete(recipe->parameters) ;
- return 0 ;
-}
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Get the command line options and execute the data reduction
- @param parlist the parameters list
- @param frameset the frames list
- @return 0 if everything is ok
- */
-/*----------------------------------------------------------------------------*/
-static int amber_raw_to_fitsimage(
- cpl_parameterlist * parlist,
- cpl_frameset * frameset)
-{
- cpl_frame * cur_frame=NULL;
- cpl_frame * pFrameProduct = NULL;
- cpl_imagelist * pImagelist = NULL;
- char szMessage[1024];
- cpl_frame * pFrame = NULL;
- cpl_propertylist * pHeader = NULL;
- cpl_propertylist * qclist = NULL;
- int iStatus = 0;
- const char * fctid = "amber_raw_to_fitsimage";
- int iNumbExt = 0; /* Number of extensions in FITS file */
- int iTelescopes = 0; /* Number of Telescopes used to produce raw data */
- //amdlibERROR_MSG errMsg;
- int pszTemp;
- char * pszInfile;
- char szProduct[512];
- cpl_propertylist * pHeader_tmp = NULL;
-
-
- cpl_msg_info( fctid, "Start of DataReduction");
-
- /* For DFS fill Header function later */;
- /* pHeader = cpl_propertylist_new(); IMPLICIT to load later */
- pFrame = cpl_frame_new();
-
- /* Outfile goes to temp */
- strcpy( szProduct, "/tmp/amber_display.fits" );
-
- /* Just use the first frame */
- cur_frame = cpl_frameset_get_first( frameset );
- cpl_frame_set_group(cur_frame, CPL_FRAME_GROUP_RAW);
- pszInfile = (char *)cpl_frame_get_filename( cur_frame );
-
-
- {
-
-
- /* read the number of extensions from the file */
- iNumbExt = cpl_fits_count_extensions(pszInfile);
- /* cpl_msg_info(cpl_func,"iNumbExt: %d", iNumbExt); */
-
- if( iNumbExt < 3 )
- {
- /* Necessary extension 2 and 3 is not existing! */
- iStatus = 2;
- }
- else
- {
- /* Decide 2 or 3 telescope case by number of subwindows */
-
- pHeader_tmp = cpl_propertylist_load(pszInfile,2);
-
- pszTemp=cpl_propertylist_get_int(pHeader_tmp,"NREGION");
- cpl_msg_info(cpl_func,"NREGION: %d", pszTemp);
-
- cpl_propertylist_delete(pHeader_tmp);
-
- if(pszTemp == 4){
- iTelescopes = 2;
- }
- else if( pszTemp == 5){
- iTelescopes = 3;
- }
- else if(pszTemp == 1){
- iTelescopes = 1;
- }
- if(iTelescopes != 1 && iTelescopes != 2 && iTelescopes != 3 )
- {
- iStatus = 3;
- }
- else
- {
- /* Load raw frame and store it as an image */
- if (amdlibLoadRawData(pszInfile, &rawData, errMsg) !=
- amdlibSUCCESS)
- {
-#ifdef TL_DEBUG
- printf ("Could not load raw data file '%s'\n", pszInfile);
- printf ("%s\n", errMsg);
-#endif
- iStatus = 20;
- }
-
- if( amdlibSaveRawDataToFits( szProduct, &rawData, errMsg) !=
- amdlibSUCCESS )
- {
-#ifdef TL_DEBUG
- printf ("Could not write image file '%s'\n", szProduct);
- printf ("%s\n", errMsg);
-#endif
- iStatus = 21;
- }
- else
- {
- /* OK */
- iStatus = 0;
- amdlibReleaseRawData(&rawData);
- }
- } /* wrong region count */
- } /* ext 2 not present */
- }
-
-
-
- /* Create the Product file, start with filling the header */
-
- sprintf( szMessage, "Extracted Header from file %s.", pszInfile );
- cpl_msg_info( fctid, "%s", szMessage );
-
- /* Create a set of frames with just this frame, so header will be correct */
-
- pImagelist = cpl_imagelist_load(szProduct, CPL_TYPE_FLOAT, 0 );
-
- pHeader = cpl_propertylist_load( pszInfile, 0 );
-
- pFrameProduct = cpl_frame_new();
- cpl_frame_set_filename( pFrameProduct, szProduct );
- cpl_frame_set_type ( pFrameProduct, CPL_FRAME_TYPE_IMAGE );
- cpl_frame_set_tag ( pFrameProduct, "AMBER_RAW_IMAGE" );
- cpl_frame_set_group ( pFrameProduct, CPL_FRAME_GROUP_PRODUCT );
- cpl_frame_set_level ( pFrameProduct, CPL_FRAME_LEVEL_FINAL );
-
-
- /* Add the necessary DFS fits header information to the product */
- if( cpl_dfs_setup_product_header( pHeader,
- pFrameProduct,
- frameset,
- parlist,
- "amber_raw_to_fitsimage", /* const char * recid, */
- "AMBER", /* const char * pipeline_id, */
- "AMBER", /* const char * dictionary_id */
- NULL
- ) != CPL_ERROR_NONE )
- {
- /* Error */
- sprintf( szMessage, "Warning: problem with product header. [%s]",
- cpl_error_get_where() );
-
- cpl_msg_info( fctid, "%s", szMessage );
- /* cpl_msg_info(cpl_func, cpl_error_get_message()); */
- iStatus = 16;
- }
-
-
- /* Add a QC parameter */
- qclist = cpl_propertylist_new();
-
- cpl_image * ima_summ = cpl_imagelist_collapse_create(pImagelist);
- cpl_image_multiply_scalar(ima_summ, cpl_imagelist_get_size(pImagelist));
-
- /* Add the product category and save image */
- cpl_propertylist_update_string(qclist, CPL_DFS_PRO_CATG, "AMBER_RAW_SUM");
-
- cpl_dfs_save_image(frameset, NULL, parlist, frameset, NULL,
- ima_summ, CPL_TYPE_FLOAT,
- "amber_raw_to_fitsimage", qclist, NULL,
- PACKAGE "/" PACKAGE_VERSION, "amber_raw_sum.fits");
-
- cpl_propertylist_update_string(qclist, CPL_DFS_PRO_CATG, "AMBER_RAW_CUBE");
-
- cpl_dfs_save_imagelist(frameset, NULL, parlist, frameset, NULL,
- pImagelist, CPL_TYPE_FLOAT,
- "amber_raw_to_fitsimage", qclist, NULL,
- PACKAGE "/" PACKAGE_VERSION, "amber_raw_cube.fits");
-
- cpl_propertylist_delete(qclist);
- cpl_image_delete(ima_summ);
-
-
- cpl_frame_delete(pFrame);
- cpl_frame_delete(pFrameProduct);
- cpl_propertylist_delete(pHeader);
-
- cpl_imagelist_delete(pImagelist);
-
- /* FREE CPL STUFF !!! */
-
- /* ---------
- 0 = OK
- 1 = not a FITS file
- 2 = Ext 2 or 3 not present
- 3 = Wrong number of Regions in Extension 2
- 4 = No new FITS Header available
- 5 = Cannot create outfile
-
- 11 = no memory for buffer
- 12 = cannot open table with IMAGING_DATA
-
- 20 = amdlib error
- ----------- */
-
- //sprintf ( szMessage, "Status: %d for %s", iStatus, szProduct );
- //cpl_msg_info( fctid, "%s", szMessage );
-
- //cpl_msg_info( fctid, "End of DataReduction");
-
- //cpl_error_reset();
-
-
- return iStatus;
-}
diff --git a/recipes/amber_selector.c b/recipes/amber_selector.c
deleted file mode 100644
index 2f0f4ea..0000000
--- a/recipes/amber_selector.c
+++ /dev/null
@@ -1,363 +0,0 @@
-/* $Id: amber_selector.c,v 1.53 2011-09-26 12:54:06 agabasch Exp $
- *
- * This file is part of the AMBER 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: agabasch $
- * $Date: 2011-09-26 12:54:06 $
- * $Revision: 1.53 $
- * $Name: not supported by cvs2svn $
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-/* AMDLIB usage switch */
-#define USE_AMDLIB YES
-//#define amdlibPRECISION 1E-6
-/*-----------------------------------------------------------------------------
- Includes
- ----------------------------------------------------------------------------*/
-#include <string.h>
-#include <math.h>
-#include <cpl.h>
-#include "amdrs.h"
-#include "amber_qc.h"
-#include "esolibSelector.h"
-
-const char * selMethod1 = "First_x_Frames";
-const char * selMethod2 = "Fringe_SNR_gt_x";
-const char * selMethod3 = "Fringe_SNR_percentage_x";
-const char * selMethod4 = "Flux_gt_x";
-const char * selMethod5 = "Flux_percentage_x";
-const char * selMethod6 = "Exclude_Frames_by_ASCII_File";
-const char * selMethod7 = "Include_Frames_by_ASCII_File";
-const char * selMethod8 = "IO-Test_no_filtering";
-const char * selMethod9 = "Absolute_piston_value_lt_x";
-const char * selMethod10= "Absolute_piston_value_percentage_x";
-
-
-/*-----------------------------------------------------------------------------
- Functions prototypes
- ----------------------------------------------------------------------------*/
-
-static int amber_selector_create(cpl_plugin *) ;
-static int amber_selector_exec(cpl_plugin *) ;
-static int amber_selector_destroy(cpl_plugin *) ;
-static int amber_selector(cpl_parameterlist *, cpl_frameset *) ;
-/*-----------------------------------------------------------------------------
- Static variables
- ----------------------------------------------------------------------------*/
-
-static char amber_selector_man[] =
- "This recipe selects frames stored in an AMBER OI product by various\n"
- "methods and writes a filtered OI product. After selecting a method "
- "one\n"
- "can set a selection criteria for every baseline by defining the\n"
- "variables X1, X2, and X3. If only one baseline is available, X2 and "
- "X3\n"
- "can be neglected. Moreover one can choose the combining method of "
- "the\n"
- "single criteria by setting the Boolean variable ANDselection.\n"
- "\n"
- "If ANDselection is not set (--ANDselection=FALSE), a frame passes "
- "the\n"
- "filter if at least one of the selection criteria (X1 || X2 || X3) is\n"
- "fulfilled.\n"
- "\n"
- "If ANDselection is set (--ANDselection=TRUE), a frame passes the\n"
- "filter only if ALL selection criteria (X1 && X2 && X3) are "
- "fulfilled.\n"
- "\n"
- "Please note, that for three baselines in both cases the visibility\n"
- "triplet is written to the product file!\n\n"
- "Input files:\n\n"
- " DO category: Type: Explanation: Required: \n"
- " SCIENCE_REDUCED Products OI-Fits file \n"
- " or \n"
- " SCIENCE_REDUCED_FILTERED Products OI-Fits file \n"
- " or \n"
- " CALIB_REDUCED Products OI-Fits file Y\n"
- " or \n"
- " CALIB_REDUCED_FILTERED Products OI-Fits file \n"
- " or \n"
- " SCIENCE_CALIBRATED Products OI-Fits file \n\n"
- "Output files:\n\n"
- " DO category: Data type: Explanation: \n"
- " SCIENCE_REDUCED_FILTERED Products: filtered OI-fits file \n"
- " or \n"
- " CALIB_REDUCED_FILTERED Products: filtered OI-fits file \n\n";
-
-/*-----------------------------------------------------------------------------
- Functions code
- ----------------------------------------------------------------------------*/
-
-/* FIXME: Cast string literal in fits_create_tbl(), ..to avoid compiler warnings
- - and pray that CFITSIO does not try to modify them :-(((( */
-
-
-#define amdlib_OI_REVISION 1 /*Current revision number*/
-#define amdlibNM_TO_M 1e-9 /* conversion nanometers to meters */
-
-/** Usefull macro to error when reading/writing IO6FITS file */
-#define amdlibOiReturnError(routine,msg) \
- fits_get_errstatus(status, (char*)fitsioMsg); \
- amdlibERROR("%s(): %s - %s\n", routine, msg, fitsioMsg); \
- sprintf(errMsg, "%s(): %s - %s", routine, msg, fitsioMsg); \
- return (amdlibFAILURE)
-
-
-/* ---------------------------------------------------------------------------*/
-
-/*----------------------------------------------------------------------------*/
-/**
- @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,
- AMBER_BINARY_VERSION,
- CPL_PLUGIN_TYPE_RECIPE,
- "amber_selector",
- "AMBER OI frame selector",
- amber_selector_man,
- "Armin Gabasch",
- PACKAGE_BUGREPORT,
- "",
- amber_selector_create,
- amber_selector_exec,
- amber_selector_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 amber_selector_create(cpl_plugin * plugin)
-{
- cpl_recipe * recipe = (cpl_recipe *)plugin ;
- cpl_parameter * p ;
-
- /* Create the parameters list in the cpl_recipe object */
- recipe->parameters = cpl_parameterlist_new() ;
-
- /* Fill the parameters list */
-
-
- /* Selection Method */
- p = cpl_parameter_new_enum( "amber.amber_selector.selection_method",
- CPL_TYPE_STRING,
- "Selection methods",
- "amber.selection",
- selMethod2, 10,
- selMethod1, selMethod2, selMethod3, selMethod4,
- selMethod5, selMethod6, selMethod7, selMethod8, selMethod9,
- selMethod10 );
-
- cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "selection-method") ;
- cpl_parameterlist_append(recipe->parameters, p) ;
-
- /* selection threshold float */
- p = cpl_parameter_new_value("amber.amber_selector.selection_x1",
- CPL_TYPE_DOUBLE, "X1 Value", "amber.amber_selector", 2.0 ) ;
- cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "X1") ;
- cpl_parameterlist_append(recipe->parameters, p) ;
-
- p = cpl_parameter_new_value("amber.amber_selector.selection_x2",
- CPL_TYPE_DOUBLE, "X2 Value", "amber.amber_selector", 2.0 ) ;
- cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "X2") ;
- cpl_parameterlist_append(recipe->parameters, p) ;
-
-
- p = cpl_parameter_new_value("amber.amber_selector.selection_x3",
- CPL_TYPE_DOUBLE, "X3 Value", "amber.amber_selector", 2.0 ) ;
- cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "X3") ;
- cpl_parameterlist_append(recipe->parameters, p) ;
-
-
- p = cpl_parameter_new_value("amber.amber_selector.selection_ANDselection",
- CPL_TYPE_BOOL, "X1, X2, and X3 combining method",
- "amber.amber_selector", FALSE) ;
- cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "ANDselection") ;
- 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 amber_selector_exec(cpl_plugin * plugin)
-{
- cpl_recipe * recipe = (cpl_recipe *)plugin ;
- return amber_selector(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 amber_selector_destroy(cpl_plugin * plugin)
-{
- cpl_recipe * recipe = (cpl_recipe *)plugin ;
- cpl_parameterlist_delete(recipe->parameters) ;
- return 0 ;
-}
-
-
-
-static int amber_selector(
- cpl_parameterlist * parlist,
- cpl_frameset * framelist)
-{
- cpl_parameter * cur_param=NULL;
- cpl_frame * cur_frame=NULL;
- int ANDselection=0;
- double x1=0,x2=0,x3=0;
- const char * Method=NULL;
- int iIsScience;
- int returncode=0;
- int framecount=0;
- char * outname=NULL;
- char * systemcall=NULL;
- cpl_errorstate prestate = cpl_errorstate_get();
- const char * tag=NULL;
- int framelist_orig_length=0;
-
- /* Read the parameters */
- cur_param=cpl_parameterlist_find( parlist,
- "amber.amber_selector.selection_x1");
- x1 = cpl_parameter_get_double(cur_param);
- cur_param=cpl_parameterlist_find( parlist,
- "amber.amber_selector.selection_x2");
- x2 = cpl_parameter_get_double(cur_param);
- cur_param=cpl_parameterlist_find(parlist,
- "amber.amber_selector.selection_x3");
- x3=cpl_parameter_get_double(cur_param);
- cur_param=cpl_parameterlist_find(parlist,
- "amber.amber_selector.selection_ANDselection");
- ANDselection=cpl_parameter_get_bool(cur_param);
- cur_param=cpl_parameterlist_find( parlist,
- "amber.amber_selector.selection_method");
- Method=cpl_parameter_get_string(cur_param);
- cpl_msg_info(cpl_func,"Using Method: %s with x1=%g x2=%g x3=%g "
- "ANDselection %d", Method, x1, x2, x3, ANDselection);
-
- cur_frame = cpl_frameset_get_first(framelist);
- if (cur_frame == NULL) {
- return (int)cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
- "SOF does not have any file");
- }
-
- while(cur_frame)
- {
- cpl_frame_set_group(cur_frame, CPL_FRAME_GROUP_CALIB) ;
- cur_frame = cpl_frameset_get_next( framelist );
- }
-
- framelist_orig_length=cpl_frameset_get_size(framelist);
-
-
- prestate = cpl_errorstate_get();
-
- for(framecount=0; framecount<framelist_orig_length; framecount++){
- /* Check the right tags */
- cur_frame=cpl_frameset_get_frame(framelist, framecount);
- tag = cpl_frame_get_tag(cur_frame);
- outname=cpl_sprintf("amber_filtered_%04d.fits",framecount);
-
-
- if (!strcmp(tag, "SCIENCE_REDUCED") ||
- !strcmp(tag,"SCIENCE_REDUCED_FILTERED") ||
- !strcmp(tag,"SCIENCE_CALIBRATED")) {
- iIsScience = 1;
- //trigger data reduction
- returncode=amber_selector_lib(x1, x2, x3, ANDselection, Method,
- cpl_frame_get_filename(cur_frame), outname,
- iIsScience, framelist, parlist, "amber_selector");
- if(returncode){
- cpl_msg_warning(cpl_func,"A problem occurred! Please check the "
- "filtering Criteria!!");
-
-
- cpl_msg_info(cpl_func,"Cleaning up working directory ...");
- systemcall=cpl_sprintf("rm -f %s",outname);
- system(systemcall);
- cpl_free(systemcall);
- }
- }
- if (!strcmp(tag, "CALIB_REDUCED") ||
- !strcmp(tag,"CALIB_REDUCED_FILTERED" )) {
- iIsScience = 0;
- //trigger data reduction
- returncode=amber_selector_lib(x1, x2, x3, ANDselection, Method,
- cpl_frame_get_filename(cur_frame), outname,
- iIsScience, framelist, parlist, "amber_selector");
- if(returncode){
- cpl_msg_warning(cpl_func,"A problem occurred! Please check the "
- "filtering Criteria!!");
-
- cpl_msg_info(cpl_func,"Cleaning up working directory ...");
- systemcall=cpl_sprintf("rm -f %s",outname);
- system(systemcall);
- cpl_free(systemcall);
- }
- }
- cpl_free(outname);
-
- }
-
- cpl_errorstate_set(prestate);
-
- /* return */
- if (cpl_error_get_code()) return -1 ;
- else return 0 ;
-}
-
-
diff --git a/recipes/amber_spectral_calibration.c b/recipes/amber_spectral_calibration.c
deleted file mode 100644
index ae073e4..0000000
--- a/recipes/amber_spectral_calibration.c
+++ /dev/null
@@ -1,407 +0,0 @@
-/*
- * amber_spectral_calibration.c
- *
- * Created on: Nov 5, 2012
- * Author: agabasch
- *
- * 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
- *
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-/*-----------------------------------------------------------------------------
- Includes
- -----------------------------------------------------------------------------*/
-
-#include <string.h>
-#include <cpl.h>
-
-#include "amber_dfs.h"
-#include "amdlib.h"
-#include "amdlibProtected.h"
-
-/*-----------------------------------------------------------------------------
- Private function prototypes
- -----------------------------------------------------------------------------*/
-
-static int amber_spectral_calibration_create(cpl_plugin *);
-static int amber_spectral_calibration_exec(cpl_plugin *);
-static int amber_spectral_calibration_destroy(cpl_plugin *);
-static int amber_spectral_calibration(cpl_frameset *, const cpl_parameterlist *);
-
-/*-----------------------------------------------------------------------------
- Static variables
- -----------------------------------------------------------------------------*/
-
-static char amber_spectral_calibration_description[] =
- "The recipe calculates the real Y offset between the different\n"
- "photometric and the interferometric channels in the 3-telescope\n"
- "mode. It uses the same algorithm as the amber_p2vm recipe.\n"
- "Input files:\n\n"
- " DO category: Type: Explanation: Required: \n"
- " AMBER_BADPIX Products Bad pixel map Y\n"
- " AMBER_FLATFIELD Products Flatfield Y\n"
- " AMBER_3WAVE Raw amber_wave data Y\n"
- "\n"
- "Output files:\n\n"
- " DO category: Data type: Explanation: \n"
- " AMBER_SPECTRAL_CALIBRATION Products Header with QC parameter \n\n"
- "\n";
-
-/*-----------------------------------------------------------------------------
- Function code
- -----------------------------------------------------------------------------*/
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Build the list of available plugins, for this module.
- @param list the plugin list
- @return 0 if everything is ok, 1 otherwise
- @note Only this function is exported
-
- Create the recipe instance and make it available to the application using the
- interface.
- */
-/*----------------------------------------------------------------------------*/
-int cpl_plugin_get_info(cpl_pluginlist * list)
-{
- cpl_recipe * recipe = cpl_calloc(1, sizeof *recipe );
- cpl_plugin * plugin = &recipe->interface;
-
- if (cpl_plugin_init(plugin,
- CPL_PLUGIN_API,
- AMBER_BINARY_VERSION,
- CPL_PLUGIN_TYPE_RECIPE,
- "amber_spectral_calibration",
- "AMBER Offset between photo. and interf. channels",
- amber_spectral_calibration_description,
- "Armin Gabasch",
- PACKAGE_BUGREPORT,
- "GPL",
- amber_spectral_calibration_create,
- amber_spectral_calibration_exec,
- amber_spectral_calibration_destroy)) {
- cpl_msg_error(cpl_func, "Plugin initialization failed");
- (void)cpl_error_set_where(cpl_func);
- return 1;
- }
-
- if (cpl_pluginlist_append(list, plugin)) {
- cpl_msg_error(cpl_func, "Error adding plugin to list");
- (void)cpl_error_set_where(cpl_func);
- return 1;
- }
-
- 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 amber_spectral_calibration_create(cpl_plugin * plugin)
-{
- cpl_recipe * recipe;
- //cpl_parameter * p;
-
- /* Do not create the recipe if an error code is already set */
- if (cpl_error_get_code() != CPL_ERROR_NONE) {
- cpl_msg_error(cpl_func, "%s():%d: An error is already set: %s",
- cpl_func, __LINE__, cpl_error_get_where());
- return (int)cpl_error_get_code();
- }
-
- if (plugin == NULL) {
- cpl_msg_error(cpl_func, "Null plugin");
- cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
- }
-
- /* Verify plugin type */
- if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
- cpl_msg_error(cpl_func, "Plugin is not a recipe");
- cpl_ensure_code(0, (int)CPL_ERROR_TYPE_MISMATCH);
- }
-
- /* Get the recipe */
- recipe = (cpl_recipe *)plugin;
-
- /* Create the parameters list in the cpl_recipe object */
- recipe->parameters = cpl_parameterlist_new();
- if (recipe->parameters == NULL) {
- cpl_msg_error(cpl_func, "Parameter list allocation failed");
- cpl_ensure_code(0, (int)CPL_ERROR_ILLEGAL_OUTPUT);
- }
-
- return 0;
-}
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Execute the plugin instance given by the interface
- @param plugin the plugin
- @return 0 if everything is ok
- */
-/*----------------------------------------------------------------------------*/
-static int amber_spectral_calibration_exec(cpl_plugin * plugin)
-{
-
- cpl_recipe * recipe;
- int recipe_status;
- cpl_errorstate initial_errorstate = cpl_errorstate_get();
-
- /* Return immediately if an error code is already set */
- if (cpl_error_get_code() != CPL_ERROR_NONE) {
- cpl_msg_error(cpl_func, "%s():%d: An error is already set: %s",
- cpl_func, __LINE__, cpl_error_get_where());
- return (int)cpl_error_get_code();
- }
-
- if (plugin == NULL) {
- cpl_msg_error(cpl_func, "Null plugin");
- cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
- }
-
- /* Verify plugin type */
- if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
- cpl_msg_error(cpl_func, "Plugin is not a recipe");
- cpl_ensure_code(0, (int)CPL_ERROR_TYPE_MISMATCH);
- }
-
- /* Get the recipe */
- recipe = (cpl_recipe *)plugin;
-
- /* Verify parameter and frame lists */
-/*
- if (recipe->parameters == NULL) {
- cpl_msg_error(cpl_func, "Recipe invoked with NULL parameter list");
- cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
- }
-*/
- if (recipe->frames == NULL) {
- cpl_msg_error(cpl_func, "Recipe invoked with NULL frame set");
- cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
- }
-
- /* Invoke the recipe */
- recipe_status = amber_spectral_calibration(recipe->frames, recipe->parameters);
-
- /* Ensure DFS-compliance of the products */
- if (cpl_dfs_update_product_header(recipe->frames)) {
- if (!recipe_status) recipe_status = (int)cpl_error_get_code();
- }
-
- if (!cpl_errorstate_is_equal(initial_errorstate)) {
- /* Dump the error history since recipe execution start.
- At this point the recipe cannot recover from the error */
- cpl_errorstate_dump(initial_errorstate, CPL_FALSE, NULL);
- }
-
- return recipe_status;
-}
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Destroy what has been created by the 'create' function
- @param plugin the plugin
- @return 0 if everything is ok
- */
-/*----------------------------------------------------------------------------*/
-static int amber_spectral_calibration_destroy(cpl_plugin * plugin)
-{
- cpl_recipe * recipe;
-
- if (plugin == NULL) {
- cpl_msg_error(cpl_func, "Null plugin");
- cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
- }
-
- /* Verify plugin type */
- if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
- cpl_msg_error(cpl_func, "Plugin is not a recipe");
- cpl_ensure_code(0, (int)CPL_ERROR_TYPE_MISMATCH);
- }
-
- /* Get the recipe */
- recipe = (cpl_recipe *)plugin;
-
- cpl_parameterlist_delete(recipe->parameters);
-
- return 0;
-}
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Interpret the command line options and execute the data processing
- @param frameset the frames list
- @param parlist the parameters list
- @return 0 if everything is ok
- */
-/*----------------------------------------------------------------------------*/
-static int amber_spectral_calibration(cpl_frameset * frameset,
- const cpl_parameterlist * parlist)
-{
- const cpl_frame * flatfield = NULL ;
- const cpl_frame * badpixel = NULL ;
- const cpl_frame * wave3tel1 = NULL ;
- const cpl_frame * wave3tel2 = NULL ;
- const cpl_frame * wave3tel3 = NULL ;
- const cpl_frame * wave3tel4 = NULL ;
-
- cpl_propertylist * applist = NULL ;
-
- amdlibDOUBLE spectralOffsets[3]= {amdlibOFFSETY_NOT_CALIBRATED,
- amdlibOFFSETY_NOT_CALIBRATED, amdlibOFFSETY_NOT_CALIBRATED};
-
-
-
- /* Identify the RAW and CALIB frames in the input frameset */
- cpl_ensure_code(amber_dfs_set_groups(frameset) == CPL_ERROR_NONE,
- cpl_error_get_code());
-
- cpl_msg_info (cpl_func, "Extracting the required frames");
-
- cpl_msg_indent_more();
-
- /* GET THE REQUIRED FRAMES */
- flatfield = cpl_frameset_find_const( frameset, "AMBER_FLATFIELD" );
- if (flatfield == NULL) {
- return (int)cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
- "SOF does not have a flatfield tagged AMBER_FLATFIELD");
- }
- else {
- cpl_msg_info (cpl_func, "AMBER_FLATFIELD found: %s",
- cpl_frame_get_filename(flatfield));
- }
-
- badpixel = cpl_frameset_find_const( frameset, "AMBER_BADPIX" );
- if (badpixel == NULL) {
- return (int)cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
- "SOF does not have a badpixel mask tagged AMBER_BADPIX");
- }
- else {
- cpl_msg_info (cpl_func, "AMBER_BADPIX found: %s",
- cpl_frame_get_filename(badpixel));
- }
-
- wave3tel1 = cpl_frameset_find_const( frameset, "AMBER_3WAVE" );
- if (wave3tel1 == NULL) {
- return (int)cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
- "SOF does not have all 4 images tagged AMBER_3WAVE");
- }
- else {
- cpl_msg_info (cpl_func, "AMBER_3WAVE found: %s",
- cpl_frame_get_filename(wave3tel1));
- }
-
- wave3tel2 = cpl_frameset_find_const( frameset, NULL );
- if (wave3tel2 == NULL) {
- return (int)cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
- "SOF does not have all 4 images tagged AMBER_3WAVE");
- }
- else {
- cpl_msg_info (cpl_func, "AMBER_3WAVE found: %s",
- cpl_frame_get_filename(wave3tel2));
- }
-
- wave3tel3 = cpl_frameset_find_const( frameset, NULL );
- if (wave3tel3 == NULL) {
- return (int)cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
- "SOF does not have all 4 images tagged AMBER_3WAVE");
- }
- else {
- cpl_msg_info (cpl_func, "AMBER_3WAVE found: %s",
- cpl_frame_get_filename(wave3tel3));
- }
-
- wave3tel4 = cpl_frameset_find_const( frameset, NULL );
- if (wave3tel4 == NULL) {
- return (int)cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
- "SOF does not have all 4 images tagged AMBER_3WAVE");
- }
- else {
- cpl_msg_info (cpl_func, "AMBER_3WAVE found: %s",
- cpl_frame_get_filename(wave3tel4));
- }
-
- cpl_msg_indent_less();
-
- cpl_msg_info (cpl_func, "Computing the spectral calibration for 3 Telecopes");
-
- cpl_msg_info(cpl_func," ");
-
- if (amdlibComputeSpectralCalibration3T(
- cpl_frame_get_filename(badpixel),
- cpl_frame_get_filename(flatfield),
- cpl_frame_get_filename(wave3tel1),
- cpl_frame_get_filename(wave3tel2),
- cpl_frame_get_filename(wave3tel3),
- cpl_frame_get_filename(wave3tel4),
- spectralOffsets)
- != amdlibSUCCESS){
- return (int)cpl_error_set_message(cpl_func, CPL_ERROR_UNSPECIFIED,
- "Amdlib failed to compute the spectral calibration");
- }
- else
- {
- cpl_msg_info(cpl_func," ");
- cpl_msg_info(cpl_func,"Computed spectral offsets: ");
- cpl_msg_indent_more();
- cpl_msg_info(cpl_func,"Photometric 1 = %f, ", spectralOffsets[0]);
- cpl_msg_info(cpl_func,"Photometric 2 = %f, ", spectralOffsets[1]);
- cpl_msg_info(cpl_func,"Photometric 3 = %f, ", spectralOffsets[2]);
- cpl_msg_indent_less();
- }
-
- /* Add a QC parameter */
- applist=cpl_propertylist_new();
- /* Add the product category */
- cpl_propertylist_append_string(applist, CPL_DFS_PRO_CATG,
- "AMBER_SPECTRAL_CALIBRATION");
-
-
-
- cpl_propertylist_append_double(applist, "ESO QC P1 OFFSETY", spectralOffsets[0] );
- cpl_propertylist_append_double(applist, "ESO QC P2 OFFSETY", spectralOffsets[1] );
- cpl_propertylist_append_double(applist, "ESO QC P3 OFFSETY", spectralOffsets[2] );
-
-
- if(cpl_dfs_save_propertylist(frameset,
- NULL,
- parlist,
- frameset,
- NULL,
- "amber_spectral_calibration",
- applist,
- NULL,
- PACKAGE "/" PACKAGE_VERSION,
- "amber_spectral_calibration.fits")){
- /* Propagate the error */
- (void)cpl_error_set_where(cpl_func);
- }
-
- cpl_propertylist_delete(applist);
-
- return (int)cpl_error_get_code();
-}
-
diff --git a/recipes/amber_trf.c b/recipes/amber_trf.c
deleted file mode 100644
index 0d9e471..0000000
--- a/recipes/amber_trf.c
+++ /dev/null
@@ -1,339 +0,0 @@
-/* This file is part of the AMBER 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: agabasch $
- * $Date: 2011-09-26 12:54:06 $
- * $Revision: 1.11 $
- * $Name: not supported by cvs2svn $
- */
-
-
-/*
- * amber_trf.c
- *
- * Created on: Oct 21, 2009
- * Author: agabasch
- */
-
-
-/*-----------------------------------------------------------------------------
- Includes
- -----------------------------------------------------------------------------*/
-#include <config.h>
-#include <cpl.h>
-#include "amber_dfs.h"
-#include "string.h"
-#include "esolibTransferfunction.h"
-
-/*-----------------------------------------------------------------------------
- Private function prototypes
- -----------------------------------------------------------------------------*/
-static int amber_trf_create(cpl_plugin *);
-static int amber_trf_exec(cpl_plugin *);
-static int amber_trf_destroy(cpl_plugin *);
-static int amber_trf(cpl_frameset *, cpl_parameterlist *);
-
-/*-----------------------------------------------------------------------------
- Static variables
- -----------------------------------------------------------------------------*/
-
-static char amber_trf_man[]=
- "This recipe calculates the transfer function of Amber\n"
- "\n"
- "Input files:\n\n"
- " DO category: Type: Explanation: Required:\n"
- " CALIB_REDUCED Products Calibrator frame \n"
- " or Y\n"
- " CALIB_REDUCED_FILTERED Products Calibrator frame \n\n"
- " CALIB_DATABASE_J Calib J-Band Calibrator database \n"
- " and/or \n"
- " CALIB_DATABASE_H Calib H-Band Calibrator database Y\n"
- " and/or \n"
- " CALIB_DATABASE_K Calib K-Band Calibrator database\n\n"
- "Output files:\n\n"
- " DO category: Data type: Explanation:\n"
- " AMBER_TRF_J OI-fits table Transfer Function \n"
- " and/or \n"
- " AMBER_TRF_H OI-fits table Transfer Function \n"
- " and/or \n"
- " AMBER_TRF_K OI-fits table Transfer Function \n\n";
-
-/*-----------------------------------------------------------------------------
- Function code
- -----------------------------------------------------------------------------*/
-
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Build the list of available plugins, for this module.
- @param list the plugin list
- @return 0 if everything is ok, 1 otherwise
- @note Only this function is exported
-
- Create the recipe instance and make it available to the application using the
- interface.
- */
-/*----------------------------------------------------------------------------*/
-int cpl_plugin_get_info(cpl_pluginlist * list)
-{
- cpl_recipe * recipe = cpl_calloc(1, sizeof *recipe );
- cpl_plugin * plugin = &recipe->interface;
-
- if (cpl_plugin_init(plugin,
- CPL_PLUGIN_API,
- AMBER_BINARY_VERSION,
- CPL_PLUGIN_TYPE_RECIPE,
- "amber_trf",
- "AMBER Derives the transfer function",
- amber_trf_man,
- "Armin Gabasch",
- PACKAGE_BUGREPORT,
- "GPL",
- amber_trf_create,
- amber_trf_exec,
- amber_trf_destroy)) {
- cpl_msg_error(cpl_func, "Plugin initialization failed");
- (void)cpl_error_set_where(cpl_func);
- return 1;
- }
-
- if (cpl_pluginlist_append(list, plugin)) {
- cpl_msg_error(cpl_func, "Error adding plugin to list");
- (void)cpl_error_set_where(cpl_func);
- return 1;
- }
-
- 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 amber_trf_create(cpl_plugin * plugin)
-{
- cpl_recipe * recipe;
- /*cpl_parameter * p;*/
-
- /* Do not create the recipe if an error code is already set */
- if (cpl_error_get_code() != CPL_ERROR_NONE) {
- cpl_msg_error(cpl_func, "%s():%d: An error is already set: %s",
- cpl_func, __LINE__, cpl_error_get_where());
- return (int)cpl_error_get_code();
- }
-
- if (plugin == NULL) {
- cpl_msg_error(cpl_func, "Null plugin");
- cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
- }
-
- /* Verify plugin type */
- if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
- cpl_msg_error(cpl_func, "Plugin is not a recipe");
- cpl_ensure_code(0, (int)CPL_ERROR_TYPE_MISMATCH);
- }
-
- /* Get the recipe */
- recipe = (cpl_recipe *)plugin;
-
- /* Create the parameters list in the cpl_recipe object */
- recipe->parameters = cpl_parameterlist_new();
- if (recipe->parameters == NULL) {
- cpl_msg_error(cpl_func, "Parameter list allocation failed");
- cpl_ensure_code(0, (int)CPL_ERROR_ILLEGAL_OUTPUT);
- }
-
- /* Fill the parameters list */
-
-
- return 0;
-}
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Execute the plugin instance given by the interface
- @param plugin the plugin
- @return 0 if everything is ok
- */
-/*----------------------------------------------------------------------------*/
-static int amber_trf_exec(cpl_plugin * plugin)
-{
-
- cpl_recipe * recipe;
- int recipe_status;
- cpl_errorstate initial_errorstate = cpl_errorstate_get();
-
- /* Return immediately if an error code is already set */
- if (cpl_error_get_code() != CPL_ERROR_NONE) {
- cpl_msg_error(cpl_func, "%s():%d: An error is already set: %s",
- cpl_func, __LINE__, cpl_error_get_where());
- return (int)cpl_error_get_code();
- }
-
- if (plugin == NULL) {
- cpl_msg_error(cpl_func, "Null plugin");
- cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
- }
-
- /* Verify plugin type */
- if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
- cpl_msg_error(cpl_func, "Plugin is not a recipe");
- cpl_ensure_code(0, (int)CPL_ERROR_TYPE_MISMATCH);
- }
-
- /* Get the recipe */
- recipe = (cpl_recipe *)plugin;
-
- /* Verify parameter and frame lists */
- if (recipe->parameters == NULL) {
- cpl_msg_error(cpl_func, "Recipe invoked with NULL parameter list");
- cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
- }
- if (recipe->frames == NULL) {
- cpl_msg_error(cpl_func, "Recipe invoked with NULL frame set");
- cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
- }
-
- /* Invoke the recipe */
- recipe_status = amber_trf(recipe->frames, recipe->parameters);
-
- /* Ensure DFS-compliance of the products */
- if (cpl_dfs_update_product_header(recipe->frames)) {
- if (!recipe_status) recipe_status = (int)cpl_error_get_code();
- }
-
- if (!cpl_errorstate_is_equal(initial_errorstate)) {
- /* Dump the error history since recipe execution start.
- At this point the recipe cannot recover from the error */
- cpl_errorstate_dump(initial_errorstate, CPL_FALSE, NULL);
- }
-
- return recipe_status;
-}
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Destroy what has been created by the 'create' function
- @param plugin the plugin
- @return 0 if everything is ok
- */
-/*----------------------------------------------------------------------------*/
-static int amber_trf_destroy(cpl_plugin * plugin)
-{
- cpl_recipe * recipe;
-
- if (plugin == NULL) {
- cpl_msg_error(cpl_func, "Null plugin");
- cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
- }
-
- /* Verify plugin type */
- if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
- cpl_msg_error(cpl_func, "Plugin is not a recipe");
- cpl_ensure_code(0, (int)CPL_ERROR_TYPE_MISMATCH);
- }
-
- /* Get the recipe */
- recipe = (cpl_recipe *)plugin;
-
- cpl_parameterlist_delete(recipe->parameters);
-
- return 0;
-}
-/*----------------------------------------------------------------------------*/
-/**
- @brief Interpret the command line options and execute the data processing
- @param frameset the frames list
- @param parlist the parameters list
- @return 0 if everything is ok
- */
-/*----------------------------------------------------------------------------*/
-static int amber_trf(cpl_frameset * frameset, cpl_parameterlist * parlist)
-{
- cpl_errorstate prestate=0;
- cpl_frame * cur_frame=NULL;
- int frameset_orig_length=0;
- int i=0;
- prestate = cpl_errorstate_get();
-
- amber_dfs_set_groups(frameset);
-
- frameset_orig_length=cpl_frameset_get_size(frameset);
-
-
- if (!frameset_orig_length)
- {
- cpl_msg_error(cpl_func,"No file found in the SOF!!");
- return -1;
- }
-
- if(cpl_frameset_find( frameset, "CALIB_REDUCED" )==NULL &&
- cpl_frameset_find( frameset, "CALIB_REDUCED_FILTERED")==NULL )
- {
- cpl_msg_error(cpl_func,"No file tagged CALIB_REDUCED or "
- "CALIB_REDUCED_FILTERED found in the SOF!!");
- return -1;
- }
-
- for(i=0; i<frameset_orig_length; i++){
- cur_frame=cpl_frameset_get_frame(frameset,i);
- if (!strcmp(cpl_frame_get_tag(cur_frame), "CALIB_REDUCED"))
- {
- amber_TransferFunction("amber_trf",
- cpl_frame_get_filename(cur_frame), parlist, frameset);
- }
-
- else if (!strcmp(cpl_frame_get_tag(cur_frame),
- "CALIB_REDUCED_FILTERED"))
- {
- amber_TransferFunction("amber_trf",
- cpl_frame_get_filename(cur_frame), parlist, frameset);
- }
-
- }
-
- /*
-
- Get first valid frame
- cur_frame = cpl_frameset_find( frameset, "CALIB_REDUCED" );
- if (cur_frame==NULL)
- {
- cur_frame = cpl_frameset_find( frameset, "CALIB_REDUCED_FILTERED" );
- }
-
-
-
- amber_TransferFunction("amber_trf",cpl_frame_get_filename(cur_frame),
- parlist, frameset);
- */
-
- if (!cpl_errorstate_is_equal(prestate)){
- /*cpl_errorstate_dump(prestate, CPL_FALSE, NULL);*/
- return cpl_error_set_message(cpl_func, cpl_error_get_code(),
- "Recipe failed");
-
-
- }
- return 0;
-
-}
diff --git a/regtests/Makefile.am b/regtests/Makefile.am
deleted file mode 100644
index 8abab04..0000000
--- a/regtests/Makefile.am
+++ /dev/null
@@ -1,30 +0,0 @@
-## 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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
deleted file mode 100644
index 6c830d5..0000000
--- a/regtests/Makefile.in
+++ /dev/null
@@ -1,614 +0,0 @@
-# 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/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/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@
-AMBER_BINARY_AGE = @AMBER_BINARY_AGE@
-AMBER_BINARY_VERSION = @AMBER_BINARY_VERSION@
-AMBER_INCLUDES = @AMBER_INCLUDES@
-AMBER_INTERFACE_AGE = @AMBER_INTERFACE_AGE@
-AMBER_LDFLAGS = @AMBER_LDFLAGS@
-AMBER_MAJOR_VERSION = @AMBER_MAJOR_VERSION@
-AMBER_MICRO_VERSION = @AMBER_MICRO_VERSION@
-AMBER_MINOR_VERSION = @AMBER_MINOR_VERSION@
-AMBER_VERSION = @AMBER_VERSION@
-AMTAR = @AMTAR@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFITSIO_INCLUDES = @CFITSIO_INCLUDES@
-CFITSIO_LDFLAGS = @CFITSIO_LDFLAGS@
-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@
-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@
-FFTWF_INCLUDES = @FFTWF_INCLUDES@
-FFTWF_LDFLAGS = @FFTWF_LDFLAGS@
-FFTW_INCLUDES = @FFTW_INCLUDES@
-FFTW_LDFLAGS = @FFTW_LDFLAGS@
-FGREP = @FGREP@
-GREP = @GREP@
-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@
-LIBAMBER = @LIBAMBER@
-LIBCEXT = @LIBCEXT@
-LIBCFITSIO = @LIBCFITSIO@
-LIBCPLCORE = @LIBCPLCORE@
-LIBCPLDFS = @LIBCPLDFS@
-LIBCPLDRS = @LIBCPLDRS@
-LIBCPLUI = @LIBCPLUI@
-LIBFFTW = @LIBFFTW@
-LIBFFTWF = @LIBFFTWF@
-LIBOBJS = @LIBOBJS@
-LIBPTHREAD = @LIBPTHREAD@
-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@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PRODUCT_DID = @PRODUCT_DID@
-PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
-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_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@
-lt_ECHO = @lt_ECHO@
-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@
-scriptsdir = @scriptsdir@
-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@
-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
deleted file mode 100644
index d46c913..0000000
--- a/regtests/tests/Makefile.am
+++ /dev/null
@@ -1,77 +0,0 @@
-## 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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
-
-regcheck:
- @if test ! -d "${SOF_DATA}" ; then \
- echo "ERROR: The SOF_DATA environment variable was not set to point to the regression data." 1>&2 ; \
- exit 1 ; \
- fi
- 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
-
-check:
- @if test -d /NRI && (echo `hostname` | grep '^vm.*nri$$' > /dev/null 2>&1) && (echo `pwd` | grep '^/disk.*/NRI/DFS' > /dev/null 2>&1) ; then \
- echo "Detected NRI environment, will run regression tests automatically..." ; \
- $(MAKE) $(AM_MAKEFLAGS) regcheck ; \
- else \
- if test x"${FORCE_REGCHECK}" = xyes ; then \
- $(MAKE) $(AM_MAKEFLAGS) regcheck ; \
- else \
- echo "Skipping regression tests. To execute them, either run 'make regcheck' or set the environment variable FORCE_REGCHECK=yes." ; \
- fi ; \
- fi
-
-if PURIFY
-include $(top_builddir)/Makefile.purify
-endif
-
-
-
-
-
diff --git a/regtests/tests/Makefile.in b/regtests/tests/Makefile.in
deleted file mode 100644
index 4217e69..0000000
--- a/regtests/tests/Makefile.in
+++ /dev/null
@@ -1,451 +0,0 @@
-# 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/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/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@
-AMBER_BINARY_AGE = @AMBER_BINARY_AGE@
-AMBER_BINARY_VERSION = @AMBER_BINARY_VERSION@
-AMBER_INCLUDES = @AMBER_INCLUDES@
-AMBER_INTERFACE_AGE = @AMBER_INTERFACE_AGE@
-AMBER_LDFLAGS = @AMBER_LDFLAGS@
-AMBER_MAJOR_VERSION = @AMBER_MAJOR_VERSION@
-AMBER_MICRO_VERSION = @AMBER_MICRO_VERSION@
-AMBER_MINOR_VERSION = @AMBER_MINOR_VERSION@
-AMBER_VERSION = @AMBER_VERSION@
-AMTAR = @AMTAR@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFITSIO_INCLUDES = @CFITSIO_INCLUDES@
-CFITSIO_LDFLAGS = @CFITSIO_LDFLAGS@
-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@
-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@
-FFTWF_INCLUDES = @FFTWF_INCLUDES@
-FFTWF_LDFLAGS = @FFTWF_LDFLAGS@
-FFTW_INCLUDES = @FFTW_INCLUDES@
-FFTW_LDFLAGS = @FFTW_LDFLAGS@
-FGREP = @FGREP@
-GREP = @GREP@
-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@
-LIBAMBER = @LIBAMBER@
-LIBCEXT = @LIBCEXT@
-LIBCFITSIO = @LIBCFITSIO@
-LIBCPLCORE = @LIBCPLCORE@
-LIBCPLDFS = @LIBCPLDFS@
-LIBCPLDRS = @LIBCPLDRS@
-LIBCPLUI = @LIBCPLUI@
-LIBFFTW = @LIBFFTW@
-LIBFFTWF = @LIBFFTWF@
-LIBOBJS = @LIBOBJS@
-LIBPTHREAD = @LIBPTHREAD@
-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@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PRODUCT_DID = @PRODUCT_DID@
-PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
-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_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@
-lt_ECHO = @lt_ECHO@
-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@
-scriptsdir = @scriptsdir@
-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@
-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
-
-regcheck:
- @if test ! -d "${SOF_DATA}" ; then \
- echo "ERROR: The SOF_DATA environment variable was not set to point to the regression data." 1>&2 ; \
- exit 1 ; \
- fi
- 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
-
-check:
- @if test -d /NRI && (echo `hostname` | grep '^vm.*nri$$' > /dev/null 2>&1) && (echo `pwd` | grep '^/disk.*/NRI/DFS' > /dev/null 2>&1) ; then \
- echo "Detected NRI environment, will run regression tests automatically..." ; \
- $(MAKE) $(AM_MAKEFLAGS) regcheck ; \
- else \
- if test x"${FORCE_REGCHECK}" = xyes ; then \
- $(MAKE) $(AM_MAKEFLAGS) regcheck ; \
- else \
- echo "Skipping regression tests. To execute them, either run 'make regcheck' or set the environment variable FORCE_REGCHECK=yes." ; \
- fi ; \
- 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/scripts/Makefile.am b/scripts/Makefile.am
deleted file mode 100644
index 878fc66..0000000
--- a/scripts/Makefile.am
+++ /dev/null
@@ -1,32 +0,0 @@
-## 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 = Makefile.in
-
-endif
-
-dist_scripts_SCRIPTS =
-
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
deleted file mode 100644
index b4f1a74..0000000
--- a/scripts/Makefile.in
+++ /dev/null
@@ -1,475 +0,0 @@
-# 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 = scripts
-DIST_COMMON = $(dist_scripts_SCRIPTS) $(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/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/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)$(scriptsdir)"
-SCRIPTS = $(dist_scripts_SCRIPTS)
-SOURCES =
-DIST_SOURCES =
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMBER_BINARY_AGE = @AMBER_BINARY_AGE@
-AMBER_BINARY_VERSION = @AMBER_BINARY_VERSION@
-AMBER_INCLUDES = @AMBER_INCLUDES@
-AMBER_INTERFACE_AGE = @AMBER_INTERFACE_AGE@
-AMBER_LDFLAGS = @AMBER_LDFLAGS@
-AMBER_MAJOR_VERSION = @AMBER_MAJOR_VERSION@
-AMBER_MICRO_VERSION = @AMBER_MICRO_VERSION@
-AMBER_MINOR_VERSION = @AMBER_MINOR_VERSION@
-AMBER_VERSION = @AMBER_VERSION@
-AMTAR = @AMTAR@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFITSIO_INCLUDES = @CFITSIO_INCLUDES@
-CFITSIO_LDFLAGS = @CFITSIO_LDFLAGS@
-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@
-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@
-FFTWF_INCLUDES = @FFTWF_INCLUDES@
-FFTWF_LDFLAGS = @FFTWF_LDFLAGS@
-FFTW_INCLUDES = @FFTW_INCLUDES@
-FFTW_LDFLAGS = @FFTW_LDFLAGS@
-FGREP = @FGREP@
-GREP = @GREP@
-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@
-LIBAMBER = @LIBAMBER@
-LIBCEXT = @LIBCEXT@
-LIBCFITSIO = @LIBCFITSIO@
-LIBCPLCORE = @LIBCPLCORE@
-LIBCPLDFS = @LIBCPLDFS@
-LIBCPLDRS = @LIBCPLDRS@
-LIBCPLUI = @LIBCPLUI@
-LIBFFTW = @LIBFFTW@
-LIBFFTWF = @LIBFFTWF@
-LIBOBJS = @LIBOBJS@
-LIBPTHREAD = @LIBPTHREAD@
-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@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PRODUCT_DID = @PRODUCT_DID@
-PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
-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_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@
-lt_ECHO = @lt_ECHO@
-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@
-scriptsdir = @scriptsdir@
-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@
-AUTOMAKE_OPTIONS = 1.8 foreign
-DISTCLEANFILES = *~
- at MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = Makefile.in
-dist_scripts_SCRIPTS =
-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 scripts/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign scripts/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-dist_scriptsSCRIPTS: $(dist_scripts_SCRIPTS)
- @$(NORMAL_INSTALL)
- test -z "$(scriptsdir)" || $(MKDIR_P) "$(DESTDIR)$(scriptsdir)"
- @list='$(dist_scripts_SCRIPTS)'; test -n "$(scriptsdir)" || list=; \
- for p in $$list; do \
- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
- done | \
- sed -e 'p;s,.*/,,;n' \
- -e 'h;s|.*|.|' \
- -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
- $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
- { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
- if ($$2 == $$4) { files[d] = files[d] " " $$1; \
- if (++n[d] == $(am__install_max)) { \
- print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
- else { print "f", d "/" $$4, $$1 } } \
- END { for (d in files) print "f", d, files[d] }' | \
- while read type dir files; do \
- if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
- test -z "$$files" || { \
- echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(scriptsdir)$$dir'"; \
- $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(scriptsdir)$$dir" || exit $$?; \
- } \
- ; done
-
-uninstall-dist_scriptsSCRIPTS:
- @$(NORMAL_UNINSTALL)
- @list='$(dist_scripts_SCRIPTS)'; test -n "$(scriptsdir)" || exit 0; \
- files=`for p in $$list; do echo "$$p"; done | \
- sed -e 's,.*/,,;$(transform)'`; \
- test -n "$$list" || exit 0; \
- echo " ( cd '$(DESTDIR)$(scriptsdir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(scriptsdir)" && rm -f $$files
-
-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 $(SCRIPTS)
-installdirs:
- for dir in "$(DESTDIR)$(scriptsdir)"; 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 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-dist_scriptsSCRIPTS
-
-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-dist_scriptsSCRIPTS
-
-.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-dist_scriptsSCRIPTS \
- 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 uninstall-dist_scriptsSCRIPTS
-
-
-# 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
deleted file mode 100755
index 76653d2..0000000
--- a/setup
+++ /dev/null
@@ -1,88 +0,0 @@
-#! /bin/sh
-# This file is part of the AMBER Pipeline
-# Copyright (C) 2002-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: agabasch $
-# $Date: 2012-01-09 12:59:14 $
-# $Revision: 1.8 $
-# $Name: not supported by cvs2svn $
-
-
-# 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
-}
-
-
-warning () {
- echo "Warning: $cmd: $1"
- exit 1
-}
-
-
-#
-# Main
-#
-
-#Export variables if not set
-#if [ -z "$QFITSDIR" ] ; then export QFITSDIR=$DFS_HOME ; fi
-#if [ -z "$CFITSIODIR" ] ; then export CFITSIODIR=$VLTROOT ; fi
-#if [ -z "$CC" ] ; then export CC=gcc ; fi
-
-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
deleted file mode 100644
index 4e6128f..0000000
--- a/tests/Makefile.am
+++ /dev/null
@@ -1,48 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-## This file is part of the AMBER Pipeline Library
-## 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 = Makefile.in
-
-endif
-
-
-LIBAMBER = $(top_builddir)/amber/libamber.la
-
-AM_CPPFLAGS = -I$(top_builddir)/amber
-LDADD = $(LIBAMBER) $(LIBCPLCORE) $(LIBCPLUI)
-
-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
deleted file mode 100644
index 5e16152..0000000
--- a/tests/Makefile.in
+++ /dev/null
@@ -1,532 +0,0 @@
-# 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/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/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@
-AMBER_BINARY_AGE = @AMBER_BINARY_AGE@
-AMBER_BINARY_VERSION = @AMBER_BINARY_VERSION@
-AMBER_INCLUDES = @AMBER_INCLUDES@
-AMBER_INTERFACE_AGE = @AMBER_INTERFACE_AGE@
-AMBER_LDFLAGS = @AMBER_LDFLAGS@
-AMBER_MAJOR_VERSION = @AMBER_MAJOR_VERSION@
-AMBER_MICRO_VERSION = @AMBER_MICRO_VERSION@
-AMBER_MINOR_VERSION = @AMBER_MINOR_VERSION@
-AMBER_VERSION = @AMBER_VERSION@
-AMTAR = @AMTAR@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFITSIO_INCLUDES = @CFITSIO_INCLUDES@
-CFITSIO_LDFLAGS = @CFITSIO_LDFLAGS@
-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@
-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@
-FFTWF_INCLUDES = @FFTWF_INCLUDES@
-FFTWF_LDFLAGS = @FFTWF_LDFLAGS@
-FFTW_INCLUDES = @FFTW_INCLUDES@
-FFTW_LDFLAGS = @FFTW_LDFLAGS@
-FGREP = @FGREP@
-GREP = @GREP@
-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@
-LIBAMBER = $(top_builddir)/amber/libamber.la
-LIBCEXT = @LIBCEXT@
-LIBCFITSIO = @LIBCFITSIO@
-LIBCPLCORE = @LIBCPLCORE@
-LIBCPLDFS = @LIBCPLDFS@
-LIBCPLDRS = @LIBCPLDRS@
-LIBCPLUI = @LIBCPLUI@
-LIBFFTW = @LIBFFTW@
-LIBFFTWF = @LIBFFTWF@
-LIBOBJS = @LIBOBJS@
-LIBPTHREAD = @LIBPTHREAD@
-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@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PRODUCT_DID = @PRODUCT_DID@
-PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
-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_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@
-lt_ECHO = @lt_ECHO@
-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@
-scriptsdir = @scriptsdir@
-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@
-AUTOMAKE_OPTIONS = 1.8 foreign
-DISTCLEANFILES = *~
- at MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = Makefile.in
-AM_CPPFLAGS = -I$(top_builddir)/amber
-LDADD = $(LIBAMBER) $(LIBCPLCORE) $(LIBCPLUI)
-
-# 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-astro/packages/cpl-plugin-amber.git
More information about the Debian-astro-commits
mailing list