mirror of
https://github.com/eddyem/apogee_control.git
synced 2025-12-06 02:35:16 +03:00
cloned
This commit is contained in:
parent
0188a9ad35
commit
4776ef09d1
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
.hg*
|
||||
*.tgz
|
||||
*~
|
||||
72
CMakeLists.txt
Normal file
72
CMakeLists.txt
Normal file
@ -0,0 +1,72 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
set(PROJ apogee_control)
|
||||
project(${PROJ})
|
||||
set(VERSION "0.2.0")
|
||||
set(CMAKE_COLOR_MAKEFILE ON)
|
||||
#set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
if(DEFINED DEBUG)
|
||||
add_definitions(-DEBUG)
|
||||
endif()
|
||||
if(DEFINED CMAKE_INSTALL_PREFIX AND CMAKE_INSTALL_PREFIX MATCHES "/usr/local")
|
||||
set(CMAKE_INSTALL_PREFIX "/usr")
|
||||
endif()
|
||||
message("Install dir prefix: ${CMAKE_INSTALL_PREFIX}")
|
||||
if(NOT DEFINED LOCALEDIR)
|
||||
set(LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale)
|
||||
endif()
|
||||
set(SOURCES takepic.c usage.c camtools.c am.c)
|
||||
if(NOT DEFINED NOBTA)
|
||||
set(SOURCES ${SOURCES} bta_print.c)
|
||||
add_definitions(-DUSE_BTA)
|
||||
endif()
|
||||
if(DEFINED TELALT)
|
||||
add_definitions(-DTELALT=${TELALT})
|
||||
endif()
|
||||
if(DEFINED TELLONG)
|
||||
add_definitions(-DTELLONG=${TELLONG})
|
||||
endif()
|
||||
if(DEFINED TELLAT)
|
||||
add_definitions(-DTELLAT=${TELLAT})
|
||||
endif()
|
||||
set(LCPATH locale/ru)
|
||||
set(CFLAGS -O3 -Wall -Werror -W -std=gnu99)
|
||||
set(PO_FILE ${LCPATH}/messages.po)
|
||||
set(MO_FILE ${LCPATH}/LC_MESSAGES/${PROJ}.mo)
|
||||
set(RU_FILE ${LCPATH}/ru.po)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
set(MODULES cfitsio>=3.0 apogeec>=1.71)
|
||||
if(DEFINED USEPNG)
|
||||
set(MODULES ${MODULES} libpng>=1.2)
|
||||
add_definitions(-DUSEPNG)
|
||||
endif()
|
||||
pkg_check_modules(${PROJ} REQUIRED ${MODULES})
|
||||
if(DEFINED USERAW)
|
||||
add_definitions(-DUSERAW)
|
||||
endif()
|
||||
add_executable(${PROJ} ${SOURCES} ${PO_FILE} ${MO_FILE})
|
||||
target_link_libraries(${PROJ} ${${PROJ}_LIBRARIES} -lm)
|
||||
include_directories(${${PROJ}_INCLUDE_DIRS})
|
||||
link_directories(${${PROJ}_LIBRARY_DIRS})
|
||||
add_definitions(${CFLAGS}
|
||||
-DLOCALEDIR=\"${LOCALEDIR}\"
|
||||
-DPACKAGE_VERSION=\"${VERSION}\" -DGETTEXT_PACKAGE=\"${PROJ}\")
|
||||
|
||||
# Installation of the program
|
||||
INSTALL(FILES ${MO_FILE} DESTINATION "share/locale/ru/LC_MESSAGES")
|
||||
INSTALL(TARGETS ${PROJ} DESTINATION "bin")
|
||||
|
||||
find_package(Gettext REQUIRED)
|
||||
find_program(GETTEXT_XGETTEXT_EXECUTABLE xgettext)
|
||||
if(NOT GETTEXT_XGETTEXT_EXECUTABLE OR NOT GETTEXT_MSGFMT_EXECUTABLE)
|
||||
message(FATAL_ERROR "xgettext not found")
|
||||
endif()
|
||||
add_custom_command(
|
||||
OUTPUT ${PO_FILE}
|
||||
COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} --from-code=koi8-r ${SOURCES} -c -k_ -kN_ -o ${PO_FILE}
|
||||
COMMAND sed 's/charset=UTF-8/charset=koi8-r/' ${PO_FILE} | enconv > tmp && mv -f tmp ${PO_FILE}
|
||||
COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} -Uis ${RU_FILE} ${PO_FILE}
|
||||
DEPENDS ${SOURCES})
|
||||
add_custom_command(
|
||||
OUTPUT ${MO_FILE}
|
||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} ${RU_FILE} -o ${MO_FILE}
|
||||
DEPENDS ${RU_FILE})
|
||||
22
README
Normal file
22
README
Normal file
@ -0,0 +1,22 @@
|
||||
1. cmake .
|
||||
2. make
|
||||
3. [make install] or just copy file takepic wherever you want
|
||||
|
||||
File bta_print.c needed to fill specific FITS keys for BTA telescope
|
||||
If your want use this outside SAO RAS localnet, write:
|
||||
1. cmake -DNOBTA=1 .
|
||||
2. make ...
|
||||
|
||||
|
||||
If you wish to save not only FITS, define:
|
||||
* -DUSERAW=1 to save raw data
|
||||
* -DUSEPNG=1 to save png data
|
||||
|
||||
define
|
||||
* -DEBUG=1 for debug info
|
||||
|
||||
By default observatory location is SAO RAS, to change coordinates define:
|
||||
* -DTELLAT=lattitude in degr
|
||||
* -DTELLONG=longitude in degr
|
||||
* -DTELALT=altitude in m
|
||||
|
||||
124
README-func
Normal file
124
README-func
Normal file
@ -0,0 +1,124 @@
|
||||
Сишные функции вызываются через посредника libapogee.cpp, который и занимается трансляцией сишных в плюсовые функции
|
||||
|
||||
Пока есть следующее:
|
||||
|
||||
****** int ApnGlueOpen(unsigned int N);
|
||||
Открывает камеру номер N, если камера одна, писать N=1
|
||||
Возвращает 0 в случае удачи
|
||||
|
||||
****** void ApnGlueGetMaxValues (double *exptime, int *roiw, int *roih, int *osw,
|
||||
****** int *osh, int *binw, int *binh, int *shutter, double *mintemp);
|
||||
Получает предельные значения, допустимые для камеры (по порядку аргументов функции):
|
||||
время экспозиции, габариты изображения, габариты оверскана, максимальный биннинг,
|
||||
есть ли затвор (==1 пока), минимальная температура (пока -30)
|
||||
|
||||
****** int ApnGlueSetExpGeom (int roiw, int roih, int osw, int osh, int binw,
|
||||
****** int binh, int roix, int roiy, int *impixw, int *impixh, char whynot[]);
|
||||
Устанавливает геометрию для экспозиции:
|
||||
габариты изображения, габариты оверскана (если его надо считывать), биннинг,
|
||||
левый верхний угол подызображения, возвращает реальные размеры изображения (с учетом биннинга)
|
||||
и строку с сообщением об ошибке (если не получилось)
|
||||
Возвращает 0 в случае успеха
|
||||
|
||||
****** void ApnGlueExpAbort(void);
|
||||
Прервать экспозицию
|
||||
|
||||
****** int ApnGlueStartExp (double *exptime, int shutter);
|
||||
Начать экспозицию с временем exptime (если оно слишком мало, в него запишется реальное время экспозиции),
|
||||
shutter==1 - затвор откроется
|
||||
Возвращает 0 в случае успеха
|
||||
|
||||
****** int ApnGlueExpDone(void);
|
||||
Возвращает 1, если экспозиция завершена
|
||||
|
||||
|
||||
****** int ApnGlueReadPixels (unsigned short *buf, int nbuf, char whynot[]);
|
||||
Считывает накопленное изображение в буфер buf длиной nbuf, в случае ошибки помещает сообщение в whynot
|
||||
Возвращает 0 в случае успеха
|
||||
|
||||
****** void ApnGlueSetTemp (double C);
|
||||
Устанавливает температуру чипа в С градусов цельсия
|
||||
|
||||
****** int ApnGlueGetTemp (double *Cp);
|
||||
Получает текущую температуру в Cp
|
||||
Возвращает статус системы охлаждения: 0 - выключено, 1 - доходит до заданной точки, 2 - на заданной точке
|
||||
|
||||
|
||||
****** void ApnGlueSetFan (int speed);
|
||||
Устанавливает скорость вращения вентилятора (0..3)
|
||||
|
||||
****** void ApnGlueGetName(char **sensor, char **camera);
|
||||
Возвращает имена сенсора и камеры (!!! не изменять эти величины)
|
||||
|
||||
|
||||
|
||||
========================= добавил ===============================
|
||||
|
||||
****** void ApnGlueReset();
|
||||
Полный сброс
|
||||
|
||||
****** void ApnGlueClose();
|
||||
Закрыть файл (например, чтобы переподключить камеру)
|
||||
|
||||
****** void ApnGluePauseTimer(int flag);
|
||||
Приостановить таймер (если flag == 1) или продолжить отсчет (если 0)
|
||||
|
||||
****** int ApnGlueStopExposure();
|
||||
Остановить экспозицию (но не очищать матрицу), 0 - если успешно
|
||||
|
||||
****** int ApnGluePowerDown();
|
||||
Перейти в спящий режим (возвращает 0, если успешно)
|
||||
|
||||
****** void ApnGluePowerResume();
|
||||
Проснуться
|
||||
|
||||
****** int ApnGlueReadShutter();
|
||||
Возвращает 1, если затвор открыт
|
||||
|
||||
****** void ApnGlueOpenShutter(int flag);
|
||||
Открыть/закрыть затвор (согласно флагу)
|
||||
|
||||
****** void ApnGlueDisablePostExpFlushing(int flag);
|
||||
Запретить/разрешить очистку после экспозиции
|
||||
|
||||
****** void ApnGluePreFlash(int flag);
|
||||
Установить (по умолчанию установлено)/сбросить ИК засветку перед экспозицией
|
||||
|
||||
****** void ApnGlueWriteCamMode(Apn_CameraMode CameraMode);
|
||||
Изменить режим работы камеры
|
||||
|
||||
****** void ApnGlueSetDatabits(Apn_Resolution BitResolution);
|
||||
Установить 12 или 16 бит АЦП
|
||||
|
||||
****** int ApnGlueReadSetPoint(double *temp, int *stat);
|
||||
Помещает в temp установочную температуру холодильника, в stat - +1, если
|
||||
температура достигнута. Возвращает 0, если холодильник выключен
|
||||
|
||||
****** double ApnGlueGetHotTemp();
|
||||
Возвращает температуру горячего спая
|
||||
|
||||
****** unsigned short ApnGlueGetSpeed();
|
||||
Получает скорость считывания
|
||||
|
||||
****** void ApnGlueSetSpeed(unsigned short Sp);
|
||||
Устанавливает скорость считывания
|
||||
|
||||
****** int ApnGlueWheelOpen(unsigned int id, Apn_Filter type);
|
||||
Инициализирует турель (id - номер или 1, если одна; type -тип)
|
||||
|
||||
****** void ApnGlueWheelClose();
|
||||
Отключает устройство турели
|
||||
|
||||
****** int ApnGlueWheelGetStatus();
|
||||
Возвращает статус (0 - готово, 1 - движется или отсутствует)
|
||||
|
||||
****** int ApnGlueWheelGetMaxPos();
|
||||
Получает максимальный номер номер позиции турели (отсчет - от ЕДИНИЦЫ!),
|
||||
возвращает 0 в случае успеха
|
||||
|
||||
****** int ApnGlueWheelSetPos(int pos);
|
||||
Устанавливает турель в позицию pos (отсчет - от ЕДИНИЦЫ!),
|
||||
возвращает 0 в случае успеха
|
||||
|
||||
****** int ApnGlueWheelGetPos();
|
||||
Возвращает текущую позицию или -1 в случае ошибки
|
||||
76
am.c
Normal file
76
am.c
Normal file
@ -0,0 +1,76 @@
|
||||
#include "takepic.h"
|
||||
//#define __USE_XOPEN
|
||||
//#include <math.h>
|
||||
static int main(int argc, char *argv[]) __attribute((unused));
|
||||
static void usage(void) __attribute((unused));
|
||||
#define inline
|
||||
#include "airmass.c"
|
||||
#undef inline
|
||||
|
||||
void calc_airmass(
|
||||
// in
|
||||
double daynum, // Day number from beginning of year, 0 = midnight Jan 1
|
||||
double h0,// Relative humidity in percent
|
||||
double p0, // local pressure in mmHg
|
||||
double t0, // temperature in kelvins
|
||||
double z, // zenith distance in degr
|
||||
// out
|
||||
double *am, // AIRMASS
|
||||
double *acd, // column density
|
||||
double *wcd, // water vapor column density
|
||||
double *wam // water vapor airmass
|
||||
){
|
||||
int i;
|
||||
double colz, col0, cosyearfrac, sinz, rmsl, bigrmsl,
|
||||
rjunk, coslatsq, lambda=5500., alt=TELALT,
|
||||
lat=TELLAT, betapoly[5]={-0.0065107, -4.5403e-06,
|
||||
3.6599e-07, -2.2174e-09, 7.9392e-12}, r1poly[11]={17.204, 8.9155e-03,
|
||||
-3.6420e-03, 2.5617e-05, 2.4796e-07, -1.2774e-08, 1.3017e-10,
|
||||
2.0151e-12, -2.6985e-14, -1.0397e-16, 1.4849e-18}, hvec[(NTLEVELS+1)]=
|
||||
{0., 11000., 20000., 32000., 47000., 52000., 61000., 79000., 88743.};
|
||||
p0 *= 101325. / 760.;
|
||||
relhumid = h0 / 100.;
|
||||
sinz=sin(z*DEG2RAD);
|
||||
cee=CONSTC*(2.87566E-4+134.12/(lambda*lambda)+3.777E8*pow(lambda, -4.));
|
||||
cosyearfrac=cos((daynum-202.)*(360.*DEG2RAD/365.));
|
||||
coslatsq=cos(lat*DEG2RAD);
|
||||
coslatsq*=coslatsq;
|
||||
rmsl=sqrt(((POLAR*POLAR*POLAR*POLAR)+(EQUATOR*EQUATOR*EQUATOR*EQUATOR-
|
||||
POLAR*POLAR*POLAR*POLAR)*coslatsq)/((POLAR*POLAR)+(EQUATOR*EQUATOR-
|
||||
POLAR*POLAR)*coslatsq));
|
||||
bigrmsl=(-STANDARDR02)/rmsl;
|
||||
/* Calculate bigrvec, the bigr at the bottom of each temperature layer */
|
||||
*bigrvec=(-STANDARDR02)/(rmsl+alt);
|
||||
rjunk=r1poly[10];
|
||||
for (i=9;i>=0;i--) rjunk=rjunk*lat+((i%2) ? r1poly[i]*cosyearfrac :
|
||||
r1poly[i]);
|
||||
bigrvec[1]=(-STANDARDR02)/(rmsl+rjunk*1000.);
|
||||
for (i=2;i<(NTLEVELS+1);i++) bigrvec[i]=hvec[i]+bigrmsl;
|
||||
|
||||
/* Set up our temperature profile for the troposphere/lower stratosphere */
|
||||
*betavec=betapoly[4];
|
||||
for (i=3;i>=0;i--) *betavec=*betavec*lat+((i%2) ? betapoly[i]*cosyearfrac :
|
||||
betapoly[i]);
|
||||
*betavec*=(-rmsl/bigrvec[1]);
|
||||
*tvec=t0;
|
||||
tvec[1]=t0+*betavec*(bigrvec[1]-*bigrvec);
|
||||
betavec[1]=(tvec[2]-tvec[1])/(bigrvec[2]-bigrvec[1]);
|
||||
|
||||
/* Compute the density at the bottom of each temperature layer */
|
||||
*rhovec=p0/(AIRCONSTANT*t0);
|
||||
for (i=0;i<(NTLEVELS-1);i++) rhovec[i+1]=frho(bigrvec[i+1]-bigrvec[i],
|
||||
rhovec[i], tvec[i], betavec[i]);
|
||||
|
||||
const6=musquare(*rhovec)*sinz*sinz/(*bigrvec*(*bigrvec)); /* for z */
|
||||
colz=qromb(columndensityint, *bigrvec, bigrvec[NTLEVELS], 1.E-8);
|
||||
const6=0.; /* equivalent to setting z = 0. */
|
||||
col0=qromb(columndensityint, *bigrvec, bigrvec[NTLEVELS], 1.E-8);
|
||||
*am = colz/col0; *acd = 0.1*colz;
|
||||
if(h0 < 0.1){ *wcd = 0.; *wam = 0.; return;}
|
||||
const7=relhumid/(bigrvec[2]-bigrvec[1]);
|
||||
const6=musquare(*rhovec)*sinz*sinz/(*bigrvec*(*bigrvec)); /* for z */
|
||||
colz=qromb(vaporcolumndensityint, *bigrvec, bigrvec[2], 1.E-8);
|
||||
const6=0.; /* equivalent to setting z = 0. */
|
||||
col0=qromb(vaporcolumndensityint, *bigrvec, bigrvec[2], 1.E-8);
|
||||
*wcd = 0.1*colz; *wam = colz/col0;
|
||||
}
|
||||
61
apogee_C_wrapper/CMakeLists.txt
Normal file
61
apogee_C_wrapper/CMakeLists.txt
Normal file
@ -0,0 +1,61 @@
|
||||
cmake_minimum_required(VERSION 2.4.7)
|
||||
set(CMAKE_COLOR_MAKEFILE ON)
|
||||
|
||||
set(SRC ${CMAKE_SOURCE_DIR}/src)
|
||||
set(LIBSRC ${SRC}/libapogee.cpp)
|
||||
set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin")
|
||||
set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include")
|
||||
|
||||
if(DEFINED EBUG)
|
||||
add_definitions(-DEBUG)
|
||||
endif()
|
||||
if(DEFINED VERBOSE OR DEFINED VERB OR DEFINED V)
|
||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
endif()
|
||||
if(NOT DEFINED CAMERA_TYPE)
|
||||
message(FATAL_ERROR "You shoul define camera type CAMERA_TYPE: APOGEE_ASCENT, "
|
||||
"APOGEE_ALTA, APOGEE_ALTAF, APOGEE_ASPEN or APOGEE_QUAD\n"
|
||||
"For example, run\n\tcmake .. -DCAMERA_TYPE=APOGEE_ALTAF")
|
||||
else()
|
||||
add_definitions("-D${CAMERA_TYPE}")
|
||||
endif()
|
||||
|
||||
set(APOGEE_VERSION "3.0")
|
||||
set(APOGEE_SOVERSION "3")
|
||||
|
||||
find_path(APOGEE_LIB_INCLUDE_DIR NAMES Alta.h
|
||||
PATH_SUFFIXES libapogee-3.0/apogee
|
||||
)
|
||||
|
||||
find_library(APOGEE_LIB NAMES apogee apogee-3.0.2865 apogeeu
|
||||
PATHS /lib
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/opt/lib
|
||||
)
|
||||
|
||||
if(${APOGEE_LIB} STREQUAL "APOGEE_LIB-NOTFOUND"
|
||||
OR ${APOGEE_LIB_INCLUDE_DIR} STREQUAL "APOGEE_LIB_INCLUDE_DIR-NOTFOUND")
|
||||
message(FATAL_ERROR "You need first to install libapogee")
|
||||
endif()
|
||||
|
||||
add_definitions("-O3 -g -fpic -Wall -Werror -W -I${APOGEE_LIB_INCLUDE_DIR}")
|
||||
|
||||
add_library(apogeeu SHARED ${LIBSRC})
|
||||
|
||||
set_target_properties(apogeeu PROPERTIES VERSION ${APOGEE_VERSION} SOVERSION ${APOGEE_SOVERSION})
|
||||
|
||||
target_link_libraries(apogeeu ${APOGEE_LIB})
|
||||
|
||||
add_executable(test ${SRC}/test.c)
|
||||
target_link_libraries(test apogeeu)
|
||||
|
||||
add_executable(test_wheel ${SRC}/test_wheel.c)
|
||||
target_link_libraries(test_wheel apogeeu)
|
||||
|
||||
install(TARGETS apogeeu LIBRARY DESTINATION lib${LIB_POSTFIX})
|
||||
install(FILES ${SRC}/60-apogee.rules DESTINATION /etc/udev/rules.d/)
|
||||
install(FILES ${SRC}/libapogee.h DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)
|
||||
|
||||
configure_file(${SRC}/apogeec.pc.in ${SRC}/apogeec.pc @ONLY)
|
||||
install(FILES ${SRC}/apogeec.pc DESTINATION /usr/share/pkgconfig/ COMPONENT Devel)
|
||||
22
apogee_C_wrapper/README
Normal file
22
apogee_C_wrapper/README
Normal file
@ -0,0 +1,22 @@
|
||||
To compile and install wrapper make:
|
||||
|
||||
0. Install libapogee ver. >= 3.0
|
||||
1. cd cmake
|
||||
2. cmake -DCAMERA_TYPE={camtype} ..
|
||||
3. make
|
||||
4. su -c "make install"
|
||||
[5] You can run test applications: ./test will make testing connection to your camera and
|
||||
./test_wheel will make test connection to your wheel, increasing its current position.
|
||||
|
||||
After installing cd to apogee_control working directory and compile&install apogee_control.
|
||||
|
||||
|
||||
{camtype} is type of your camera, one of:
|
||||
|
||||
APOGEE_ASCENT
|
||||
APOGEE_ALTA
|
||||
APOGEE_ALTAF
|
||||
APOGEE_ASPEN
|
||||
APOGEE_QUAD
|
||||
|
||||
If you wanna see debugging information, add -DEBUG to cmake options
|
||||
10
apogee_C_wrapper/src/60-apogee.rules
Normal file
10
apogee_C_wrapper/src/60-apogee.rules
Normal file
@ -0,0 +1,10 @@
|
||||
# apogee.rules a udev rules file for apogee usb cameras
|
||||
SUBSYSTEM!="usb", ACTION!="add", GOTO="apogee_rules_end"
|
||||
# Apogee Alta-U
|
||||
ATTRS{idVendor}=="125c", ATTRS{idProduct}=="0010", GROUP="users", MODE="666"
|
||||
# Apogee Ascent
|
||||
ATTRS{idVendor}=="125c", ATTRS{idProduct}=="0020",GROUP="users", MODE="666"
|
||||
# Apogee USB Filter Wheel
|
||||
ATTRS{idVendor}=="125c", ATTRS{idProduct}=="0100",GROUP="users", MODE="666"
|
||||
LABEL="apogee_rules_end"
|
||||
|
||||
10
apogee_C_wrapper/src/apogeec.pc.in
Normal file
10
apogee_C_wrapper/src/apogeec.pc.in
Normal file
@ -0,0 +1,10 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/lib
|
||||
includedir=${prefix}/include
|
||||
|
||||
Name: ApogeeU
|
||||
Description: Apogee USB camera module (C wrapper for lib 3x)
|
||||
Version: @APOGEE_VERSION@
|
||||
Libs: -L${libdir} -lapogeeu
|
||||
Cflags: -I${includedir}
|
||||
697
apogee_C_wrapper/src/libapogee.cpp
Normal file
697
apogee_C_wrapper/src/libapogee.cpp
Normal file
@ -0,0 +1,697 @@
|
||||
/*
|
||||
* libapogee.cpp - libapogee C wrapper
|
||||
*
|
||||
* Copyright 2013 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "libapogee.h"
|
||||
|
||||
#include <Alta.h>
|
||||
#include <AltaF.h>
|
||||
#include <Ascent.h>
|
||||
#include <Aspen.h>
|
||||
#include <Quad.h>
|
||||
#include <CameraInfo.h>
|
||||
#include <FindDeviceUsb.h>
|
||||
#include <ApogeeFilterWheel.h>
|
||||
#include <ApogeeCam.h>
|
||||
|
||||
#if defined APOGEE_ASCENT
|
||||
#define CCD Ascent
|
||||
#elif defined APOGEE_ALTA
|
||||
#define CCD Alta
|
||||
#elif defined APOGEE_ALTAF
|
||||
#define CCD AltaF
|
||||
#elif defined APOGEE_ASPEN
|
||||
#define CCD Aspen
|
||||
#elif defined APOGEE_QUAD
|
||||
#define CCD Quad
|
||||
#else
|
||||
#error "You must define camera type: APOGEE_ASCENT, APOGEE_ALTA, \
|
||||
APOGEE_ALTAF, APOGEE_ASPEN or APOGEE_QUAD"
|
||||
#endif
|
||||
|
||||
// static class for CCD device
|
||||
static CCD *alta = NULL;
|
||||
// static variable with last error
|
||||
CCDerr altaerr = ALTA_OK;
|
||||
|
||||
typedef struct{
|
||||
std::string address;
|
||||
uint16_t FirmwareRev;
|
||||
uint16_t Id;
|
||||
std::string deviceType;
|
||||
std::string model;
|
||||
} CamParams;
|
||||
// last camera parameters
|
||||
static CamParams par;
|
||||
|
||||
#define TRY altaerr=ALTA_OK; try
|
||||
#ifdef EBUG
|
||||
#define SHOWEX() do{std::cout << "ERROR! " << err.what() << std::endl;}while(0)
|
||||
#define DBG(msg) do{std::cout << msg << std::endl;}while(0)
|
||||
#else
|
||||
#define SHOWEX()
|
||||
#define DBG(msg)
|
||||
#endif
|
||||
#define CATCH(ERR) catch(std::exception & err){altaerr=ERR;SHOWEX();}catch(...){altaerr=ALTA_UNDEF;}
|
||||
|
||||
#define RETERR(ERR) do{altaerr=ERR; return altaerr;}while(0)
|
||||
|
||||
static void checkalta(){
|
||||
if(!alta){
|
||||
fprintf(stderr, "Bug! Alta used before open\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// Functions for getting camera parameters from discovery string
|
||||
// first two functions are from apogee's library
|
||||
std::vector<std::string> MakeTokens(const std::string &str, const std::string &separator){
|
||||
std::vector<std::string> returnVector;
|
||||
std::string::size_type start = 0;
|
||||
std::string::size_type end = 0;
|
||||
while((end = str.find(separator, start)) != std::string::npos){
|
||||
returnVector.push_back (str.substr(start, end-start));
|
||||
start = end + separator.size();
|
||||
}
|
||||
returnVector.push_back( str.substr(start) );
|
||||
return returnVector;
|
||||
}
|
||||
std::string GetItemFromFindStr( const std::string & msg, const std::string & item ){
|
||||
std::vector<std::string> params = MakeTokens(msg, "," );
|
||||
std::vector<std::string>::iterator iter;
|
||||
for(iter = params.begin(); iter != params.end(); ++iter){
|
||||
if( std::string::npos != (*iter).find( item )){
|
||||
std::string result = MakeTokens((*iter), "=" ).at(1);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "Bug! Can't find parameter in description string!\n");
|
||||
exit(1);
|
||||
std::string noOp;
|
||||
return noOp;
|
||||
}
|
||||
uint16_t readUI(const std::string & msg, const std::string & key){
|
||||
std::string str = GetItemFromFindStr(msg, key);
|
||||
unsigned int x;
|
||||
if(sscanf(str.c_str(), "%x", &x) < 1){
|
||||
fprintf(stderr, "Bug! Can't convert parameter from hex!\n");
|
||||
exit(1);
|
||||
}
|
||||
return (uint16_t) x;
|
||||
}
|
||||
CamParams *getCamParams(std::string & msg){
|
||||
par.address = GetItemFromFindStr(msg, "address=");
|
||||
par.FirmwareRev = readUI(msg, "firmwareRev=");
|
||||
par.Id = readUI(msg, "id=");
|
||||
par.deviceType = GetItemFromFindStr(msg, "deviceType=");
|
||||
par.model = GetItemFromFindStr(msg, "model=");
|
||||
return ∥
|
||||
}
|
||||
|
||||
/**
|
||||
* Open camera device and assign it to variable <alta>
|
||||
* IT DON'T WORK WITH MULTIPLE CAMERAS SIMULTANEOUSLY!
|
||||
* @param id - camera identificator (number)
|
||||
* @return 0 in case of success
|
||||
*/
|
||||
int ApnGlueOpen(_U_ unsigned int id){
|
||||
TRY{
|
||||
alta = (CCD*) new CCD();
|
||||
std::string ioInterface("usb");
|
||||
FindDeviceUsb look4cam;
|
||||
std::string msg = look4cam.Find();
|
||||
DBG(msg);
|
||||
if(msg == "<d></d>")
|
||||
RETERR(ALTA_NO_SUCH_DEVICE); // empty string
|
||||
CamParams *par = getCamParams(msg);
|
||||
alta->OpenConnection(ioInterface, par->address, par->FirmwareRev, par->Id);
|
||||
alta->Init();
|
||||
}CATCH(ALTA_NO_SUCH_DEVICE);
|
||||
return(altaerr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close connection and destroy camera object
|
||||
*/
|
||||
void ApnGlueClose(){
|
||||
if(!alta) return;
|
||||
TRY{
|
||||
alta->CloseConnection();
|
||||
delete alta;
|
||||
}CATCH(ALTA_CANT_CLOSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Camera sensor and model
|
||||
* @param sensor, model (o) - dinamically allocated strings or NULL
|
||||
*/
|
||||
void ApnGlueGetName(char **sensor, char **camera){
|
||||
checkalta();
|
||||
TRY{
|
||||
if(camera) *camera = (char *)alta->GetModel().c_str();
|
||||
if(sensor) *sensor = (char *)alta->GetSensor().c_str();
|
||||
}CATCH(ALTA_UNDEF);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set fan speed
|
||||
* @param speed: 0 - turn fan off; 1 - slowest, 3 - fastest
|
||||
*/
|
||||
void ApnGlueSetFan(int speed){
|
||||
checkalta();
|
||||
TRY{
|
||||
Apg::FanMode mode = (Apg::FanMode)(speed % 4);
|
||||
alta->SetFanMode(mode);
|
||||
}CATCH(ALTA_BAD_FANSPD);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fan speed
|
||||
* @return fan speed
|
||||
*/
|
||||
int ApnGlueGetFan(){
|
||||
int mode = -1;
|
||||
checkalta();
|
||||
TRY{
|
||||
mode = alta->GetFanMode();
|
||||
}CATCH(ALTA_BAD_FANSPD);
|
||||
return mode;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set parameters for subsequent exposures.
|
||||
* In case of error return -1 or altaerr with explanation in whynot[], else 0.
|
||||
* Also return final image size in net binned pixels, allowing for overscan,
|
||||
* binning etc.
|
||||
* @param roiw, roih - image width & height in unbinned pixels
|
||||
* @param osw, osh - (USED only their sign) width & height of saved overscan part (should be less than max OS)
|
||||
* @param binw, binh - binning by X and Y
|
||||
* @param roix, roiy - coordinate of image angle on CCD
|
||||
* @param impixw, impixh (o) - size of output image (binned) or NULL
|
||||
* @param whynot[] - error explanation or NULL
|
||||
* @return In case of error return -1 or altaerr with explanation in whynot[], else 0.
|
||||
*/
|
||||
int ApnGlueSetExpGeom(int roiw, int roih, int osw, int osh, int binw,
|
||||
int binh, int roix, int roiy, int *impixw, int *impixh, char whynot[]){
|
||||
uint16_t maxw, maxh, maxtotw;
|
||||
//uint16_t maxtoth;
|
||||
checkalta();
|
||||
TRY{
|
||||
maxw = alta->GetMaxImgCols();
|
||||
maxh = alta->GetMaxImgRows();
|
||||
maxtotw = alta->GetTotalRows();
|
||||
//maxtoth = alta->GetTotalCols();
|
||||
if(binw < 1) binw = 1;
|
||||
if(binh < 1) binh = 1;
|
||||
if(roiw < 1 || roiw > (int)maxw) roiw = maxw;
|
||||
if(roih < 1 || roih > (int)maxh) roih = maxh;
|
||||
if(osw > 0 || osh > 0){
|
||||
int maxosw = alta->GetNumOverscanCols();
|
||||
//int maxosh = ApogeeCam::m_CamCfgData->m_MetaData.OverscanRows;
|
||||
if (osw > maxosw){
|
||||
if(whynot) sprintf (whynot, "Max overscan columns is %d", maxosw);
|
||||
RETERR(ALTA_BAD_GEOMETRY);
|
||||
}
|
||||
/*if (osh > maxosh) {
|
||||
sprintf (whynot, "Max overscan rows is %d", maxosh);
|
||||
return (-1);
|
||||
}*/
|
||||
if (roix > 0 || roiw < maxw || roiy > 0 || roih < maxh) {
|
||||
if(whynot) sprintf (whynot, "Can not overscan with windowing");
|
||||
RETERR(ALTA_BAD_GEOMETRY);
|
||||
}
|
||||
roiw += osw;
|
||||
//roih += osh;
|
||||
if(roiw > (int)maxtotw) roiw = maxtotw;
|
||||
//if(roih > (int)maxtoth) roih = maxtoth;
|
||||
roiw = maxtotw;
|
||||
//roih = maxtoth;
|
||||
alta->SetDigitizeOverscan(true);
|
||||
}else alta->SetDigitizeOverscan(false);
|
||||
alta->SetRoiBinCol(binw);
|
||||
alta->SetRoiBinRow(binh);
|
||||
if(roix > 0 || roiy > 0){
|
||||
if((roix + roiw > maxw) || (roiy + roih > maxh)){
|
||||
if(whynot) sprintf (whynot, "Windowed image too large");
|
||||
RETERR(ALTA_BAD_GEOMETRY);
|
||||
}
|
||||
alta->SetRoiStartCol(roix);
|
||||
alta->SetRoiStartRow(roiy);
|
||||
}else{
|
||||
alta->SetRoiStartCol(0);
|
||||
alta->SetRoiStartRow(0);
|
||||
}
|
||||
alta->SetRoiNumCols(roiw / binw);
|
||||
alta->SetRoiNumRows(roih / binh);
|
||||
if(impixw) *impixw = roiw / binw;
|
||||
if(impixh) *impixh = roih / binh;
|
||||
}CATCH(ALTA_BAD_GEOMETRY);
|
||||
return altaerr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get pixel size
|
||||
* @param pixX, pixY (o) - pixel size in mkm or NULL
|
||||
*/
|
||||
void ApnGlueGetGeom(double *pixX, double *pixY){
|
||||
checkalta();
|
||||
TRY{
|
||||
if(pixX) *pixX = alta->GetPixelWidth();
|
||||
if(pixY) *pixY = alta->GetPixelHeight();
|
||||
}CATCH(ALTA_UNDEF);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get extremal values
|
||||
* @param exptime - exposition time (array: [min, max]) or NULL
|
||||
* @param roiw, roih - ROI image size or NULL
|
||||
* @param osw, osh - overscan size (used only osw) or NULL
|
||||
* @param binw, binh - binning size or NULL
|
||||
* @param shutter - shutter presence or NULL
|
||||
* @param mintemp - minimal temperature or NULL
|
||||
*/
|
||||
void ApnGlueGetMaxValues(double *exptime, int *roiw, int *roih, int *osw,
|
||||
_U_ int *osh, int *binw, int *binh, int *shutter, double *mintemp){
|
||||
checkalta();
|
||||
TRY{
|
||||
if(exptime){
|
||||
exptime[0] = alta->GetMinExposureTime();
|
||||
exptime[1] = alta->GetMaxExposureTime();
|
||||
}
|
||||
if(roiw) *roiw = alta->GetTotalRows();
|
||||
if(roih) *roih = alta->GetMaxImgRows();
|
||||
if(osw) *osw = alta->GetNumOverscanCols();
|
||||
if(binw) *binw = alta->GetMaxBinCols();
|
||||
if(binh) *binh = alta->GetMaxBinRows();
|
||||
if(shutter) *shutter = 1; // !!!TODO!!!
|
||||
if(mintemp) *mintemp = -30.; // !!!TODO!!!
|
||||
}CATCH(ALTA_UNDEF);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sensor temperature and cooler status
|
||||
* @param Cp - current sensor temperature
|
||||
* @return Cooler_Status value
|
||||
*/
|
||||
int ApnGlueGetTemp(double *Cp){
|
||||
int status = -1;
|
||||
checkalta();
|
||||
TRY{
|
||||
*Cp = alta->GetTempCcd();
|
||||
status = alta->GetCoolerStatus();
|
||||
}CATCH(ALTA_COOLER);
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get heatsink temperature (in degC)
|
||||
* @return hot side of Peltier temperature value
|
||||
*/
|
||||
double ApnGlueGetHotTemp(){
|
||||
checkalta();
|
||||
double temp = 1000.;
|
||||
TRY{
|
||||
temp = alta->GetTempHeatsink();
|
||||
}CATCH(ALTA_COOLER);
|
||||
return temp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set CCD temperature (in degC)
|
||||
* @param C - new temperature, !!! value C == 0, disables cooler !!!
|
||||
* @return
|
||||
*/
|
||||
void ApnGlueSetTemp(double C){
|
||||
checkalta();
|
||||
TRY{
|
||||
if (C == 0) {
|
||||
alta->SetCooler(0);
|
||||
} else {
|
||||
alta->SetCooler(1);
|
||||
alta->SetCoolerSetPoint(C);
|
||||
}
|
||||
}CATCH(ALTA_COOLER);
|
||||
}
|
||||
|
||||
/* Get setpoint temperature; return 1 if cooler is on, 0 if cooler is off;
|
||||
stat == 0 - clamp to setpoint, 1 - at setpoint*/
|
||||
/**
|
||||
* Get temperature setpoint
|
||||
* @param temp (o) - temperature setpoint or NULL
|
||||
* @param stat (o) - ==1 if cooler is at setpoint or NULL
|
||||
* @return cooler status
|
||||
*/
|
||||
int ApnGlueReadSetPoint(double *temp, int *stat){
|
||||
checkalta();
|
||||
Apg::CoolerStatus S = Apg::CoolerStatus_Suspended;
|
||||
TRY{
|
||||
S = alta->GetCoolerStatus();
|
||||
if(S == Apg::CoolerStatus_Off) return S;
|
||||
if(stat) *stat = (S == Apg::CoolerStatus_AtSetPoint) ? 1:0;
|
||||
if(temp) *temp = alta->GetCoolerSetPoint();
|
||||
}CATCH(ALTA_COOLER);
|
||||
return S;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read shutter state
|
||||
* @return 1 if shutter opened, 0 if closed
|
||||
*/
|
||||
int ApnGlueReadShutter(){
|
||||
checkalta();
|
||||
int state = 0;
|
||||
TRY{
|
||||
Apg::ShutterState shtr = alta->GetShutterState();
|
||||
if(shtr == Apg::ShutterState_ForceOpen)
|
||||
state = 1;
|
||||
}CATCH(ALTA_SHTR);
|
||||
return state;
|
||||
}
|
||||
/**
|
||||
* Force open/close shutter
|
||||
* @param flag - == 0 to close, != 0 to open
|
||||
*/
|
||||
void ApnGlueOpenShutter(int flag){
|
||||
checkalta();
|
||||
TRY{
|
||||
Apg::ShutterState shtr = (flag) ? Apg::ShutterState_ForceOpen : Apg::ShutterState_ForceClosed;
|
||||
alta->SetShutterState(shtr);
|
||||
}CATCH(ALTA_SHTR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ADC speed
|
||||
* @return Adc_Speed value
|
||||
*/
|
||||
unsigned short ApnGlueGetSpeed(){
|
||||
checkalta();
|
||||
Apg::AdcSpeed spd = Apg::AdcSpeed_Unknown;
|
||||
TRY{
|
||||
spd = alta->GetCcdAdcSpeed();
|
||||
}CATCH(ALTA_BADSPD);
|
||||
return (unsigned short)spd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ADC speed
|
||||
* @param Sp - speed (Adc_Speed)
|
||||
*/
|
||||
void ApnGlueSetSpeed(unsigned short Sp){
|
||||
checkalta();
|
||||
TRY{
|
||||
if(Sp != AdcSpeed_Normal && Sp != AdcSpeed_Fast && Sp != AdcSpeed_Video){
|
||||
altaerr = ALTA_BADSPD;
|
||||
return;
|
||||
}
|
||||
alta->SetCcdAdcSpeed((Apg::AdcSpeed)Sp);
|
||||
}CATCH(ALTA_BADSPD);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset camera
|
||||
*/
|
||||
void ApnGlueReset(){
|
||||
checkalta();
|
||||
TRY{
|
||||
alta->Reset();
|
||||
}CATCH(ALTA_POWER);
|
||||
}
|
||||
/**
|
||||
* Power down/resume - just a stub for backward compability
|
||||
*/
|
||||
int ApnGluePowerDown(){return -1;}
|
||||
void ApnGluePowerResume(){}
|
||||
|
||||
/**
|
||||
* Disable (flag!=1) or enable post expose flushing
|
||||
* @param flag == 1 to disable post-flushing
|
||||
*/
|
||||
void ApnGlueDisablePostExpFlushing(int flag){
|
||||
checkalta();
|
||||
TRY{
|
||||
alta->SetPostExposeFlushing(flag);
|
||||
}CATCH(ALTA_UNDEF);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set (flag!=0) or reset preexposure IR-flashing
|
||||
* @param flag != 1 to enable pre-flash
|
||||
* @return
|
||||
*/
|
||||
void ApnGluePreFlash(int flag){
|
||||
checkalta();
|
||||
TRY{
|
||||
alta->SetPreFlash(flag);
|
||||
}CATCH(ALTA_UNDEF);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ADC databits (16/12)
|
||||
* !!!DEPRECATED!!! Use ApnGlueSetSpeed() instead!
|
||||
* @param BitResolution - ADC resolution
|
||||
*/
|
||||
void ApnGlueSetDatabits(Apn_Resolution BitResolution){
|
||||
checkalta();
|
||||
TRY{
|
||||
Adc_Speed sp = AdcSpeed_Normal;
|
||||
if(BitResolution != Resolution_SixteenBit)
|
||||
sp = AdcSpeed_Fast;
|
||||
ApnGlueSetSpeed(sp);
|
||||
}CATCH(ALTA_UNDEF);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set camera mode
|
||||
* @param CameraMode - one of camera mode
|
||||
*/
|
||||
void ApnGlueWriteCamMode(Apn_CameraMode CameraMode){
|
||||
checkalta();
|
||||
TRY{
|
||||
alta->SetCameraMode((Apg::CameraMode)CameraMode);
|
||||
}CATCH(ALTA_UNDEF);
|
||||
}
|
||||
|
||||
/* start an exposure with the given duration (secs) and whether to open shutter.
|
||||
* update *exptime with the actual exposure time (may have been bumped to min).
|
||||
* return 0 if ok, else -1
|
||||
*/
|
||||
/**
|
||||
* Start an exposure with the given duration (secs)
|
||||
* Update *exptime with the actual exposure time
|
||||
* @param exptime (i/o) - exposition time in secs
|
||||
* @param shutter - shutter state (1 - object, 0 - dark)
|
||||
* @return ALTA_OK if ok
|
||||
*/
|
||||
int ApnGlueStartExp(double *exptime, int shutter){
|
||||
checkalta();
|
||||
if(!exptime) return ALTA_EXPOSURE;
|
||||
TRY{
|
||||
double maxtime; // ,mintime
|
||||
//mintime = alta->GetMinExposureTime();
|
||||
maxtime = alta->GetMaxExposureTime();
|
||||
if(*exptime > maxtime) *exptime = maxtime;
|
||||
else if(*exptime < 0.) *exptime = 0.;
|
||||
alta->SetImageCount(1);
|
||||
alta->StartExposure(*exptime, shutter);
|
||||
}CATCH(ALTA_EXPOSURE);
|
||||
return altaerr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pause or resume timer
|
||||
* @param flag - !=0 to pause, ==0 to resume
|
||||
* @return
|
||||
*/
|
||||
void ApnGluePauseTimer(int flag){
|
||||
checkalta();
|
||||
TRY{
|
||||
alta->PauseTimer(flag);
|
||||
}CATCH(ALTA_EXPOSURE);
|
||||
}
|
||||
|
||||
/**
|
||||
* These two functions makes similar work: aborts exposition
|
||||
* ApnGlueExpAbort() fully aborts it, whith sensor cleaning
|
||||
* ApnGlueStopExposure() allows to read stored image
|
||||
* @return ApnGlueStopExposure() returns value of altaerr
|
||||
*/
|
||||
void ApnGlueExpAbort(){
|
||||
checkalta();
|
||||
TRY{
|
||||
alta->StopExposure(false);
|
||||
}CATCH(ALTA_EXPOSURE);
|
||||
}
|
||||
int ApnGlueStopExposure(){
|
||||
checkalta();
|
||||
TRY{
|
||||
alta->StopExposure(true);
|
||||
}CATCH(ALTA_EXPOSURE);
|
||||
return altaerr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether exposition is done
|
||||
* @return 1 if exposition is over
|
||||
*/
|
||||
int ApnGlueExpDone(){
|
||||
checkalta();
|
||||
TRY{
|
||||
Apg::Status st = alta->GetImagingStatus();
|
||||
if(st == Apg::Status_ImageReady) return 1;
|
||||
}CATCH(ALTA_EXPOSURE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* read pixels from the camera into the given buffer of length nbuf.
|
||||
* @param buf - image buffer
|
||||
* @param nbuf - buf size
|
||||
* @param whynot - error explanation or NULL
|
||||
* @return ALTA_OK if OK
|
||||
*/
|
||||
int ApnGlueReadPixels(unsigned short *buf, int nbuf, char whynot[]){
|
||||
checkalta();
|
||||
if(!buf || nbuf < 1) RETERR(ALTA_GETIMAGE);
|
||||
printf("READ\n");
|
||||
TRY{
|
||||
std::vector<uint16_t> v;
|
||||
alta->GetImage(v);
|
||||
if(nbuf < alta->GetRoiNumCols() * (int)alta->GetRoiNumRows() || nbuf < (int)v.size()){
|
||||
if(whynot) sprintf(whynot, "Buffer size less than image size");
|
||||
RETERR(ALTA_GETIMAGE);
|
||||
}
|
||||
std::copy(v.begin(), v.end(), buf);
|
||||
}CATCH(ALTA_GETIMAGE);
|
||||
printf("DONE\n");
|
||||
return altaerr;
|
||||
}
|
||||
|
||||
/*
|
||||
******************************** FILTER WHEEL ********************************
|
||||
*/
|
||||
|
||||
static ApogeeFilterWheel *wheel;
|
||||
static void checkwheel();
|
||||
|
||||
/**
|
||||
* Open and initialise filter wheel device
|
||||
* @param id - number of wheel
|
||||
* @param type - wheel type
|
||||
* @return 0 if init OK, else return !0 and set altaerr
|
||||
*/
|
||||
int ApnGlueWheelOpen(_U_ unsigned int id, Apn_Filter type){
|
||||
TRY{
|
||||
FindDeviceUsb look4FilterWheel;
|
||||
std::string msg = look4FilterWheel.Find();
|
||||
DBG(msg);
|
||||
if(msg == "<d></d>")
|
||||
RETERR(ALTA_NO_SUCH_DEVICE);
|
||||
std::string str = GetItemFromFindStr(msg, "deviceType=");
|
||||
if(str.compare("filterWheel"))
|
||||
RETERR(ALTA_NOTWHEEL);
|
||||
wheel = (ApogeeFilterWheel*) new ApogeeFilterWheel();
|
||||
std::string addr = GetItemFromFindStr(msg, "address=");
|
||||
wheel->Init((ApogeeFilterWheel::Type)type, addr);
|
||||
}CATCH(ALTA_NO_SUCH_DEVICE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close filter device
|
||||
*/
|
||||
void ApnGlueWheelClose(){
|
||||
TRY{
|
||||
if(wheel) wheel->Close();
|
||||
delete wheel;
|
||||
}CATCH(ALTA_CANT_CLOSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current filter wheel status
|
||||
* @param
|
||||
* @return 0 if ready, 1 if moving or absent
|
||||
*/
|
||||
int ApnGlueWheelGetStatus(){
|
||||
checkwheel();
|
||||
TRY{
|
||||
ApogeeFilterWheel::Status st = wheel->GetStatus();
|
||||
if(st != ApogeeFilterWheel::READY) return 1;
|
||||
}CATCH(ALTA_NOTWHEEL);
|
||||
if(altaerr != ALTA_OK) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get maximum position number
|
||||
* @return amount of positions or -1 if err
|
||||
*/
|
||||
int ApnGlueWheelGetMaxPos(){
|
||||
uint16_t m = 0;
|
||||
checkwheel();
|
||||
TRY{
|
||||
m = wheel->GetMaxPositions();
|
||||
}CATCH(ALTA_NOTWHEEL);
|
||||
if(altaerr != ALTA_OK) return -1;
|
||||
return (int) m;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set position
|
||||
* @param pos - new position number (1..max)
|
||||
* @return 0 on success or !0 in case of error
|
||||
*/
|
||||
int ApnGlueWheelSetPos(int pos){
|
||||
checkwheel();
|
||||
TRY{
|
||||
if(pos < 1 || wheel->GetMaxPositions() < pos) RETERR(ALTA_BADWHEELPOS);
|
||||
wheel->SetPosition((uint16_t) pos);
|
||||
}CATCH(ALTA_BADWHEELPOS);
|
||||
if(altaerr != ALTA_OK) return ALTA_BADWHEELPOS;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current position (1..max)
|
||||
* @return current position or -1 on error
|
||||
*/
|
||||
int ApnGlueWheelGetPos(){
|
||||
uint16_t m = 0;
|
||||
checkwheel();
|
||||
TRY{
|
||||
m = wheel->GetPosition();
|
||||
}CATCH(ALTA_BADWHEELPOS);
|
||||
if(altaerr != ALTA_OK) return -1;
|
||||
return (int)m;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check wheel
|
||||
*/
|
||||
static void checkwheel(){
|
||||
if(!wheel){
|
||||
fprintf(stderr, "Bug! Wheel used before open\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
170
apogee_C_wrapper/src/libapogee.h
Normal file
170
apogee_C_wrapper/src/libapogee.h
Normal file
@ -0,0 +1,170 @@
|
||||
/*
|
||||
* libapogee.h - header for libapogee C wrapper
|
||||
*
|
||||
* Copyright 2013 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef __LIBAPOGEE_H__
|
||||
#define __LIBAPOGEE_H__
|
||||
|
||||
#ifndef _U_
|
||||
#define _U_ __attribute__((unused))
|
||||
#endif
|
||||
|
||||
// errors:
|
||||
typedef enum{
|
||||
ALTA_OK = 0 // all good
|
||||
,ALTA_UNDEF // undefined error
|
||||
,ALTA_NO_SUCH_DEVICE // can't open: no such device
|
||||
,ALTA_CANT_CLOSE // error when closing device
|
||||
,ALTA_BAD_FANSPD // bad fan speed (should be 0..3)
|
||||
,ALTA_BAD_GEOMETRY // bad geometry parameter
|
||||
,ALTA_COOLER // something wrong with cooler
|
||||
,ALTA_SHTR // something wrong with shutter
|
||||
,ALTA_BADSPD // error setting speed
|
||||
,ALTA_POWER // error when working with power modes
|
||||
,ALTA_EXPOSURE // error when exposing image
|
||||
,ALTA_GETIMAGE // error getting image
|
||||
,ALTA_NOTWHEEL // device isn't a filter wheel
|
||||
,ALTA_BADWHEELPOS // bad wheel position
|
||||
}CCDerr;
|
||||
|
||||
extern CCDerr altaerr;
|
||||
|
||||
// some definitions from CameraInfo.h ==================>
|
||||
typedef enum{
|
||||
CameraMode_Normal = 0,
|
||||
CameraMode_TDI,
|
||||
CameraMode_Test,
|
||||
CameraMode_ExternalTrigger,
|
||||
CameraMode_ExternalShutter,
|
||||
CameraMode_Kinetics,
|
||||
CameraMode_Unknown
|
||||
}Apn_CameraMode;
|
||||
typedef enum{
|
||||
Resolution_SixteenBit = 0,
|
||||
Resolution_TwelveBit
|
||||
}Apn_Resolution;
|
||||
typedef enum{
|
||||
Status_ConnectionError = -3,
|
||||
Status_DataError = -2,
|
||||
Status_PatternError = -1,
|
||||
Status_Idle = 0,
|
||||
Status_Exposing = 1,
|
||||
Status_ImagingActive = 2,
|
||||
Status_ImageReady = 3,
|
||||
Status_Flushing = 4,
|
||||
Status_WaitingOnTrigger = 5
|
||||
}Apn_Status;
|
||||
typedef enum{
|
||||
UNKNOWN_TYPE = 0,
|
||||
FW50_9R = 1,
|
||||
FW50_7S = 2,
|
||||
AFW25_4R = 3,
|
||||
AFW30_7R = 4,
|
||||
AFW50_5R = 5,
|
||||
AFW50_10S = 6,
|
||||
AFW31_17R = 9
|
||||
}Apn_Filter;
|
||||
typedef enum{
|
||||
CoolerStatus_Off = 0,
|
||||
CoolerStatus_RampingToSetPoint = 1,
|
||||
CoolerStatus_AtSetPoint = 2,
|
||||
CoolerStatus_Revision = 3,
|
||||
CoolerStatus_Suspended = 4
|
||||
}Cooler_Status;
|
||||
typedef enum{
|
||||
AdcSpeed_Unknown,
|
||||
AdcSpeed_Normal,
|
||||
AdcSpeed_Fast,
|
||||
AdcSpeed_Video
|
||||
}Adc_Speed;
|
||||
|
||||
// For back-compatible
|
||||
#define Apn_CameraMode_Normal CameraMode_Normal
|
||||
#define Apn_CameraMode_TDI CameraMode_TDI
|
||||
#define Apn_CameraMode_Test CameraMode_Test
|
||||
#define Apn_CameraMode_ExternalTrigger CameraMode_ExternalTrigger
|
||||
#define Apn_CameraMode_ExternalShutter CameraMode_ExternalShutter
|
||||
#define Apn_CameraMode_Kinetics CameraMode_Kinetics
|
||||
#define Apn_Resolution_SixteenBit Resolution_SixteenBit
|
||||
#define Apn_Resolution_TwelveBit Resolution_TwelveBit
|
||||
#define Apn_Filter_Unknown UNKNOWN_TYPE
|
||||
#define Apn_Filter_FW50_9R FW50_9R
|
||||
#define Apn_Filter_FW50_7S FW50_7S
|
||||
#define Apn_Filter_AFW25_4R AFW25_4R
|
||||
#define Apn_Filter_AFW30_7R AFW30_7R
|
||||
#define Apn_Filter_AFW50_5R AFW50_5R
|
||||
#define Apn_Filter_AFW50_10S AFW50_10S
|
||||
#define Apn_Filter_AFW31_17R AFW31_17R
|
||||
#define Apn_FilterStatus_NotConnected 0
|
||||
#define Apn_FilterStatus_Ready 1
|
||||
#define Apn_FilterStatus_Active 2
|
||||
// <================== some definitions from CameraInfo.h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Camera
|
||||
int ApnGlueOpen(unsigned int id);
|
||||
void ApnGlueClose();
|
||||
void ApnGlueGetName(char **sensor, char **camera);
|
||||
void ApnGlueSetFan(int speed);
|
||||
int ApnGlueGetFan();
|
||||
int ApnGlueSetExpGeom (int roiw, int roih, int osw, int osh, int binw,
|
||||
int binh, int roix, int roiy, int *impixw, int *impixh, char whynot[]);
|
||||
void ApnGlueGetGeom(double *pixX, double *pixY);
|
||||
void ApnGlueGetMaxValues (double *exptime, int *roiw, int *roih, int *osw,
|
||||
int *osh, int *binw, int *binh, int *shutter, double *mintemp);
|
||||
int ApnGlueGetTemp(double *Cp);
|
||||
double ApnGlueGetHotTemp();
|
||||
void ApnGlueSetTemp(double C);
|
||||
int ApnGlueReadSetPoint(double *temp, int *stat);
|
||||
int ApnGlueReadShutter();
|
||||
void ApnGlueOpenShutter(int flag);
|
||||
unsigned short ApnGlueGetSpeed();
|
||||
void ApnGlueSetSpeed(unsigned short Sp);
|
||||
void ApnGlueReset();
|
||||
int ApnGluePowerDown();
|
||||
void ApnGluePowerResume();
|
||||
void ApnGlueDisablePostExpFlushing(int flag);
|
||||
void ApnGluePreFlash(int flag);
|
||||
void ApnGlueSetDatabits(Apn_Resolution BitResolution);
|
||||
void ApnGlueWriteCamMode(Apn_CameraMode CameraMode);
|
||||
int ApnGlueStartExp (double *exptime, int shutter);
|
||||
void ApnGluePauseTimer(int flag);
|
||||
int ApnGlueExpDone();
|
||||
void ApnGlueExpAbort(void);
|
||||
int ApnGlueStopExposure();
|
||||
int ApnGlueReadPixels(unsigned short *buf, int nbuf, char whynot[]);
|
||||
|
||||
// Wheel
|
||||
int ApnGlueWheelOpen(unsigned int id, Apn_Filter type);
|
||||
void ApnGlueWheelClose();
|
||||
int ApnGlueWheelGetStatus();
|
||||
int ApnGlueWheelGetMaxPos();
|
||||
int ApnGlueWheelSetPos(int pos);
|
||||
int ApnGlueWheelGetPos();
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __LIBAPOGEE_H__
|
||||
107
apogee_C_wrapper/src/test.c
Normal file
107
apogee_C_wrapper/src/test.c
Normal file
@ -0,0 +1,107 @@
|
||||
/*
|
||||
* test.c - file for wrapper testing
|
||||
*
|
||||
* Copyright 2013 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "libapogee.h"
|
||||
|
||||
#define ERREND() do{printf("Error!"); if(*errmsg) printf(" %s", errmsg); printf("\n"); goto theend;}while(0)
|
||||
|
||||
int main(_U_ int argc, _U_ char **argv){
|
||||
char errmsg[256];
|
||||
*errmsg = 0;
|
||||
int W, H;
|
||||
int res = ApnGlueOpen(0);
|
||||
if(res == ALTA_NO_SUCH_DEVICE || altaerr != ALTA_OK){
|
||||
printf("Can't open! No such device.\n");
|
||||
return 1;
|
||||
}
|
||||
char *sen, *cam;
|
||||
ApnGlueGetName(&sen, &cam);
|
||||
printf("Camera: %s with sensor %s\n", cam, sen);
|
||||
printf("Speed: %d\n", ApnGlueGetSpeed());
|
||||
int fanSpeed = ApnGlueGetFan();
|
||||
if(ALTA_OK != altaerr) ERREND();
|
||||
printf("Current fan speed: %d\n", fanSpeed);
|
||||
ApnGlueSetFan(0);
|
||||
if(ALTA_OK != altaerr) ERREND();
|
||||
double pixH, pixW;
|
||||
ApnGlueGetGeom(&pixW, &pixH);
|
||||
if(ALTA_OK != altaerr) ERREND();
|
||||
printf("Pixel size: %gx%g mkm\n", pixW, pixH);
|
||||
double exp[2];
|
||||
int roiw, roih, osw, binw, binh;
|
||||
ApnGlueGetMaxValues(exp, &roiw, &roih, &osw, NULL, &binw, &binh, NULL, NULL);
|
||||
if(ALTA_OK != altaerr) ERREND();
|
||||
printf("Extremal expositions (seconds): min = %g, max = %g\n", exp[0], exp[1]);
|
||||
printf("ROI maximum size: %dx%d\n", roiw, roih);
|
||||
printf("Number of overscan columns: %d\n", osw);
|
||||
printf("Maximum binning: %dx%d\n", binw, binh);
|
||||
double currtemp;
|
||||
int status = ApnGlueGetTemp(&currtemp);
|
||||
if(ALTA_OK != altaerr) ERREND();
|
||||
char *msg;
|
||||
switch(status){
|
||||
case CoolerStatus_Off:
|
||||
msg = "Off";
|
||||
break;
|
||||
case CoolerStatus_RampingToSetPoint:
|
||||
msg = "Ramping to setpoint";
|
||||
break;
|
||||
case CoolerStatus_AtSetPoint:
|
||||
msg = "At setpoint";
|
||||
break;
|
||||
case CoolerStatus_Revision:
|
||||
msg = "Revision";
|
||||
break;
|
||||
case CoolerStatus_Suspended:
|
||||
msg = "Suspended";
|
||||
break;
|
||||
default:
|
||||
msg = "Undefined";
|
||||
}
|
||||
printf("Cooler status: %s, CCD temperature: %g, Heatsing temperature: %g\n",
|
||||
msg, currtemp, ApnGlueGetHotTemp());
|
||||
ApnGlueReadSetPoint(&currtemp, NULL);
|
||||
if(ALTA_OK != altaerr) ERREND();
|
||||
printf("Temperature setpoint: %g\n", currtemp);
|
||||
// ApnGlueSetTemp(30.);
|
||||
if(ALTA_OK != altaerr) ERREND();
|
||||
// ApnGlueOpenShutter(0);
|
||||
printf("Shutter: %s\n", ApnGlueReadShutter() ? "opened" : "closed");
|
||||
|
||||
*errmsg = 0;
|
||||
printf("Current speed: %u\n", ApnGlueGetSpeed());
|
||||
if(ALTA_OK != ApnGlueSetExpGeom(5000, 5000, 1, 0, 8, 8, 0, 0, &W, &H, errmsg))
|
||||
ERREND();
|
||||
printf("Image parameters: W = %d, H = %d\n", W, H);
|
||||
|
||||
double exptime = 1.;
|
||||
if(ALTA_OK != ApnGlueStartExp(&exptime, 0)) ERREND();
|
||||
printf("start exposition for %g s\n", exptime);
|
||||
while(!ApnGlueExpDone());
|
||||
printf("Exposition done.\n");
|
||||
unsigned short *buf = (unsigned short *) calloc(W*H, sizeof(unsigned short));
|
||||
if(ALTA_OK != ApnGlueReadPixels(buf, W*H, NULL)) ERREND();
|
||||
printf("\nimage value in pixel (W/2, H/2): %u\n", buf[(W+1)*H/2]);
|
||||
theend:
|
||||
ApnGlueClose();
|
||||
return 0;
|
||||
}
|
||||
52
apogee_C_wrapper/src/test_wheel.c
Normal file
52
apogee_C_wrapper/src/test_wheel.c
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* test.c - file for wrapper testing
|
||||
*
|
||||
* Copyright 2013 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "libapogee.h"
|
||||
|
||||
#define ERREND() do{printf("Error!"); if(altaerr != ALTA_OK) printf(" errno: %d", altaerr); printf("\n"); goto theend;}while(0)
|
||||
|
||||
int main(_U_ int argc, _U_ char **argv){
|
||||
char errmsg[256];
|
||||
*errmsg = 0;
|
||||
int res = ApnGlueWheelOpen(0, FW50_7S);
|
||||
if(res || altaerr != ALTA_OK){
|
||||
printf("Can't open! No such device.\n");
|
||||
return 1;
|
||||
}
|
||||
int maxpos, curpos;
|
||||
maxpos = ApnGlueWheelGetMaxPos();
|
||||
if(maxpos < 1) ERREND();
|
||||
curpos = ApnGlueWheelGetPos();
|
||||
if(curpos < 0) ERREND();
|
||||
printf("Found a wheel, which have %d positions, current position is %d\n", maxpos, curpos);
|
||||
if(curpos == maxpos) curpos = 1;
|
||||
else curpos++;
|
||||
printf("Go to position %d\n", curpos);
|
||||
if(ApnGlueWheelSetPos(curpos)) ERREND();
|
||||
while(ApnGlueWheelGetStatus()); // wait while moving
|
||||
curpos = ApnGlueWheelGetPos();
|
||||
if(curpos < 0) ERREND();
|
||||
printf("Now wheel is on position %d\n", curpos);
|
||||
theend:
|
||||
ApnGlueWheelClose();
|
||||
return 0;
|
||||
}
|
||||
280
bta_print.c
Normal file
280
bta_print.c
Normal file
@ -0,0 +1,280 @@
|
||||
/* Print some BTA NewACS data (or write to file)
|
||||
* Usage:
|
||||
* bta_print [time_step] [file_name]
|
||||
* Where:
|
||||
* time_step - writing period in sec., >=1.0
|
||||
* <1.0 - once and exit (default)
|
||||
* file_name - name of file to write to,
|
||||
* "-" - stdout (default)
|
||||
*/
|
||||
#include "bta_shdata.h"
|
||||
#include "takepic.h"
|
||||
#include "camtools.h"
|
||||
#include "bta_print.h"
|
||||
|
||||
#define CMNTSZ 79
|
||||
char comment[CMNTSZ + 1];
|
||||
#define CMNT(...) snprintf(comment, CMNTSZ, __VA_ARGS__)
|
||||
#define FTKEY(...) WRITEKEY(fp, __VA_ARGS__, comment)
|
||||
#define WRITEHIST(fp) \
|
||||
do{ if(test_headers){printf("HISTORY: %s\n", comment);}else{ \
|
||||
int status = 0; \
|
||||
fits_write_history(fp, comment, &status); \
|
||||
if(status) fits_report_error(stderr, status);\
|
||||
}}while(0)
|
||||
|
||||
// calculate airmass
|
||||
extern void calc_airmass(
|
||||
// in
|
||||
double daynum, // Day number from beginning of year, 0 = midnight Jan 1
|
||||
double relhumid,// Relative humidity in percent
|
||||
double p0, // local pressure in mmHg
|
||||
double t0, // temperature in kelvins
|
||||
double z, // zenith distance in degr
|
||||
// out
|
||||
double *am, // AIRMASS
|
||||
double *acd, // column density
|
||||
double *wcd, // water vapor column density
|
||||
double *wam // water vapor airmass
|
||||
);
|
||||
|
||||
static char buf[1024];
|
||||
char *time_asc(double t){
|
||||
int h, m;
|
||||
double s;
|
||||
h = (int)(t/3600.);
|
||||
m = (int)((t - (double)h*3600.)/60.);
|
||||
s = t - (double)h*3600. - (double)m*60.;
|
||||
h %= 24;
|
||||
if(s>59) s=59;
|
||||
sprintf(buf, "%dh:%02dm:%04.1fs", h,m,s);
|
||||
return buf;
|
||||
}
|
||||
|
||||
char *angle_asc(double a){
|
||||
char s;
|
||||
int d, min;
|
||||
double sec;
|
||||
if (a >= 0.)
|
||||
s = '+';
|
||||
else{
|
||||
s = '-'; a = -a;
|
||||
}
|
||||
d = (int)(a/3600.);
|
||||
min = (int)((a - (double)d*3600.)/60.);
|
||||
sec = a - (double)d*3600. - (double)min*60.;
|
||||
d %= 360;
|
||||
if(sec>59.9) sec=59.9;
|
||||
sprintf(buf, "%c%d:%02d':%04.1f''", s,d,min,sec);
|
||||
return buf;
|
||||
}
|
||||
|
||||
typedef struct{
|
||||
double Sid_time; // S_time-EE_time
|
||||
double JD; // JDate
|
||||
double Alpha; // val_Alp
|
||||
double Delta; // val_Del
|
||||
double Azimuth; // val_A
|
||||
double Zenith; // val_Z
|
||||
double P2; // val_P
|
||||
double Wind; // val_Wnd
|
||||
} BTA_PARAMS;
|
||||
|
||||
typedef struct _BTA_Que{
|
||||
BTA_PARAMS *data;
|
||||
struct _BTA_Que *next;
|
||||
struct _BTA_Que *last;
|
||||
} BTA_Queue;
|
||||
|
||||
void write_bta_queue(fitsfile *fp);
|
||||
BTA_Queue *bta_queue = NULL;
|
||||
|
||||
void write_bta_data(fitsfile *fp){
|
||||
char *val;
|
||||
double dtmp;
|
||||
time_t t_now = time(NULL);
|
||||
struct tm *tm_ut, *tm_loc;
|
||||
tm_ut = gmtime(&t_now);
|
||||
tm_loc = localtime(&t_now);
|
||||
if(!get_shm_block(&sdat, ClientSide)) return;
|
||||
if(!check_shm_block(&sdat)) return;
|
||||
/*
|
||||
* Observatory parameters
|
||||
*/
|
||||
// TELESCOP / Telescope name
|
||||
CMNT("Telescope name");
|
||||
FTKEY(TSTRING, "TELESCOP", "BTA 6m telescope");
|
||||
// ORIGIN / organization responsible for the data
|
||||
CMNT("organization responsible for the data");
|
||||
FTKEY(TSTRING, "ORIGIN", "SAO RAS");
|
||||
// OBSERVAT / Observatory name
|
||||
CMNT("Observatory name");
|
||||
FTKEY(TSTRING, "OBSERVAT", "Special Astrophysical Observatory, Russia");
|
||||
// placement
|
||||
CMNT("Observatory altitude, m");
|
||||
dtmp = TELALT; FTKEY(TDOUBLE, "ALT_OBS", &dtmp);
|
||||
CMNT("Observatory longitude, degr");
|
||||
dtmp = TELLONG; FTKEY(TDOUBLE, "LONG_OBS", &dtmp);
|
||||
CMNT("Observatory lattitude, degr");
|
||||
dtmp = TELLAT; FTKEY(TDOUBLE, "LAT_OBS", &dtmp);
|
||||
/*
|
||||
* Times
|
||||
*/
|
||||
dtmp = S_time-EE_time;
|
||||
// ST / sidereal time (hh:mm:ss.ms)
|
||||
CMNT("Sidereal time: %s", time_asc(dtmp));
|
||||
FTKEY(TDOUBLE, "ST", &dtmp);
|
||||
// UT / universal time (hh:mm:ss.ms)
|
||||
CMNT("Universal time: %s", time_asc(M_time));
|
||||
FTKEY(TDOUBLE, "UT", &M_time);
|
||||
CMNT("Julian date");
|
||||
FTKEY(TDOUBLE, "JD", &JDate);
|
||||
/*
|
||||
* Telescope parameters
|
||||
*/
|
||||
switch(Tel_Focus){
|
||||
case Nasmyth1 : val = "Nasmyth1"; break;
|
||||
case Nasmyth2 : val = "Nasmyth2"; break;
|
||||
default : val = "Prime"; break;
|
||||
}
|
||||
// FOCUS / Focus of telescope (mm)
|
||||
CMNT("Observation focus");
|
||||
FTKEY(TSTRING, "FOCUS", val);
|
||||
// VAL_F / focus value
|
||||
CMNT("Focus value (mm)");
|
||||
FTKEY(TDOUBLE, "VAL_F", &val_F);
|
||||
// EQUINOX / Epoch of RA & DEC
|
||||
dtmp = 1900 + tm_ut->tm_year + tm_ut->tm_yday / 365.2422;
|
||||
CMNT("Epoch of RA & DEC");
|
||||
FTKEY(TDOUBLE, "EQUINOX", &dtmp);
|
||||
CMNT("Current object R.A.: %s", time_asc(CurAlpha));
|
||||
// RA / Right ascention (H.H)
|
||||
dtmp = CurAlpha / 3600.; FTKEY(TDOUBLE, "RA", &dtmp);
|
||||
// DEC / Declination (D.D)
|
||||
CMNT("Current object Decl.: %s", angle_asc(CurDelta));
|
||||
dtmp = CurDelta / 3600.; FTKEY(TDOUBLE, "DEC", &dtmp);
|
||||
CMNT("Source R.A.: %s", time_asc(SrcAlpha));
|
||||
dtmp = SrcAlpha / 3600.; FTKEY(TDOUBLE, "S_RA", &dtmp);
|
||||
CMNT("Source Decl.: %s", angle_asc(SrcDelta));
|
||||
dtmp = SrcDelta / 3600.; FTKEY(TDOUBLE, "S_DEC", &dtmp);
|
||||
CMNT("Telescope R.A: %s", time_asc(val_Alp));
|
||||
dtmp = val_Alp / 3600.; FTKEY(TDOUBLE, "T_RA", &dtmp);
|
||||
CMNT("Telescope Decl.: %s", angle_asc(val_Del));
|
||||
dtmp = val_Del / 3600.; FTKEY(TDOUBLE, "T_DEC", &dtmp);
|
||||
// A / Azimuth
|
||||
CMNT("Current object Azimuth: %s", angle_asc(tag_A));
|
||||
dtmp = tag_A / 3600.; FTKEY(TDOUBLE, "A", &dtmp);
|
||||
// Z / Zenith distance
|
||||
CMNT("Current object Zenith: %s", angle_asc(tag_Z));
|
||||
dtmp = tag_Z / 3600.; FTKEY(TDOUBLE, "Z", &dtmp);
|
||||
// ROTANGLE / Field rotation angle
|
||||
CMNT("Field rotation angle: %s", angle_asc(tag_P));
|
||||
dtmp = tag_P / 3600.;FTKEY(TDOUBLE, "ROTANGLE", &dtmp);
|
||||
|
||||
CMNT("Telescope A: %s", angle_asc(val_A));
|
||||
dtmp = val_A / 3600.; FTKEY(TDOUBLE, "VAL_A", &dtmp);
|
||||
CMNT("Telescope Z: %s", angle_asc(val_Z));
|
||||
dtmp = val_Z / 3600.; FTKEY(TDOUBLE, "VAL_Z", &dtmp);
|
||||
CMNT("Current P: %s", angle_asc(val_P));
|
||||
dtmp = val_P / 3600.; FTKEY(TDOUBLE, "VAL_P", &dtmp);
|
||||
|
||||
CMNT("Dome A: %s", angle_asc(val_D));
|
||||
dtmp = val_D / 3600.; FTKEY(TDOUBLE, "VAL_D", &dtmp);
|
||||
// OUTTEMP / Out temperature (C)
|
||||
CMNT("Outern temperature, degC");
|
||||
FTKEY(TDOUBLE, "OUTTEMP", &val_T1);
|
||||
// DOMETEMP / Dome temperature (C)
|
||||
CMNT("In-dome temperature, degC");
|
||||
FTKEY(TDOUBLE, "DOMETEMP", &val_T2);
|
||||
// MIRRTEMP / Mirror temperature (C)
|
||||
CMNT("Mirror temperature, degC");
|
||||
FTKEY(TDOUBLE, "MIRRTEMP", &val_T3);
|
||||
// PRESSURE / Pressure (mmHg)
|
||||
CMNT("Pressure, mmHg");
|
||||
FTKEY(TDOUBLE, "PRESSURE", &val_B);
|
||||
// WIND / Wind speed (m/s)
|
||||
CMNT("Wind speed, m/s");
|
||||
FTKEY(TDOUBLE, "WIND", &val_Wnd);
|
||||
CMNT("Humidity, %%");
|
||||
FTKEY(TDOUBLE, "HUM", &val_Hmd);
|
||||
/*
|
||||
* Airmass calculation
|
||||
* by Reed D. Meyer
|
||||
*/
|
||||
double am, acd, wcd, wam;
|
||||
dtmp = tm_loc->tm_yday; // current day of year
|
||||
calc_airmass(dtmp, val_Hmd, val_B, val_T1+273.15, val_Z/3600., &am, &acd, &wcd, &wam);
|
||||
//printf("am=%g, acd=%g, wcd=%g, wam=%g\n", am,acd,wcd,wam);
|
||||
CMNT("Air mass by Reed D. Meyer");
|
||||
FTKEY(TDOUBLE, "AIRMASS", &am);
|
||||
CMNT("Water vapour air mass by Reed D. Meyer");
|
||||
FTKEY(TDOUBLE, "WVAM", &wam);
|
||||
CMNT("Atm. column density by Reed D. Meyer, g/cm^2");
|
||||
FTKEY(TDOUBLE, "ATMDENS", &acd);
|
||||
CMNT("WV column density by Reed D. Meyer, g/cm^2");
|
||||
FTKEY(TDOUBLE, "WVDENS", &wcd);
|
||||
// if bta_queue nonempty write its data to HISTORY section
|
||||
if(bta_queue) write_bta_queue(fp);
|
||||
}
|
||||
|
||||
// get parameters
|
||||
int get_params(BTA_PARAMS *P){
|
||||
if(!get_shm_block(&sdat, ClientSide)) return -1;
|
||||
if(!check_shm_block(&sdat)) return -1;
|
||||
P->Sid_time = S_time-EE_time;
|
||||
P->JD = JDate;
|
||||
P->Alpha = val_Alp;
|
||||
P->Delta = val_Del;
|
||||
P->Azimuth = val_A;
|
||||
P->Zenith = val_Z;
|
||||
P->P2 = val_P;
|
||||
P->Wind = val_Wnd;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int push_param(){
|
||||
if(!check_shm_block(&sdat)) return -3;
|
||||
BTA_PARAMS *Par = calloc(1, sizeof(BTA_PARAMS));
|
||||
BTA_Queue *qcur = calloc(1, sizeof(BTA_Queue));
|
||||
if(!Par || !qcur){
|
||||
free(Par);
|
||||
free(qcur);
|
||||
return -1; // malloc error
|
||||
}
|
||||
if(get_params(Par)){
|
||||
free(Par);
|
||||
free(qcur);
|
||||
return -2; // error getting parameters
|
||||
}
|
||||
qcur->data = Par;
|
||||
qcur->next = NULL;
|
||||
qcur->last = qcur;
|
||||
if(!bta_queue){ // initialisation of que
|
||||
bta_queue = qcur;
|
||||
}else{ // variable que initialized previously
|
||||
bta_queue->last->next = qcur;
|
||||
bta_queue->last = qcur;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void write_bta_queue(fitsfile *fp){
|
||||
#define HISTRY(...) do{CMNT(__VA_ARGS__); WRITEHIST(fp);}while(0)
|
||||
if(!bta_queue) return;
|
||||
BTA_Queue *cur = bta_queue;
|
||||
BTA_PARAMS *P;
|
||||
int i = 0;
|
||||
do{
|
||||
P = cur->data;
|
||||
HISTRY("Data record # %d", i);
|
||||
HISTRY("ST = %.3f / Sidereal time: %s", P->Sid_time, time_asc(P->Sid_time));
|
||||
HISTRY("JD = %.8g / Julian date", P->JD);
|
||||
HISTRY("T_RA = %.8g / Telescope R.A: %s", P->Alpha / 3600., time_asc(P->Alpha));
|
||||
HISTRY("T_DEC = %.8g / Telescope Decl.: %s", P->Delta / 3600., angle_asc(P->Delta));
|
||||
HISTRY("T_AZ = %.8g / Telescope Az: %s", P->Azimuth / 3600., angle_asc(P->Azimuth));
|
||||
HISTRY("T_ZD = %.8g / Telescope ZD: %s", P->Zenith / 3600., angle_asc(P->Zenith));
|
||||
HISTRY("T_P2 = %.8g / Current P: %s", P->P2 / 3600., angle_asc(P->P2));
|
||||
HISTRY("WIND = %.2g / Wind speed, m/s", P->Wind);
|
||||
i++;
|
||||
}while((cur = cur->next));
|
||||
}
|
||||
7
bta_print.h
Normal file
7
bta_print.h
Normal file
@ -0,0 +1,7 @@
|
||||
#ifndef __BTA_PRINT_H__
|
||||
#define __BTA_PRINT_H__
|
||||
|
||||
void write_bta_data(fitsfile *fp);
|
||||
int push_param();
|
||||
|
||||
#endif // __BTA_PRINT_H__
|
||||
1159
bta_shdata.h
Normal file
1159
bta_shdata.h
Normal file
File diff suppressed because it is too large
Load Diff
363
camtools.c
Normal file
363
camtools.c
Normal file
@ -0,0 +1,363 @@
|
||||
#include "takepic.h"
|
||||
#include "camtools.h"
|
||||
#include "usage.h"
|
||||
|
||||
#ifdef USE_BTA
|
||||
#include "bta_print.h"
|
||||
#endif
|
||||
|
||||
unsigned short max=0, min=65535; // extremums of current image
|
||||
double avr, std; // average value and standard deviation
|
||||
|
||||
/*
|
||||
* Fake util to show FITS keys in stdout
|
||||
* when test_headers == 1
|
||||
*/
|
||||
void print_fits_header(fitsfile *fptr __attribute((unused)), int datatype,
|
||||
char *keyname, void *value, char *comment){
|
||||
void _ub(char* r, void* p){snprintf(r, 80, "%hhu", *(unsigned char*)p);}
|
||||
void _b(char* r, void* p){snprintf(r, 80, "%hhd", *(char*)p);}
|
||||
void _us(char* r, void* p){snprintf(r, 80, "%hu", *(unsigned short*)p);}
|
||||
void _ui(char* r, void* p){snprintf(r, 80, "%u", *(unsigned int*)p);}
|
||||
void _ul(char* r, void* p){snprintf(r, 80, "%lu", *(unsigned long*)p);}
|
||||
void _s(char* r, void* p){snprintf(r, 80, "%hd", *(short*)p);}
|
||||
void _i(char* r, void* p){snprintf(r, 80, "%d", *(int*)p);}
|
||||
void _l(char* r, void* p){snprintf(r, 80, "%ld", *(long*)p);}
|
||||
void _ll(char* r, void* p){snprintf(r, 80, "%lld", *(long long*)p);}
|
||||
void _f(char* r, void* p){snprintf(r, 80, "%g", *(float*)p);}
|
||||
void _d(char* r, void* p){snprintf(r, 80, "%g", *(double*)p);}
|
||||
void _fc(char* r, void* p){snprintf(r, 80, "(%.4g, %.4g)",
|
||||
((float*)p)[0], ((float*)p)[1]);}
|
||||
void _dc(char* r, void* p){snprintf(r, 80, "(%.4g, %.4g)",
|
||||
((double*)p)[0], ((double*)p)[1]);}
|
||||
void _log(char* r, void* p){snprintf(r, 80, "'%s'", (int*)p ? "true" : "false");}
|
||||
void _str(char* r, void* p){snprintf(r, 80, "'%s'", (char*)p);}
|
||||
void _unk(char* r, void* p __attribute((unused))){sprintf(r, "unknown datatype");}
|
||||
char tmp[81], res[81];
|
||||
void (*__)(char*, void*);
|
||||
switch(datatype){
|
||||
case TBIT:
|
||||
case TBYTE: __ = _ub; break;
|
||||
case TSBYTE: __ = _b; break;
|
||||
case TUSHORT: __ = _us; break;
|
||||
case TUINT: __ = _ui; break;
|
||||
case TULONG: __ = _ul; break;
|
||||
case TSHORT: __ = _s; break;
|
||||
case TINT: __ = _i; break;
|
||||
case TLONG: __ = _l; break;
|
||||
case TLONGLONG: __ = _ll; break;
|
||||
case TFLOAT: __ = _f; break;
|
||||
case TDOUBLE: __ = _d; break;
|
||||
case TCOMPLEX: __ = _fc; break;
|
||||
case TDBLCOMPLEX: __ = _dc; break;
|
||||
case TLOGICAL: __ = _log; break;
|
||||
case TSTRING: __ = _str; break;
|
||||
default: __ = _unk;
|
||||
}
|
||||
__(res, value);
|
||||
if(strlen(res) < 20)
|
||||
snprintf(tmp, 80, "%-8s = %-20s", keyname, res);
|
||||
else
|
||||
snprintf(tmp, 80, "%-8s = %s", keyname, res);
|
||||
snprintf(res, 80, "%s / %s", tmp, comment);
|
||||
printf("%s\n", res);
|
||||
}
|
||||
|
||||
/*
|
||||
* set fun speed
|
||||
* if user set option fan-speed=F, then speed would be set to F
|
||||
* if onoff == FALSE, try to set speed according to hot Peltier temperature
|
||||
* if onoff == TRUE, set speed=3, if cooler is on, else set speed=0
|
||||
*/
|
||||
void AutoadjustFanSpeed(bool onoff){
|
||||
int Mode = 3, curMode, stat;
|
||||
double temp, HotTemp;
|
||||
stat = ApnGlueGetTemp(&temp);
|
||||
curMode = ApnGlueGetFan();
|
||||
HotTemp = ApnGlueGetHotTemp();
|
||||
if(fanspd != -1){
|
||||
ApnGlueSetFan(fanspd);
|
||||
}
|
||||
if(HotTemp < -30.){ // -255. - there's no thermometer on hot side
|
||||
// "÷ ×ÁÛÅÍ Ó×ÅÔÏÐÒÉÅÍÎÉËÅ ÎÅÔ \"ÇÏÒÑÞÅÇÏ\" ÔÅÒÍÏÍÅÔÒÁ"
|
||||
info(_("Your camera have no hot temperature sensor\n"));
|
||||
return;
|
||||
}
|
||||
if(onoff){ // quit, set speed according cooler status
|
||||
if(!stat && HotTemp < 30.) Mode = 0; // cooler is off -> turn fans off
|
||||
}else{
|
||||
if(HotTemp < 20.) Mode = 0;
|
||||
else if(HotTemp < 25.) Mode = 1;
|
||||
else if(HotTemp < 30.) Mode = 2;
|
||||
}
|
||||
if(Mode == curMode) return;
|
||||
ApnGlueSetFan(Mode);
|
||||
if(ApnGlueGetFan() == Mode)
|
||||
// "õÓÔÁÎÁ×ÌÉ×ÁÀ ÓËÏÒÏÓÔØ ×ÒÁÝÅÎÉÑ ×ÅÎÔÉÌÑÔÏÒÏ× × %d\n"
|
||||
info(_("Set fan speed %d\n"), Mode);
|
||||
else
|
||||
// "îÅ ÍÏÇÕ ÓÍÅÎÉÔØ ÓËÏÒÏÓÔØ ×ÒÁÝÅÎÉÑ ×ÅÎÔÉÌÑÔÏÒÏ×!\n"
|
||||
ERR("Can't set fan speed\n");
|
||||
}
|
||||
|
||||
double printCoolerStat(double *t_ext){
|
||||
double temp, extemp, settemp;
|
||||
char *s;
|
||||
int stat = ApnGlueGetTemp(&temp);
|
||||
extemp = ApnGlueGetHotTemp();
|
||||
if(ApnGlueReadSetPoint(&settemp, NULL)){
|
||||
// "ãÅÌÅ×ÁÑ ÔÅÍÐÅÒÁÔÕÒÁ: %g\n"
|
||||
info(_("Cooler setpoint: %g\n"), settemp);
|
||||
}
|
||||
switch(stat){
|
||||
case 0:
|
||||
// "èÏÌÏÄÉÌØÎÉË ÏÔËÌÀÞÅÎ"
|
||||
s = _("Cooler is off"); break;
|
||||
case 1:
|
||||
// "õÓÔÁÎÏ×ËÁ ÚÁÄÁÎÎÏÊ ÔÅÍÐÅÒÁÔÕÒÙ"
|
||||
s = _("Go to setpoint"); break;
|
||||
case 2:
|
||||
// "ðÏÄÄÅÒÖÁÎÉÅ ÚÁÄÁÎÎÏÊ ÔÅÍÐÅÒÁÔÕÒÙ"
|
||||
s = _("Keeping setpoint"); break;
|
||||
default:
|
||||
// "óÔÁÔÕÓ ÎÅÉÚ×ÅÓÔÅÎ"
|
||||
s = _("Unknown status");
|
||||
}
|
||||
info("%s, T=%g, Thot=%g\n", s, temp, extemp);
|
||||
if(t_ext) *t_ext = extemp;
|
||||
return temp;
|
||||
}
|
||||
|
||||
void print_stat(unsigned short *img, long size, FILE *f){
|
||||
long i, Noverld = 0L, N = 0L;
|
||||
double pv, sum=0., sum2=0., sz = (double)size, tres;
|
||||
unsigned short *ptr = img, val, valoverld;
|
||||
max = 0; min = 65535;
|
||||
if(twelveBit) min = 4095;
|
||||
valoverld = min - 5;
|
||||
for(i = 0; i < size; i++, ptr++){
|
||||
val = *ptr;
|
||||
pv = (double) val;
|
||||
sum += pv;
|
||||
sum2 += (pv * pv);
|
||||
if(max < val) max = val;
|
||||
if(min > val) min = val;
|
||||
if(val >= valoverld) Noverld++;
|
||||
}
|
||||
// "óÔÁÔÉÓÔÉËÁ ÐÏ ÉÚÏÂÒÁÖÅÎÉÀ:\n"
|
||||
printf(_("Image stat:\n"));
|
||||
avr = sum/sz;
|
||||
printf("avr = %.1f, std = %.1f, Noverload = %ld\n", avr,
|
||||
std = sqrt(fabs(sum2/sz - avr*avr)), Noverld);
|
||||
printf("max = %u, min = %u, size = %ld\n", max, min, size);
|
||||
if(!f) return;
|
||||
// full statistics
|
||||
fprintf(f, "%d\t%d\t%.3f\t%.3f\t%ld\t", max, min, avr, std, Noverld);
|
||||
Noverld = 0L;
|
||||
ptr = img; sum = 0.; sum2 = 0.;
|
||||
tres = avr + 3. * std; // max treshold == 3sigma
|
||||
for(i = 0; i < size; i++, ptr++){
|
||||
val = *ptr;
|
||||
pv = (double) val;
|
||||
if(pv > tres){
|
||||
Noverld++; // now this is an amount of overload pixels
|
||||
continue;
|
||||
}
|
||||
sum += pv;
|
||||
sum2 += (pv * pv);
|
||||
N++;
|
||||
}
|
||||
if(N == 0L){
|
||||
fprintf(f, "err\n");
|
||||
return;
|
||||
}
|
||||
sz = (double)N;
|
||||
avr = sum/sz; std = sqrt(fabs(sum2/sz - avr*avr));
|
||||
fprintf(f, "%ld\t%.3f\t%.3f\n", Noverld, avr, std);
|
||||
fflush(f);
|
||||
printf("Novr3 = %ld\n", Noverld);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* header must include:
|
||||
* RATE / Readout rate (KPix/sec)
|
||||
* GAIN / gain, e/ADU
|
||||
* SEEING / Seeing ('')
|
||||
* IMSCALE / Image scale (''/pix x ''/pix)
|
||||
* CLOUDS / Clouds (%)
|
||||
*/
|
||||
|
||||
|
||||
int writefits(char *filename, int width, int height, void *data){
|
||||
long naxes[2] = {width, height};//, startTime;
|
||||
double tmp = 0.0;
|
||||
unsigned short ustmp;
|
||||
struct tm *tm_starttime;
|
||||
char buf[80];
|
||||
time_t savetime = time(NULL);
|
||||
fitsfile *fp;
|
||||
TRYFITS(fits_create_file, &fp, filename);
|
||||
TRYFITS(fits_create_img, fp, USHORT_IMG, 2, naxes);
|
||||
// FILE / Input file original name
|
||||
WRITEKEY(fp, TSTRING, "FILE", filename, "Input file original name");
|
||||
/*
|
||||
* Detector parameters
|
||||
*/
|
||||
// DETECTOR / detector
|
||||
if(camera){
|
||||
WRITEKEY(fp, TSTRING, "DETECTOR", camera, "Detector model");
|
||||
}
|
||||
// SENSOR / sensor
|
||||
if(sensor){
|
||||
WRITEKEY(fp, TSTRING, "SENSOR", sensor, "Camera sensor model");
|
||||
}
|
||||
// INSTRUME / Instrument
|
||||
if(instrument){
|
||||
WRITEKEY(fp, TSTRING, "INSTRUME", instrument, "Instrument");
|
||||
}else
|
||||
WRITEKEY(fp, TSTRING, "INSTRUME", "direct imaging", "Instrument");
|
||||
snprintf(buf, 79, "%.g x %.g", pixX, pixY);
|
||||
// PXSIZE / pixel size
|
||||
WRITEKEY(fp, TSTRING, "PXSIZE", buf, "Pixel size in mkm");
|
||||
// XPIXELSZ, YPIXELSZ -- the same
|
||||
WRITEKEY(fp, TDOUBLE, "XPIXELSZ", &pixX, "X pixel size in mkm");
|
||||
WRITEKEY(fp, TDOUBLE, "YPIXELSZ", &pixY, "Y pixel size in mkm");
|
||||
WRITEKEY(fp, TSTRING, "VIEW_FIELD", viewfield, "Camera field of view");
|
||||
// CRVAL1, CRVAL2 / Offset in X, Y
|
||||
if(X0) WRITEKEY(fp, TINT, "CRVAL1", &X0, "Offset in X");
|
||||
if(Y0) WRITEKEY(fp, TINT, "CRVAL2", &Y0, "Offset in Y");
|
||||
if(exptime == 0) sprintf(buf, "bias");
|
||||
else if(shutter == 0) sprintf(buf, "dark");
|
||||
else if(objtype) strncpy(buf, objtype, 79);
|
||||
else sprintf(buf, "object");
|
||||
// IMAGETYP / object, flat, dark, bias, scan, eta, neon, push
|
||||
WRITEKEY(fp, TSTRING, "IMAGETYP", buf, "Image type");
|
||||
// DATAMAX, DATAMIN / Max,min pixel value
|
||||
ustmp = ((twelveBit) ? 4095 : 65535);
|
||||
WRITEKEY(fp, TUSHORT, "DATAMAX", &ustmp, "Max pixel value");
|
||||
ustmp = 0;
|
||||
WRITEKEY(fp, TUSHORT, "DATAMIN", &ustmp, "Min pixel value");
|
||||
// Some Statistics
|
||||
WRITEKEY(fp, TUSHORT, "STATMAX", &max, "Max data value");
|
||||
WRITEKEY(fp, TUSHORT, "STATMIN", &min, "Min data value");
|
||||
WRITEKEY(fp, TDOUBLE, "STATAVR", &avr, "Average data value");
|
||||
WRITEKEY(fp, TDOUBLE, "STATSTD", &std, "Standart deviation of data value");
|
||||
// Temperatures
|
||||
WRITEKEY(fp, TDOUBLE, "TEMP0", &temperature, "Camera temperature at exp. start (degr C)");
|
||||
WRITEKEY(fp, TDOUBLE, "TEMP1", &t_int, "Camera temperature at exp. end (degr C)");
|
||||
if(t_ext > -30.) // there's a hot temp sensor
|
||||
WRITEKEY(fp, TDOUBLE, "TEMPBODY", &t_ext, "Camera body temperature at exp. end (degr C)");
|
||||
tmp = (temperature + t_int) / 2. + 273.15;
|
||||
// CAMTEMP / Camera temperature (K)
|
||||
WRITEKEY(fp, TDOUBLE, "CAMTEMP", &tmp, "Camera temperature (K)");
|
||||
tmp = (double)exptime / 1000.;
|
||||
// EXPTIME / actual exposition time (sec)
|
||||
WRITEKEY(fp, TDOUBLE, "EXPTIME", &tmp, "actual exposition time (sec)");
|
||||
// DATE / Creation date (YYYY-MM-DDThh:mm:ss, UTC)
|
||||
strftime(buf, 79, "%Y-%m-%dT%H:%M:%S", gmtime(&savetime));
|
||||
WRITEKEY(fp, TSTRING, "DATE", buf, "Creation date (YYYY-MM-DDThh:mm:ss, UTC)");
|
||||
tm_starttime = localtime(&expStartsAt);
|
||||
/*
|
||||
* startTime = (long)expStartsAt;
|
||||
* strftime(buf, 79, "exposition starts at %d/%m/%Y, %H:%M:%S (local)", tm_starttime);
|
||||
* WRITEKEY(fp, TLONG, "UNIXTIME", &startTime, buf);
|
||||
*/
|
||||
strftime(buf, 79, "%Y-%m-%dT%H:%M:%S", tm_starttime);
|
||||
// DATE-OBS / DATE OF OBS.
|
||||
WRITEKEY(fp, TSTRING, "DATE-OBS", buf, "DATE OF OBS. (YYYY-MM-DDThh:mm:ss, local)");
|
||||
/*
|
||||
* // START / Measurement start time (local) (hh:mm:ss)
|
||||
* strftime(buf, 79, "%H:%M:%S", tm_starttime);
|
||||
* WRITEKEY(fp, TSTRING, "START", buf, "Measurement start time (hh:mm:ss, local)");
|
||||
*/
|
||||
// OBJECT / Object name
|
||||
if(objname){
|
||||
WRITEKEY(fp, TSTRING, "OBJECT", objname, "Object name");
|
||||
}
|
||||
// BINNING / Binning
|
||||
if(hbin != 1 || vbin != 1){
|
||||
snprintf(buf, 79, "%d x %d", hbin, vbin);
|
||||
WRITEKEY(fp, TSTRING, "BINNING", buf, "Binning (hbin x vbin)");
|
||||
}
|
||||
WRITEKEY(fp, TINT, "XBIN", &hbin, "Horizontal binning");
|
||||
WRITEKEY(fp, TINT, "YBIN", &vbin, "Vertical binning");
|
||||
// OBSERVER / Observers
|
||||
if(observers){
|
||||
WRITEKEY(fp, TSTRING, "OBSERVER", observers, "Observers");
|
||||
}
|
||||
// PROG-ID / Observation program identifier
|
||||
if(prog_id){
|
||||
WRITEKEY(fp, TSTRING, "PROG-ID", prog_id, "Observation program identifier");
|
||||
}
|
||||
// AUTHOR / Author of the program
|
||||
if(author){
|
||||
WRITEKEY(fp, TSTRING, "AUTHOR", author, "Author of the program");
|
||||
}
|
||||
#ifdef USE_BTA
|
||||
write_bta_data(fp);
|
||||
#endif
|
||||
TRYFITS(fits_write_img, fp, TUSHORT, 1, width * height, data);
|
||||
TRYFITS(fits_close_file, fp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef USEPNG
|
||||
int writepng(char *filename, int width, int height, void *data){
|
||||
int err;
|
||||
FILE *fp = NULL;
|
||||
png_structp pngptr = NULL;
|
||||
png_infop infoptr = NULL;
|
||||
void *row;
|
||||
if ((fp = fopen(filename, "wb")) == NULL){
|
||||
err = -errno;
|
||||
goto done;
|
||||
}
|
||||
if ((pngptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,
|
||||
NULL, NULL, NULL)) == NULL){
|
||||
err = -ENOMEM;
|
||||
goto done;
|
||||
}
|
||||
if ((infoptr = png_create_info_struct(pngptr)) == NULL){
|
||||
err = -ENOMEM;
|
||||
goto done;
|
||||
}
|
||||
png_init_io(pngptr, fp);
|
||||
png_set_compression_level(pngptr, Z_BEST_COMPRESSION);
|
||||
png_set_IHDR(pngptr, infoptr, width, height, 16, PNG_COLOR_TYPE_GRAY,
|
||||
PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
|
||||
PNG_FILTER_TYPE_DEFAULT);
|
||||
png_write_info(pngptr, infoptr);
|
||||
png_set_swap(pngptr);
|
||||
for(row = data; height > 0; row += width * sizeof(u_int16_t), height--)
|
||||
png_write_row(pngptr, row);
|
||||
png_write_end(pngptr, infoptr);
|
||||
err = 0;
|
||||
done:
|
||||
if(fp) fclose(fp);
|
||||
if(pngptr) png_destroy_write_struct(&pngptr, &infoptr);
|
||||
return err;
|
||||
}
|
||||
#endif /* USEPNG */
|
||||
|
||||
#ifdef USERAW
|
||||
int writeraw(char *filename, int width, int height, void *data){
|
||||
int fd, size, err;
|
||||
if ((fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC,
|
||||
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH )) == -1){
|
||||
warn("open(%s) failed", filename);
|
||||
return -errno;
|
||||
}
|
||||
size = width * height * sizeof(unsigned short);
|
||||
if ((err = write(fd, data, size)) != size){
|
||||
warn("write() failed");
|
||||
err = -errno;
|
||||
}
|
||||
else err = 0;
|
||||
close(fd);
|
||||
return err;
|
||||
}
|
||||
#endif // USERAW
|
||||
45
camtools.h
Normal file
45
camtools.h
Normal file
@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
#ifndef __CAMTOOLS_H__
|
||||
#define __CAMTOOLS_H__
|
||||
|
||||
#define TRYFITS(f, ...) \
|
||||
do{if(!test_headers){ int status = 0; \
|
||||
f(__VA_ARGS__, &status); \
|
||||
if (status){ \
|
||||
fits_report_error(stderr, status); \
|
||||
return -1;} \
|
||||
}}while(0)
|
||||
#define WRITEKEY(...) \
|
||||
do{ if(test_headers){ \
|
||||
print_fits_header(__VA_ARGS__); \
|
||||
}else{ int status = 0; \
|
||||
fits_write_key(__VA_ARGS__, &status); \
|
||||
if(status) fits_report_error(stderr, status);\
|
||||
}}while(0)
|
||||
|
||||
void print_fits_header(fitsfile *fptr, int datatype, char *keyname,
|
||||
void *value, char *comment);
|
||||
|
||||
extern char *camera, *sensor, viewfield[];
|
||||
extern double pixX, pixY, t_ext, t_int;
|
||||
extern unsigned short max, min;
|
||||
extern double avr, std;
|
||||
extern time_t expStartsAt;
|
||||
|
||||
|
||||
void AutoadjustFanSpeed(bool onoff);
|
||||
double printCoolerStat(double *t_ext);
|
||||
|
||||
void print_stat(unsigned short *img, long size, FILE* f);
|
||||
|
||||
|
||||
int writefits(char *filename, int width, int height, void *data);
|
||||
#ifdef USEPNG
|
||||
int writepng(char *filename, int width, int height, void *data);
|
||||
#endif /* USEPNG */
|
||||
#ifdef USERAW
|
||||
int writeraw(char *filename, int width, int height, void *data);
|
||||
#endif // USERAW
|
||||
|
||||
#endif // __CAMTOOLS_H__
|
||||
|
||||
BIN
locale/ru/LC_MESSAGES/apogee_control.mo
Normal file
BIN
locale/ru/LC_MESSAGES/apogee_control.mo
Normal file
Binary file not shown.
647
locale/ru/messages.po
Normal file
647
locale/ru/messages.po
Normal file
@ -0,0 +1,647 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2013-08-29 10:54+0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=koi8-r\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#. "ðÏÌÕÞÅÎ ÓÉÇÎÁÌ %d, ÏÔËÌÀÞÁÀÓØ.\n"
|
||||
#: takepic.c:62
|
||||
#, c-format
|
||||
msgid "Get signal %d, quit.\n"
|
||||
msgstr ""
|
||||
|
||||
#. "îÅ ÍÏÇÕ ÕÄÁÌÉÔØ PID-ÆÁÊÌ"
|
||||
#: takepic.c:68
|
||||
msgid "Can't delete PIDfile"
|
||||
msgstr ""
|
||||
|
||||
#. "ïÂÎÁÒÕÖÅÎ ÒÁÂÏÔÁÀÝÉÊ ÐÒÏÃÅÓÓ (pid=%d), ×ÙÈÏÄ.\n"
|
||||
#: takepic.c:108 takepic.c:120
|
||||
#, c-format
|
||||
msgid ""
|
||||
"\n"
|
||||
"Found running process (pid=%d), exit.\n"
|
||||
msgstr ""
|
||||
|
||||
#. "îÅ ÍÏÇÕ ÏÔËÒÙÔØ ÔÕÒÅÌØ"
|
||||
#: takepic.c:152
|
||||
msgid "Can't open turret"
|
||||
msgstr ""
|
||||
|
||||
#. "íÁËÓÉÍÁÌØÎÁÑ (MAX) É ÔÅËÕÝÁÑ (CUR) ÐÏÚÉÃÉÉ ÔÕÒÅÌÉ:\n"
|
||||
#: takepic.c:159
|
||||
#, c-format
|
||||
msgid "Turret MAXimum position and CURrent position:\n"
|
||||
msgstr ""
|
||||
|
||||
#. "ôÒÅÂÕÅÍÁÑ ÐÏÚÉÃÉÑ ÂÏÌØÛÅ ÍÁËÓÉÍÁÌØÎÏÊ"
|
||||
#: takepic.c:164
|
||||
msgid "Required position greater then max"
|
||||
msgstr ""
|
||||
|
||||
#. "îÅ ÍÏÇÕ ÐÅÒÅÍÅÓÔÉÔØ ÔÕÒÅÌØ"
|
||||
#: takepic.c:169
|
||||
msgid "Can't move turret"
|
||||
msgstr ""
|
||||
|
||||
#. "ðÏÄÏÖÄÉÔÅ ÚÁ×ÅÒÛÅÎÉÑ ÐÅÒÅÍÅÝÅÎÉÑ ÔÕÒÅÌÉ "
|
||||
#: takepic.c:174
|
||||
#, c-format
|
||||
msgid "Wait, while turret is moving "
|
||||
msgstr ""
|
||||
|
||||
#. "ïÂÎÁÒÕÖÅÎÁ ËÁÍÅÒÁ '%s' Ó ÄÁÔÞÉËÏÍ '%s'"
|
||||
#: takepic.c:226
|
||||
#, c-format
|
||||
msgid "Find camera '%s' with sensor '%s'"
|
||||
msgstr ""
|
||||
|
||||
#. "ïÛÉÂËÁ ÐÅÒÅÈÏÄÁ × ÓÐÑÝÉÊ ÒÅÖÉÍ!"
|
||||
#: takepic.c:236
|
||||
msgid "Error: sleepless night!"
|
||||
msgstr ""
|
||||
|
||||
#. "îÅ ÍÏÇÕ ÏÔËÒÙÔØ ÆÁÊÌ ÖÕÒÎÁÌÁ ÔÅÍÐÅÒÁÔÕÒ"
|
||||
#: takepic.c:250
|
||||
msgid "Can't open temperature log file"
|
||||
msgstr ""
|
||||
|
||||
#. "îÅ ÍÏÇÕ ÏÔËÒÙÔØ ÆÁÊÌ ÖÕÒÎÁÌÁ ÓÔÁÔÉÓÔÉËÉ"
|
||||
#: takepic.c:264
|
||||
msgid "Can't open statistics log file"
|
||||
msgstr ""
|
||||
|
||||
#. "\núÁÔ×ÏÒ "
|
||||
#: takepic.c:273
|
||||
#, c-format
|
||||
msgid ""
|
||||
"\n"
|
||||
"The shutter is "
|
||||
msgstr ""
|
||||
|
||||
#. "ÏÔËÒÙÔ\n"
|
||||
#: takepic.c:276
|
||||
#, c-format
|
||||
msgid "open\n"
|
||||
msgstr ""
|
||||
|
||||
#. "ÚÁËÒÙÔ\n"
|
||||
#: takepic.c:279
|
||||
#, c-format
|
||||
msgid "closed\n"
|
||||
msgstr ""
|
||||
|
||||
#. "ïÔËÌÀÞÅÎÉÅ ÈÏÌÏÄÉÌØÎÉËÁ"
|
||||
#: takepic.c:285
|
||||
msgid "Switch cooler off"
|
||||
msgstr ""
|
||||
|
||||
#. "éÚÍÅÎÅÎÉÅ ÔÅÍÐÅÒÁÔÕÒÙ ÈÏÌÏÄÉÌØÎÉËÁ"
|
||||
#: takepic.c:291
|
||||
msgid "Changing of cooler setpoint"
|
||||
msgstr ""
|
||||
|
||||
#. "ôÅÍÐÅÒÁÔÕÒÁ ÎÉÖÅ ÄÏÐÕÓÔÉÍÏÊ"
|
||||
#: takepic.c:294
|
||||
msgid "The temperature setpoint is too low"
|
||||
msgstr ""
|
||||
|
||||
#. "÷ÉÄÉÍÏÅ ÐÏÌÅ: %s"
|
||||
#: takepic.c:303
|
||||
#, c-format
|
||||
msgid "Field of view: %s"
|
||||
msgstr ""
|
||||
|
||||
#. "ðÏÌÅ ÉÚÏÂÒÁÖÅÎÉÑ: (0, %d)(0, %d)"
|
||||
#: takepic.c:305
|
||||
#, c-format
|
||||
msgid "Array field: (0, %d)(0, %d)"
|
||||
msgstr ""
|
||||
|
||||
#. pre-expose
|
||||
#. "ðÒÅÄ×ÁÒÉÔÅÌØÎÁÑ ÜËÓÐÏÚÉÃÉÑ"
|
||||
#: takepic.c:341
|
||||
msgid "Pre-expose"
|
||||
msgstr ""
|
||||
|
||||
#. "ïÛÉÂËÁ ÓÞÉÔÙ×ÁÎÉÑ: %s\n"
|
||||
#: takepic.c:353 takepic.c:414
|
||||
#, c-format
|
||||
msgid "Readout error: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#. "úÁÈ×ÁÔ ËÁÄÒÁ %d, ×ÒÅÍÑ ÜËÓÐÏÚÉÃÉÉ - %g ÓÅËÕÎÄ\n"
|
||||
#: takepic.c:380
|
||||
#, c-format
|
||||
msgid "Capture frame %d, exp time - %g sec\n"
|
||||
msgstr ""
|
||||
|
||||
#. "óÞÉÔÙ×ÁÎÉÅ ÉÚÏÂÒÁÖÅÎÉÑ:"
|
||||
#: takepic.c:408
|
||||
#, c-format
|
||||
msgid "Read image: "
|
||||
msgstr ""
|
||||
|
||||
#. "îÅ ÍÏÇÕ ÓÏÈÒÁÎÉÔØ ÆÁÊÌ"
|
||||
#: takepic.c:428
|
||||
msgid "Can't save file"
|
||||
msgstr ""
|
||||
|
||||
#. "æÁÊÌ ÚÁÐÉÓÁÎ × '%s'"
|
||||
#: takepic.c:432
|
||||
#, c-format
|
||||
msgid "File saved as '%s'"
|
||||
msgstr ""
|
||||
|
||||
#. "%d ÓÅËÕÎÄ ÄÏ ÏËÏÎÞÁÎÉÑ ÐÁÕÚÙ\n"
|
||||
#: takepic.c:450
|
||||
#, c-format
|
||||
msgid "%d seconds till pause ends\n"
|
||||
msgstr ""
|
||||
|
||||
#. "îÅ×ÅÒÎÁÑ ÎÉÖÎÑÑ ÇÒÁÎÉÃÁ: %s"
|
||||
#: usage.c:77
|
||||
#, c-format
|
||||
msgid "Wrong lower border: %s"
|
||||
msgstr ""
|
||||
|
||||
#. "îÅ×ÅÒÎÁÑ ×ÅÒÈÎÑÑ ÇÒÁÎÉÃÁ: %s"
|
||||
#: usage.c:82
|
||||
#, c-format
|
||||
msgid "Wrong upper border: %s"
|
||||
msgstr ""
|
||||
|
||||
#. "éÓÐÏÌØÚÏ×ÁÎÉÅ:\t%s [ÏÐÃÉÉ] [ÐÒÅÆÉËÓ ×ÙÈÏÄÎÙÈ ÆÁÊÌÏ×]\n"
|
||||
#: usage.c:98
|
||||
#, c-format
|
||||
msgid "Usage:\t%s [options] [output files prefix]\n"
|
||||
msgstr ""
|
||||
|
||||
#. "\tïÐÃÉÉ:\n"
|
||||
#: usage.c:101
|
||||
#, c-format
|
||||
msgid "\tOptions:\n"
|
||||
msgstr ""
|
||||
|
||||
#. "Á×ÔÏÒ ÐÒÏÇÒÁÍÍÙ"
|
||||
#: usage.c:104
|
||||
msgid "program author"
|
||||
msgstr ""
|
||||
|
||||
#. "ÏÔËÌÀÞÉÔØ ÈÏÌÏÄÉÌØÎÉË"
|
||||
#: usage.c:107 usage.c:289
|
||||
msgid "Set cooler off"
|
||||
msgstr ""
|
||||
|
||||
#. "ÎÅ ÏÔËÒÙ×ÁÔØ ÚÁÔ×ÏÒ ÐÒÉ ÜËÓÐÏÚÉÃÉÉ (\"ÔÅÍÎÏ×ÙÅ\")"
|
||||
#: usage.c:110
|
||||
msgid "not open shutter when exposing (\"dark frames\")"
|
||||
msgstr ""
|
||||
|
||||
#. "ÎÅ ÚÁÓ×ÅÞÉ×ÁÔØ ÍÁÔÒÉÃÕ ÐÅÒÅÄ ÜËÓÐÏÚÉÃÉÅÊ"
|
||||
#: usage.c:113
|
||||
msgid "Don't flash CCD chip before expose"
|
||||
msgstr ""
|
||||
|
||||
#. "õÓÔÁÎÏ×ÉÔØ ÓËÏÒÏÓÔØ ×ÅÎÔÉÌÑÔÏÒÏ× × F (0..3)"
|
||||
#: usage.c:116
|
||||
msgid "Set fan speed to F (0..3)"
|
||||
msgstr ""
|
||||
|
||||
#. ÐÏÌÕÞÉÔØ Ó×ÅÄÅÎÉÑ Ï ÔÕÒÅÌÉ
|
||||
#: usage.c:119
|
||||
msgid "get turret's parameters"
|
||||
msgstr ""
|
||||
|
||||
#. ÐÅÒÅÍÅÓÔÉÔØ ÔÕÒÅÌØ × N-À ÐÏÚÉÃÉÀ
|
||||
#: usage.c:122
|
||||
msgid "set turret to Nth position"
|
||||
msgstr ""
|
||||
|
||||
#. "ÉÎÔÅÒ×ÁÌ ×ÒÅÍÅÎÉ ÍÅÖÄÕ ÐÏÓÌÅÄÏ×ÁÔÅÌØÎÙÍÉ ÚÁÐÉÓÑÍÉ × ÌÏÇ É HISTORY (× ÓÅËÕÎÄÁÈ)"
|
||||
#: usage.c:125
|
||||
msgid "time interval between sequential writings to log & HISTORY (in seconds)"
|
||||
msgstr ""
|
||||
|
||||
#. "ÂÉÎÎÉÎÇ N ÐÉËÓÅÌÅÊ ÐÏ ÇÏÒÉÚÏÎÔÁÌÉ"
|
||||
#: usage.c:128
|
||||
msgid "horizontal binning to N pixels"
|
||||
msgstr ""
|
||||
|
||||
#. "ÔÉÐ ÉÚÏÂÒÁÖÅÎÉÑ"
|
||||
#: usage.c:131
|
||||
msgid "image type"
|
||||
msgstr ""
|
||||
|
||||
#. "ÎÁÚ×ÁÎÉÅ ÐÒÉÂÏÒÁ"
|
||||
#: usage.c:134
|
||||
msgid "instrument name"
|
||||
msgstr ""
|
||||
|
||||
#. "ÎÅ ÓÏÈÒÁÎÑÔØ ÉÚÏÂÒÁÖÅÎÉÑ, ÌÉÛØ ×ÅÓÔÉ ÚÁÐÉÓØ ÓÔÁÔÉÓÔËÉ"
|
||||
#: usage.c:137
|
||||
msgid "don't save images, only make all-stat log"
|
||||
msgstr ""
|
||||
|
||||
#. "×ÅÓÔÉ ÚÁÐÉÓØ ÒÁÂÏÞÉÈ ÔÅÍÐÅÒÁÔÕÒ × ÆÁÊÌ temp_log"
|
||||
#: usage.c:140
|
||||
msgid "make temperatures logging to file temp_log"
|
||||
msgstr ""
|
||||
|
||||
#. "ÒÁÂÏÔÁÔØ Ó N-Ê ËÁÍÅÒÏÊ"
|
||||
#: usage.c:143
|
||||
msgid "work with Nth camera"
|
||||
msgstr ""
|
||||
|
||||
#. "N ËÁÄÒÏ× × ÓÅÒÉÉ"
|
||||
#: usage.c:146
|
||||
msgid "make series of N frames"
|
||||
msgstr ""
|
||||
|
||||
#. "ÎÁÚ×ÁÎÉÅ ÏÂßÅËÔÁ"
|
||||
#: usage.c:149
|
||||
msgid "object name"
|
||||
msgstr ""
|
||||
|
||||
#. "ÉÍÅÎÁ ÎÁÂÌÀÄÁÔÅÌÅÊ"
|
||||
#: usage.c:152
|
||||
msgid "observers' names"
|
||||
msgstr ""
|
||||
|
||||
#. "ÎÁÚ×ÁÎÉÅ ÐÒÏÇÒÁÍÍÙ ÎÁÂÌÀÄÅÎÉÊ"
|
||||
#: usage.c:155
|
||||
msgid "observing program name"
|
||||
msgstr ""
|
||||
|
||||
#. "×ÙÄÅÒÖÁÔØ ptime ÓÅËÕÎÄ ÍÅÖÄÕ ÜËÓÐÏÚÉÃÉÑÍÉ"
|
||||
#: usage.c:158
|
||||
msgid "make pause for ptime seconds between expositions"
|
||||
msgstr ""
|
||||
|
||||
#. "ÕÓÔÁÎÏ×ÉÔØ ÓËÏÒÏÓÔØ ÓÞÉÔÙ×ÁÎÉÑ × N"
|
||||
#: usage.c:161
|
||||
msgid "set readout speed to N"
|
||||
msgstr ""
|
||||
|
||||
#. "ðÏÌÎÙÊ ÓÂÒÏÓ"
|
||||
#: usage.c:164
|
||||
msgid "full reset"
|
||||
msgstr ""
|
||||
|
||||
#. "ÐÅÒÅÊÔÉ × ÓÐÑÝÉÊ ÒÅÖÉÍ"
|
||||
#: usage.c:167
|
||||
msgid "go to sleeping mode"
|
||||
msgstr ""
|
||||
|
||||
#. "ÎÅ ÓÏÈÒÁÎÑÔØ ÉÚÏÂÒÁÖÅÎÉÅ, Á ÔÏÌØËÏ ÏÔÏÂÒÁÚÉÔØ ÓÔÁÔÉÓÔÉËÕ"
|
||||
#: usage.c:170
|
||||
msgid "not save image, just show statistics"
|
||||
msgstr ""
|
||||
|
||||
#. "ÔÏÌØËÏ ÚÁÄÁÔØ/ÐÏÌÕÞÉÔØ ÔÅÍÐÅÒÁÔÕÒÕ"
|
||||
#. "ÔÏÌØËÏ ÏÔÏÂÒÁÚÉÔØ/ÚÁÄÁÔØ ÔÅÍÐÅÒÁÔÕÒÕ"
|
||||
#: usage.c:173 usage.c:426
|
||||
msgid "only set/get temperature"
|
||||
msgstr ""
|
||||
|
||||
#. "ÚÁÄÁÔØ ÒÁÂÏÞÕÀ ÔÅÍÐÅÒÁÔÕÒÕ degr ÇÒÁÄÕÓÏ×"
|
||||
#: usage.c:176
|
||||
msgid "set work temperature to degr C"
|
||||
msgstr ""
|
||||
|
||||
#. "ÂÉÎÎÉÎÇ N ÐÉËÓÅÌÅÊ ÐÏ ×ÅÒÔÉËÁÌÉ"
|
||||
#: usage.c:179
|
||||
msgid "vertical binning to N pixels"
|
||||
msgstr ""
|
||||
|
||||
#. ÕÓÔÁÎÏ×ÉÔØ ÎÏÍÅÒ ÔÕÒÅÌÉ × N
|
||||
#: usage.c:182
|
||||
msgid "set turret's number to N"
|
||||
msgstr ""
|
||||
|
||||
#. "×ÏÚÏÂÎÏ×ÉÔØ ÐÉÔÁÎÉÅ"
|
||||
#: usage.c:185
|
||||
msgid "resume system"
|
||||
msgstr ""
|
||||
|
||||
#. "×ÒÅÍÑ ÜËÓÐÏÚÉÃÉÉ exptime ÍÓ"
|
||||
#: usage.c:188
|
||||
msgid "set exposure time to exptime ms"
|
||||
msgstr ""
|
||||
|
||||
#. "×ÙÂÒÁÔØ ÄÉÁÐÁÚÏÎ ÄÌÑ ÓÞÉÔÙ×ÁÎÉÑ"
|
||||
#: usage.c:191 usage.c:194
|
||||
msgid "select clip region"
|
||||
msgstr ""
|
||||
|
||||
#. "ÎÅ ÏÞÉÝÁÔØ ÍÁÔÒÉÃÕ ÐÏÓÌÅ ÓÞÉÔÙ×ÁÎÉÑ"
|
||||
#: usage.c:198
|
||||
msgid "don't flush ccd after expose"
|
||||
msgstr ""
|
||||
|
||||
#. "×ÙÐÏÌÎÉÔØ ÐÒÅÄ×ÁÒÉÔÅÌØÎÕÀ ÎÕÌÅ×ÕÀ ÜËÓÐÏÚÉÃÉÀ ÄÌÑ ÏÞÉÓÔËÉ ÍÁÔÒÉÃÙ"
|
||||
#: usage.c:201
|
||||
msgid "make a preliminary zero exposition for cleaning CCD"
|
||||
msgstr ""
|
||||
|
||||
#. "ÏÔËÒÙÔØ ÚÁÔ×ÏÒ"
|
||||
#: usage.c:204
|
||||
msgid "open shutter"
|
||||
msgstr ""
|
||||
|
||||
#. "ÚÁÔËÒÙÔØ ÚÁÔ×ÏÒ"
|
||||
#: usage.c:207
|
||||
msgid "close shutter"
|
||||
msgstr ""
|
||||
|
||||
#. "ÎÅ ÏÔËÒÙ×ÁÔØ ÕÓÔÒÏÊÓÔ×Ï, ÌÉÛØ ÏÔÏÂÒÁÚÉÔØ ÛÁÐËÕ FITS"
|
||||
#: usage.c:210
|
||||
msgid "don't open camera device, just show FITS header"
|
||||
msgstr ""
|
||||
|
||||
#. "ÒÁÂÏÔÁÔØ × 12-ÂÉÔÎÏÍ ÒÅÖÉÍÅ"
|
||||
#: usage.c:213
|
||||
msgid "work in a 12-bit ADC mode"
|
||||
msgstr ""
|
||||
|
||||
#. "îÅ ××ÅÄÅÎÏ ÎÉËÁËÉÈ ÐÁÒÁÍÅÔÒÏ×"
|
||||
#: usage.c:271
|
||||
msgid "Any parameters are absent"
|
||||
msgstr ""
|
||||
|
||||
#. "á×ÔÏÒ ÐÒÏÇÒÁÍÍÙ: %s"
|
||||
#: usage.c:283
|
||||
#, c-format
|
||||
msgid "Program author: %s"
|
||||
msgstr ""
|
||||
|
||||
#. "óßÅÍËÁ ÔÅÍÎÏ×ÙÈ"
|
||||
#: usage.c:295
|
||||
msgid "Dark frames"
|
||||
msgstr ""
|
||||
|
||||
#. "îÅ ÚÁÓ×ÅÞÉ×ÁÔØ ËÁÍÅÒÕ ÄÏ ÜËÓÐÏÚÉÃÉÉ"
|
||||
#: usage.c:300
|
||||
msgid "No pre-expose flash"
|
||||
msgstr ""
|
||||
|
||||
#. "óËÏÒÏÓÔØ ×ÅÎÔÉÌÑÔÏÒÁ ÄÏÌÖÎÁ ÂÙÔØ × ÐÒÅÄÅÌÅ 0..3"
|
||||
#: usage.c:305
|
||||
msgid "Fan speed should be in interval 0..3"
|
||||
msgstr ""
|
||||
|
||||
#. "õÓÔÁÎÏ×ÉÔØ ÓËÏÒÏÓÔØ ×ÒÁÝÅÎÉÑ ×ÅÎÔÉÌÑÔÏÒÏ× × %d"
|
||||
#: usage.c:307
|
||||
#, c-format
|
||||
msgid "Fan speed would be set to %d"
|
||||
msgstr ""
|
||||
|
||||
#. "ðÏÌÕÞÉÔØ ÉÎÆÏÒÍÁÃÉÀ Ï ÔÕÒÅÌÉ"
|
||||
#: usage.c:313
|
||||
msgid "Get turret's info"
|
||||
msgstr ""
|
||||
|
||||
#. "îÏÍÅÒ ÐÏÚÉÃÉÉ ÄÏÌÖÅÎ ÂÙÔØ ÂÏÌØÛÅ 0"
|
||||
#: usage.c:319
|
||||
msgid "Position number should be positive value"
|
||||
msgstr ""
|
||||
|
||||
#. "ðÅÒÅÍÅÓÔÉÔØ ÔÕÒÅÌØ × ÐÏÚÉÃÉÀ %d"
|
||||
#: usage.c:321
|
||||
#, c-format
|
||||
msgid "Move turret into %d"
|
||||
msgstr ""
|
||||
|
||||
#. "úÎÁÞÅÎÉÅ time-interval ÄÏÌÖÎÏ ÂÙÔØ ÎÁÔÕÒÁÌØÎÙÍ ÞÉÓÌÏÍ"
|
||||
#: usage.c:326
|
||||
msgid "Value of time-interval must be non-zero positive"
|
||||
msgstr ""
|
||||
|
||||
#. "õÓÔÁÎÏ×ÉÔØ ÉÎÔÅÒ×ÁÌ ÌÏÇÇÉÒÏ×ÁÎÉÑ × %d ÓÅËÕÎÄ"
|
||||
#: usage.c:328
|
||||
#, c-format
|
||||
msgid "Set logging interval to %d seconds"
|
||||
msgstr ""
|
||||
|
||||
#. "îÅ×ÅÒÎÙÊ"
|
||||
#: usage.c:333 usage.c:442
|
||||
msgid "Wrong"
|
||||
msgstr ""
|
||||
|
||||
#. "çÏÒ. ÂÉÎÎÉÎÇ: %d"
|
||||
#: usage.c:336
|
||||
#, c-format
|
||||
msgid "Horisontal binning: %d"
|
||||
msgstr ""
|
||||
|
||||
#. "ôÉÐ ÉÚÏÂÒÁÖÅÎÉÑ - %s"
|
||||
#: usage.c:341
|
||||
#, c-format
|
||||
msgid "Image type - %s"
|
||||
msgstr ""
|
||||
|
||||
#. "îÁÚ×ÁÎÉÅ ÐÒÉÂÏÒÁ - %s"
|
||||
#: usage.c:346
|
||||
#, c-format
|
||||
msgid "Instrument name - %s"
|
||||
msgstr ""
|
||||
|
||||
#. ðÏÌÎÏÅ ÖÕÒÎÁÌÉÒÏ×ÁÎÉÅ ÓÔÁÔÉÓÔÉËÉ
|
||||
#: usage.c:351
|
||||
msgid "Full statistics logging"
|
||||
msgstr ""
|
||||
|
||||
#. "óÏÈÒÁÎÅÎÉÅ ÖÕÒÎÁÌÁ ÔÅÍÐÅÒÁÔÕÒ"
|
||||
#: usage.c:357
|
||||
msgid "Save temperature log"
|
||||
msgstr ""
|
||||
|
||||
#. "îÅ×ÅÒÎÙÊ ÎÏÍÅÒ ËÁÍÅÒÙ: %s"
|
||||
#: usage.c:363
|
||||
#, c-format
|
||||
msgid "Wrong camera number: %s"
|
||||
msgstr ""
|
||||
|
||||
#. "òÁÂÏÔÁÔØ Ó ËÁÍÅÒÏÊ ÎÏÍÅÒ %d"
|
||||
#: usage.c:366
|
||||
#, c-format
|
||||
msgid "Open camera number %d"
|
||||
msgstr ""
|
||||
|
||||
#. "îÅ×ÅÒÎÏÅ ËÏÌ-×Ï ËÁÄÒÏ×: %s"
|
||||
#: usage.c:371
|
||||
#, c-format
|
||||
msgid "Wrong frames number in series: %s"
|
||||
msgstr ""
|
||||
|
||||
#. "óÅÒÉÑ ÉÚ %d ËÁÄÒÏ×"
|
||||
#: usage.c:374
|
||||
#, c-format
|
||||
msgid "Series of %d frames"
|
||||
msgstr ""
|
||||
|
||||
#. "éÍÑ ÏÂßÅËÔÁ - %s"
|
||||
#: usage.c:379
|
||||
#, c-format
|
||||
msgid "Object name - %s"
|
||||
msgstr ""
|
||||
|
||||
#. "îÁÂÌÀÄÁÔÅÌÉ: %s"
|
||||
#: usage.c:384
|
||||
#, c-format
|
||||
msgid "Observers: %s"
|
||||
msgstr ""
|
||||
|
||||
#. "îÁÚ×ÁÎÉÅ ÐÒÏÇÒÁÍÍÙ: %s"
|
||||
#: usage.c:389
|
||||
#, c-format
|
||||
msgid "Program name: %s"
|
||||
msgstr ""
|
||||
|
||||
#. "îÅ×ÅÒÎÁÑ ÐÁÕÚÁ: %s"
|
||||
#: usage.c:394
|
||||
#, c-format
|
||||
msgid "Wrong pause length: %s"
|
||||
msgstr ""
|
||||
|
||||
#. "ðÁÕÚÁ: %dÓ"
|
||||
#: usage.c:397
|
||||
#, c-format
|
||||
msgid "Pause: %ds"
|
||||
msgstr ""
|
||||
|
||||
#. "óËÏÒÏÓÔØ ÓÞÉÔÙ×ÁÎÉÑ - ÂÅÚÚÎÁËÏ×ÏÅ ÃÅÌÏÅ!"
|
||||
#: usage.c:402
|
||||
msgid "Readout speed should be unsigned int!"
|
||||
msgstr ""
|
||||
|
||||
#. "ðÏÌÎÙÊ ÓÂÒÏÓ"
|
||||
#: usage.c:410
|
||||
msgid "Reset"
|
||||
msgstr ""
|
||||
|
||||
#. "óÐÑÝÉÊ ÒÅÖÉÍ"
|
||||
#: usage.c:416
|
||||
msgid "Go to sleep"
|
||||
msgstr ""
|
||||
|
||||
#. "îÅ×ÅÒÎÏÅ ÚÎÁÞÅÎÉÅ ÔÅÍÐÅÒÁÔÕÒÙ: %s (ÄÏÌÖÎÏ ÂÙÔØ ÏÔ -35 ÄÏ 30)"
|
||||
#: usage.c:433
|
||||
#, c-format
|
||||
msgid "Wrong temperature: %s (must be from -35 to 30)"
|
||||
msgstr ""
|
||||
|
||||
#. "õÓÔÁÎÏ×ÉÔØ ÔÅÍÐÅÒÁÔÕÒÕ: %.3f"
|
||||
#: usage.c:437
|
||||
#, c-format
|
||||
msgid "Set temperature: %.3f"
|
||||
msgstr ""
|
||||
|
||||
#. "÷ÅÒÔ. ÂÉÎÎÉÎÇ: %d"
|
||||
#: usage.c:445
|
||||
#, c-format
|
||||
msgid "Vertical binning: %d"
|
||||
msgstr ""
|
||||
|
||||
#. "îÏÍÅÒ ÔÕÒÅÌÉ ÄÏÌÖÅÎ ÂÙÔØ ÂÏÌØÛÅ 0"
|
||||
#: usage.c:451
|
||||
msgid "Turret number should be positive value"
|
||||
msgstr ""
|
||||
|
||||
#. "òÁÂÏÔÁÔØ Ó ÔÕÒÅÌØÀ %d"
|
||||
#: usage.c:453
|
||||
#, c-format
|
||||
msgid "Work with turret %d"
|
||||
msgstr ""
|
||||
|
||||
#. "áËÔÉ×ÉÒÏ×ÁÔØ ËÁÍÅÒÕ"
|
||||
#: usage.c:459
|
||||
msgid "Wakeup camera"
|
||||
msgstr ""
|
||||
|
||||
#. "îÅ×ÅÒÎÏÅ ×ÒÅÍÑ ÜËÓÐÏÚÉÃÉÉ: %s"
|
||||
#: usage.c:465
|
||||
#, c-format
|
||||
msgid "Wrong exposure time: %s"
|
||||
msgstr ""
|
||||
|
||||
#. "÷ÒÅÍÑ ÜËÓÐÏÚÉÃÉÉ: %dÍÓ"
|
||||
#: usage.c:468
|
||||
#, c-format
|
||||
msgid "Exposure time: %dms"
|
||||
msgstr ""
|
||||
|
||||
#. "äÉÁÐÁÚÏÎ ÐÏ X: [%d, %d]"
|
||||
#: usage.c:473
|
||||
#, c-format
|
||||
msgid "X range: [%d, %d]"
|
||||
msgstr ""
|
||||
|
||||
#. "äÉÁÐÁÚÏÎ ÐÏ Y: [%d, %d]"
|
||||
#: usage.c:478
|
||||
#, c-format
|
||||
msgid "Y range: [%d, %d]"
|
||||
msgstr ""
|
||||
|
||||
#. "éÇÎÏÒÉÒÕÀ ÁÒÇÕÍÅÎÔ[Ù]:\n"
|
||||
#: usage.c:496
|
||||
#, c-format
|
||||
msgid "Ignore argument[s]:\n"
|
||||
msgstr ""
|
||||
|
||||
#. -255. - there's no thermometer on hot side
|
||||
#. "÷ ×ÁÛÅÍ Ó×ÅÔÏÐÒÉÅÍÎÉËÅ ÎÅÔ \"ÇÏÒÑÞÅÇÏ\" ÔÅÒÍÏÍÅÔÒÁ"
|
||||
#: camtools.c:83
|
||||
msgid "Your camera have no hot temperature sensor\n"
|
||||
msgstr ""
|
||||
|
||||
#. "õÓÔÁÎÁ×ÌÉ×ÁÀ ÓËÏÒÏÓÔØ ×ÒÁÝÅÎÉÑ ×ÅÎÔÉÌÑÔÏÒÏ× × %d\n"
|
||||
#: camtools.c:97
|
||||
#, c-format
|
||||
msgid "Set fan speed %d\n"
|
||||
msgstr ""
|
||||
|
||||
#. "ãÅÌÅ×ÁÑ ÔÅÍÐÅÒÁÔÕÒÁ: %g\n"
|
||||
#: camtools.c:110
|
||||
#, c-format
|
||||
msgid "Cooler setpoint: %g\n"
|
||||
msgstr ""
|
||||
|
||||
#. "èÏÌÏÄÉÌØÎÉË ÏÔËÌÀÞÅÎ"
|
||||
#: camtools.c:115
|
||||
msgid "Cooler is off"
|
||||
msgstr ""
|
||||
|
||||
#. "õÓÔÁÎÏ×ËÁ ÚÁÄÁÎÎÏÊ ÔÅÍÐÅÒÁÔÕÒÙ"
|
||||
#: camtools.c:118
|
||||
msgid "Go to setpoint"
|
||||
msgstr ""
|
||||
|
||||
#. "ðÏÄÄÅÒÖÁÎÉÅ ÚÁÄÁÎÎÏÊ ÔÅÍÐÅÒÁÔÕÒÙ"
|
||||
#: camtools.c:121
|
||||
msgid "Keeping setpoint"
|
||||
msgstr ""
|
||||
|
||||
#. "óÔÁÔÕÓ ÎÅÉÚ×ÅÓÔÅÎ"
|
||||
#: camtools.c:124
|
||||
msgid "Unknown status"
|
||||
msgstr ""
|
||||
|
||||
#. "óÔÁÔÉÓÔÉËÁ ÐÏ ÉÚÏÂÒÁÖÅÎÉÀ:\n"
|
||||
#: camtools.c:148
|
||||
#, c-format
|
||||
msgid "Image stat:\n"
|
||||
msgstr ""
|
||||
647
locale/ru/ru.po
Normal file
647
locale/ru/ru.po
Normal file
@ -0,0 +1,647 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2013-08-29 10:54+0400\n"
|
||||
"PO-Revision-Date: 2011-06-28 09:22+0300\n"
|
||||
"Last-Translator: Edward V. Emelianov <eddy@sao.ru>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=koi8-r\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#. "\tОпции:\n"
|
||||
#: usage.c:101
|
||||
#, c-format
|
||||
msgid "\tOptions:\n"
|
||||
msgstr "\tОпции:\n"
|
||||
|
||||
#. "Обнаружен работающий процесс (pid=%d), выход.\n"
|
||||
#: takepic.c:108 takepic.c:120
|
||||
#, c-format
|
||||
msgid "\n"
|
||||
"Found running process (pid=%d), exit.\n"
|
||||
msgstr "\n"
|
||||
"Обнаружен работающий процесс (pid=%d), выход.\n"
|
||||
|
||||
#. "\nЗатвор "
|
||||
#: takepic.c:273
|
||||
#, c-format
|
||||
msgid "\n"
|
||||
"The shutter is "
|
||||
msgstr "\n"
|
||||
"Затвор "
|
||||
|
||||
#. "%d секунд до окончания паузы\n"
|
||||
#: takepic.c:450
|
||||
#, c-format
|
||||
msgid "%d seconds till pause ends\n"
|
||||
msgstr "%d секунд до окончания паузы\n"
|
||||
|
||||
#. "Не введено никаких параметров"
|
||||
#: usage.c:271
|
||||
msgid "Any parameters are absent"
|
||||
msgstr "Не введено никаких параметров"
|
||||
|
||||
#. "Поле изображения: (0, %d)(0, %d)"
|
||||
#: takepic.c:305
|
||||
#, c-format
|
||||
msgid "Array field: (0, %d)(0, %d)"
|
||||
msgstr "Поле изображения: (0, %d)(0, %d)"
|
||||
|
||||
#. "Не могу удалить PID-файл"
|
||||
#: takepic.c:68
|
||||
msgid "Can't delete PIDfile"
|
||||
msgstr "Не могу удалить PID-файл"
|
||||
|
||||
#. "Не могу переместить турель"
|
||||
#: takepic.c:169
|
||||
msgid "Can't move turret"
|
||||
msgstr "Не могу переместить турель"
|
||||
|
||||
#. "Не могу открыть файл журнала статистики"
|
||||
#: takepic.c:264
|
||||
msgid "Can't open statistics log file"
|
||||
msgstr "Не могу открыть журнал статистики"
|
||||
|
||||
#. "Не могу открыть файл журнала температур"
|
||||
#: takepic.c:250
|
||||
msgid "Can't open temperature log file"
|
||||
msgstr "Не могу открыть журнал температур"
|
||||
|
||||
#. "Не могу открыть турель"
|
||||
#: takepic.c:152
|
||||
msgid "Can't open turret"
|
||||
msgstr "Не могу открыть турель"
|
||||
|
||||
#. "Не могу сохранить файл"
|
||||
#: takepic.c:428
|
||||
msgid "Can't save file"
|
||||
msgstr "Не могу сохранить файл"
|
||||
|
||||
#. "Захват кадра %d, время экспозиции - %g секунд\n"
|
||||
#: takepic.c:380
|
||||
#, c-format
|
||||
msgid "Capture frame %d, exp time - %g sec\n"
|
||||
msgstr "Захват кадра %d, время экспозиции - %g секунд\n"
|
||||
|
||||
#. "Изменение температуры холодильника"
|
||||
#: takepic.c:291
|
||||
msgid "Changing of cooler setpoint"
|
||||
msgstr "Изменение температуры холодильника"
|
||||
|
||||
#. "Холодильник отключен"
|
||||
#: camtools.c:115
|
||||
msgid "Cooler is off"
|
||||
msgstr "Холодильник отключен"
|
||||
|
||||
#. "Целевая температура: %g\n"
|
||||
#: camtools.c:110
|
||||
#, c-format
|
||||
msgid "Cooler setpoint: %g\n"
|
||||
msgstr "Целевая температура: %g\n"
|
||||
|
||||
#. "Съемка темновых"
|
||||
#: usage.c:295
|
||||
msgid "Dark frames"
|
||||
msgstr "Съемка темновых"
|
||||
|
||||
#. "не засвечивать матрицу перед экспозицией"
|
||||
#: usage.c:113
|
||||
msgid "Don't flash CCD chip before expose"
|
||||
msgstr "не засвечивать матрицу перед экспозицией"
|
||||
|
||||
#. "Ошибка перехода в спящий режим!"
|
||||
#: takepic.c:236
|
||||
msgid "Error: sleepless night!"
|
||||
msgstr "Ошибка перехода в спящий режим!"
|
||||
|
||||
#. "Время экспозиции: %dмс"
|
||||
#: usage.c:468
|
||||
#, c-format
|
||||
msgid "Exposure time: %dms"
|
||||
msgstr "Время экспозиции: %dмс"
|
||||
|
||||
#. "Скорость вентилятора должна быть в пределе 0..3"
|
||||
#: usage.c:305
|
||||
msgid "Fan speed should be in interval 0..3"
|
||||
msgstr "Скорость вентилятора должна быть в пределе 0..3"
|
||||
|
||||
#. "Установить скорость вращения вентиляторов в %d"
|
||||
#: usage.c:307
|
||||
#, c-format
|
||||
msgid "Fan speed would be set to %d"
|
||||
msgstr "Установить скорость вращения вентиляторов в %d"
|
||||
|
||||
#. "Видимое поле: %s"
|
||||
#: takepic.c:303
|
||||
#, c-format
|
||||
msgid "Field of view: %s"
|
||||
msgstr "Видимое поле: %s"
|
||||
|
||||
#. "Файл записан в '%s'"
|
||||
#: takepic.c:432
|
||||
#, c-format
|
||||
msgid "File saved as '%s'"
|
||||
msgstr "Файл записан в '%s'"
|
||||
|
||||
#. "Обнаружена камера '%s' с датчиком '%s'"
|
||||
#: takepic.c:226
|
||||
#, c-format
|
||||
msgid "Find camera '%s' with sensor '%s'"
|
||||
msgstr "Обнаружена камера '%s' с датчиком '%s'"
|
||||
|
||||
#. Полное журналирование статистики
|
||||
#: usage.c:351
|
||||
msgid "Full statistics logging"
|
||||
msgstr "Полное журналирование статистики"
|
||||
|
||||
#. "Получен сигнал %d, отключаюсь.\n"
|
||||
#: takepic.c:62
|
||||
#, c-format
|
||||
msgid "Get signal %d, quit.\n"
|
||||
msgstr "Получен сигнал %d, отключаюсь.\n"
|
||||
|
||||
#. "Получить информацию о турели"
|
||||
#: usage.c:313
|
||||
msgid "Get turret's info"
|
||||
msgstr "Получить информацию о турели"
|
||||
|
||||
#. "Установка заданной температуры"
|
||||
#: camtools.c:118
|
||||
msgid "Go to setpoint"
|
||||
msgstr "Установка заданной температуры"
|
||||
|
||||
#. "Спящий режим"
|
||||
#: usage.c:416
|
||||
msgid "Go to sleep"
|
||||
msgstr "Спящий режим"
|
||||
|
||||
#. "Гор. биннинг: %d"
|
||||
#: usage.c:336
|
||||
#, c-format
|
||||
msgid "Horisontal binning: %d"
|
||||
msgstr "Гор. биннинг: %d"
|
||||
|
||||
#. "Игнорирую аргумент[ы]:\n"
|
||||
#: usage.c:496
|
||||
#, c-format
|
||||
msgid "Ignore argument[s]:\n"
|
||||
msgstr "Игнорирую аргумент[ы]:\n"
|
||||
|
||||
#. "Статистика по изображению:\n"
|
||||
#: camtools.c:148
|
||||
#, c-format
|
||||
msgid "Image stat:\n"
|
||||
msgstr "Статистика по изображению\n"
|
||||
|
||||
#. "Тип изображения - %s"
|
||||
#: usage.c:341
|
||||
#, c-format
|
||||
msgid "Image type - %s"
|
||||
msgstr "Тип изображения - %s"
|
||||
|
||||
#. "Название прибора - %s"
|
||||
#: usage.c:346
|
||||
#, c-format
|
||||
msgid "Instrument name - %s"
|
||||
msgstr "Название прибора - %s"
|
||||
|
||||
#. "Поддержание заданной температуры"
|
||||
#: camtools.c:121
|
||||
msgid "Keeping setpoint"
|
||||
msgstr "Поддержание заданной температуры"
|
||||
|
||||
#. "Переместить турель в позицию %d"
|
||||
#: usage.c:321
|
||||
#, c-format
|
||||
msgid "Move turret into %d"
|
||||
msgstr "Переместить турель в позицию %d"
|
||||
|
||||
#. "Не засвечивать камеру до экспозиции"
|
||||
#: usage.c:300
|
||||
msgid "No pre-expose flash"
|
||||
msgstr "Не засвечивать камеру до экспозиции"
|
||||
|
||||
#. "Имя объекта - %s"
|
||||
#: usage.c:379
|
||||
#, c-format
|
||||
msgid "Object name - %s"
|
||||
msgstr "Имя объекта - %s"
|
||||
|
||||
#. "Наблюдатели: %s"
|
||||
#: usage.c:384
|
||||
#, c-format
|
||||
msgid "Observers: %s"
|
||||
msgstr "Наблюдатели: %s"
|
||||
|
||||
#. "Работать с камерой номер %d"
|
||||
#: usage.c:366
|
||||
#, c-format
|
||||
msgid "Open camera number %d"
|
||||
msgstr "Работать с камерой номер %d"
|
||||
|
||||
#. "Пауза: %dс"
|
||||
#: usage.c:397
|
||||
#, c-format
|
||||
msgid "Pause: %ds"
|
||||
msgstr "Пауза: %dс"
|
||||
|
||||
#. "Номер позиции должен быть больше 0"
|
||||
#: usage.c:319
|
||||
msgid "Position number should be positive value"
|
||||
msgstr "Номер позиции должен быть больше 0"
|
||||
|
||||
#. pre-expose
|
||||
#. "Предварительная экспозиция"
|
||||
#: takepic.c:341
|
||||
msgid "Pre-expose"
|
||||
msgstr "Предварительная экспозиция"
|
||||
|
||||
#. "Автор программы: %s"
|
||||
#: usage.c:283
|
||||
#, c-format
|
||||
msgid "Program author: %s"
|
||||
msgstr "Автор программы: %s"
|
||||
|
||||
#. "Название программы: %s"
|
||||
#: usage.c:389
|
||||
#, c-format
|
||||
msgid "Program name: %s"
|
||||
msgstr "Название программы: %s"
|
||||
|
||||
#. "Считывание изображения:"
|
||||
#: takepic.c:408
|
||||
#, c-format
|
||||
msgid "Read image: "
|
||||
msgstr "Считывание изображения: "
|
||||
|
||||
#. "Ошибка считывания: %s\n"
|
||||
#: takepic.c:353 takepic.c:414
|
||||
#, c-format
|
||||
msgid "Readout error: %s\n"
|
||||
msgstr "Ошибка считывания: %s\n"
|
||||
|
||||
#. "Скорость считывания - беззнаковое целое!"
|
||||
#: usage.c:402
|
||||
msgid "Readout speed should be unsigned int!"
|
||||
msgstr "Скорость считывания - беззнаковое целое!"
|
||||
|
||||
#. "Требуемая позиция больше максимальной"
|
||||
#: takepic.c:164
|
||||
msgid "Required position greater then max"
|
||||
msgstr "ребуемая позиция больше максимальной"
|
||||
|
||||
#. "Полный сброс"
|
||||
#: usage.c:410
|
||||
msgid "Reset"
|
||||
msgstr "Полный сброс"
|
||||
|
||||
#. "Сохранение журнала температур"
|
||||
#: usage.c:357
|
||||
msgid "Save temperature log"
|
||||
msgstr "Сохранение журнала температур"
|
||||
|
||||
#. "Серия из %d кадров"
|
||||
#: usage.c:374
|
||||
#, c-format
|
||||
msgid "Series of %d frames"
|
||||
msgstr "Серия из %d кадров"
|
||||
|
||||
#. "отключить холодильник"
|
||||
#: usage.c:107 usage.c:289
|
||||
msgid "Set cooler off"
|
||||
msgstr "отключить холодильник"
|
||||
|
||||
#. "Устанавливаю скорость вращения вентиляторов в %d\n"
|
||||
#: camtools.c:97
|
||||
#, c-format
|
||||
msgid "Set fan speed %d\n"
|
||||
msgstr "Устанавливаю скорость вращения вентиляторов в %d\n"
|
||||
|
||||
#. "Установить скорость вентиляторов в F (0..3)"
|
||||
#: usage.c:116
|
||||
msgid "Set fan speed to F (0..3)"
|
||||
msgstr "Установить скорость вентиляторов в F (0..3)"
|
||||
|
||||
#. "Установить интервал логгирования в %d секунд"
|
||||
#: usage.c:328
|
||||
#, c-format
|
||||
msgid "Set logging interval to %d seconds"
|
||||
msgstr "Установить интервал логгирования в %d секунд"
|
||||
|
||||
#. "Установить температуру: %.3f"
|
||||
#: usage.c:437
|
||||
#, c-format
|
||||
msgid "Set temperature: %.3f"
|
||||
msgstr "Установить температуру: %.3f"
|
||||
|
||||
#. "Отключение холодильника"
|
||||
#: takepic.c:285
|
||||
msgid "Switch cooler off"
|
||||
msgstr "Отключение холодильника"
|
||||
|
||||
#. "Температура ниже допустимой"
|
||||
#: takepic.c:294
|
||||
msgid "The temperature setpoint is too low"
|
||||
msgstr "Температура ниже допустимой"
|
||||
|
||||
#. "Максимальная (MAX) и текущая (CUR) позиции турели:\n"
|
||||
#: takepic.c:159
|
||||
#, c-format
|
||||
msgid "Turret MAXimum position and CURrent position:\n"
|
||||
msgstr "Максимальная (MAX) и текущая (CUR) позиции турели:\n"
|
||||
|
||||
#. "Номер турели должен быть больше 0"
|
||||
#: usage.c:451
|
||||
msgid "Turret number should be positive value"
|
||||
msgstr "Номер турели должен быть больше 0"
|
||||
|
||||
#. "Статус неизвестен"
|
||||
#: camtools.c:124
|
||||
msgid "Unknown status"
|
||||
msgstr "Хрен знает что"
|
||||
|
||||
#. "Использование:\t%s [опции] [префикс выходных файлов]\n"
|
||||
#: usage.c:98
|
||||
#, c-format
|
||||
msgid "Usage:\t%s [options] [output files prefix]\n"
|
||||
msgstr "Использование:\t%s [опции] [префикс выходных файлов]\n"
|
||||
|
||||
#. "Значение time-interval должно быть натуральным числом"
|
||||
#: usage.c:326
|
||||
msgid "Value of time-interval must be non-zero positive"
|
||||
msgstr "Значение time-interval должно быть натуральным числом"
|
||||
|
||||
#. "Верт. биннинг: %d"
|
||||
#: usage.c:445
|
||||
#, c-format
|
||||
msgid "Vertical binning: %d"
|
||||
msgstr "Верт. биннинг: %d"
|
||||
|
||||
#. "Подождите завершения перемещения турели "
|
||||
#: takepic.c:174
|
||||
#, c-format
|
||||
msgid "Wait, while turret is moving "
|
||||
msgstr "Подождите завершения перемещения турели "
|
||||
|
||||
#. "Активировать камеру"
|
||||
#: usage.c:459
|
||||
msgid "Wakeup camera"
|
||||
msgstr "Активировать камеру"
|
||||
|
||||
#. "Работать с турелью %d"
|
||||
#: usage.c:453
|
||||
#, c-format
|
||||
msgid "Work with turret %d"
|
||||
msgstr "Работать с турелью %d"
|
||||
|
||||
#. "Неверный"
|
||||
#: usage.c:333 usage.c:442
|
||||
msgid "Wrong"
|
||||
msgstr "Неверный"
|
||||
|
||||
#. "Неверный номер камеры: %s"
|
||||
#: usage.c:363
|
||||
#, c-format
|
||||
msgid "Wrong camera number: %s"
|
||||
msgstr "Неверный номер камеры: %s"
|
||||
|
||||
#. "Неверное время экспозиции: %s"
|
||||
#: usage.c:465
|
||||
#, c-format
|
||||
msgid "Wrong exposure time: %s"
|
||||
msgstr "Неверное время экспозиции: %s"
|
||||
|
||||
#. "Неверное кол-во кадров: %s"
|
||||
#: usage.c:371
|
||||
#, c-format
|
||||
msgid "Wrong frames number in series: %s"
|
||||
msgstr "Неверное кол-во кадров: %s"
|
||||
|
||||
#. "Неверная нижняя граница: %s"
|
||||
#: usage.c:77
|
||||
#, c-format
|
||||
msgid "Wrong lower border: %s"
|
||||
msgstr "Неверная нижняя граница: %s"
|
||||
|
||||
#. "Неверная пауза: %s"
|
||||
#: usage.c:394
|
||||
#, c-format
|
||||
msgid "Wrong pause length: %s"
|
||||
msgstr "Неверная пауза: %s"
|
||||
|
||||
#. "Неверное значение температуры: %s (должно быть от -35 до 30)"
|
||||
#: usage.c:433
|
||||
#, c-format
|
||||
msgid "Wrong temperature: %s (must be from -35 to 30)"
|
||||
msgstr "Неверное значение температуры: %s (должно быть от -35 до 30)"
|
||||
|
||||
#. "Неверная верхняя граница: %s"
|
||||
#: usage.c:82
|
||||
#, c-format
|
||||
msgid "Wrong upper border: %s"
|
||||
msgstr "Неверная верхняя граница: %s"
|
||||
|
||||
#. "Диапазон по X: [%d, %d]"
|
||||
#: usage.c:473
|
||||
#, c-format
|
||||
msgid "X range: [%d, %d]"
|
||||
msgstr "Диапазон по X: [%d, %d]"
|
||||
|
||||
#. "Диапазон по Y: [%d, %d]"
|
||||
#: usage.c:478
|
||||
#, c-format
|
||||
msgid "Y range: [%d, %d]"
|
||||
msgstr "Диапазон по Y: [%d, %d]"
|
||||
|
||||
#. -255. - there's no thermometer on hot side
|
||||
#. "В вашем светоприемнике нет \"горячего\" термометра"
|
||||
#: camtools.c:83
|
||||
msgid "Your camera have no hot temperature sensor\n"
|
||||
msgstr "В вашем светоприемнике нет \"горячего\" термометра\n"
|
||||
|
||||
#. "заткрыть затвор"
|
||||
#: usage.c:207
|
||||
msgid "close shutter"
|
||||
msgstr "заткрыть затвор"
|
||||
|
||||
#. "закрыт\n"
|
||||
#: takepic.c:279
|
||||
#, c-format
|
||||
msgid "closed\n"
|
||||
msgstr "закрыт\n"
|
||||
|
||||
#. "не очищать матрицу после считывания"
|
||||
#: usage.c:198
|
||||
msgid "don't flush ccd after expose"
|
||||
msgstr "не очищать матрицу после считывания"
|
||||
|
||||
#. "не открывать устройство, лишь отобразить шапку FITS"
|
||||
#: usage.c:210
|
||||
msgid "don't open camera device, just show FITS header"
|
||||
msgstr "не открывать устройство, лишь отобразить шапку FITS"
|
||||
|
||||
#. "не сохранять изображения, лишь вести запись статистки"
|
||||
#: usage.c:137
|
||||
msgid "don't save images, only make all-stat log"
|
||||
msgstr "не сохранять изображения, лишь вести запись статистки"
|
||||
|
||||
#. "Полный сброс"
|
||||
#: usage.c:164
|
||||
msgid "full reset"
|
||||
msgstr "Полный сброс"
|
||||
|
||||
#. получить сведения о турели
|
||||
#: usage.c:119
|
||||
msgid "get turret's parameters"
|
||||
msgstr "получить сведения о турели"
|
||||
|
||||
#. "перейти в спящий режим"
|
||||
#: usage.c:167
|
||||
msgid "go to sleeping mode"
|
||||
msgstr "перейти в спящий режим"
|
||||
|
||||
#. "биннинг N пикселей по горизонтали"
|
||||
#: usage.c:128
|
||||
msgid "horizontal binning to N pixels"
|
||||
msgstr "биннинг N пикселей по горизонтали"
|
||||
|
||||
#. "тип изображения"
|
||||
#: usage.c:131
|
||||
msgid "image type"
|
||||
msgstr "тип изображения"
|
||||
|
||||
#. "название прибора"
|
||||
#: usage.c:134
|
||||
msgid "instrument name"
|
||||
msgstr "название прибора"
|
||||
|
||||
#. "выполнить предварительную нулевую экспозицию для очистки матрицы"
|
||||
#: usage.c:201
|
||||
msgid "make a preliminary zero exposition for cleaning CCD"
|
||||
msgstr "выполнить предварительную нулевую экспозицию для очистки матрицы"
|
||||
|
||||
#. "выдержать ptime секунд между экспозициями"
|
||||
#: usage.c:158
|
||||
msgid "make pause for ptime seconds between expositions"
|
||||
msgstr "выдержать ptime секунд между экспозициями"
|
||||
|
||||
#. "N кадров в серии"
|
||||
#: usage.c:146
|
||||
msgid "make series of N frames"
|
||||
msgstr "N кадров в серии"
|
||||
|
||||
#. "вести запись рабочих температур в файл temp_log"
|
||||
#: usage.c:140
|
||||
msgid "make temperatures logging to file temp_log"
|
||||
msgstr "вести запись рабочих температур в файл temp_log"
|
||||
|
||||
#. "не открывать затвор при экспозиции (\"темновые\")"
|
||||
#: usage.c:110
|
||||
msgid "not open shutter when exposing (\"dark frames\")"
|
||||
msgstr "не открывать затвор при экспозиции (\"темновые\")"
|
||||
|
||||
#. "не сохранять изображение, а только отобразить статистику"
|
||||
#: usage.c:170
|
||||
msgid "not save image, just show statistics"
|
||||
msgstr "не сохранять изображение, а только отобразить статистику"
|
||||
|
||||
#. "название объекта"
|
||||
#: usage.c:149
|
||||
msgid "object name"
|
||||
msgstr "название объекта"
|
||||
|
||||
#. "имена наблюдателей"
|
||||
#: usage.c:152
|
||||
msgid "observers' names"
|
||||
msgstr "имена наблюдателей"
|
||||
|
||||
#. "название программы наблюдений"
|
||||
#: usage.c:155
|
||||
msgid "observing program name"
|
||||
msgstr "название программы наблюдений"
|
||||
|
||||
#. "только задать/получить температуру"
|
||||
#. "только отобразить/задать температуру"
|
||||
#: usage.c:173 usage.c:426
|
||||
msgid "only set/get temperature"
|
||||
msgstr "только задать/получить температуру"
|
||||
|
||||
#. "открыт\n"
|
||||
#: takepic.c:276
|
||||
#, c-format
|
||||
msgid "open\n"
|
||||
msgstr "открыт\n"
|
||||
|
||||
#. "открыть затвор"
|
||||
#: usage.c:204
|
||||
msgid "open shutter"
|
||||
msgstr "открыть затвор"
|
||||
|
||||
#. "автор программы"
|
||||
#: usage.c:104
|
||||
msgid "program author"
|
||||
msgstr "автор программы"
|
||||
|
||||
#. "возобновить питание"
|
||||
#: usage.c:185
|
||||
msgid "resume system"
|
||||
msgstr "возобновить питание"
|
||||
|
||||
#. "выбрать диапазон для считывания"
|
||||
#: usage.c:191 usage.c:194
|
||||
msgid "select clip region"
|
||||
msgstr "выбрать диапазон для считывания"
|
||||
|
||||
#. "время экспозиции exptime мс"
|
||||
#: usage.c:188
|
||||
msgid "set exposure time to exptime ms"
|
||||
msgstr "время экспозиции exptime мс"
|
||||
|
||||
#. "установить скорость считывания в N"
|
||||
#: usage.c:161
|
||||
msgid "set readout speed to N"
|
||||
msgstr "установить скорость считывания в N"
|
||||
|
||||
#. переместить турель в N-ю позицию
|
||||
#: usage.c:122
|
||||
msgid "set turret to Nth position"
|
||||
msgstr "переместить турель в N-ю позицию"
|
||||
|
||||
#. установить номер турели в N
|
||||
#: usage.c:182
|
||||
msgid "set turret's number to N"
|
||||
msgstr "установить номер турели в N"
|
||||
|
||||
#. "задать рабочую температуру degr градусов"
|
||||
#: usage.c:176
|
||||
msgid "set work temperature to degr C"
|
||||
msgstr "задать рабочую температуру degr градусов"
|
||||
|
||||
#. "интервал времени между последовательными записями в лог и HISTORY (в секундах)"
|
||||
#: usage.c:125
|
||||
msgid "time interval between sequential writings to log & HISTORY (in "
|
||||
"seconds)"
|
||||
msgstr "интервал времени между последовательными записями в лог и HISTORY (в "
|
||||
"секундах)"
|
||||
|
||||
#. "биннинг N пикселей по вертикали"
|
||||
#: usage.c:179
|
||||
msgid "vertical binning to N pixels"
|
||||
msgstr "биннинг N пикселей по вертикали"
|
||||
|
||||
#. "работать в 12-битном режиме"
|
||||
#: usage.c:213
|
||||
msgid "work in a 12-bit ADC mode"
|
||||
msgstr "работать в 12-битном режиме"
|
||||
|
||||
#. "работать с N-й камерой"
|
||||
#: usage.c:143
|
||||
msgid "work with Nth camera"
|
||||
msgstr "работать с N-й камерой"
|
||||
483
takepic.c
Normal file
483
takepic.c
Normal file
@ -0,0 +1,483 @@
|
||||
#include "takepic.h"
|
||||
#include <locale.h>
|
||||
#include <signal.h>
|
||||
#include <dirent.h>
|
||||
#include <float.h>
|
||||
#include "usage.h"
|
||||
#include "camtools.h"
|
||||
#include "bta_print.h"
|
||||
|
||||
#define BUFF_SIZ 4096
|
||||
#define PROC_BASE "/proc"
|
||||
|
||||
#define TMBUFSIZ 40 // time string buffer length
|
||||
|
||||
char *pidfilename = "/tmp/takepic.pid"; // pidfile
|
||||
|
||||
char tm_buf[TMBUFSIZ]; // time string buffer
|
||||
|
||||
char *camera = NULL, *sensor = NULL, viewfield[80];
|
||||
double pixX, pixY; // pixel size
|
||||
|
||||
int test_headers = 0; // don't even try to open camera device, just show FITS keys
|
||||
|
||||
double t_ext, t_int; // hot & cold side temperatures
|
||||
time_t expStartsAt; // time of exposition start (time_t)
|
||||
|
||||
int itime(){ // time in seconds to count intervals
|
||||
struct timeval ct;
|
||||
gettimeofday(&ct, NULL);
|
||||
return (ct.tv_sec);
|
||||
}
|
||||
int time0;
|
||||
int ltime(){ // time since last time0 reinitialising
|
||||
return(itime()-time0);
|
||||
}
|
||||
|
||||
// return string with current date/time
|
||||
size_t curtime(char *s_time){
|
||||
time_t tm = time(NULL);
|
||||
size_t s = strftime(s_time, TMBUFSIZ, "%d/%m/%Y,%H:%M:%S", localtime(&tm));
|
||||
if(!s) info("curtime() error");
|
||||
return s;
|
||||
}
|
||||
|
||||
// find the first non-exists filename & put it into buff
|
||||
int check_filename(char *buff, char *outfile, char *ext){
|
||||
struct stat filestat;
|
||||
int num;
|
||||
for(num = 1; num < 10000; num++){
|
||||
if(snprintf(buff, BUFF_SIZ, "%s_%04d.%s", outfile, num, ext) < 1)
|
||||
return 0;
|
||||
if(stat(buff, &filestat)) // OK, file not exists
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// quit by signal
|
||||
static void signals(int sig){
|
||||
int u;
|
||||
// "ðÏÌÕÞÅÎ ÓÉÇÎÁÌ %d, ÏÔËÌÀÞÁÀÓØ.\n"
|
||||
printf(_("Get signal %d, quit.\n"), sig);
|
||||
ApnGlueWheelClose();
|
||||
ApnGlueExpAbort();
|
||||
ApnGlueClose();
|
||||
u = unlink(pidfilename);
|
||||
// "îÅ ÍÏÇÕ ÕÄÁÌÉÔØ PID-ÆÁÊÌ"
|
||||
if(u == -1) perror(_("Can't delete PIDfile"));
|
||||
exit(sig);
|
||||
}
|
||||
|
||||
// check for running process
|
||||
void check4running(){
|
||||
// get process name from /proc
|
||||
int readname(char *name, pid_t pid){
|
||||
char *pp = name, byte, path[256];
|
||||
int cntr = 0, file;
|
||||
snprintf (path, 255, PROC_BASE "/%d/cmdline", pid);
|
||||
file = open(path, O_RDONLY);
|
||||
if(file == -1) return 0;
|
||||
do{
|
||||
read(file, &byte, 1);
|
||||
if (byte != '/') *pp++ = byte;
|
||||
else pp = name;
|
||||
}
|
||||
while(byte != EOF && byte != 0 && cntr++ < 255);
|
||||
name[255] = 0;
|
||||
close(file);
|
||||
return 1;
|
||||
}
|
||||
DIR *dir;
|
||||
FILE* pidfile;
|
||||
struct dirent *de;
|
||||
struct stat s_buf;
|
||||
pid_t pid, self, run = 0;
|
||||
char name[256], myname[256];
|
||||
if (!(dir = opendir(PROC_BASE))){ // open /proc dir
|
||||
perror(PROC_BASE);
|
||||
exit(1);
|
||||
}
|
||||
self = getpid(); // self PID
|
||||
if(stat(pidfilename, &s_buf) == 0){ // PID file exists
|
||||
pidfile = fopen(pidfilename, "r");
|
||||
fscanf(pidfile, "%d", &run); // get PID of (possibly) running process
|
||||
fclose(pidfile);
|
||||
if(readname(name, run) && strncmp(name, myname, 255) == 0){
|
||||
// "ïÂÎÁÒÕÖÅÎ ÒÁÂÏÔÁÀÝÉÊ ÐÒÏÃÅÓÓ (pid=%d), ×ÙÈÏÄ.\n"
|
||||
ERR(_("\nFound running process (pid=%d), exit.\n"), run);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
// there's no PID file or it's old
|
||||
readname(myname, self); // self name
|
||||
while ((de = readdir (dir)) != NULL){ // scan /proc
|
||||
if (!(pid = (pid_t) atoi (de->d_name)) || pid == self)
|
||||
continue;
|
||||
readname(name, pid); // get process name
|
||||
if(strncmp(name, myname, 255) == 0){
|
||||
// "ïÂÎÁÒÕÖÅÎ ÒÁÂÏÔÁÀÝÉÊ ÐÒÏÃÅÓÓ (pid=%d), ×ÙÈÏÄ.\n"
|
||||
ERR(_("\nFound running process (pid=%d), exit.\n"), pid);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
unlink(pidfilename); // try to remove pidfilename
|
||||
DBG("my PID: %d\n", self);
|
||||
pidfile = fopen(pidfilename, "w");
|
||||
fprintf(pidfile, "%d\n", self); // write into pidfilename the pid
|
||||
fclose(pidfile);
|
||||
}
|
||||
|
||||
// Try to ignore all signals
|
||||
void ignore_signals(){
|
||||
for(int _=0; _<256; _++)
|
||||
signal(_, SIG_IGN);
|
||||
}
|
||||
// We must take care about signals to avoid ctrl+C problems
|
||||
void catch_signals(){
|
||||
ignore_signals(); // first -- ignore all signals
|
||||
signal(SIGTERM, signals); // kill (-15) - quit
|
||||
signal(SIGHUP, signals); // hup - quit
|
||||
signal(SIGINT, signals); // ctrl+C - quit
|
||||
signal(SIGQUIT, signals); // ctrl+\ - quit
|
||||
//signal(SIGTSTP, SIG_IGN); // ignore ctrl+Z
|
||||
}
|
||||
|
||||
// Work with turret
|
||||
void parse_turret_args(){
|
||||
int maxPos, curPos;
|
||||
if(ApnGlueWheelOpen(Nwheel, Apn_Filter_FW50_7S)){
|
||||
// "îÅ ÍÏÇÕ ÏÔËÒÙÔØ ÔÕÒÅÌØ"
|
||||
ERR(_("Can't open turret"));
|
||||
return;
|
||||
}
|
||||
DBG("get max pos");
|
||||
maxPos = ApnGlueWheelGetMaxPos();
|
||||
curPos = ApnGlueWheelGetPos();
|
||||
// "íÁËÓÉÍÁÌØÎÁÑ (MAX) É ÔÅËÕÝÁÑ (CUR) ÐÏÚÉÃÉÉ ÔÕÒÅÌÉ:\n"
|
||||
printf(_("Turret MAXimum position and CURrent position:\n"));
|
||||
printf("MAX=%d, CUR=%d\n", maxPos, curPos);
|
||||
if(wheelPos == 0) goto wheelret;
|
||||
if(wheelPos > maxPos){
|
||||
// "ôÒÅÂÕÅÍÁÑ ÐÏÚÉÃÉÑ ÂÏÌØÛÅ ÍÁËÓÉÍÁÌØÎÏÊ"
|
||||
ERR(_("Required position greater then max"));
|
||||
goto wheelret;
|
||||
}
|
||||
if(ApnGlueWheelSetPos(wheelPos)){
|
||||
// "îÅ ÍÏÇÕ ÐÅÒÅÍÅÓÔÉÔØ ÔÕÒÅÌØ"
|
||||
ERR(_("Can't move turret"));
|
||||
goto wheelret;
|
||||
}
|
||||
if(ApnGlueWheelGetStatus()){
|
||||
// "ðÏÄÏÖÄÉÔÅ ÚÁ×ÅÒÛÅÎÉÑ ÐÅÒÅÍÅÝÅÎÉÑ ÔÕÒÅÌÉ "
|
||||
printf(_("Wait, while turret is moving "));
|
||||
while(ApnGlueWheelGetStatus()){
|
||||
printf("."); fflush(NULL);
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
wheelret:
|
||||
ApnGlueWheelClose();
|
||||
}
|
||||
|
||||
int main(int argc, char **argv){
|
||||
int i; //cycles
|
||||
FILE *f_tlog = NULL; // temperature logging file
|
||||
FILE *f_statlog = NULL; // stat file
|
||||
int roih=0, roiw=0, osh=0, osw=0, binh=0, binw=0, shtr=0; // camera parameters
|
||||
char whynot[BUFF_SIZ]; // temporary buffer for error texts
|
||||
int imW=0, imH=0; // real (with binning) image size
|
||||
unsigned short *buf = NULL; // image buffer
|
||||
double mintemp=0.;
|
||||
|
||||
//setlocale(LC_ALL, getenv("LC_ALL"));
|
||||
setlocale(LC_ALL, "");
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
|
||||
//bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
|
||||
textdomain(GETTEXT_PACKAGE);
|
||||
|
||||
parse_args(argc, argv);
|
||||
|
||||
catch_signals();
|
||||
// Check whether there's no concurrents
|
||||
check4running();
|
||||
|
||||
if(test_headers){
|
||||
writefits(NULL, imW, imH, NULL);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Turret block
|
||||
if(open_turret) parse_turret_args();
|
||||
if(only_turret) goto returning;
|
||||
|
||||
// And camera block
|
||||
// First - open camera devise
|
||||
if(ApnGlueOpen(Ncam)){
|
||||
// "îÅ ÍÏÇÕ ÏÔËÒÙÔØ ËÁÍÅÒÕ, ÚÁ×ÅÒÛÁÀ"
|
||||
ERR("Can't open camera device, exit");
|
||||
return 1;
|
||||
}
|
||||
ApnGlueGetName(&sensor, &camera);
|
||||
camera = strdup(camera); sensor = strdup(sensor);
|
||||
// "ïÂÎÁÒÕÖÅÎÁ ËÁÍÅÒÁ '%s' Ó ÄÁÔÞÉËÏÍ '%s'"
|
||||
info(_("Find camera '%s' with sensor '%s'"), camera, sensor);
|
||||
// Second - check whether we want do a simple power operations
|
||||
if(StopRes){
|
||||
switch(StopRes){
|
||||
case Reset:
|
||||
ApnGlueReset();
|
||||
break;
|
||||
case Sleep:
|
||||
if(ApnGluePowerDown())
|
||||
// "ïÛÉÂËÁ ÐÅÒÅÈÏÄÁ × ÓÐÑÝÉÊ ÒÅÖÉÍ!"
|
||||
ERR(_("Error: sleepless night!"));
|
||||
break;
|
||||
default:
|
||||
ApnGluePowerResume();
|
||||
}
|
||||
goto returning;
|
||||
}
|
||||
// And then we can do other work
|
||||
if(save_Tlog){
|
||||
struct stat s;
|
||||
char print_hdr = 1;
|
||||
if(stat("temp_log", &s) == 0) print_hdr = 0;
|
||||
f_tlog = fopen("temp_log", "a");
|
||||
// "îÅ ÍÏÇÕ ÏÔËÒÙÔØ ÆÁÊÌ ÖÕÒÎÁÌÁ ÔÅÍÐÅÒÁÔÕÒ"
|
||||
if(!f_tlog) err(1, _("Can't open temperature log file"));
|
||||
if(print_hdr)
|
||||
fprintf(f_tlog, "Time\t\t\tUnix time\tTint\tText\tStatus (eXp, Idle)\n");
|
||||
//fprintf(f_tlog, "\n\n\n");
|
||||
}
|
||||
// Shutter
|
||||
if(Shtr != -1)
|
||||
ApnGlueOpenShutter(Shtr);
|
||||
if(stat_logging){
|
||||
struct stat s;
|
||||
char print_hdr = 1;
|
||||
if(stat("stat_log", &s) == 0) print_hdr = 0;
|
||||
f_statlog = fopen("stat_log", "a");
|
||||
// "îÅ ÍÏÇÕ ÏÔËÒÙÔØ ÆÁÊÌ ÖÕÒÎÁÌÁ ÓÔÁÔÉÓÔÉËÉ"
|
||||
if(!f_statlog) err(1, _("Can't open statistics log file"));
|
||||
if(print_hdr)
|
||||
fprintf(f_statlog, "Time\t\t\tUnix time\tTexp\tTint\tText\tImax\tImin\tIavr\tIstd\tNover\tN>3std\tIavr3\t\tIstd3\n");
|
||||
}
|
||||
//ApnGlueSetFan(3);
|
||||
ApnGlueGetMaxValues (NULL, &roiw, &roih, &osw, &osh, &binw, &binh,
|
||||
&shtr, &mintemp);
|
||||
ApnGlueGetGeom(&pixX, &pixY);
|
||||
// "\núÁÔ×ÏÒ "
|
||||
printf(_("\nThe shutter is "));
|
||||
if(ApnGlueReadShutter())
|
||||
// "ÏÔËÒÙÔ\n"
|
||||
printf(_("open\n"));
|
||||
else
|
||||
// "ÚÁËÒÙÔ\n"
|
||||
printf(_("closed\n"));
|
||||
printCoolerStat(NULL);
|
||||
if(set_T){
|
||||
if(cooler_off){
|
||||
ApnGlueSetTemp(0);
|
||||
// "ïÔËÌÀÞÅÎÉÅ ÈÏÌÏÄÉÌØÎÉËÁ"
|
||||
info(_("Switch cooler off"));
|
||||
}else{
|
||||
if(temperature >= mintemp){
|
||||
if(temperature == 0) temperature += DBL_EPSILON; // remove problem of zero temperature
|
||||
ApnGlueSetTemp(temperature);
|
||||
// "éÚÍÅÎÅÎÉÅ ÔÅÍÐÅÒÁÔÕÒÙ ÈÏÌÏÄÉÌØÎÉËÁ"
|
||||
info(_("Changing of cooler setpoint"));
|
||||
}else
|
||||
// "ôÅÍÐÅÒÁÔÕÒÁ ÎÉÖÅ ÄÏÐÕÓÔÉÍÏÊ"
|
||||
info(_("The temperature setpoint is too low"));
|
||||
}
|
||||
}
|
||||
|
||||
// òÁÚÍÅÒ ÐÉËÓÅÌÑ: %g x %g
|
||||
//info(_("Pixel size: %g x %g"), pixX, pixY);
|
||||
|
||||
snprintf(viewfield, 79, "(0, %d)(0, %d)", roiw, roih);
|
||||
// "÷ÉÄÉÍÏÅ ÐÏÌÅ: %s"
|
||||
info(_("Field of view: %s"), viewfield);
|
||||
// "ðÏÌÅ ÉÚÏÂÒÁÖÅÎÉÑ: (0, %d)(0, %d)"
|
||||
info(_("Array field: (0, %d)(0, %d)"), roiw+osw, roih+osh);
|
||||
|
||||
if(X0 == -1) X0 = 0; // default parameters
|
||||
if(Y0 == -1) Y0 = 0;
|
||||
if(X1 == -1 || X1 > roiw) X1 = roiw;
|
||||
if(Y1 == -1 || Y1 > roih) Y1 = roih;
|
||||
if(X0 != 0 || X1 != roiw) osw = 0; // check overskan
|
||||
if(Y0 != 0 || Y1 != roih) osh = 0;
|
||||
if(hbin > binw) hbin = binw;
|
||||
if(vbin > binh) vbin = binh;
|
||||
|
||||
if(only_T) goto returning;
|
||||
AutoadjustFanSpeed(FALSE);
|
||||
if(noflash) ApnGluePreFlash(0);
|
||||
if(noclean) ApnGlueDisablePostExpFlushing(1);
|
||||
if(twelveBit)
|
||||
ApnGlueSetDatabits(Apn_Resolution_TwelveBit);
|
||||
else
|
||||
ApnGlueSetDatabits(Apn_Resolution_SixteenBit);
|
||||
|
||||
if(ROspeed) ApnGlueSetSpeed(ROspeed);
|
||||
|
||||
if(pre_exp){// pre-expose
|
||||
// "ðÒÅÄ×ÁÒÉÔÅÌØÎÁÑ ÜËÓÐÏÚÉÃÉÑ"
|
||||
info(_("Pre-expose"));
|
||||
double E = 0.;
|
||||
if(!twelveBit)
|
||||
ApnGlueSetDatabits(Apn_Resolution_TwelveBit);
|
||||
if(ApnGlueSetExpGeom(roiw, roih, 0, 0, binw, binh,
|
||||
0, 0, &imW, &imH, whynot)){
|
||||
// "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÐÁÒÁÍÅÔÒÙ ÓÞÉÔÙ×ÁÎÉÑ: %s"
|
||||
ERR("Can't set readout parameters: %s", whynot);
|
||||
goto returning;
|
||||
}
|
||||
int L = imW*imH;
|
||||
buf = (unsigned short*) calloc(L, sizeof(unsigned short));
|
||||
if(!buf){
|
||||
// "ïÛÉÂËÁ ×ÙÄÅÌÅÎÉÑ ÐÁÍÑÔÉ!"
|
||||
err(1, "malloc() failed");
|
||||
}
|
||||
if(ApnGlueStartExp(&E, 0)){
|
||||
// "ïÛÉÂËÁ ÜËÓÐÏÚÉÃÉÉ!"
|
||||
ERR("Error exposing frame!");
|
||||
exit(-2);
|
||||
}
|
||||
ignore_signals();
|
||||
if(ApnGlueReadPixels(buf, L, whynot)){
|
||||
// "ïÛÉÂËÁ ÓÞÉÔÙ×ÁÎÉÑ: %s\n"
|
||||
ERR(_("Readout error: %s\n"), whynot);
|
||||
exit(-2);
|
||||
}
|
||||
free(buf);
|
||||
// restore signals
|
||||
catch_signals();
|
||||
if(!twelveBit)
|
||||
ApnGlueSetDatabits(Apn_Resolution_SixteenBit);
|
||||
}
|
||||
if(ApnGlueSetExpGeom(X1-X0, Y1-Y0, osw, osh, hbin, vbin,
|
||||
X0, Y0, &imW, &imH, whynot)){
|
||||
// "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÐÁÒÁÍÅÔÒÙ ÓÞÉÔÙ×ÁÎÉÑ: %s"
|
||||
ERR("Can't set readout parameters: %s", whynot);
|
||||
goto returning;
|
||||
}
|
||||
int L = imW*imH;
|
||||
buf = (unsigned short*) calloc(L, sizeof(unsigned short));
|
||||
if(!buf){
|
||||
// "ïÛÉÂËÁ ×ÙÄÅÌÅÎÉÑ ÐÁÍÑÔÉ!"
|
||||
err(1, "malloc() failed");
|
||||
}
|
||||
for (i = 0; i < pics; i++){
|
||||
AutoadjustFanSpeed(FALSE);
|
||||
temperature = printCoolerStat(NULL);
|
||||
double E;
|
||||
int I;
|
||||
if(exptime > -1){ // do expositions only if there is -x key
|
||||
E = (double) exptime / 1000.;
|
||||
I = (int) E;
|
||||
if(ApnGlueStartExp(&E, shutter)){
|
||||
// "ïÛÉÂËÁ ÜËÓÐÏÚÉÃÉÉ!"
|
||||
ERR("Error exposing frame!");
|
||||
continue;
|
||||
}
|
||||
#ifdef USE_BTA
|
||||
push_param();
|
||||
#endif
|
||||
//exptime = (int)(E*1000.);
|
||||
printf("\n\n");
|
||||
// "úÁÈ×ÁÔ ËÁÄÒÁ %d, ×ÒÅÍÑ ÜËÓÐÏÚÉÃÉÉ - %g ÓÅËÕÎÄ\n"
|
||||
printf(_("Capture frame %d, exp time - %g sec\n"), i, E);
|
||||
expStartsAt = time(NULL); // ×ÒÅÍÑ ÎÁÞÁÌÁ ÜËÓÐÏÚÉÃÉÉ
|
||||
/*if(save_Tlog) if(curtime(tm_buf))
|
||||
// "îÁÞÉÎÁÀ ÜËÓÐÏÚÉÃÉÀ %d-ÇÏ ÆÁÊÌÁ; ÜËÓÐÏÚÉÃÉÑ: %gÓ, ×ÒÅÍÑ ÎÁÞÁÌÁ: %s, ÆÁÊÌ: %s\n"
|
||||
fprintf(f_tlog, _("Begin exposition of %dth frame; exp length: %gs, start time: %s, filename: %s\n"),
|
||||
i, E, tm_buf, outfile);*/
|
||||
time0 = itime();
|
||||
do{
|
||||
// %.3f ÓÅËÕÎÄ ÄÏ ÏËÏÎÞÁÎÉÑ ÜËÓÐÏÚÉÃÉÉ\n
|
||||
//printf(_("%.3f seconds till exposition ends\n"), ((float)ltmp) / 1000.);
|
||||
t_int = printCoolerStat(&t_ext);
|
||||
if(save_Tlog && curtime(tm_buf)){
|
||||
fprintf(f_tlog, "%s\t%ld\t%.2f\t%.2f\tX\n", tm_buf, time(NULL), t_int, t_ext);
|
||||
}
|
||||
AutoadjustFanSpeed(FALSE);
|
||||
int tt = ltime();
|
||||
printf("%d sec\n", tt);
|
||||
if(I - tt > time_interval){
|
||||
sleep(time_interval);
|
||||
#ifdef USE_BTA
|
||||
push_param();
|
||||
#endif
|
||||
}else while(!ApnGlueExpDone()) usleep(100000); // make 100ms error
|
||||
}while(!ApnGlueExpDone());
|
||||
#ifdef USE_BTA
|
||||
push_param();
|
||||
#endif
|
||||
// "óÞÉÔÙ×ÁÎÉÅ ÉÚÏÂÒÁÖÅÎÉÑ:"
|
||||
printf(_("Read image: "));
|
||||
fflush(stdout);
|
||||
// try to ignore signals for this long operation
|
||||
ignore_signals();
|
||||
if(ApnGlueReadPixels(buf, L, whynot)){
|
||||
// "ïÛÉÂËÁ ÓÞÉÔÙ×ÁÎÉÑ: %s\n"
|
||||
ERR(_("Readout error: %s\n"), whynot);
|
||||
catch_signals();
|
||||
continue;
|
||||
}
|
||||
// restore signals
|
||||
catch_signals();
|
||||
t_int = printCoolerStat(&t_ext);
|
||||
if(f_statlog && curtime(tm_buf))
|
||||
fprintf(f_statlog, "%s\t%ld\t%g\t%.2f\t%.2f\t", tm_buf,
|
||||
time(NULL), E, t_int, t_ext);
|
||||
print_stat(buf, L, f_statlog);
|
||||
inline void WRITEIMG(int (*writefn)(char*,int,int,void*), char *ext){
|
||||
if(!check_filename(whynot, outfile, ext))
|
||||
// "îÅ ÍÏÇÕ ÓÏÈÒÁÎÉÔØ ÆÁÊÌ"
|
||||
err(1, _("Can't save file"));
|
||||
else{
|
||||
int r = writefn(whynot, imW, imH, buf);
|
||||
// "æÁÊÌ ÚÁÐÉÓÁÎ × '%s'"
|
||||
if (r == 0) info(_("File saved as '%s'"), whynot);
|
||||
}
|
||||
}
|
||||
if(save_image){
|
||||
#ifdef USERAW
|
||||
WRITEIMG(writeraw, "raw");
|
||||
#endif // USERAW
|
||||
WRITEIMG(writefits, "fit");
|
||||
#ifdef USEPNG
|
||||
WRITEIMG(writepng, "png");
|
||||
#endif /* USEPNG */
|
||||
}
|
||||
}
|
||||
if(pause_len){
|
||||
int delta;
|
||||
time0 = itime();
|
||||
while((delta = pause_len - ltime()) > 0){
|
||||
// "%d ÓÅËÕÎÄ ÄÏ ÏËÏÎÞÁÎÉÑ ÐÁÕÚÙ\n"
|
||||
printf(_("%d seconds till pause ends\n"), delta);
|
||||
temperature = printCoolerStat(&t_ext);
|
||||
if(save_Tlog && curtime(tm_buf)){
|
||||
fprintf(f_tlog, "%s\t%ld\t%.2f\t%.2f\tI\n", tm_buf, time(NULL), temperature, t_ext);
|
||||
}
|
||||
AutoadjustFanSpeed(FALSE);
|
||||
if(delta > 10) sleep(10);
|
||||
else sleep(delta);
|
||||
}
|
||||
}
|
||||
fflush(NULL);
|
||||
}
|
||||
returning:
|
||||
free(buf);
|
||||
if(f_tlog) fclose(f_tlog);
|
||||
if(f_statlog) fclose(f_statlog);
|
||||
// set fan speed to 0 or 3 according cooler status
|
||||
if(!only_turret) AutoadjustFanSpeed(TRUE);
|
||||
return 0;
|
||||
}
|
||||
89
takepic.h
Normal file
89
takepic.h
Normal file
@ -0,0 +1,89 @@
|
||||
#ifndef __TAKEPIC_H__
|
||||
#define __TAKEPIC_H__
|
||||
#define _XOPEN_SOURCE 501
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <err.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
#include <fitsio.h>
|
||||
#include <libintl.h>
|
||||
|
||||
#ifdef USEPNG
|
||||
#include <png.h>
|
||||
#endif /* USEPNG */
|
||||
|
||||
#include <libapogee.h>
|
||||
|
||||
#ifndef GETTEXT_PACKAGE
|
||||
#define GETTEXT_PACKAGE "apogee_control"
|
||||
#endif
|
||||
#ifndef LOCALEDIR
|
||||
#define LOCALEDIR "./locale"
|
||||
#endif
|
||||
|
||||
#define _(String) gettext(String)
|
||||
#define gettext_noop(String) String
|
||||
#define N_(String) gettext_noop(String)
|
||||
|
||||
|
||||
/*
|
||||
* SAO longitude 41 26 29.175
|
||||
* SAO latitude 43 39 12.7
|
||||
* SAO altitude 2070
|
||||
*/
|
||||
#ifndef TELLAT
|
||||
#define TELLAT 43.6535278
|
||||
#endif
|
||||
#ifndef TELLONG
|
||||
#define TELLONG 41.44143375
|
||||
#endif
|
||||
#ifndef TELALT
|
||||
#define TELALT 2070.0
|
||||
#endif
|
||||
|
||||
// ÒÅÖÉÍ ÏÔÌÁÄËÉ, -DEBUG
|
||||
#ifdef EBUG
|
||||
#define RED "\033[1;32;41m"
|
||||
#define GREEN "\033[5;30;42m"
|
||||
#define OLDCOLOR "\033[0;0;0m"
|
||||
#define FNAME() fprintf(stderr, "\n%s (%s, line %d)\n", __func__, __FILE__, __LINE__)
|
||||
#define DBG(...) do{fprintf(stderr, "%s (%s, line %d): ", __func__, __FILE__, __LINE__); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
fprintf(stderr, "\n");} while(0)
|
||||
#define ERR(...) DBG(__VA_ARGS__)
|
||||
#else
|
||||
#define FNAME() do{}while(0)
|
||||
#define DBG(...) do{}while(0)
|
||||
#define ERR(...) do{fprintf(stderr, __VA_ARGS__); \
|
||||
fprintf(stderr, "\n");} while(0)
|
||||
#endif //EBUG
|
||||
|
||||
extern int test_headers;
|
||||
|
||||
extern const char *__progname;
|
||||
#define info(format, args...) do{ \
|
||||
printf("%s: ", __progname); \
|
||||
printf(format, ## args); \
|
||||
printf("\n");}while(0)
|
||||
|
||||
/*
|
||||
#define warnc(c, format, args...) \
|
||||
warnx(format ": %s", ## args, strerror(c))
|
||||
long r;
|
||||
#define TRYFUNC(f, ...) \
|
||||
do{ if((r = f(__VA_ARGS__))) \
|
||||
warnc(-r, #f "() failed"); \
|
||||
}while(0)
|
||||
*/
|
||||
|
||||
#endif // __TAKEPIC_H__
|
||||
501
usage.c
Normal file
501
usage.c
Normal file
@ -0,0 +1,501 @@
|
||||
#include "usage.h"
|
||||
|
||||
Apn_Filter Tturret = Apn_Filter_FW50_7S; // turrer type
|
||||
int
|
||||
TurretPos = 0 // turret setposition
|
||||
,wheelPos = 0 // turret position
|
||||
,Nwheel = 1 // turret number
|
||||
;
|
||||
|
||||
unsigned short
|
||||
ROspeed = 0 // readout speed
|
||||
;
|
||||
|
||||
char
|
||||
*objname = NULL // object name
|
||||
,*outfile = NULL // filename prefix
|
||||
,*objtype = NULL // frame type (default - object, when -d - dark)
|
||||
,*instrument = NULL // instrument name (default - "direct imaging")
|
||||
,*observers = NULL // observers name
|
||||
,*prog_id = NULL // program identificator
|
||||
,*author = NULL // author of program
|
||||
;
|
||||
int
|
||||
exptime = -1 // exposition time (in ms), -1 means no exposition
|
||||
,fanspd = -1 // set fan speed (default - auto)
|
||||
,time_interval = 10 // interval between sequential logging
|
||||
,pics = 1 // number of frames per run
|
||||
,Ncam = 1 // camera number (if many)
|
||||
,hbin = 1 // horizontal binning
|
||||
,vbin = 1 // vertical binning
|
||||
,X0=-1,Y0=-1 // top left corner coordinates
|
||||
,X1=-1,Y1=-1 // right bottom corner coordinates
|
||||
// if ==-1 - all, including overscan
|
||||
,pause_len = 0 // pause length (in s) between frames
|
||||
,pre_exp = 0 // pre-expose
|
||||
,StopRes = 0 // reset (1), sleep (2), awake (3)
|
||||
,Shtr = -1 // shutter: -1 -- no action or SHUTTER_OPEN/SHUTTER_CLOSE
|
||||
,noclean = 0 // don't flush camera after exp
|
||||
,twelveBit = 0 // 12-bit ADC
|
||||
;
|
||||
double temperature = -25.; // setpoint of temperature
|
||||
|
||||
int shutter = 1; // object frame == 1, dark frame == 0
|
||||
|
||||
bool
|
||||
only_T = FALSE // only show temperature
|
||||
,noflash = FALSE // don't flash before exposition
|
||||
,set_T = FALSE // set temperature
|
||||
,cooler_off = FALSE // set cooler off
|
||||
,save_Tlog = FALSE // save temperature log
|
||||
,save_image = TRUE // save image into file
|
||||
,stat_logging = FALSE // full stat log
|
||||
,only_turret = TRUE // only move turret
|
||||
,open_turret = FALSE // work with turret
|
||||
;
|
||||
|
||||
int myatoi(int *num, const char *str){ // "careful" atoi
|
||||
long tmp;
|
||||
char *endptr;
|
||||
tmp = strtol(str, &endptr, 0);
|
||||
if (*str == '\0' || *endptr != '\0' || tmp < INT_MIN || tmp > INT_MAX){
|
||||
return -1;
|
||||
}
|
||||
*num = (int)tmp;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void getrange(int *X0, int *X1, char *arg){
|
||||
char *a = NULL, *pair;
|
||||
pair = strdup(arg);
|
||||
if((a = strchr(pair, ','))){
|
||||
*a = 0;
|
||||
a++;
|
||||
}
|
||||
if(myatoi(X0, pair) || *X0 < 0){
|
||||
// "îÅ×ÅÒÎÁÑ ÎÉÖÎÑÑ ÇÒÁÎÉÃÁ: %s"
|
||||
usage(_("Wrong lower border: %s"), pair);
|
||||
}
|
||||
if(a){
|
||||
if(myatoi(X1, a) || *X1 < 0 || *X1 <= *X0){
|
||||
// "îÅ×ÅÒÎÁÑ ×ÅÒÈÎÑÑ ÇÒÁÎÉÃÁ: %s"
|
||||
usage(_("Wrong upper border: %s"), pair);
|
||||
}
|
||||
}
|
||||
free(pair);
|
||||
}
|
||||
|
||||
void usage(char *fmt, ...){
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
printf("\n");
|
||||
if (fmt != NULL){
|
||||
vprintf(fmt, ap);
|
||||
printf("\n\n");
|
||||
}
|
||||
va_end(ap);
|
||||
// "éÓÐÏÌØÚÏ×ÁÎÉÅ:\t%s [ÏÐÃÉÉ] [ÐÒÅÆÉËÓ ×ÙÈÏÄÎÙÈ ÆÁÊÌÏ×]\n"
|
||||
printf(_("Usage:\t%s [options] [output files prefix]\n"),
|
||||
__progname);
|
||||
// "\tïÐÃÉÉ:\n"
|
||||
printf(_("\tOptions:\n"));
|
||||
printf("\t-A,\t--author=author\t\t%s\n",
|
||||
// "Á×ÔÏÒ ÐÒÏÇÒÁÍÍÙ"
|
||||
_("program author"));
|
||||
printf("\t-c,\t--cooler-off\t\t%s\n",
|
||||
// "ÏÔËÌÀÞÉÔØ ÈÏÌÏÄÉÌØÎÉË"
|
||||
_("Set cooler off"));
|
||||
printf("\t-d,\t--dark\t\t\t%s\n",
|
||||
// "ÎÅ ÏÔËÒÙ×ÁÔØ ÚÁÔ×ÏÒ ÐÒÉ ÜËÓÐÏÚÉÃÉÉ (\"ÔÅÍÎÏ×ÙÅ\")"
|
||||
_("not open shutter when exposing (\"dark frames\")"));
|
||||
printf("\t-f,\t--no-flash\t\t%s\n",
|
||||
// "ÎÅ ÚÁÓ×ÅÞÉ×ÁÔØ ÍÁÔÒÉÃÕ ÐÅÒÅÄ ÜËÓÐÏÚÉÃÉÅÊ"
|
||||
_("Don't flash CCD chip before expose"));
|
||||
printf("\t-F,\t--fan-speed=F\t\t%s\n",
|
||||
// "õÓÔÁÎÏ×ÉÔØ ÓËÏÒÏÓÔØ ×ÅÎÔÉÌÑÔÏÒÏ× × F (0..3)"
|
||||
_("Set fan speed to F (0..3)"));
|
||||
printf("\t-g,\t--wheel-get\t\t%s\n",
|
||||
// ÐÏÌÕÞÉÔØ Ó×ÅÄÅÎÉÑ Ï ÔÕÒÅÌÉ
|
||||
_("get turret's parameters"));
|
||||
printf("\t-G,\t--wheel-go=N\t\t%s\n",
|
||||
// ÐÅÒÅÍÅÓÔÉÔØ ÔÕÒÅÌØ × N-À ÐÏÚÉÃÉÀ
|
||||
_("set turret to Nth position"));
|
||||
printf("\t-H,\t--time-interval=T\t%s\n",
|
||||
// "ÉÎÔÅÒ×ÁÌ ×ÒÅÍÅÎÉ ÍÅÖÄÕ ÐÏÓÌÅÄÏ×ÁÔÅÌØÎÙÍÉ ÚÁÐÉÓÑÍÉ × ÌÏÇ É HISTORY (× ÓÅËÕÎÄÁÈ)"
|
||||
_("time interval between sequential writings to log & HISTORY (in seconds)"));
|
||||
printf("\t-h,\t--hbin=N\t\t%s\n",
|
||||
// "ÂÉÎÎÉÎÇ N ÐÉËÓÅÌÅÊ ÐÏ ÇÏÒÉÚÏÎÔÁÌÉ"
|
||||
_("horizontal binning to N pixels"));
|
||||
printf("\t-I,\t--image-type=type\t%s\n",
|
||||
// "ÔÉÐ ÉÚÏÂÒÁÖÅÎÉÑ"
|
||||
_("image type"));
|
||||
printf("\t-i,\t--instrument=instr\t%s\n",
|
||||
// "ÎÁÚ×ÁÎÉÅ ÐÒÉÂÏÒÁ"
|
||||
_("instrument name"));
|
||||
printf("\t-L,\t--log-only\t\t%s\n",
|
||||
// "ÎÅ ÓÏÈÒÁÎÑÔØ ÉÚÏÂÒÁÖÅÎÉÑ, ÌÉÛØ ×ÅÓÔÉ ÚÁÐÉÓØ ÓÔÁÔÉÓÔËÉ"
|
||||
_("don't save images, only make all-stat log"));
|
||||
printf("\t-l,\t--tlog\t\t\t%s\n",
|
||||
// "×ÅÓÔÉ ÚÁÐÉÓØ ÒÁÂÏÞÉÈ ÔÅÍÐÅÒÁÔÕÒ × ÆÁÊÌ temp_log"
|
||||
_("make temperatures logging to file temp_log"));
|
||||
printf("\t-N,\t--ncam=N\t\t%s\n",
|
||||
// "ÒÁÂÏÔÁÔØ Ó N-Ê ËÁÍÅÒÏÊ"
|
||||
_("work with Nth camera"));
|
||||
printf("\t-n,\t--nframes=N\t\t%s\n",
|
||||
// "N ËÁÄÒÏ× × ÓÅÒÉÉ"
|
||||
_("make series of N frames"));
|
||||
printf("\t-O,\t--object=obj\t\t%s\n",
|
||||
// "ÎÁÚ×ÁÎÉÅ ÏÂßÅËÔÁ"
|
||||
_("object name"));
|
||||
printf("\t-o,\t--observer=obs\t\t%s\n",
|
||||
// "ÉÍÅÎÁ ÎÁÂÌÀÄÁÔÅÌÅÊ"
|
||||
_("observers' names"));
|
||||
printf("\t-P,\t--prog-id=prname\t%s\n",
|
||||
// "ÎÁÚ×ÁÎÉÅ ÐÒÏÇÒÁÍÍÙ ÎÁÂÌÀÄÅÎÉÊ"
|
||||
_("observing program name"));
|
||||
printf("\t-p,\t--pause-len=ptime\t%s\n",
|
||||
// "×ÙÄÅÒÖÁÔØ ptime ÓÅËÕÎÄ ÍÅÖÄÕ ÜËÓÐÏÚÉÃÉÑÍÉ"
|
||||
_("make pause for ptime seconds between expositions"));
|
||||
printf("\t-r,\t--speed-set=N\t\t%s\n",
|
||||
// "ÕÓÔÁÎÏ×ÉÔØ ÓËÏÒÏÓÔØ ÓÞÉÔÙ×ÁÎÉÑ × N"
|
||||
_("set readout speed to N"));
|
||||
printf("\t-R,\t--reset\t\t\t%s\n",
|
||||
// "ðÏÌÎÙÊ ÓÂÒÏÓ"
|
||||
_("full reset"));
|
||||
printf("\t-S,\t--sleep\t\t\t%s\n",
|
||||
// "ÐÅÒÅÊÔÉ × ÓÐÑÝÉÊ ÒÅÖÉÍ"
|
||||
_("go to sleeping mode"));
|
||||
printf("\t-s,\t--only-stat\t\t%s\n",
|
||||
// "ÎÅ ÓÏÈÒÁÎÑÔØ ÉÚÏÂÒÁÖÅÎÉÅ, Á ÔÏÌØËÏ ÏÔÏÂÒÁÚÉÔØ ÓÔÁÔÉÓÔÉËÕ"
|
||||
_("not save image, just show statistics"));
|
||||
printf("\t-T,\t--only-temp\t\t%s\n",
|
||||
// "ÔÏÌØËÏ ÚÁÄÁÔØ/ÐÏÌÕÞÉÔØ ÔÅÍÐÅÒÁÔÕÒÕ"
|
||||
_("only set/get temperature"));
|
||||
printf("\t-t,\t--set-temp=degr\t\t%s\n",
|
||||
// "ÚÁÄÁÔØ ÒÁÂÏÞÕÀ ÔÅÍÐÅÒÁÔÕÒÕ degr ÇÒÁÄÕÓÏ×"
|
||||
_("set work temperature to degr C"));
|
||||
printf("\t-v,\t--vbin=N\t\t%s\n",
|
||||
// "ÂÉÎÎÉÎÇ N ÐÉËÓÅÌÅÊ ÐÏ ×ÅÒÔÉËÁÌÉ"
|
||||
_("vertical binning to N pixels"));
|
||||
printf("\t-w,\t--wheel-num=N\t\t%s\n",
|
||||
// ÕÓÔÁÎÏ×ÉÔØ ÎÏÍÅÒ ÔÕÒÅÌÉ × N
|
||||
_("set turret's number to N"));
|
||||
printf("\t-W,\t--wakeup\t\t%s\n",
|
||||
// "×ÏÚÏÂÎÏ×ÉÔØ ÐÉÔÁÎÉÅ"
|
||||
_("resume system"));
|
||||
printf("\t-x,\t--exp=exptime\t\t%s\n",
|
||||
// "×ÒÅÍÑ ÜËÓÐÏÚÉÃÉÉ exptime ÍÓ"
|
||||
_("set exposure time to exptime ms"));
|
||||
printf("\t-X,\t--xclip=X0[,X1]\t\t%s [X0:X1]\n",
|
||||
// "×ÙÂÒÁÔØ ÄÉÁÐÁÚÏÎ ÄÌÑ ÓÞÉÔÙ×ÁÎÉÑ"
|
||||
_("select clip region"));
|
||||
printf("\t-Y,\t--xclip=Y0[,Y1]\t\t%s [Y0:Y1]\n",
|
||||
// "×ÙÂÒÁÔØ ÄÉÁÐÁÚÏÎ ÄÌÑ ÓÞÉÔÙ×ÁÎÉÑ"
|
||||
_("select clip region"));
|
||||
// ONLY LONG
|
||||
printf("\t\t--noclean\t\t%s\n",
|
||||
// "ÎÅ ÏÞÉÝÁÔØ ÍÁÔÒÉÃÕ ÐÏÓÌÅ ÓÞÉÔÙ×ÁÎÉÑ"
|
||||
_("don't flush ccd after expose"));
|
||||
printf("\t\t--pre-exp\t\t%s\n",
|
||||
// "×ÙÐÏÌÎÉÔØ ÐÒÅÄ×ÁÒÉÔÅÌØÎÕÀ ÎÕÌÅ×ÕÀ ÜËÓÐÏÚÉÃÉÀ ÄÌÑ ÏÞÉÓÔËÉ ÍÁÔÒÉÃÙ"
|
||||
_("make a preliminary zero exposition for cleaning CCD"));
|
||||
printf("\t\t--shutter-open\t\t%s\n",
|
||||
// "ÏÔËÒÙÔØ ÚÁÔ×ÏÒ"
|
||||
_("open shutter"));
|
||||
printf("\t\t--shutter-close\t\t%s\n",
|
||||
// "ÚÁÔËÒÙÔØ ÚÁÔ×ÏÒ"
|
||||
_("close shutter"));
|
||||
printf("\t\t--test-headers\t\t%s\n",
|
||||
// "ÎÅ ÏÔËÒÙ×ÁÔØ ÕÓÔÒÏÊÓÔ×Ï, ÌÉÛØ ÏÔÏÂÒÁÚÉÔØ ÛÁÐËÕ FITS"
|
||||
_("don't open camera device, just show FITS header"));
|
||||
printf("\t\t--twelve-bit\t\t%s\n",
|
||||
// "ÒÁÂÏÔÁÔØ × 12-ÂÉÔÎÏÍ ÒÅÖÉÍÅ"
|
||||
_("work in a 12-bit ADC mode"));
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void parse_args(int argc, char **argv){
|
||||
int i;
|
||||
char short_options[] = "A:cdfF:gG:H:h:I:i:LlN:n:O:o:P:p:Rr:SsTt:v:Ww:x:X:Y:";
|
||||
struct option long_options[] = {
|
||||
/* { name, has_arg, flag, val }, ÇÄÅ:
|
||||
* name - name of long parameter
|
||||
* has_arg = 0 - no argument, 1 - need argument, 2 - unnesessary argument
|
||||
* flag = NULL to return val, pointer to int - to set it
|
||||
* value of val (function returns 0)
|
||||
* val - getopt_long return value or value, flag setting to
|
||||
* !!! last string - for zeros !!!
|
||||
*/
|
||||
{"author", 1, 0, 'A'},
|
||||
{"cooler-off", 0, 0, 'c'},
|
||||
{"dark", 0, 0, 'd'},
|
||||
{"no-flash", 0, 0, 'f'},
|
||||
{"fan-speed", 1, 0, 'F'},
|
||||
{"wheel-get", 0, 0, 'g'},
|
||||
{"wheel-go", 1, 0, 'G'},
|
||||
{"time-interval",1, 0, 'H'},
|
||||
{"hbin", 1, 0, 'h'},
|
||||
{"image-type", 1, 0, 'I'},
|
||||
{"instrument", 1, 0, 'i'},
|
||||
{"log-only", 0, 0, 'L'},
|
||||
{"tlog", 0, 0, 'l'},
|
||||
{"ncam", 1, 0, 'N'},
|
||||
{"nframes", 1, 0, 'n'},
|
||||
{"object", 1, 0, 'O'},
|
||||
{"observers", 1, 0, 'o'},
|
||||
{"prog-id", 1, 0, 'P'},
|
||||
{"pause-len", 1, 0, 'p'},
|
||||
{"reset", 0, 0, 'R'},
|
||||
{"speed-set", 1, 0, 'r'},
|
||||
{"sleep", 0, 0, 'S'},
|
||||
{"only-stat", 0, 0, 's'},
|
||||
{"only-temp", 0, 0, 'T'},
|
||||
{"set-temp", 1, 0, 't'},
|
||||
{"vbin", 1, 0, 'v'},
|
||||
{"wheel-num", 1, 0, 'w'},
|
||||
{"wakeup", 0, 0, 'W'},
|
||||
{"exp", 1, 0, 'x'},
|
||||
{"xclip", 1, 0, 'X'},
|
||||
{"yclip", 1, 0, 'Y'},
|
||||
// options, that have no short analogs:
|
||||
{"noclean", 0, &noclean, 1},
|
||||
{"shutter-open", 0, &Shtr, 1},
|
||||
{"shutter-close", 0, &Shtr, 0},
|
||||
{"test-headers", 0, &test_headers, 1},
|
||||
{"twelve-bit", 0, &twelveBit, 1},
|
||||
{"pre-exp", 0, &pre_exp, 1},
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
if(argc == 1){
|
||||
// "îÅ ××ÅÄÅÎÏ ÎÉËÁËÉÈ ÐÁÒÁÍÅÔÒÏ×"
|
||||
usage(_("Any parameters are absent"));
|
||||
}
|
||||
while (1){
|
||||
int opt;
|
||||
if((opt = getopt_long(argc, argv, short_options,
|
||||
long_options, NULL)) == -1) break;
|
||||
switch(opt){
|
||||
case 0: // only long option
|
||||
break;
|
||||
case 'A':
|
||||
author = strdup(optarg);
|
||||
// "á×ÔÏÒ ÐÒÏÇÒÁÍÍÙ: %s"
|
||||
info(_("Program author: %s"), author);
|
||||
break;
|
||||
case 'c':
|
||||
only_turret = FALSE;
|
||||
set_T = TRUE;
|
||||
// "ÏÔËÌÀÞÉÔØ ÈÏÌÏÄÉÌØÎÉË"
|
||||
info(_("Set cooler off"));
|
||||
cooler_off = TRUE;
|
||||
break;
|
||||
case 'd':
|
||||
shutter = 0;
|
||||
// "óßÅÍËÁ ÔÅÍÎÏ×ÙÈ"
|
||||
info(_("Dark frames"));
|
||||
break;
|
||||
case 'f':
|
||||
noflash = TRUE;
|
||||
// "îÅ ÚÁÓ×ÅÞÉ×ÁÔØ ËÁÍÅÒÕ ÄÏ ÜËÓÐÏÚÉÃÉÉ"
|
||||
info(_("No pre-expose flash"));
|
||||
break;
|
||||
case 'F':
|
||||
if(myatoi(&fanspd, optarg) || fanspd > 3 || fanspd < 0)
|
||||
// "óËÏÒÏÓÔØ ×ÅÎÔÉÌÑÔÏÒÁ ÄÏÌÖÎÁ ÂÙÔØ × ÐÒÅÄÅÌÅ 0..3"
|
||||
usage(_("Fan speed should be in interval 0..3"));
|
||||
// "õÓÔÁÎÏ×ÉÔØ ÓËÏÒÏÓÔØ ×ÒÁÝÅÎÉÑ ×ÅÎÔÉÌÑÔÏÒÏ× × %d"
|
||||
info(_("Fan speed would be set to %d"), fanspd);
|
||||
only_turret = FALSE;
|
||||
break;
|
||||
case 'g':
|
||||
open_turret = TRUE;
|
||||
// "ðÏÌÕÞÉÔØ ÉÎÆÏÒÍÁÃÉÀ Ï ÔÕÒÅÌÉ"
|
||||
info(_("Get turret's info"));
|
||||
break;
|
||||
case 'G':
|
||||
open_turret = TRUE;
|
||||
if(myatoi(&wheelPos, optarg) || wheelPos < 1)
|
||||
// "îÏÍÅÒ ÐÏÚÉÃÉÉ ÄÏÌÖÅÎ ÂÙÔØ ÂÏÌØÛÅ 0"
|
||||
usage(_("Position number should be positive value"));
|
||||
// "ðÅÒÅÍÅÓÔÉÔØ ÔÕÒÅÌØ × ÐÏÚÉÃÉÀ %d"
|
||||
info(_("Move turret into %d"), wheelPos);
|
||||
break;
|
||||
case 'H':
|
||||
if(myatoi(&time_interval, optarg) || time_interval < 1)
|
||||
// "úÎÁÞÅÎÉÅ time-interval ÄÏÌÖÎÏ ÂÙÔØ ÎÁÔÕÒÁÌØÎÙÍ ÞÉÓÌÏÍ"
|
||||
usage(_("Value of time-interval must be non-zero positive"));
|
||||
// "õÓÔÁÎÏ×ÉÔØ ÉÎÔÅÒ×ÁÌ ÌÏÇÇÉÒÏ×ÁÎÉÑ × %d ÓÅËÕÎÄ"
|
||||
info(_("Set logging interval to %d seconds"), time_interval);
|
||||
break;
|
||||
case 'h':
|
||||
if (myatoi(&hbin, optarg) || hbin < 1){
|
||||
// "îÅ×ÅÒÎÙÊ"
|
||||
usage("%s hbin: %s", _("Wrong"), optarg);
|
||||
}
|
||||
// "çÏÒ. ÂÉÎÎÉÎÇ: %d"
|
||||
info(_("Horisontal binning: %d"), hbin);
|
||||
break;
|
||||
case 'I':
|
||||
objtype = strdup(optarg);
|
||||
// "ôÉÐ ÉÚÏÂÒÁÖÅÎÉÑ - %s"
|
||||
info(_("Image type - %s"), objtype);
|
||||
break;
|
||||
case 'i':
|
||||
instrument = strdup(optarg);
|
||||
// "îÁÚ×ÁÎÉÅ ÐÒÉÂÏÒÁ - %s"
|
||||
info(_("Instrument name - %s"), instrument);
|
||||
break;
|
||||
case 'L':
|
||||
stat_logging = TRUE;
|
||||
// ðÏÌÎÏÅ ÖÕÒÎÁÌÉÒÏ×ÁÎÉÅ ÓÔÁÔÉÓÔÉËÉ
|
||||
info(_("Full statistics logging"));
|
||||
break;
|
||||
case 'l':
|
||||
save_Tlog = TRUE;
|
||||
only_turret = FALSE;
|
||||
// "óÏÈÒÁÎÅÎÉÅ ÖÕÒÎÁÌÁ ÔÅÍÐÅÒÁÔÕÒ"
|
||||
info(_("Save temperature log"));
|
||||
break;
|
||||
case 'N':
|
||||
only_turret = FALSE;
|
||||
if (myatoi(&Ncam, optarg) || Ncam < 1){
|
||||
// "îÅ×ÅÒÎÙÊ ÎÏÍÅÒ ËÁÍÅÒÙ: %s"
|
||||
usage(_("Wrong camera number: %s"), optarg);
|
||||
}
|
||||
// "òÁÂÏÔÁÔØ Ó ËÁÍÅÒÏÊ ÎÏÍÅÒ %d"
|
||||
info(_("Open camera number %d"), Ncam);
|
||||
break;
|
||||
case 'n':
|
||||
if (myatoi(&pics, optarg) || pics <= 0){
|
||||
// "îÅ×ÅÒÎÏÅ ËÏÌ-×Ï ËÁÄÒÏ×: %s"
|
||||
usage(_("Wrong frames number in series: %s"), optarg);
|
||||
}
|
||||
// "óÅÒÉÑ ÉÚ %d ËÁÄÒÏ×"
|
||||
info(_("Series of %d frames"), pics);
|
||||
break;
|
||||
case 'O':
|
||||
objname = strdup(optarg);
|
||||
// "éÍÑ ÏÂßÅËÔÁ - %s"
|
||||
info(_("Object name - %s"), objname);
|
||||
break;
|
||||
case 'o':
|
||||
observers = strdup(optarg);
|
||||
// "îÁÂÌÀÄÁÔÅÌÉ: %s"
|
||||
info(_("Observers: %s"), observers);
|
||||
break;
|
||||
case 'P':
|
||||
prog_id = strdup(optarg);
|
||||
// "îÁÚ×ÁÎÉÅ ÐÒÏÇÒÁÍÍÙ: %s"
|
||||
info(_("Program name: %s"), prog_id);
|
||||
break;
|
||||
case 'p':
|
||||
if (myatoi(&pause_len, optarg) || pause_len < 0){
|
||||
// "îÅ×ÅÒÎÁÑ ÐÁÕÚÁ: %s"
|
||||
usage(_("Wrong pause length: %s"), optarg);
|
||||
}
|
||||
// "ðÁÕÚÁ: %dÓ"
|
||||
info(_("Pause: %ds"), pause_len);
|
||||
break;
|
||||
case 'r':
|
||||
if (myatoi(&i, optarg) || i < 1 || i > USHRT_MAX){
|
||||
// "óËÏÒÏÓÔØ ÓÞÉÔÙ×ÁÎÉÑ - ÂÅÚÚÎÁËÏ×ÏÅ ÃÅÌÏÅ!"
|
||||
usage(_("Readout speed should be unsigned int!"));
|
||||
}
|
||||
ROspeed = (unsigned short) i;
|
||||
break;
|
||||
case 'R':
|
||||
only_turret = FALSE;
|
||||
StopRes = Reset;
|
||||
// "ðÏÌÎÙÊ ÓÂÒÏÓ"
|
||||
info(_("Reset"));
|
||||
break;
|
||||
case 'S':
|
||||
only_turret = FALSE;
|
||||
StopRes = Sleep;
|
||||
// "óÐÑÝÉÊ ÒÅÖÉÍ"
|
||||
info(_("Go to sleep"));
|
||||
break;
|
||||
case 's':
|
||||
save_image = FALSE;
|
||||
break;
|
||||
case 'T':
|
||||
only_T = TRUE;
|
||||
only_turret = FALSE;
|
||||
save_image = FALSE;
|
||||
// "ÔÏÌØËÏ ÏÔÏÂÒÁÚÉÔØ/ÚÁÄÁÔØ ÔÅÍÐÅÒÁÔÕÒÕ"
|
||||
info(_("only set/get temperature"));
|
||||
break;
|
||||
case 't':
|
||||
only_turret = FALSE;
|
||||
temperature = atof(optarg);
|
||||
if(temperature < -35. || temperature > 30.){
|
||||
// "îÅ×ÅÒÎÏÅ ÚÎÁÞÅÎÉÅ ÔÅÍÐÅÒÁÔÕÒÙ: %s (ÄÏÌÖÎÏ ÂÙÔØ ÏÔ -35 ÄÏ 30)"
|
||||
usage(_("Wrong temperature: %s (must be from -35 to 30)"), optarg);
|
||||
}
|
||||
set_T = TRUE;
|
||||
// "õÓÔÁÎÏ×ÉÔØ ÔÅÍÐÅÒÁÔÕÒÕ: %.3f"
|
||||
info(_("Set temperature: %.3f"), temperature);
|
||||
break;
|
||||
case 'v':
|
||||
if (myatoi(&vbin, optarg) || vbin < 1){
|
||||
// "îÅ×ÅÒÎÙÊ"
|
||||
usage("%s vbin: %s", _("Wrong"), optarg);
|
||||
}
|
||||
// "÷ÅÒÔ. ÂÉÎÎÉÎÇ: %d"
|
||||
info(_("Vertical binning: %d"), vbin);
|
||||
break;
|
||||
case 'w':
|
||||
open_turret = TRUE;
|
||||
if(myatoi(&Nwheel, optarg) || Nwheel < 1)
|
||||
// "îÏÍÅÒ ÔÕÒÅÌÉ ÄÏÌÖÅÎ ÂÙÔØ ÂÏÌØÛÅ 0"
|
||||
usage(_("Turret number should be positive value"));
|
||||
// "òÁÂÏÔÁÔØ Ó ÔÕÒÅÌØÀ %d"
|
||||
info(_("Work with turret %d"), Nwheel);
|
||||
break;
|
||||
case 'W':
|
||||
only_turret = FALSE;
|
||||
StopRes = Wake;
|
||||
// "áËÔÉ×ÉÒÏ×ÁÔØ ËÁÍÅÒÕ"
|
||||
info(_("Wakeup camera"));
|
||||
break;
|
||||
case 'x':
|
||||
only_turret = FALSE;
|
||||
if (myatoi(&exptime, optarg) || exptime < 0){
|
||||
// "îÅ×ÅÒÎÏÅ ×ÒÅÍÑ ÜËÓÐÏÚÉÃÉÉ: %s"
|
||||
usage(_("Wrong exposure time: %s"), optarg);
|
||||
}
|
||||
// "÷ÒÅÍÑ ÜËÓÐÏÚÉÃÉÉ: %dÍÓ"
|
||||
info(_("Exposure time: %dms"), exptime);
|
||||
break;
|
||||
case 'X':
|
||||
getrange(&X0, &X1, optarg);
|
||||
// "äÉÁÐÁÚÏÎ ÐÏ X: [%d, %d]"
|
||||
info(_("X range: [%d, %d]"), X0, X1);
|
||||
break;
|
||||
case 'Y':
|
||||
getrange(&Y0, &Y1, optarg);
|
||||
// "äÉÁÐÁÚÏÎ ÐÏ Y: [%d, %d]"
|
||||
info(_("Y range: [%d, %d]"), Y0, Y1);
|
||||
break;
|
||||
default:
|
||||
usage(NULL);
|
||||
}
|
||||
}
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
if(argc == 0){
|
||||
save_image = FALSE;
|
||||
}
|
||||
else{
|
||||
outfile = argv[0];
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
if(argc > 0){
|
||||
// "éÇÎÏÒÉÒÕÀ ÁÒÇÕÍÅÎÔ[Ù]:\n"
|
||||
printf(_("Ignore argument[s]:\n"));
|
||||
for (i = 0; i < argc; i++)
|
||||
warnx("%s ", argv[i]);
|
||||
}
|
||||
if(Shtr != -1) only_turret = FALSE;
|
||||
}
|
||||
65
usage.h
Normal file
65
usage.h
Normal file
@ -0,0 +1,65 @@
|
||||
#ifndef __USAGE_H__
|
||||
#define __USAGE_H__
|
||||
|
||||
#include "takepic.h"
|
||||
#include <getopt.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
extern Apn_Filter Tturret;
|
||||
extern int TurretPos;
|
||||
|
||||
enum{
|
||||
Reset = 1,
|
||||
Sleep,
|
||||
Wake
|
||||
};
|
||||
|
||||
unsigned short
|
||||
ROspeed
|
||||
;
|
||||
|
||||
extern int
|
||||
exptime
|
||||
,fanspd
|
||||
,time_interval
|
||||
,pics
|
||||
,Ncam
|
||||
,hbin
|
||||
,vbin
|
||||
,X0, X1, Y0, Y1
|
||||
,pause_len
|
||||
,pre_exp
|
||||
,shutter
|
||||
,StopRes
|
||||
,Nwheel
|
||||
,wheelPos
|
||||
,Shtr
|
||||
,noclean
|
||||
,twelveBit
|
||||
;
|
||||
extern double temperature;
|
||||
|
||||
extern bool
|
||||
only_T
|
||||
,noflash
|
||||
,set_T
|
||||
,cooler_off
|
||||
,save_Tlog
|
||||
,save_image
|
||||
,stat_logging
|
||||
,only_turret
|
||||
,open_turret
|
||||
;
|
||||
extern char
|
||||
*objname
|
||||
,*outfile
|
||||
,*objtype
|
||||
,*instrument
|
||||
,*observers
|
||||
,*prog_id
|
||||
,*author
|
||||
;
|
||||
void usage(char *fmt, ...);
|
||||
void parse_args(int argc, char **argv);
|
||||
|
||||
#endif // __USAGE_H__
|
||||
Loading…
x
Reference in New Issue
Block a user