Skip to content

Commit

Permalink
Merge pull request #1256 from AllenInstitute/feature/1256-sweepformul…
Browse files Browse the repository at this point in the history
…a_sweeps_from_all

SF: Change SF_GetSweepForFormula to return also data from non-displayed sweeps
  • Loading branch information
t-b authored Apr 15, 2022
2 parents 2688690 + 8803d9c commit 134ff2b
Show file tree
Hide file tree
Showing 16 changed files with 2,381 additions and 1,679 deletions.
2 changes: 1 addition & 1 deletion Packages/MIES/MIES_AnalysisFunctions.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,7 @@ End
///
/// setvar_DataAcq_OnsetDelayUser -> Pre DAQ|20|
/// Popup_Settings_FixedFreq -> Pre Sweep|100|Post Sweep|Maximum|
/// sweepFormula_formula -> Pre Set|data(cursors(A,B), channels(AD), sweeps())
/// sweepFormula_formula -> Pre Set|data(cursors(A,B), select(channels(AD), sweeps()))
///
/// \endrst
///
Expand Down
25 changes: 11 additions & 14 deletions Packages/MIES/MIES_AnalysisFunctions_PatchSeq.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -4427,7 +4427,7 @@ Function PSQ_PipetteInBath(string device, struct AnalysisFunction_V3& s)
variable multiplier, chunk, baselineQCPassed, ret, DAC, pipetteResistanceQCPassed, samplingFrequencyQCPassed, ovsState
variable sweepsInSet, passesInSet, acquiredSweepsInSet, sweepPassed, setPassed, numSweepsFailedAllowed, failsInSet
variable maxPipetteResistance, minPipetteResistance, expectedNumTestpulses, numTestPulses, pipetteResistance
string key, ctrl, stimset, msg, databrowser, bsPanel, formula_nb
string key, ctrl, stimset, msg, databrowser, bsPanel

switch(s.eventType)
case PRE_DAQ_EVENT:
Expand Down Expand Up @@ -4461,11 +4461,10 @@ Function PSQ_PipetteInBath(string device, struct AnalysisFunction_V3& s)
databrowser = DB_GetBoundDataBrowser(device)
bsPanel = BSP_GetPanel(databrowser)

formula_nb = BSP_GetSFFormula(databrowser)

/// @todo: Rework to use non-displayed sweeps, once https://github.com/AllenInstitute/MIES/pull/1256 is merged
/// this also then allows us to remove the OVS fiddling
ReplaceNotebookText(formula_nb, "store(\"Steady state resistance\", tp(ss, channels(AD), sweeps(), [0]))")
/// @todo: The call should work on the last sweep acquired. Once this number is retrieved it can be set directly
/// in the formula string replacing sweeps(). The the OVS disabled/enable procedure can be skipped.
/// By using SF_ExecuteFormula instead it can also executed right here.
SF_SetFormula(databrowser, "store(\"Steady state resistance\", tp(ss, select(channels(AD), sweeps()), [0]))")

PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_SF", val = 1)

Expand Down Expand Up @@ -5019,7 +5018,7 @@ Function PSQ_SealEvaluation(string device, struct AnalysisFunction_V3& s)
variable multiplier, chunk, baselineQCPassed, ret, DAC, samplingFrequencyQCPassed, sealResistanceMax
variable sweepsInSet, passesInSet, acquiredSweepsInSet, sweepPassed, setPassed, numSweepsFailedAllowed, failsInSet, ovsState
variable expectedNumTestpulses, numTestPulses, sealResistanceA, sealResistanceB, sealResistanceQCPassed, testpulseGroupSel, sealThreshold
string key, ctrl, stimset, msg, databrowser, bsPanel, formula, formula_nb, pipetteResistanceStr, sweepStr
string key, ctrl, stimset, msg, databrowser, bsPanel, formula, pipetteResistanceStr, sweepStr
string sealResistanceGroupAStr, sealResistanceGroupBStr

