Skip to content

[Re] An independent, provenance-carrying re-implementation of the PyRhO three-state channelrhodopsin-2 photocycle #143

Open

Description

@fasn98

Activity

  1. rougier commented on Nov 1, 2026

    @rougier
    Member

    Thanks for your submission and sorry for the delay. We are currently overwhelmed by submissions such that we'll ask you to make two reviews (2 for you or your co-authors, not 2 each) for ReScience C before we can proceed with your submission.
    If it is ok, you can make fill your information on this issuer at ReScience/ReScience#27 and confirm on ReScience/ReScience#118.

  2. fasn98 commented on Nov 1, 2026

    @fasn98
    Author

    Adding a disclosure that should have been part of the original submission.

    AI assistance disclosure

    This work was carried out with substantial assistance from Claude
    (Anthropic), used throughout implementation, experimental design,
    analysis and drafting. The author directed the work, made all
    scientific and methodological decisions, executed and verified every
    computation reported here, and takes full responsibility for the
    content, including any errors.

    Claude is not an author: it cannot take responsibility for the work,
    which is a condition of authorship under ICMJE and COPE guidance.

    The development record is public: commits in the project repository
    carry Co-Authored-By trailers identifying the model used, so the
    extent of this assistance can be audited directly rather than taken
    on trust.

    I am adding the same statement to the manuscript, and to the README of
    the project repository. The bioRxiv preprint will carry it in the next
    version.

  3. fasn98 commented on Nov 1, 2026

    @fasn98
    Author

    @rougier — having added the AI assistance disclosure above, I notice other
    submissions carry AI: Code and AI: Prose labels. Should #143 carry them as
    well? I would rather the labelling match the disclosure than leave it to be
    noticed later.

  4. AngadKumar16 commented on Nov 1, 2026

    @AngadKumar16

    I am volunteering as a reviewer for this submission (no editor assigned yet, so @rougier please let me know if this should wait for one).
    @fasn98, the review is below.

    First, the link to the pdf is incorrect. I believe that the correct link should be https://github.com/fasn98/optosim/blob/main/optosim_rescience.pdf. This is the pdf I will be reading.

    I cloned the repo at commit 3eab43d and installed it on Python 3.13. All 108 tests pass, and running scripts/validate_opsin.py at 1 and 10 mW/mm2 gives the same numbers that are in the article. I also set up my own Python 3.9 environment with PyRhO 0.9.4 (numpy 1.19.5, lmfit < 1.0, scipy < 1.7, ipywidgets) and reran scripts/pyrho_reference.py. The traces I got were identical to the ones committed in runs/, so the reference data checks out. The coupled model result also reproduces fine (100 ms pulse at 5 mW/mm2, 1 spike for HH, 35 for LIF).

    The problems I found are mostly about what the paper claims to replicate and what is missing from the repo.

    Recommended revisions:

    1. The main issue is the paper doesn't do replication. The metadata.yaml lists Evans et al. 2016 as the replicated article, but the paper only shows that optosim matches PyRhO's code. Does this fit a [Re] article? The only figure in Evans et al. 2016 that uses the three-state model is Figure 6, where the authors fit it to measured ChR2 currents. Replicating that would mean fitting optosim to the same recordings, which aren’t public but may be available from the original authors. If that isn’t possible, the paper should drop the [Re] framing, unless the editor thinks that a rewording of this as a re-implementation is fine. You could also consider publishing this somewhere else.
    2. The PyRhO current is saved with the wrong unit. The file pyrho_reference.py stores the output of PyRhO's calcI under current_pa, but calcI returns nA (per its docstring). optosim's current is exactly 1000 times the stored value (-3263.49 pA vs -3.26349 at the 1 mW/mm2 peak). optosim is right and the label is wrong. Please fix the label and regenerate the reference files.
    3. Please compare the photocurrent, not only the open fraction. validate_opsin.py and test_pyrho_agreement.py only check O. The current is what drives the neuron, and it's the only place g0, E, v0 and v1 are used, so right now those four parameters are untested against PyRhO.
    4. Please add a script that generates Figures 1 and 2. scripts/ only has pyrho_reference.py and validate_opsin.py, so the figures can't be regenerated from the repo, and metadata.yaml points to a bibliography.bib that isn't there.
    5. Please state the exact Figure 2 protocol (pulse start time and total simulation length). The LIF neuron keeps firing briefly after the light turns off. With the pulse at t = 0 and a 100 ms run I get 35 spikes; with a 200 ms run I get 39, because 4 spikes come after the light is off. Figure 2's axis runs to 120 ms, so it's not clear which window the 35 refers to.
    6. The paper says PyRhO fails on Python 3.12 because of an OrderedDict incompatibility, but the README and pyrho_reference.py say it's because lmfit < 1.0 imports numpy.dual. Please pick the correct one. The docstring also says numpy.dual was removed in numpy 1.20 and that 1.20 is the last version supporting Python 3.9. Neither is right as numpy.dual was deprecated in 1.20 and removed in 1.25, and numpy kept supporting 3.9 well past 1.20. If the numpy < 1.20 pin is still needed for another reason, please say what it is.
    7. The reference doesn't run PyRhO's own simulator. pyrho_reference.py copies the odeint call from PyRhO's simulators.py and calls the model methods directly. Figure 1 caption ("PyRhO, run unmodified") and Section 2.4 ("PyRhO's own integration") do not follow this.
    8. Please state the 470 nm wavelength used to convert irradiance to photon flux in the Methods, since every rate depends on it.
    9. Please give the HH reference temperature (6.3 °C) in Section 4, so readers can see the size of the Q10 gap the paper already mentions.
    10. The AI Disclosure shows how AI was used in the publication, but not exactly where. How did the author check the code, tests, or text AI produced? Given how much of the work the assistance covers, please state concretely which parts were AI-generated and how each was verified. Several of the issues above are statements that don’t match the code: the unit label (point 2), the numpy explanations (point 6) and “run unmodified” (point 7). Overall the code is solid and well tested, but major revisions are needed. HANDOFF.md also shows that notes were assed between agent sessions, and the commit that added it is AI co-authored, so the disclosure should describe that workflow and what the author checked at each step.
  5. fasn98 commented on Nov 2, 2026

    @fasn98
    Author

    Thank you for this review. You ran the code — the 1000× factor, the 35-versus-39
    spike count at different run lengths — and that is a lot more work than reading a
    PDF. The errors you found are real and I accept them.

    Taking them in order.

    2. The unit label. You are right and I have no defence: calcI returns nA and
    pyrho_reference.py stores it under current_pa. I will fix the label and
    regenerate the reference files. I will also check whether the mislabelled value
    propagated into any reported number — my current reading is that it did not,
    because as you note in point 3 the comparison only ever used the open fraction,
    but I will verify that rather than assume it.

    6. The numpy explanation. Also wrong, and wrong twice. numpy.dual was
    deprecated in 1.20 and removed in 1.25, not removed in 1.20; and numpy supported
    Python 3.9 well past 1.20. The paper and the README also disagree with each other
    about whether the blocker is OrderedDict or numpy.dual. I will determine the
    actual constraint that made the environment work, state that one, and make the
    paper, the README and the docstring agree. If the numpy<1.20 pin turns out to
    have no reason, I will remove it rather than invent a justification for it.

    7. "Run unmodified". Accepted. pyrho_reference.py reproduces PyRhO's
    integration procedure using PyRhO's model object, but it does not invoke PyRhO's
    simulator entry point, and "PyRhO, run unmodified" claims that it does. There are
    two honest fixes and I would value the editor's view on which is preferred: change
    the claim to describe what the script does, or change the script to call
    simulators.py so the claim becomes true. The second is better evidence and I am
    inclined to do it.

    3. Comparing the photocurrent. This is the most substantive gap you found. You
    are right that g0, E, v0 and v1 are untested against PyRhO, and that the current —
    not the open fraction — is what drives the neuron. I will extend
    validate_opsin.py and test_pyrho_agreement.py to compare the current, and
    report the agreement separately from the open-fraction agreement rather than
    folding them together.

    4. Figure generation and the missing bibliography. Both correct. I will add a
    script that regenerates Figures 1 and 2 from the committed reference traces, and
    add the bibliography.bib that metadata.yaml points at.

    5. The Figure 2 protocol. Correct, and your observation that the LIF neuron
    keeps firing after the light goes off is the reason the number is ambiguous. I
    will state the pulse start and the total simulation length explicitly, and give the
    window the 35 refers to.

    8 and 9. Both will be added: the 470 nm wavelength in the Methods, since every
    rate depends on it, and the 6.3 °C Hodgkin-Huxley reference temperature in
    Section 4, which makes the size of the Q10 gap visible instead of implied.

    1. Whether this is a replication. This is the point I cannot resolve alone,
    and I would like the editor's guidance.

    You are right that the paper demonstrates agreement with PyRhO's code rather than
    reproduction of a result in Evans et al. 2016, and that the only three-state figure
    in that paper is Figure 6, fitted to measured currents the paper does not have. The
    abstract already concedes the substance of your point — it states that agreement
    with PyRhO establishes correct transcription and not that the model describes the
    real protein — so the [Re] framing is in tension with what the paper itself claims.

    Three options as I see them, and I have no attachment to any of them:

    • Obtain the recordings from the original authors and fit optosim to them. This
      would be a genuine replication of Figure 6, but it requires their cooperation
      and a fitting capability optosim does not have, since PyRhO fits and optosim
      only simulates.
    • Reword as a re-implementation, if the editor considers that within scope.
    • Withdraw and submit elsewhere, where a software contribution is the unit of
      review.

    One narrower possibility I would like the editor to rule on: the paper does
    reproduce a published result, in that the converged open fraction matches the
    closed-form steady state to 1e-12. Whether reproducing a published closed-form
    expression is enough to anchor a [Re] is a judgement about scope that is not mine
    to make.

    I would rather settle this before revising the other nine points, since the answer
    changes what the paper is.

    10. The AI disclosure.

    I am an Electronic Engineer, graduated in 1994. I am a professional IT Consultant and foremost passionate about Science. That said, I can assure you that I reviewed the numbers carefully, but I did not apply the same scrutiny to the prose, for the reason set out below.

    There are three main embedded verification mechanisms:

    • the exact solution via matrix exponential, which validates the integrator against an independent analytical reference—a form of verification that does not require anyone to read through the code line by line;
    • the 108 test cases in the suite;
    • the anti-fabrication safeguard, which traverses the syntax tree and breaks the build if a module that produces scientific output manages to access a random number generator.

    These mechanisms verify computations, not prose statements about third-party software. None of them could have caught "numpy.dual was removed in 1.20," "PyRhO runs unmodified," or a unit label that never factored into a comparison. All three errors fell precisely into the gap between what a machine verifies and what only a human would check.

    Regarding AI use: it was used in coding, tests, validation procedures, and also the article text creation. I created the scope and managed the process through several agents. On HANDOFF.md, given technical issues I had to create snapshots so that the agent could continue its tasks when a session was interrupted.

    Moving forward, I will ensure that statements regarding third-party software are verified against the source before being included in the text, and that figure captions are checked against the script used to generate the figures.

  6. rougier commented on Nov 2, 2026

    @rougier
    Member

    The use of AI for code and prose is not yet settled. Main problem right now is that we have too manu submissions and we can't cope with them so we have to find a solution. This is the reason for the tags. For now this is mostly a warning for editors/reviewers that may refuse to review AI code. For this submission, please add link here to the review you've done or registered to.

  7. fasn98 commented on Nov 2, 2026

    @fasn98
    Author

    Thank you for this review. It was thorough, it ran the code, and it was right about
    everything it claimed — including the three statements that did not match the code,
    which is the part I had not caught myself.

    Below is a point-by-point response. Points 2 through 9 are addressed in the
    repository; point 1 I am putting to the editor, since it is not mine to decide.


    1. The paper does not do replication; metadata.yaml cites Evans et al. 2016.

    You are right, and the paper's own text already concedes it: the Introduction calls
    this an "independent re-implementation" twice, and Section 4 states that no
    comparison against measured photocurrents was attempted. What claims replication is
    the metadata.yaml entry and the [Re] prefix, not the body.

    Replicating Figure 6 of Evans et al. would mean fitting optosim to the ChR2
    recordings behind it. Those are not public. I can write to the original authors, but
    I cannot promise the outcome or the timescale.

    @rougier — this is the decision I would like from you. Three options as I see them:
    drop the [Re] prefix and resubmit this as a re-implementation with the
    metadata.yaml corrected; keep it as is while I attempt to obtain the recordings;
    or withdraw it as out of scope for ReScience C. I will take whichever you judge
    right. I would rather change the designation than argue for one the work does not
    support.

    2. The PyRhO current is stored under current_pa but calcI returns nA.

    Confirmed, and fixed. I verified the factor independently rather than taking it on
    your word: recomputing I = g0·O·f_v(V)·(V−E) straight from PyRhO's own parameter
    table gives −3263486.8 in pS·mV, which is femtoamps, i.e. −3.2635 nA — exactly the
    stored value. optosim was right and the label was wrong.

    scripts/pyrho_reference.py now writes current_na with an explicit
    current_unit field, and both reference files were regenerated, not relabelled,
    in the same Python 3.9 environment that produced the originals (3.9.23, numpy
    1.19.5, lmfit 0.9.15, PyRhO 0.9.4). The values are unchanged, as they must be:
    −3.263486814261679 nA at 1 mW/mm² and −6.892586014620666 nA at 10 mW/mm².

    Commits 218c8e9 (writer) and baf0867 (regenerated data).

    3. Compare the photocurrent, not only the open fraction.

    Done, and you were right that it mattered: g0, E, v0 and v1 were carrying a
    claim of agreement with PyRhO that had never touched them. The data needed for this
    was already committed — the reference files have held PyRhO's current series all
    along, written and never read.

    Measured at −70 mV on the reference's own grid:

    At 1 mW/mm², peak |I| is 3263.4868 pA and the maximum deviation is
    1.9115×10⁻⁴ pA, or 5.86×10⁻⁸ of the peak.

    At 10 mW/mm², peak |I| is 6892.5860 pA and the maximum deviation is
    3.7241×10⁻⁴ pA, or 5.40×10⁻⁸ of the peak.

    The same scale as the open-fraction deviation, so the residual is still the
    reference's own odeint tolerance rather than a disagreement in the current
    equation.

    Two covering tests, both checked for power: a wrong Gd already failed the
    open-fraction comparison, and a doubled g0 passes every open-fraction test while
    failing the current one — which is precisely why the class exists. Commit 218c8e9.

    4. No script generates Figures 1 and 2; metadata.yaml points to a missing
    bibliography.bib.

    Both fixed, and the first was worse than you could see from outside: the figures
    were not in the repository either, only in the Overleaf project.

    scripts/make_figures.py now regenerates both and prints every number that appears
    in a caption or in the Results — the peak-to-plateau ratios (2.22, 2.83), the
    open-fraction deviations (1.74×10⁻⁸, 3.39×10⁻⁸) and the spike counts. The figures
    are committed under figures/. bibliography.bib is committed. Commits ef4166e
    and b3bad0d.

    5. State the exact Figure 2 protocol; the 35 is ambiguous.

    The protocol is a 5 mW/mm² pulse from t = 0 to t = 100 ms, simulated to 120 ms at
    dt = 0.01 ms. Measured:

    The Hodgkin-Huxley neuron fires once. The LIF baseline fires 35 times during
    the pulse and 4 more after light-off, so 39 in the window, the last at
    113.71 ms.

    Which makes both of your numbers right: a 100 ms run gives 35, and any run past
    about 114 ms gives 39. The 120 ms window is not an arbitrary truncation — nothing
    fires after 113.71 ms.

    Writing the figure script also found something your review did not, and could not
    have: Figure 2's legend said "35 spikes" while the figure drew 39. The number in
    the paper was not wrong, it was unqualified, and the legend was simply wrong. Both
    now name the window. The protocol and all four counts are pinned in
    tests/test_figure_protocol.py, which imports the protocol from the figure script
    rather than restating it. Commit ef4166e.

    6. The paper and the README give different reasons for the Python 3.12 failure,
    and the numpy facts in both are wrong.

    You were right on both facts, and my first attempt to fix this was also wrong —
    better sourced, still a deduction. I then measured it, by walking one Python 3.10
    environment down the numpy versions:

    With numpy 2.2.6 it fails at lmfit/minimizer.py line 23, on
    "from numpy.dual import inv". numpy.dual was removed in numpy 1.25.

    With numpy 1.24.4 it gets past that and fails at lmfit/models.py line 15, on
    "np.finfo(np.float).eps". np.float was removed in numpy 1.24.

    With numpy 1.23.5 lmfit imports, and PyRhO then fails at
    pyrho/IPythonGUI.py line 7 on "import ipywidgets", a dependency it imports
    unconditionally and omits from its metadata.

    With numpy 1.23.5 and ipywidgets installed there is no failure: PyRhO 0.9.4
    imports on Python 3.10.21.

    So the binding pin is numpy<1.24, not numpy<1.20. numpy.dual was deprecated in
    1.20 and removed in 1.25, as you said — but correcting only that still lands on the
    wrong number, because np.float goes one release sooner and lmfit 0.9.15 evaluates
    it at import time. The OrderedDict explanation in the paper was simply false and is
    gone.

    Python 3.9 was never required. The original 3.10 attempt failed because pip put
    numpy 2.2.6 in it, not because of the interpreter. And the reference regenerated
    under Python 3.10.21 with numpy 1.23.5 is bit-identical to the committed one —
    all 20001 samples, open fraction and photocurrent both, max |diff| exactly 0.0.

    That last result is worth more than the correction that produced it: the PyRhO
    reference this paper validates against is reproducible across two interpreters and
    two numpy versions, so it is not an artefact of one environment on one machine.
    Commit c7257bf.

    Python 3.12 does remain out of reach: numpy 1.26 is the first that builds on it, so
    numpy<1.24 cannot be satisfied there at all.

    7. The reference does not run PyRhO's own simulator.

    Correct, and the caption and Section 2.4 were wrong to imply otherwise. Both are
    rewritten. Section 2.4 now says that PyRhO's model object was driven directly by
    reproducing the odeint call simulators.py makes — the same right-hand side, the
    same fitted parameters, the same analytic Jacobian, the same solver settings,
    invoked outside PyRhO's simulator wrapper — and states explicitly that
    simulator-level machinery is not exercised and that this is not a claim to have
    exercised it. Figure 1's caption says the same. The repository wording was brought
    into line in commit 94b7dd4.

    PyRhO itself still was not patched; installing a package's dependencies is not
    editing it. That claim is unchanged because it is the one that was true.

    8. State the 470 nm wavelength in the Methods.

    Added to Section 2.1, with the conversion written out: φ = Eₑλ/(hc), giving
    2.37×10¹⁵ photons s⁻¹ mm⁻² at 1 mW/mm². I checked the constant against the code
    rather than assuming it: CHR2_PEAK_WAVELENGTH_NM = 470.0 in optosim/units.py,
    duplicated deliberately in scripts/pyrho_reference.py so a shared conversion error
    could not cancel out, and the photon_flux recorded in the reference files is
    2366034786745074.0, which matches.

    9. Give the Hodgkin-Huxley reference temperature in Section 4.

    Added: 6.3 °C, with the size of the gap stated — some 30 °C, and at the Q₁₀ = 3
    Hodgkin and Huxley themselves used for the gating rates, roughly thirtyfold in the
    rates.

    10. The AI disclosure does not say where, or how it was checked.

    Answered in my earlier comment on this issue, which I wrote myself for the reason
    given there. One thing to add now that the other nine points are done: the
    commitment I made in that comment — that statements about third-party software are
    checked against the source before they go in the text, and that figure captions are
    checked against the script that generates the figure — was tested within hours.
    Point 6 is the result. My first correction to it was wrong, and what caught that was
    running the thing instead of reasoning about it. Point 5 is the other: the caption
    error there was found by writing the script, not by reading the paper.


    Two further things you did not ask for, which seem worth stating since they change
    what is in the repository.

    The test suite went from 108 to 118. The new tests are the photocurrent comparison
    and the figure-protocol tests; the latter exist because the anti-fabrication guard
    checks output paths for randomness and has nothing to say about a sentence
    describing a figure. A statement in prose is only ever checked by something that
    recomputes what it claims.

    And the article sources are still not in the repository — metadata.yaml is there
    but content.tex is not, which is how bibliography.bib came to be missing in the
    first place. I will move the manuscript into the repository so the PDF is
    regenerable from it, unless you would rather that waited for the decision on
    point 1.

  8. self-assigned this
    on Nov 3, 2026
  9. rougier commented on Nov 3, 2026

    @rougier
    Member

    @AngadKumar16 @fasn98 Are you both using AI for review and answer?

  10. fasn98 commented on Nov 3, 2026

    @fasn98
    Author

    Yes @rougier, I am using the help of AI for both, although I must enhance that I reviewed all the feedback from it.

  11. AngadKumar16 commented on Nov 3, 2026

    @AngadKumar16

    Hi @rougier. I do use AI (specifically claude opus) to help with my reviews. However, the final review is my writing and I do make sure that all points in the review are correct. I can guarantee the quality of the review.

  12. AngadKumar16 commented on Nov 3, 2026

    @AngadKumar16

    Hi @rougier. I am still new to this entire review process, this was my first review. If you have any suggestions or recommendations on how I should go about with reviewing, please tell me at [email protected]. I want to become a respectable reviewer, so I would appreciate any advice. Thanks!

  13. rougier commented on Nov 3, 2026

    @rougier
    Member

    Thanks for being honest about AI usage. Problem for us is that we are now looking at AI submissions / AI reviews which kind of defeat the purpose of the journal and in the end we (editors) have to read the original paper, the (AI) replication + the (AI) reviews. It's not a lot of fun for us and it takes too much time. Some decisions need to be taken, I'll keep you updated (else chime in)

  14. AngadKumar16 commented on Nov 3, 2026

    @AngadKumar16

    Hi @rougier. Ok yeah I see the issue with ai overuse. Soon, I will redo this review and do some more reviews by myself and make sure this does not happen again.

  15. rougier commented on Nov 3, 2026

    @rougier
    Member

    Wait. I just opened a new issue to discuss the problem. You can comment/answer if you want (motivations to use AI in the first place, how id you use it, etc). At this point we've no form position but we since we are not so many in the board, we need to think about our future.

  16. electron-rare commented on Nov 6, 2026

    @electron-rare

    @rougier If a second, independent reviewer is still wanted here I can do it (one of the two reviews requested for #147). I would run the PyRhO comparison myself and keep the report short.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions