Skip to content

Alternative way to get offset before first "epoch" in axon protocol conversion #1305

Open
@MichaelClerx

Description

@MichaelClerx

At the moment Neo uses a slightly "magic" equation to work out the (undocumented) time spent at holding potential before the first "epoch" of a protocol starts:

# Save last sample index
i_last = int(nSam * 15625 / 10 ** 6)
# TODO guess for first holding

Digging into the File Support Pack 1 for Windows for the old ABF 1.x format, there's a method inside AxonDev/Comp/AxAbfFio32/ABFHWAVE.CPP (which I guess deals with "waveforms", a.k.a. D/A protocol outputs) called _GetHoldingLength():

//===============================================================================================
// FUNCTION: GetHoldingLength
// PURPOSE:  Get the duration of the first/last holding period.
//
static int _GetHoldingLength(int nSweepLength, int nNumChannels)
{
   ASSERT((nSweepLength % nNumChannels)==0);

   // Calculate holding count.
   int nHoldingCount = nSweepLength / ABFH_HOLDINGFRACTION;

   // Round down to nearest sequence length.
   nHoldingCount -= nHoldingCount % nNumChannels;

   // If less than one sequence, round up to one sequence.
   if (nHoldingCount < nNumChannels)
      nHoldingCount = nNumChannels;

   return nHoldingCount;
}

where ABFH_HOLDINGFRACTION is a macro defined as 64 and where I'm guessing nNumChannels is the number of AD (not DA) channels.

I've tried for a few files and it seems to give the same result as the current code. Don't want to fix what isn't broken, but perhaps good to try out?

The next function down, ABFH_GetHoldingDuration, suggests a difference for "old" versions of the format (but given that these were "old" in 2000, maybe that's ok)

Note that the file starts with

// Copyright (c) 1993-2000 Axon Instruments.
// All rights reserved.
// Permission is granted to freely to use, modify and copy the code in this file.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions