Repository navigation
Conversation
The driver counted holders of the library (cameras, and list_cameras while it ran) and finalized it when the last gave it back, so a listing followed by initialize, or shutdown followed by initialize, called AT_InitialiseLibrary a second time in one process. On the real library (SDK3 3.15.30175, USB 3 Zyla, Linux) the second call never returns: it waits inside the USB transport for a control transfer to the camera. The manual initializes and finalizes once per application. The driver now calls AT_InitialiseLibrary at most once per binding per process, at the first use, and never finalizes the library while the process runs. The real binding registers an atexit hook that finalizes it once if it was initialized; a fake registers none. The holder count, LibraryUse, the camera's library_held field and the release paths in shutdown, initialize and list_cameras are removed. The fake records an AT_InitialiseLibrary after an AT_FinaliseLibrary as a violation, since a test cannot hang. New tests: a listing, initialize, capture, shutdown and initialize again on one fake make exactly one initialisation and no finalise; the exit hook finalizes once and does nothing when the library was never initialized. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sured
Found with a USB 3 Zyla, SDK3 3.15.30175: with TriggerMode "External
Exposure" the camera reports ExposureTime not writable, and
AT_SetFloat("ExposureTime") answers 5 (AT_ERR_NOTWRITABLE); the pulse sets the
exposure. The driver sent the exposure, then the region, then the trigger
mode, at initialize and at every capture start, so with trigger_mode
EXTERNAL_EXPOSURE the second start, and an initialize of a camera already in
that mode, threw.
The trigger mode is now sent before the exposure, and no ExposureTime is sent
when the mode being sent is EXTERNAL_EXPOSURE; exposure_time_actual is still
read back. setexposuretime! in that mode throws and says the exposure comes
from the trigger pulse, with no library call.
The stand-in's Zyla profile answers as the real camera did: ExposureTime is
not writable in External Exposure; AcquisitionStop on an idle camera answers 5;
after a fixed cycle ends by itself CameraAcquiring stays true and
AcquisitionStart answers 5 until AcquisitionStop. The simulated-camera profile
keeps the old answers, and the knobs (idle_stop_code, needs_stop) remain.
Comments record the other facts from the same camera: a second AT_Close of a
closed handle answers 12, a second AT_Open of a held index succeeds with a new
handle (the driver never does it), and ImageSizeBytes equals AOIStride times
AOIHeight at full frame.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ished after it The exit hook called AT_FinaliseLibrary whenever the library was up, so a process that exited with a camera open finalized the library under that camera, and a later exit hook (an application's, registered before the library's first use, which Julia runs after the driver's) then reached a finalized library: its shutdown failed, and its list_cameras initialized the library again, which never returned on the real library. - The hook finalizes only when the process holds no camera in the library. With one open it leaves the library up, so a later hook's shutdown works. - The library state is :down, :up or :finalized. After the finalize, every use throws, saying the library was finalized at exit and cannot be initialized again in this process, with no library call. A failed first AT_InitialiseLibrary stays :down and is tried again. - initialize initializes the library inside find_camera!'s hold of the registry lock, so the hook cannot finalize between that and the open. - Whether a binding's library is finalized at exit is a method, registers_exit_hook (true for AtCore). The fake can stand for the real library (exit_hook), so a test sees the hook registered in Base.atexit_hooks once, at the first successful initialization, never for a fake or after a failed first one, and runs it. A child process checks the exit order with an application hook registered before the first use. - The comment on the library cites the manual for what it says (a second initialization is allowed, M3 p.27) and says what the real library did: an initialization after a finalize never returned. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…alize reads it once setexposuretime! refused by the trigger_mode field, which is a request: with the field set back from EXTERNAL_EXPOSURE by hand, or after a settriggermode! the camera refused, the camera was still in External Exposure and the setter sent ExposureTime, which the camera refuses in that mode. - setexposuretime! still refuses with no library call when trigger_mode is EXTERNAL_EXPOSURE. Otherwise it reads the camera's TriggerMode first and, in External Exposure, throws, saying settriggermode! or the next start sends trigger_mode and changes it. - initialize reads trigger_mode once and passes it to the trigger and the exposure senders, as capture does, so a field edited between the two cannot send an exposure the camera refuses, or skip one it needs. - Tests: both ways into the stale mode; the field edited during the trigger mode's read-back, in both directions; and in External Exposure the exposure the camera reports changes between captures, so a readback reused from the first start fails. These tests deliver the frame at the first poll, so they never compare the clock with a deadline. - The struct and export_state docstrings say no exposure is sent in External Exposure, and that exposure_time_actual is then the value the camera reports, not the width of the trigger pulse. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… profile tests - The simulated camera's profile is checked by the raw calls: a start, its one frame delivered, and a second start with no stop between. capture sends a stop between its starts, so the old check passed with a simulated camera that refused the second start. - The profile testset delivers the frame at the first poll, so its captures never compare the clock with a deadline. - The stop subtest that modeled a library neither profile is (a finished cycle that reads idle and refuses the stop) is gone. The rule it also guarded, that capture flushes after a failed AcquisitionStop and then lets the buffer go, is now asserted in the walk of a code at every call of capture, on the Zyla profile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…for it The Andor SDK3 driver has never been released, so its two Fixed entries are folded into its Added entry, which now says: - every start sends every setting, the trigger mode first, except the exposure in EXTERNAL_EXPOSURE, where setexposuretime! throws while the field asks for that mode or the camera is still in it, and exposure_time_actual is the value the camera gives, not the pulse width; - the library is initialized once per process and not finalized while it runs; the exit hook finalizes it only with no camera open, and after that, initialize and list_cameras throw with no library call; - the library lifecycle and what is sent in External Exposure follow how a real Zyla answered, in place of the claim that no Andor library or camera was used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The comment said the driver never makes a second AT_InitialiseLibrary with no finalize between. It does, to retry a first one that failed; whether that hangs on the real library was not tried. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…from initialization through open The failure walk injects an error by call number, and its fake delivered on the second poll against a real deadline: a descheduled runner could end the wait first and move the injection from AcquisitionStop to AT_Flush. The trace run and each injected run now use a fake whose clock stands still, with both polls still covered. A new test runs a competing task, as the exit hook of another thread would, just as use_library! returns for the fake. It takes the registry lock if it is free; with use_library! outside find_camera!'s hold the camera is finalized before it is opened. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…each capture; formatting Each capture sends the trigger mode, the exposure (none in External Exposure), the region and the one-frame cycle; features are sent only at initialize. The CHANGELOG no longer says the rule to finalize at exit only with no camera open follows the camera: review set it. Overlong lines in the Andor entry and an unevenly rewrapped docstring are wrapped to the file's width. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…vers the whole span; text The capture failure walk runs on a clock that advances 1 ms per read and asserts that no more than two polls follow each other, so a driver that swallows an injected failure and waits for a frame never queued fails the test at once instead of polling until the deadline. Two reworked testsets that captured on the default fake use first-poll delivery, so no reworked test reads the wall clock. The lock test now counts its probe's runs and asserts it ran, probes both initialize and list_cameras, and builds the camera before installing the shared callback so a failed construction cannot leave it set. The existing registry-lock test also records the lock at the DeviceCount read between the library's initialization and the opens. Text: the frame timeout is checked and bounds the driver's own polling; it is not sent to the camera (CHANGELOG and the capture docstring). The capture docstring is rewrapped, a code span is no longer split across lines, and the comment on the probe says what point it guards. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
AndorSDK3Cameradriver's first run against Andor's real library (SDK3 3.15.30175) and a USB 3 Zyla on Linuxfound two defects. This pull request fixes both, and makes the test stand-in answer as the real camera did.
A second library initialization hangs
On the real library, an
AT_InitialiseLibraryafter anAT_FinaliseLibraryin the same process never returned: itwaited inside the USB transport. The manual says a second initialization is allowed (M3 p.27). The driver counted the
library's users and finalized it when the last let go. So a camera listing followed by
initialize, or ashutdownfollowed by
initialize, hung the process.The driver now initializes the library once per process, at the first use, and never finalizes it while the process
runs:
atexithook, registered for the real library at its first successful initialization, finalizes it at exit.It does so only when no camera is open, so
AT_FinaliseLibraryis always the last library call. An application'sown exit hook that calls
shutdownstill finds the library up.library_heldfield are gone.ExposureTimeunder External ExposureUnder the trigger mode External Exposure, the trigger pulse sets the exposure, and the camera refuses an
ExposureTimewrite (AT_ERR_NOTWRITABLE). The driver sent the exposure, then the region, then the trigger mode atevery start. So a start that found the camera already in External Exposure failed, whatever mode it asked for. The
first External Exposure start worked, and every start after it failed until the mode was changed.
initializeandcapturenow send the trigger mode first, and no exposure in External Exposure. They still readthe exposure back.
setexposuretime!refuses, with no library call, whentrigger_modeasks for External Exposure. When the cameraitself reports that mode, it also refuses.
exposure_time_actualis the value the camera reports, not the pulse width. The docstrings say so.The test stand-in
The stand-in's Zyla profile now answers as the real Zyla did:
AcquisitionStopon an idle camera answers 5.CameraAcquiringstays true, and a new start answers 5 until a stop.ExposureTimeanswers 5 under External Exposure.The simulated-camera profile keeps its answers, which match Andor's simulated camera. The stand-in records a second
initialization after a finalize as a violation.
Tests
2eb4ae1, and each was checked by removing its fix. The profile testscheck the stand-in itself, so they pass with either driver.
atexithooks. It adds about 15 s.xvfb-run: passes (3@test_brokenintest/gui.jl, as onmain). The Andortests pass on Julia 1.11.9. The docs build.
The version stays
0.2.7-DEV. The Andor driver has not been released, soCHANGELOG.mddescribes it as it now isunder Added.
🤖 Generated with Claude Code