switch(s.eventType)
Expand Down Expand Up @@ -5055,8 +5054,6 @@ Function PSQ_SealEvaluation(string device, struct AnalysisFunction_V3& s)

bsPanel = BSP_GetPanel(databrowser)

formula_nb = BSP_GetSFFormula(databrowser)

testpulseGroupSel = PSQ_SE_GetTestpulseGroupSelection(s.params)

/// @todo: Rework to use non-displayed sweeps, once https://github.com/AllenInstitute/MIES/pull/1256 is merged
Expand All @@ -5068,21 +5065,21 @@ Function PSQ_SealEvaluation(string device, struct AnalysisFunction_V3& s)
// and `tp` takes the *ignored* list
switch(testpulseGroupSel)
case PSQ_SE_TGS_BOTH:
formula = "store(\"Steady state resistance (group A)\", tp(ss, channels(AD), sweeps(), [0, 4, 5, 6]))\r" + \
formula = "store(\"Steady state resistance (group A)\", tp(ss, select(channels(AD), sweeps()), [0, 4, 5, 6]))\r" + \
"and\r" + \
"store(\"Steady state resistance (group B)\", tp(ss, channels(AD), sweeps(), [0, 1, 2, 3]))"
"store(\"Steady state resistance (group B)\", tp(ss, select(channels(AD), sweeps()), [0, 1, 2, 3]))"
break
case PSQ_SE_TGS_FIRST:
formula = "store(\"Steady state resistance (group A)\", tp(ss, channels(AD), sweeps(), [0]))"
formula = "store(\"Steady state resistance (group A)\", tp(ss, select(channels(AD), sweeps()), [0]))"
break
case PSQ_SE_TGS_SECOND:
formula = "store(\"Steady state resistance (group B)\", tp(ss, channels(AD), sweeps(), [0]))"
formula = "store(\"Steady state resistance (group B)\", tp(ss, select(channels(AD), sweeps()), [0]))"
break
default:
ASSERT(0, "Invalid testpulseGroupSel: " + num2str(testpulseGroupSel))
endswitch

ReplaceNotebookText(formula_nb, formula)
SF_SetFormula(databrowser, formula)

PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_SF", val = 1)

Expand Down
2 changes: 1 addition & 1 deletion Packages/MIES/MIES_Constants.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ Constant HARDWARE_DAC_EXTERNAL_TRIGGER = 0x1

/// Used to upgrade the GuiStateWave as well as the DA Ephys panel
Constant DA_EPHYS_PANEL_VERSION = 55
Constant DATA_SWEEP_BROWSER_PANEL_VERSION = 39
Constant DATA_SWEEP_BROWSER_PANEL_VERSION = 40
Constant WAVEBUILDER_PANEL_VERSION = 12
Constant ANALYSISBROWSER_PANEL_VERSION = 1

Expand Down
5 changes: 2 additions & 3 deletions Packages/MIES/MIES_DataBrowser.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ End
/// after GUI editor adapted controls in development process
Function DB_ResetAndStoreCurrentDBPanel()
string device, bsPanel, scPanel, shPanel, recreationCode
string sfFormula, sfJSON, descNB
string sfJSON, descNB

device = GetMainWindow(GetCurrentWindow())
if(!windowExists(device))
Expand Down Expand Up @@ -222,8 +222,7 @@ Function DB_ResetAndStoreCurrentDBPanel()
// settings history
CheckBox check_limit_x_selected_sweeps WIN = $shPanel, value=0

sfFormula = BSP_GetSFFormula(device)
ReplaceNotebookText(sfFormula, "data(\rcursors(A,B),\rchannels(AD),\rsweeps()\r)")
SF_SetFormula(device, "data(\rcursors(A,B),\rselect(channels(AD),sweeps())\r)")

sfJSON = BSP_GetSFJSON(device)
ReplaceNotebookText(sfJSON, "")
Expand Down
Loading

0 comments on commit 134ff2b

Please sign in to comment.