Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This code implies that we may be able to reduce this time significantly with a "single pass" calibration (I believe Mikhail currently does two passes through the data with numpy: one for pedestals and one for gains).  I think I have to add a "mask" to this, but we hopefully  Hopefully don't need common mode in the DRP?

Code Block
(ps-4.5.24) drp-neh-cmp015:lcls2$ more junk.cc
#include <stdint.h>
#include <stdio.h>
#include <string.h>

#define RAW_SIZE 2000000
#define NIMG 100
uint16_t raw[NIMG][RAW_SIZE];
float result[RAW_SIZE];
uint16_t peds[RAW_SIZE];
uint8_t mask[RAW_SIZE];
float gains[7][RAW_SIZE];

int main() {
    memset(mask,0,RAW_SIZE);

    for (unsigned count=0; count<NIMG; count++) {
        for (unsigned i=0; i<RAW_SIZE; i++) {
            unsigned val = raw[count][i];
            unsigned range = val&0x7000;
            result[i] = mask[i] ? 0 : (val-peds[i])*gains[range][i];
        }
    }
}
(ps-4.5.24) drp-neh-cmp015:lcls2$ 

With these results (about 10ms per image):

Code Block
(ps-4.5.24) drp-neh-cmp015:lcls2$ g++ -o junk junk.cc
(ps-4.5.24) drp-neh-cmp015:lcls2$ time ./junk

real	0m0.744s955s
user	0m0.739s949s
sys	0m0.005s
(ps-4.5.24) drp-neh-cmp015:lcls2$ 

...