Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
[submodule "camerad/Instruments/hispec_tracking_camera"]
path = camerad/Instruments/hispec_tracking_camera
url = git@github.com:CaltechOpticalObservatories/hispec-tracking-camera-instrument.git
url = https://github.com/CaltechOpticalObservatories/hispec-tracking-camera-instrument.git
[submodule "camerad/Instruments/deimos"]
path = camerad/Instruments/deimos
url = https://github.com/CaltechOpticalObservatories/deimos-instrument.git
[submodule "camerad/Instruments/cryoscope"]
path = camerad/Instruments/cryoscope
url = https://github.com/CaltechOpticalObservatories/cryoscope-instrument.git
1 change: 1 addition & 0 deletions camerad/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ elseif (CONTROLLER STREQUAL "archon")
${CAMERAD_DIR}/archon_interface.cpp
${CAMERAD_DIR}/archon_controller.cpp
${CAMERAD_DIR}/archon_exposure_modes.cpp
${CAMERAD_DIR}/archon_exposure_modes_rxrv.cpp
)
# ----------------------------------------------------------------------------
# AstroCam ARC-64/66 PCI/e
Expand Down
1 change: 1 addition & 0 deletions camerad/Instruments/cryoscope
Submodule cryoscope added at 35dd0e
2 changes: 0 additions & 2 deletions camerad/archon_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1855,8 +1855,6 @@ namespace Camera {
int num_detect = this->modemap[this->selectedmode].geometry.num_detect;
auto index = this->frameinfo.index.load();

logwrite(function, "");

this->frametype = type;

// Archon buffer number of the last frame read into memory
Expand Down
66 changes: 3 additions & 63 deletions camerad/archon_exposure_modes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Camera {
*
*/
long ExposureModeSingle::expose() {
const std::string function("Camera::ExposureModeSingle::expose");
std::string_view function("Camera::ExposureModeSingle::expose");
logwrite(function, "hi");
return NO_ERROR;
}
Expand All @@ -29,7 +29,7 @@ namespace Camera {
*
*/
void ExposureModeSingle::image_acquisition_thread() {
const std::string function("Camera::ExposureModeSingle::image_acquisition_thread");
std::string_view function("Camera::ExposureModeSingle::image_acquisition_thread");
char message[256];

logwrite(function, "");
Expand Down Expand Up @@ -115,7 +115,7 @@ namespace Camera {
*
*/
void ExposureModeSingle::image_processing_thread() {
const std::string function("Camera::ExposureModeSingle::image_processing_thread");
std::string_view function("Camera::ExposureModeSingle::image_processing_thread");
logwrite(function, "enter");

// open FITS file ?
Expand Down Expand Up @@ -175,64 +175,4 @@ namespace Camera {
}
/***** Camera::ExposureModeRaw::expose *************************************/


/***** Camera::ExposureModeRXRV ********************************************/
/**
* @brief implementation of Archon-specific expose for RXR-Video
*
*/
long ExposureModeRXRV::expose() {
const std::string function("Camera::ExposureModeRXRV::expose");

size_t sz=100;

// Two each of signal and reset buffers, current and previous, since
// we need to pair the reset from the previous frame with signal from
// the current frame. These will hold deinterlaced frames.
//
std::vector<std::vector<uint16_t>> sigbuf(2, std::vector<uint16_t>(sz));
std::vector<std::vector<uint16_t>> resbuf(2, std::vector<uint16_t>(sz));

// allocate memory for frame buffer read from Archon
interface->allocate_framebuf(sz);

// create an appropriate deinterlacer object
try { processor = make_image_processor("rxrv");
}
catch(const std::exception &e) {
logwrite(function, "ERROR: "+std::string(e.what()));
return ERROR;
}

// read first frame pair into my frame buffer
char* buffer=new char[1024]{}; // TODO temporary, for compilation only
this->interface->controller->read_frame(ArchonController::FRAME_IMAGE, buffer);

// process (deinterlace) first frame pair
processor->deinterlacer()->deinterlace(interface->get_framebuf(), sigbuf[0].data(), resbuf[0].data());

// sample calls to other processor functions
uint16_t a, b;
int16_t c;
processor->subtractor()->subtract(&a, &b, &c);
processor->coadder()->coadd(&a, &b);

// show contents
std::stringstream message;
message << "sig:";
for (int i=0; i<10; i++) message << " " << sigbuf[0][i];
logwrite(function, message.str());
message.str(""); message << "res:";
for (int i=0; i<10; i++) message << " " << resbuf[0][i];
logwrite(function, message.str());

// loop:
// subsequent frame pairs, read, deinterlace, write

delete [] buffer;

return NO_ERROR;
}
/***** Camera::ExposureModeRXRV ********************************************/

}
64 changes: 50 additions & 14 deletions camerad/archon_exposure_modes.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ namespace Camera {
namespace ArchonExposureMode {
constexpr const char* RAW = "RAW";
constexpr const char* SINGLE = "SINGLE";
constexpr const char* RXRV = "RXRV";
constexpr const char* ALLMODES[] = {RAW, SINGLE, RXRV};
constexpr const char* VIDEORXR = "VIDEORXR";
constexpr const char* ALLMODES[] = {RAW, SINGLE, VIDEORXR};
};

/** @struct ArchonImageBuffer
Expand All @@ -37,33 +37,51 @@ namespace Camera {
std::vector<uint64_t> buftimestamp_slice; ///< Archon timestamp(s) for all slices in this image
};

struct PairIndex {
int curr;
int prev;
};

inline PairIndex get_indices(int count) {
int c = count & 1;
return {c, 1 - c};
}

class ArchonInterface; // forward declaration

/***** Camera::ExposureModeRaw **********************************************/
/**
* @brief class constructor
* @param[in] _interface Pointer to Camera InterfaceType
*/
class ExposureModeRaw : public ArchonImageBuffer, public ExposureModeTemplate<Camera::ArchonInterface> {
class ExposureModeRaw : public ArchonImageBuffer,
public ExposureModeTemplate<Camera::ArchonInterface,
Camera::ArchonImageBuffer> {
public:
ExposureModeRaw(Camera::ArchonInterface* iface)
: ExposureModeTemplate<Camera::ArchonInterface>(iface) {
this->type=ArchonExposureMode::RAW;
: ExposureModeTemplate<Camera::ArchonInterface,
Camera::ArchonImageBuffer>(iface) {
this->modetype=ArchonExposureMode::RAW;
}

long expose() override;
};
/***** Camera::ExposureModeRaw **********************************************/


/***** Camera::ExposureModeSingle *******************************************/
/**
* @class Camera::ExposureModeSingle
* @brief derived class for Exposure Mode Single
*
*/
class ExposureModeSingle : public ArchonImageBuffer, public ExposureModeTemplate<Camera::ArchonInterface> {
class ExposureModeSingle : public ArchonImageBuffer,
public ExposureModeTemplate<Camera::ArchonInterface,
Camera::ArchonImageBuffer> {
public:
ExposureModeSingle(Camera::ArchonInterface* iface)
: ExposureModeTemplate<Camera::ArchonInterface>(iface) {
type=ArchonExposureMode::SINGLE;
: ExposureModeTemplate<Camera::ArchonInterface,
Camera::ArchonImageBuffer>(iface) {
this->modetype=ArchonExposureMode::SINGLE;
}

/** @var imagebuf_queue
Expand All @@ -79,13 +97,31 @@ namespace Camera {
/***** Camera::ExposureModeSingle *******************************************/


class ExposureModeRXRV : public ArchonImageBuffer, public ExposureModeTemplate<Camera::ArchonInterface> {
/***** Camera::ExposureMode_VIDEORXR ****************************************/
/**
* @brief derived class for Exposure Mode VIDEORXR
*
*/
class ExposureMode_VIDEORXR : public ArchonImageBuffer,
public ExposureModeTemplate<Camera::ArchonInterface,
Camera::ArchonImageBuffer> {
public:
ExposureModeRXRV(Camera::ArchonInterface* iface)
: ExposureModeTemplate<Camera::ArchonInterface>(iface) {
type=ArchonExposureMode::RXRV;
ExposureMode_VIDEORXR(Camera::ArchonInterface* iface, std::vector<std::string> argsin)
: ExposureModeTemplate<Camera::ArchonInterface,
Camera::ArchonImageBuffer>(iface) {
this->modetype = ArchonExposureMode::VIDEORXR;
this->modeargs = argsin;
this->processor = Camera::make_image_processor("rxrv"); // TODO don't use this string
}

long expose() override;
/** @brief FIFO queue to contain images from Archon
*/
std::queue<std::shared_ptr<ArchonImageBuffer>> imagebuf_queue;

void image_acquisition_thread() override;
void image_processing_thread() override;
long expose() override; // TODO obsolete?
};
/***** Camera::ExposureMode_VIDEORXR ****************************************/

}
Loading