- Fixed conflicts in ascon.c
- Supressed superfluous message from fmess - Expanded multicounter to deal with threshold commands nicely - Fixed an an issue with an uninitialized dummy connection in nserver - Many changes to simidex to make it work in a more reliable way. - Added hdbfactory path alias targetpath - Extended frame to deal with sinqhttp HM
This commit is contained in:
49
frame.c
49
frame.c
@@ -19,19 +19,23 @@
|
||||
#include "HistMem.h"
|
||||
#include "HistMem.i"
|
||||
#include "HistDriv.i"
|
||||
#include "hardsup/sinqhm.h"
|
||||
#include "sinqhmdriv.i"
|
||||
#include "psi/hardsup/sinqhm.h"
|
||||
#include "psi/sinqhmdriv.i"
|
||||
#include "nxdict.h"
|
||||
#include "frame.h"
|
||||
|
||||
extern int isSINQHTTP(pHistDriver self);
|
||||
/*======================================================================*/
|
||||
static int readHMFrame(SConnection * pCon, pHistMem pHM, int nFrame)
|
||||
static int readHMFrame(SConnection * pCon, pHistMem pHM,
|
||||
int nFrame, int sansflag)
|
||||
{
|
||||
HistInt *buffer = NULL;
|
||||
HistInt *buffer = NULL, *subbuf = NULL;
|
||||
int iDim[MAXDIM], rank, length, status, i, noTimeBins;
|
||||
pSINQHM pHist;
|
||||
SinqHMDriv *pTata;
|
||||
const float *timeBin;
|
||||
|
||||
char histCommand[132];
|
||||
|
||||
/*
|
||||
find dimensions and allocate data
|
||||
*/
|
||||
@@ -56,17 +60,17 @@ static int readHMFrame(SConnection * pCon, pHistMem pHM, int nFrame)
|
||||
buffer[0] = htonl(iDim[0]);
|
||||
buffer[1] = htonl(iDim[1]);
|
||||
|
||||
if (nFrame < 0) {
|
||||
nFrame = 0;
|
||||
}
|
||||
if (nFrame >= noTimeBins) {
|
||||
nFrame = noTimeBins - 1;
|
||||
}
|
||||
if (isSINQHMDriv(pHM->pDriv) && noTimeBins > 2) {
|
||||
/*
|
||||
read from HM. The 5 is PROJECT__FRAME in Sinqhm_def.h
|
||||
Again: be friendly: fix out of range frames
|
||||
*/
|
||||
if (nFrame < 0) {
|
||||
nFrame = 0;
|
||||
}
|
||||
if (nFrame >= noTimeBins) {
|
||||
nFrame = noTimeBins - 1;
|
||||
}
|
||||
pTata = (SinqHMDriv *) pHM->pDriv->pPriv;
|
||||
pHist = (pSINQHM) pTata->pMaster;
|
||||
status = SINQHMProject(pHist, 0x0005, 0, nFrame,
|
||||
@@ -77,6 +81,21 @@ static int readHMFrame(SConnection * pCon, pHistMem pHM, int nFrame)
|
||||
free(buffer);
|
||||
return 0;
|
||||
}
|
||||
} else if(isSINQHTTP(pHM->pDriv) && noTimeBins > 2){
|
||||
if(sansflag){
|
||||
snprintf(histCommand,132,"sample:0:%d:%d:%d", iDim[0]*iDim[1], nFrame, nFrame+1);
|
||||
} else {
|
||||
snprintf(histCommand,132,"sample:0:%d:0:%d:%d:%d", iDim[0], iDim[1], nFrame, nFrame+1);
|
||||
}
|
||||
if(pHM->pDriv->SubSample != NULL){
|
||||
subbuf = pHM->pDriv->SubSample(pHM->pDriv, pCon,0,histCommand);
|
||||
if(subbuf == NULL){
|
||||
SCWrite(pCon,"ERROR: subsampling failed ", eError);
|
||||
return 0;
|
||||
}
|
||||
memcpy(buffer+2,subbuf, length *sizeof(HistInt));
|
||||
free(subbuf);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
be friendly, just read the 2D data which is there
|
||||
@@ -210,6 +229,7 @@ int PSDFrameAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
{
|
||||
pHistMem pHM;
|
||||
int nFrame;
|
||||
int sansflag; /* this is unique and special for the SANS at PSI */
|
||||
|
||||
if (argc < 2) {
|
||||
SCWrite(pCon, "ERROR: Insufficient number of arguments to PSDFrame",
|
||||
@@ -230,7 +250,12 @@ int PSDFrameAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
return 0;
|
||||
}
|
||||
nFrame = atoi(argv[3]);
|
||||
return readHMFrame(pCon, pHM, nFrame);
|
||||
if(argc > 3 && (strcmp(argv[4],"sans") == 0) ){
|
||||
sansflag = 1;
|
||||
} else {
|
||||
sansflag = 0;
|
||||
}
|
||||
return readHMFrame(pCon, pHM, nFrame, sansflag);
|
||||
} else if (strcmp(argv[1], "file") == 0) {
|
||||
if (argc < 6) {
|
||||
SCWrite(pCon,
|
||||
|
||||
Reference in New Issue
Block a user