Skip to content

Commit

Permalink
legal gain values in jungfrau simulator
Browse files Browse the repository at this point in the history
  • Loading branch information
thattil committed Nov 20, 2024
1 parent f1ffc60 commit 18134b7
Showing 1 changed file with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2254,7 +2254,7 @@ int setThresholdTemperature(int val) {

double ftemp = (double)temp / 1000.00;
LOG(logDEBUG1, ("Threshold Temperature read %f °C\n", ftemp));

9b821f3db4ec3dbe5ffb3cddc311babf60c8fbe6
return temp;
}

Expand Down Expand Up @@ -2791,9 +2791,9 @@ void *start_timer(void *arg) {
}

if ((i % 1024) < 300) {
gainVal = 1;
gainVal = 0;
} else if ((i % 1024) < 600) {
gainVal = 2;
gainVal = 1;
} else {
gainVal = 3;
}
Expand Down Expand Up @@ -2830,17 +2830,29 @@ void *start_timer(void *arg) {
clock_gettime(CLOCK_REALTIME, &begin);
usleep(expUs);

#ifdef TEST_CHANGE_GAIN_EVERY_FRAME
// change gain and data for every frame
{
const int npixels = (NCHAN * NCHIP);

// random gain values, 2 becomes 3 as 2 is invalid
int randomGainValues[3] = {0};
srand(time(0));
for (int i = 0; i != 3; ++i) {
int r = rand() % 3;
if (r == 2)
r = 3;
randomGainValues[i] = r;
}

for (int i = 0; i < npixels; ++i) {
int gainVal = 0;
if ((i % 1024) < 300) {
gainVal = 1 + iframes;
gainVal = randomGainValues[0];
} else if ((i % 1024) < 600) {
gainVal = 2 + iframes;
gainVal = randomGainValues[1];
} else {
gainVal = 3 + iframes;
gainVal = randomGainValues[2];
}
int dataVal =
*((uint16_t *)(imageData + i * sizeof(uint16_t)));
Expand All @@ -2851,7 +2863,7 @@ void *start_timer(void *arg) {
(uint16_t)pixelVal;
}
}

#endif
int srcOffset = 0;
int srcOffset2 = DATA_BYTES / 2;
int row0 = (numInterfaces == 1 ? detPos[1] : detPos[3]);
Expand Down

0 comments on commit 18134b7

Please sign in to comment.