Commit 549b83af authored by Sebastien Petitdemange's avatar Sebastien Petitdemange

Merge branch 'cmake'

parents e4d993f6 44c7910b
############################################################################
# This file is part of LImA, a Library for Image Acquisition
#
# Copyright (C) : 2009-2013
# Copyright (C) : 2009-2017
# European Synchrotron Radiation Facility
# BP 220, Grenoble 38043
# FRANCE
......@@ -19,44 +19,52 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
############################################################################
LIMA_DIR := $(shell pwd)/../../../..
LIMA_ESPIA_DIR := $(LIMA_DIR)/camera/common/espia
set(NAME "maxipix")
include $(LIMA_DIR)/config.inc
include $(LIMA_DIR)/control/control.inc
include $(LIMA_ESPIA_DIR)/include/espia.inc
set(${NAME}_srcs src/PriamSerial.cpp src/PriamAcq.cpp
src/PixelArray.cpp src/MaxipixReconstruction.cpp
src/MaxipixCamera.cpp src/MaxipixInterface.cpp
src/MpxDetConfig.cpp src/MpxCommon.cpp src/MpxChipConfig.cpp src/MpxDacs
tools/src/INIReader.cpp tools/ini.c)
SRCS = test.cpp test2.cpp
add_library(lima${NAME} SHARED ${${NAME}_srcs})
CPPFLAGS = -I../../include -I../../tools/src -I$(LIMA_ESPIA_DIR)/include \
$(CT_CPPFLAGS) -I$(ESPIA_DRV_INCL)
CXXFLAGS = $(CT_CXXFLAGS)
DEPLIBS = $(CT_DEPLIBS) \
$(LIMA_DIR)/build,limacore \
$(LIMA_DIR)/build,limaespia \
$(LIMA_DIR)/build,limamaxipix
LDFLAGS = $(CT_LDFLAGS) $(call lib-depflags,$(DEPLIBS)) -L$(ESPIA_DRV_LIB)
LDLIBS = $(CT_LDLIBS) $(call lib-deplibs,$(DEPLIBS)) -lespia
target_include_directories(lima${NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_include_directories(lima${NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/tools/src")
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../common/espia/cmake ${CMAKE_MODULE_PATH})
include(FindEspiaDrv)
test-progs = test test2
#set paths for espia driver and limaespialib and include files
target_include_directories(lima${NAME} PUBLIC "${ESPIA_DRV_INCLUDE_DIR}")
target_include_directories(lima${NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../common/espia/include")
all: $(test-progs)
link_directories("${CMAKE_CURRENT_SOURCE_DIR}/../common/espia")
test: test.o
$(CXX) $(LDFLAGS) -o $@ $+ $(LDLIBS)
target_link_libraries(lima${NAME} limacore)
target_link_libraries(lima${NAME} ${ESPIA_DRV_LIB})
target_link_libraries(lima${NAME} limaespia)
test2: test2.o
$(CXX) $(LDFLAGS) -o $@ $+ $(LDLIBS)
limatools_set_library_soversion(lima${NAME} "VERSION")
install(TARGETS lima${NAME} LIBRARY DESTINATION lib)
clean:
rm -f *.o *.P test test2
if(LIMA_ENABLE_PYTHON)
set(NAME "maxipix")
set(IMPORTS
"%Import limaespia.sip")
set(SIP_INCLUDES ${SIP_INCLUDES}
"${CMAKE_CURRENT_SOURCE_DIR}/../common/espia/sip"
"${CMAKE_BINARY_DIR}/camera/common/espia/sip")
if(SIP_VERSION_STR VERSION_LESS "4.12")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/sip/PixelArray_before_4_12.sip.in sip/PixelArray.sip)
else()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/sip/PixelArray.sip.in sip/PixelArray.sip)
endif()
%.o : %.cpp
$(COMPILE.cpp) $(CPPFLAGS) -MD $(CXXFLAGS) -o $@ $<
@cp $*.d $*.P; \
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
-e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $*.P; \
rm -f $*.d
limatools_run_sip_for_camera(${NAME})
install(FILES python/__init__.py DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/Lima/Maxipix")
endif()
-include $(SRCS:.cpp=.P)
if(LIMA_ENABLE_TESTS)
add_subdirectory(test)
endif()
[config]
version = 1.0
type = MAXIPIX
[dacs]
biaslvds = 128
buffanaloga = 127
buffanalogb = 127
ctpr = 1
disc = 110
fbk = 140
gnd = 80
hist = 0
ikrum = 5
preamp = 240
reflvds = 128
thl = 7480
ths = 80
vcas = 130
[detmodule]
chip_1 = 1
chip_2 = 2
chip_3 = 3
chip_4 = 4
frequency = 50.0
name = tpxatl44x
bias = 150
polarity = POSITIVE
asic = TPX1
nchips = 4
pitch = 1
xfirst = 0
yfirst = 0
xpixels = 256
ypixels = 256
name_1=x
name_2=x
name_3=x
name_4=x
energy = 5
[layout_standard]
layout = L_2X2
xchips=2
ychips=2
xgap=4
ygap=4
pos_1=10
pos_2=00
pos_3=01
pos_4=11
rot_2 = 1
rot_3 = -1
rot_1 = 1
rot_4 = -1
[calibration]
energy = 4.0
thlnoise_2 = 7809
thlnoise_3 = 7912
thlnoise_1 = 7846
thlnoise_4 = 7903
thlxray_2 = 7773
thlxray_3 = 7873
thlxray_1 = 7808
thlxray_4 = 7850
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -19,21 +19,8 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
############################################################################
from Lima import module_helper
mod_path = __path__
depends_on = 'Espia'
has_dependent = False
cleanup_data = module_helper.load_prepare(mod_path, depends_on, has_dependent)
from Lima import Espia
cleanup_data = module_helper.load_dep_cleanup(cleanup_data)
from Lima.Maxipix.limamaxipix import *
module_helper.load_cleanup(cleanup_data)
from limamaxipix import Maxipix as _M
globals().update(_M.__dict__)
del mod_path, depends_on, has_dependent, cleanup_data
del module_helper
//###########################################################################
// This file is part of LImA, a Library for Image Acquisition
//
// Copyright (C) : 2009-2011
// European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
// This 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 3 of the License, or
// (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//###########################################################################
namespace Maxipix {
%TypeHeaderCode
#define NO_IMPORT_ARRAY
#define PY_ARRAY_UNIQUE_SYMBOL _LimaNumPy
#include "numpy/arrayobject.h"
#include "MpxVersion.h"
#include "PixelArray.h"
#include <string>
using namespace lima;
%End
class PixelConfigArray {
public:
PixelConfigArray(lima::Maxipix::Version);
~PixelConfigArray();
void convert(std::string& /Out/);
void* maskArray
{
%GetCode
if (!sipCpp->maskArray) Py_RETURN_NONE;
npy_intp dims[2]= { 256, 256 };
sipPy = PyArray_SimpleNewFromData(2, dims, NPY_UBYTE, sipCpp->maskArray);
%End
%SetCode
PyArrayObject *tmpObject= (PyArrayObject*)PyArray_ContiguousFromObject(sipPy,NPY_NOTYPE,0,0);
if(!tmpObject) sipErr= 1;
if (!sipErr) {
int nbBytes= PyArray_NBYTES(tmpObject);
if (nbBytes != 256*256) sipErr= 1;
if (!sipErr) {
sipCpp->maskArray= (unsigned char*)PyArray_BYTES(tmpObject);
}
}
Py_DECREF(tmpObject);
%End
};
void* testArray
{
%GetCode
if (!sipCpp->testArray) Py_RETURN_NONE;
npy_intp dims[2]= { 256, 256 };
sipPy = PyArray_SimpleNewFromData(2, dims, NPY_UBYTE, sipCpp->testArray);
%End
%SetCode
PyArrayObject *tmpObject= (PyArrayObject*)PyArray_ContiguousFromObject(sipPy,NPY_NOTYPE,0,0);
if(!tmpObject) sipErr= 1;
if (!sipErr) {
int nbBytes= PyArray_NBYTES(tmpObject);
if (nbBytes != 256*256) sipErr= 1;
if (!sipErr) {
sipCpp->testArray= (unsigned char*)PyArray_BYTES(tmpObject);
}
}
Py_DECREF(tmpObject);
%End
};
void* lowArray
{
%GetCode
if (!sipCpp->lowArray) Py_RETURN_NONE;
npy_intp dims[2]= { 256, 256 };
sipPy = PyArray_SimpleNewFromData(2, dims, NPY_UBYTE, sipCpp->lowArray);
%End
%SetCode
PyArrayObject *tmpObject= (PyArrayObject*)PyArray_ContiguousFromObject(sipPy,NPY_NOTYPE,0,0);
if(!tmpObject) sipErr= 1;
if (!sipErr) {
int nbBytes= PyArray_NBYTES(tmpObject);
if (nbBytes != 256*256) sipErr= 1;
if (!sipErr) {
sipCpp->lowArray= (unsigned char*)PyArray_BYTES(tmpObject);
}
}
Py_DECREF(tmpObject);
%End
};
void* highArray
{
%GetCode
if (!sipCpp->highArray) Py_RETURN_NONE;
npy_intp dims[2]= { 256, 256 };
sipPy = PyArray_SimpleNewFromData(2, dims, NPY_UBYTE, sipCpp->highArray);
%End
%SetCode
PyArrayObject *tmpObject= (PyArrayObject*)PyArray_ContiguousFromObject(sipPy,NPY_NOTYPE,0,0);
if(!tmpObject) sipErr= 1;
if (!sipErr) {
int nbBytes= PyArray_NBYTES(tmpObject);
if (nbBytes != 256*256) sipErr= 1;
if (!sipErr) {
sipCpp->highArray= (unsigned char*)PyArray_BYTES(tmpObject);
}
}
Py_DECREF(tmpObject);
%End
};
};
};
############################################################################
# This file is part of LImA, a Library for Image Acquisition
#
# Copyright (C) : 2009-2011
# Copyright (C) : 2009-2017
# European Synchrotron Radiation Facility
# BP 220, Grenoble 38043
# FRANCE
......@@ -19,7 +19,14 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
############################################################################
src-dirs = src tools/src
test-dirs = test/src
include ../../global.inc
SET(maxipix_test1_srcs test_maxipix_config_reader.cpp)
SET(maxipix_test2_srcs test_maxipix_acq.cpp)
ADD_EXECUTABLE(test_maxipix_config_reader ${maxipix_test1_srcs})
ADD_EXECUTABLE(test_maxipix_acq ${maxipix_test2_srcs})
TARGET_LINK_LIBRARIES(test_maxipix_config_reader limacore limamaxipix)
TARGET_LINK_LIBRARIES(test_maxipix_acq limacore limamaxipix)
FILE(COPY config/ DESTINATION config/)
......@@ -8,14 +8,14 @@ biaslvds = 128
buffanaloga = 127
buffanalogb = 127
ctpr = 1
disc = 110
disc = 127
fbk = 128
gnd = 80
hist = 0
ikrum = 5
preamp = 240
preamp = 255
reflvds = 128
thl = 7437
thl = 7572
ths = 60
vcas = 130
......@@ -34,6 +34,7 @@ chip_1 = 1
chip_2 = 2
chip_3 = 3
chip_4 = 4
chip_5 = 5
pitch = 1
xfirst = 0
yfirst = 0
......@@ -41,22 +42,26 @@ name_1 = W15C12
name_2 = W15A6
name_3 = W15G7
name_4 = W15L8
energy = 8
energy = 10
[calibration]
mode = SPM
energy = 5
thlnoise_1 = 7530
thlnoise_2 = 7580
thlnoise_3 = 7558
thlnoise_4 = 7550
thlxray_1 = 7400
thlxray_2 = 7400
thlxray_3 = 7400
thlxray_4 = 7400
thlnoise_1 = 7575
thlnoise_2 = 7626
thlnoise_3 = 7586
thlnoise_4 = 7585
thlnoise_5 = 7585
thlxray_1 = 7425
thlxray_2 = 7526
thlxray_3 = 7486
thlxray_4 = 7485
thlxray_5 = 7485
[layout_standard]
layout = L_GENERAL
layout = L_2x2
#layout = L_GENERAL
#layout = L_NONE
xchips = 2
ychips = 2
xgap = 4
......@@ -82,4 +87,4 @@ yc_3 = 344
rot_3 = 2
xc_2 = 0
yc_2 = 260
rot_2 = 0
\ No newline at end of file
rot_2 = 0
This diff is collapsed.
This diff is collapsed.

\ No newline at end of file
\ No newline at end of file
\ No newline at end of file
......@@ -26,7 +26,7 @@ int main()
//DebParams::setTypeFlags(DebParams::AllFlags);
//DebParams::setFormatFlags(DebParams::AllFlags);
string path = "/users/blissadm/local/maxipix/tpxatl25/";
string path = "config/";
string filename = "tpxatl25";
m_camera = new Camera(0, path, filename, true);
......@@ -57,23 +57,28 @@ int main()
saving->setPrefix("maxipix_");
saving->setSuffix(".edf");
saving->setSavingMode(CtSaving::AutoFrame);
//saving->setOverwritePolicy(CtSaving::Append);
saving->setOverwritePolicy(CtSaving::Overwrite);
// do acquisition
m_control->acquisition()->setAcqExpoTime(2.0);
cout << "Will acquire 10 frames 1 sec. exposure and save in EDF format, overwrite mode and single file maxipix_0000.edf" << endl;
m_control->acquisition()->setAcqExpoTime(1.0);
m_control->acquisition()->setLatencyTime(0.01);
m_control->acquisition()->setAcqNbFrames(nframes);
m_control->prepareAcq();
m_control->startAcq();
CtControl::ImageStatus im_status;
while(1) {
cout << "sleeping ...." << endl;
m_control->getImageStatus(im_status);
cout << "Acquired " << im_status.LastImageAcquired+1 << " Saved " << im_status.LastImageSaved+1 << "\r";
cout.flush();
sleep(1);
if (!m_camera->isAcqRunning())
if (im_status.LastImageSaved == 9)
break;
}
sleep(5); //all done!
cout << "Acquired " << im_status.LastImageAcquired+1 << " Saved " << im_status.LastImageSaved+1 << endl;
cout << ">>>>> Done ! <<<<<" << endl;
delete m_control;
delete m_interface;
delete m_camera;
delete m_interface;
delete m_camera;
return(1);
}
......@@ -2,7 +2,7 @@
# python version
#from Lima.Maxipix.MpxAcq import MpxAcq
#C++ version
from Lima.Maxipix import Maxipix
from Lima import Maxipix
from Lima.Core import DebParams
from Lima import Core
import time
......@@ -13,16 +13,7 @@ import time
#DebParams.setModuleFlags(Ac0xffffb7)
# this was for python version
#mpx = MpxAcq(0);
#p = mpx.getPriamAcq()
#mpx.setPath('/users/blissadm/local/maxipix/tpxatl25')
#mpx.loadConfig('tpxatl25')
#hwint = mpx.getInterface()
# this is with C++ version
cam = Maxipix.Camera(0,'/users/blissadm/local/maxipix/tpxatl25', 'tpxatl25', True)
cam = Maxipix.Camera(0,'config', 'tpxatl25', True)
hwint = Maxipix.Interface(cam)
control = Core.CtControl(hwint)
......
......@@ -11,7 +11,7 @@ using namespace std;
int main() {
string line;
ifstream file("../config/mydet_chip_1.edf");
ifstream file("config/mydet_chip_1.edf");
if (file.is_open()) {
char *hdr = new char[1024];
file.seekg(0, ios::beg);
......@@ -27,7 +27,7 @@ int main() {
} else {
cout << "Unable to open file";
}
std::string fname = "./tpxatl25.cfg";
std::string fname = "config/tpxatl25.cfg";
INIReader reader(fname);
if (reader.ParseError() < 0) {
std::cout << "I/O error while reading file." << std::endl;
......@@ -41,14 +41,14 @@ int main() {
assert(reader.GetInteger(section, "buffanaloga", -1) == 127);
assert(reader.GetInteger(section, "buffanalogb", -1) == 127);
assert(reader.GetInteger(section, "ctpr", -1) == 1);
assert(reader.GetInteger(section, "disc", -1) == 110);
assert(reader.GetInteger(section, "disc", -1) == 127);
assert(reader.GetInteger(section, "fbk", -1) == 128);
assert(reader.GetInteger(section, "gnd", -1) == 80);
assert(reader.GetInteger(section, "hist", -1) == 0);
assert(reader.GetInteger(section, "ikrum", -1) == 5);
assert(reader.GetInteger(section, "preamp",-1) == 240);
assert(reader.GetInteger(section, "preamp",-1) == 255);
assert(reader.GetInteger(section, "reflvds",-1) == 128);
assert(reader.GetInteger(section, "thl",-1) == 7437);
assert(reader.GetInteger(section, "thl",-1) == 7572);
assert(reader.GetInteger(section, "ths",-1) == 60);
assert(reader.GetInteger(section, "vcas",-1) == 130);
......@@ -74,22 +74,22 @@ int main() {
assert(reader.Get(section, "name_2","Unknown") == "W15A6");
assert(reader.Get(section, "name_3","Unknown") == "W15G7");
assert(reader.Get(section, "name_4","Unknown") == "W15L8");
assert(reader.GetInteger(section, "energy",-1) == 8);
assert(reader.GetInteger(section, "energy",-1) == 10);
section = "calibration";
assert(reader.Get(section, "mode","Unknown") == "SPM");
assert(reader.GetInteger(section, "energy",-1) == 5);
assert(reader.GetInteger(section, "thlnoise_1",-1) == 7530);
assert(reader.GetInteger(section, "thlnoise_2",-1) == 7580);
assert(reader.GetInteger(section, "thlnoise_3",-1) == 7558);
assert(reader.GetInteger(section, "thlnoise_4",-1) == 7550);
assert(reader.GetInteger(section, "thlxray_1",-1) == 7400);
assert(reader.GetInteger(section, "thlxray_2",-1) == 7400);
assert(reader.GetInteger(section, "thlxray_3",-1) == 7400);
assert(reader.GetInteger(section, "thlxray_4",-1) == 7400);
assert(reader.GetInteger(section, "thlnoise_1",-1) == 7575);
assert(reader.GetInteger(section, "thlnoise_2",-1) == 7626);
assert(reader.GetInteger(section, "thlnoise_3",-1) == 7586);
assert(reader.GetInteger(section, "thlnoise_4",-1) == 7585);
assert(reader.GetInteger(section, "thlxray_1",-1) == 7425);
assert(reader.GetInteger(section, "thlxray_2",-1) == 7526);
assert(reader.GetInteger(section, "thlxray_3",-1) == 7486);
assert(reader.GetInteger(section, "thlxray_4",-1) == 7485);
section = "layout_standard";
assert(reader.Get(section, "layout","Unknown") == "L_GENERAL");
assert(reader.Get(section, "layout","Unknown") == "L_2x2");
assert(reader.GetInteger(section, "xchips",-1) == 2);
assert(reader.GetInteger(section, "ychips",-1) == 2);
assert(reader.GetInteger(section, "xgap",-1) == 4);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment