Merge branch 'developer' into moenchUpdated

This commit is contained in:
maliakal_d 2020-03-03 16:37:31 +01:00
commit 06bd6dfd53
15 changed files with 89 additions and 149 deletions

View File

@ -34,4 +34,5 @@ deploy:
script: find $HOME/miniconda/envs/testenv/conda-bld/${TRAVIS_OS_NAME}-64 -name "*.tar.bz2" -exec anaconda -t $CONDA_TOKEN upload --force {} \;
on:
branch: developer
tags: true

View File

@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.12)
project(slsDetectorPackage)
set(PROJECT_VERSION 5.0.0)
include(CheckIPOSupported)
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
cmake_policy(SET CMP0074 NEW)
include(cmake/project_version.cmake)
@ -44,6 +44,9 @@ option(SLS_USE_PYTHON "Python bindings" OFF)
option(SLS_USE_CTBGUI "ctb GUI" OFF)
option(SLS_BUILD_DOCS "docs" OFF)
option(SLS_BUILD_EXAMPLES "examples" OFF)
option(SLS_TUNE_LOCAL "tune to local machine" OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
@ -111,6 +114,11 @@ if(SLS_USE_SANITIZER)
# target_link_libraries(slsProjectOptions INTERFACE -fsanitize=thread)
endif()
if(SLS_TUNE_LOCAL)
target_compile_options(slsProjectOptions INTERFACE -mtune=native -march=native)
endif()
#rapidjson
add_library(rapidjson INTERFACE)
target_include_directories(rapidjson INTERFACE

View File

@ -1,13 +1,13 @@
package:
name: sls_detector_software
version: "developer"
version: {{ environ.get('GIT_DESCRIBE_TAG', '') }}
source:
- path: ..
build:
number: 1
number: 2
binary_relocation: True
rpaths:
- lib/

View File

@ -663,8 +663,10 @@ hframe=new TGHorizontalFrame(this, 800,50);
cout <<"Registering data callback" << endl;
try {
myDet->registerDataCallback(&dataCallback, (void*)this);
} CATCH_DISPLAY ("Could not get register call back.", "ctbAcquisition::ctbAcquisition")
} CATCH_DISPLAY ("Could not get register call back.", "ctbAcquisition::ctbAcquisition")
try {
myDet->setRxZmqDataStream(true);
} CATCH_DISPLAY ("Could not get set RxZmqDataStream.", "ctbAcquisition::ctbAcquisition")
cout <<"Done" << endl;
// mgAdcs=new TMultiGraph();
@ -1153,8 +1155,20 @@ void ctbAcquisition::Draw(){
void ctbAcquisition::changePlot(){
if (rbPlotOff->IsOn()) {
adcPlot=0;
dbitPlot=0;
dbitPlot=0;
try {
myDet->registerDataCallback(nullptr, this);
} CATCH_DISPLAY ("Could not get unregister call back.", "ctbAcquisition::ctbAcquisition")
try {
myDet->setRxZmqDataStream(false);
} CATCH_DISPLAY ("Could not get unset RxZmqDataStream.", "ctbAcquisition::ctbAcquisition")
} else {
try {
myDet->registerDataCallback(&dataCallback, (void*)this);
} CATCH_DISPLAY ("Could not get register call back.", "ctbAcquisition::ctbAcquisition")
try {
myDet->setRxZmqDataStream(true);
} CATCH_DISPLAY ("Could not get set RxZmqDataStream.", "ctbAcquisition::ctbAcquisition")
adcPlot=0;
dbitPlot=0;
for (int ii=0; ii<NADCS; ii++)

View File

@ -440,8 +440,8 @@ patwaittime2 0
### edit with 10 Gbs IP of your server
############################################
#zmqip 129.129.202.110
rx_zmqip 10.1.1.102
rx_zmqport 30001
#rx_zmqip 10.1.1.102
#rx_zmqport 30001
#############################################
### edit with 1 Gbs IP of PC where you will run the GUI
############################################
@ -456,8 +456,8 @@ rx_zmqport 30001
tengiga 1
#rx_datastream 1
#rx_readfreq 1
rx_datastream 1
rx_readfreq 1
dac 6 800

View File

@ -3,9 +3,9 @@ import sys
import numpy as np
sys.path.append(os.path.join(os.getcwd(), 'bin'))
from sls_detector import Detector, Mythen3, Eiger, Jungfrau, DetectorDacs, Dac, Ctb
from sls_detector import dacIndex, readoutMode
from sls_detector.lookup import view, find
from slsdet import Detector, Mythen3, Eiger, Jungfrau, DetectorDacs, Dac, Ctb
from slsdet import dacIndex, readoutMode
from slsdet.lookup import view, find
d = Detector()
# e = Eiger()

View File

@ -4,10 +4,11 @@ out = subprocess.run(['g', 'list'], stdout = subprocess.PIPE, encoding=locale.ge
cmd = out.stdout.splitlines()
cmd.pop(0)
from sls_detector import Detector, Eiger, Ctb
from slsdet import Detector, Eiger, Ctb
pycmd = dir(Detector)+dir(Eiger)+dir(Ctb)
#Add commands that we should not expect as direct commands in python
pycmd += ['vrf', 'vtr', 'vrs', 'vtgstv', 'vsvn', 'vtrim',
'vsvp', 'vth1', 'vth2', 'vth3', 'vshaper', 'vshaperneg', 'rxb_rb',
'rxb_lb', 'vref_prech', 'vref_rstore', 'vref_cds',

View File

@ -1,11 +1,19 @@
"""
Utility to find and list which command line functions have tests and
where the tests are located
"""
#local import for for parsing c++
import parse
from pathlib import Path
#General python stuff
import os
import locale
import argparse
path = Path('../../slsDetectorSoftware/tests/')
import subprocess
from pathlib import Path
#Realative path from this dir
path = Path('../../slsDetectorSoftware/tests/')
parser = argparse.ArgumentParser()
parser.add_argument("-s", "--startswith", help="for filter", type = str, default=None)
args = parser.parse_args()
@ -15,15 +23,12 @@ tested = []
for fname in files:
with open(path/fname) as f:
data = f.read()
data = parse.remove_comments(data)
data = data.splitlines()
for line in data:
if 'TEST_CASE' in line or 'SECTION' in line:
cmd = line.split("\"")[1]
tested.append(cmd)
tested.append([cmd, fname])
out = subprocess.run(['g', 'list'], stdout = subprocess.PIPE, encoding=locale.getpreferredencoding())
all_cmd = out.stdout.splitlines()
@ -33,18 +38,18 @@ all_cmd.pop(0)
if args.startswith is not None:
all_cmd = [cmd for cmd in all_cmd if cmd.startswith(args.startswith)]
tested = [cmd for cmd in tested if cmd.startswith(args.startswith)]
tested = [cmd for cmd in tested if cmd[0].startswith(args.startswith)]
tn = [cmd[0] for cmd in tested]
not_tested = [cmd for cmd in all_cmd if cmd not in tested]
misnamed = [cmd for cmd in tested if cmd not in all_cmd]
tested = [cmd for cmd in tested if cmd in all_cmd]
not_tested = [cmd for cmd in all_cmd if cmd not in tn]
misnamed = [cmd for cmd in tn if cmd not in all_cmd]
tested = [cmd for cmd in tested if cmd[0] in all_cmd]
print("\nThe following commands are tested:")
for cmd in tested:
print(cmd)
print(f'{cmd[0]:>18} : {cmd[1]}')
print("\nThe following commands are NOT tested:")
for cmd in not_tested:

View File

@ -8,7 +8,7 @@ import sys
import setuptools
import os
__version__ = 'udp'
__version__ = os.environ.get('GIT_DESCRIBE_TAG', 'developer')
def get_conda_path():

View File

@ -1,9 +1,9 @@
from .detector import Detector
def view(name):
names = find(name)
def view(name, det = Detector):
names = find(name, det)
for n in names:
print(n)
def find(name):
return [n for n in dir(Detector) if name in n]
def find(name, det = Detector):
return [n for n in dir(det) if name.lower() in n.lower()]

View File

@ -428,6 +428,13 @@ void init_det(py::module &m) {
py::arg() = Positions{})
.def("setImageTestMode", &Detector::setImageTestMode, py::arg(),
py::arg() = Positions{})
.def("getNumberOfBursts", &Detector::getNumberOfBursts,
py::arg() = Positions{})
.def("setNumberOfBursts", &Detector::setNumberOfBursts, py::arg())
.def("getBurstPeriod", &Detector::getBurstPeriod,
py::arg() = Positions{})
.def("setBurstPeriod", &Detector::setBurstPeriod, py::arg(),
py::arg() = Positions{})
.def("getInjectChannel", &Detector::getInjectChannel,
py::arg() = Positions{})
.def("setInjectChannel", &Detector::setInjectChannel, py::arg(),
@ -441,6 +448,14 @@ void init_det(py::module &m) {
.def("getBurstMode", &Detector::getBurstMode, py::arg() = Positions{})
.def("setBurstMode", &Detector::setBurstMode, py::arg(),
py::arg() = Positions{})
.def("getCurrentSource", &Detector::getCurrentSource,
py::arg() = Positions{})
.def("setCurrentSource", &Detector::setCurrentSource, py::arg(),
py::arg() = Positions{})
.def("getTimingSource", &Detector::getTimingSource,
py::arg() = Positions{})
.def("setTimingSource", &Detector::setTimingSource, py::arg(),
py::arg() = Positions{})
.def("getCounterMask", &Detector::getCounterMask,
py::arg() = Positions{})
.def("setCounterMask", &Detector::setCounterMask, py::arg(),

View File

@ -284,4 +284,11 @@ void init_enums(py::module &m) {
.value("BURST_INTERNAL", slsDetectorDefs::burstMode::BURST_INTERNAL)
.value("BURST_EXTERNAL", slsDetectorDefs::burstMode::BURST_EXTERNAL)
.export_values();
py::enum_<slsDetectorDefs::timingSourceType>(Defs, "timingSourceType")
.value("TIMING_INTERNAL",
slsDetectorDefs::timingSourceType::TIMING_INTERNAL)
.value("TIMING_EXTERNAL",
slsDetectorDefs::timingSourceType::TIMING_EXTERNAL)
.export_values();
}

View File

@ -149,6 +149,7 @@ int main(int argc, char *argv[]) {
if (argc>=9) {
nframes=atoi(argv[8]);
}
int xmin=0, xmax=nx, ymin=0, ymax=ny;
if (argc>=13) {
xmin=atoi(argv[9]);
@ -185,6 +186,7 @@ int main(int argc, char *argv[]) {
cout << "pedestal file is " << pedfile << endl;
if (thr>0)
cout << "threshold is " << thr << endl;
cout << "Nframes is " << nframes << endl;
uint32 nnx, nny;
double *gmap;

View File

@ -1,38 +1,14 @@
/**
\file mainReceiver.cpp
This file is an example of how to implement the Receiver class
You can compile it linking it to the slsReceiver library
g++ mainReceiver.cpp -L lib -lSlsReceiver -L/usr/lib64/ -L lib2 -lzmq -pthread -lrt -lm -lstdc++
where,
lib is the location of lSlsReceiver.so
lib2 is the location of the libzmq.a.
[ libzmq.a is required only when using data call backs and enabling data streaming from receiver to client.
It is linked in manual/manual-api from slsReceiverSoftware/include ]
*/
/* Creates the slsMultiReceiver for running multiple receivers form a single binary */
#include "sls_detector_defs.h"
#include "Receiver.h"
#include "container_utils.h"
#include <csignal> //SIGINT
#include <cstdlib> //system
#include <cstring>
#include <iostream>
#include <cerrno>
#include <string>
#include <sys/types.h> //wait
#include <sys/wait.h> //wait
#include <syscall.h> //tid
#include <unistd.h> //usleep
#include <semaphore.h>
using namespace std;
/** Define Colors to print data call back in different colors for different recievers */
#define PRINT_IN_COLOR(c,f, ...) printf ("\033[%dm" f RESET, 30 + c+1, ##__VA_ARGS__)
@ -258,7 +234,7 @@ int main(int argc, char *argv[]) {
/** - Print Ready and Instructions how to exit */
cout << "Ready ... " << endl;
std::cout << "Ready ... \n";
cprintf(RESET, "\n[ Press \'Ctrl+c\' to exit ]\n");
/** - Parent process waits for all child processes to exit */
@ -280,7 +256,7 @@ int main(int argc, char *argv[]) {
cprintf(BLUE,"Exiting Child Process [ Tid: %ld ]\n", (long int) childPid);
}
cout << "Goodbye!" << endl;
std::cout << "Goodbye!\n";
return 0;
}

View File

@ -1,20 +1,11 @@
/* A simple server in the internet domain using TCP
The port number is passed as an argument */
/* slsReceiver */
#include "logger.h"
#include "Receiver.h"
#include "sls_detector_defs.h"
#include "container_utils.h"
#include <csignal> //SIGINT
#include <cstdlib> //system
#include <cstring>
#include <iostream>
#include <sys/types.h> //wait
#include <sys/wait.h> //wait
#include <csignal> //SIGINT
#include <syscall.h>
#include <unistd.h> //usleep
#include <memory>
#include <semaphore.h>
sem_t semaphore;
@ -23,47 +14,6 @@ void sigInterruptHandler(int p){
sem_post(&semaphore);
}
/** Define Colors to print data call back in different colors for different recievers */
/*
#define PRINT_IN_COLOR(c,f, ...) printf ("\033[%dm" f RESET, 30 + c+1, ##__VA_ARGS__)
int StartAcq(std::string filepath, std::string filename, uint64_t fileindex, uint32_t datasize, void*p){
FILE_LOG(logINFO) << "#### StartAcq: "
"filepath: " << filepath << "filename: " << filename <<
"fileindex: " << fileindex << "datasize: " << datasize << " ####";
FILE_LOG(logINFO) << "--StartAcq: returning 0";
return 0;
}
void AcquisitionFinished(uint64_t frames, void*p){
FILE_LOG(logINFO) << "#### AcquisitionFinished: frames:" << frames << " ####";
}
void GetData(char* metadata, char* datapointer, uint32_t datasize, void* p){
slsDetectorDefs::sls_receiver_header* header = (slsDetectorDefs::sls_receiver_header*)metadata;
slsDetectorDefs::sls_detector_header detectorHeader = header->detHeader;
PRINT_IN_COLOR (detectorHeader.modId?detectorHeader.modId:detectorHeader.row,
"#### %d GetData: ####\n"
"frameNumber: %lu\t\texpLength: %u\t\tpacketNumber: %u\t\tbunchId: %lu"
"\t\ttimestamp: %lu\t\tmodId: %u\t\t"
"row: %u\t\tcolumn: %u\t\treserved: %u\t\tdebug: %u"
"\t\troundRNumber: %u\t\tdetType: %u\t\tversion: %u"
//"\t\tpacketsMask:%s"
"\t\tfirstbytedata: 0x%x\t\tdatsize: %u\n\n",
detectorHeader.row, (long unsigned int)detectorHeader.frameNumber,
detectorHeader.expLength, detectorHeader.packetNumber, (long unsigned int)detectorHeader.bunchId,
(long unsigned int)detectorHeader.timestamp, detectorHeader.modId,
detectorHeader.row, detectorHeader.column, detectorHeader.reserved,
detectorHeader.debug, detectorHeader.roundRNumber,
detectorHeader.detType, detectorHeader.version,
//header->packetsMask.to_string().c_str(),
((uint8_t)(*((uint8_t*)(datapointer)))), datasize);
}
*/
int main(int argc, char *argv[]) {
@ -99,45 +49,6 @@ int main(int argc, char *argv[]) {
throw;
}
//register callbacks
/**
callback arguments are
filepath
filename
fileindex
datasize
return value is
0 raw data ready callback takes care of open,close,write file
1 callback writes file, we have to open, close it
2 we open, close, write file, callback does not do anything
registerCallBackStartAcquisition(int (*func)(std::string, std::string, int, int, void*),void *arg);
*/
//receiver->registerCallBackStartAcquisition(startAcquisitionCallBack,NULL);
/**
callback argument is
total farmes caught
registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg);
*/
//receiver->registerCallBackAcquisitionFinished(acquisitionFinishedCallBack,NULL);
/**
args to raw data ready callback are
sls_receiver_header frame metadata
datapointer
file descriptor
guidatapointer (NULL, no data required)
NEVER DELETE THE DATA POINTER
REMEMBER THAT THE CALLBACK IS BLOCKING
registerCallBackRawDataReady(void (*func)(char*, char*, uint32_t, void*),void *arg);
*/
//receiver->registerCallBackRawDataReady(rawDataReadyCallBack,NULL);
FILE_LOG(logINFO) << "[ Press \'Ctrl+c\' to exit ]";
sem_wait(&semaphore);
sem_destroy(&semaphore);