Callback at saveat times

I have read most of the documentation on Callbacks, but I still have an issue, that does not appear to be covered.

Here is a fragment of a longer section from an UODE:

    λ8 = (T8_11 + T8_22 + T8_33)/2

    # λ9 = tr(σ⋅γd)
    λ9 = (T6_11 + T6_22 + T6_33) / 2f0

    # Run the integrity basis through a neural network
    model_inputs = [λ1;λ2;λ3;λ4;λ5;λ6;λ7;λ8;λ9]
    g1,g2,g3,g4,g5,g6,g7,g8,g9 = model_univ(model_inputs, model_weights)
    # tst that this code is being executed. Plot should change. The code was indeed executing,
    # and the solution did not change from its initial value. This must imply that the nonlinearity
    # has very little effect.
    #g1,g2,g3,g4,g5,g6,g7,g8,g9 = 0., 0., 0., 0., 0., 0., 0., 0., 0.

    # Save g1 through g9 per epoch. Once trained
    #println("g1->g9:  $t, $g1, $g2, $g3, $g4, $g5, $g6, $g7, $g8, $g9")

    if dct[:captureG]
        coef = [t, g1,g2,g3,g4,g5,g6,g7,g8,g9]
        push!(tdnn_coefs, coef)
        trace = [t, λ1, λ2, λ3, λ4, λ5, λ5, λ6, λ7, λ8, λ9]
        push!(tdnn_traces, trace)
    end

    # Tensor combining layer
    F11 = g1 + g2*σ11 + g3*γd11 + g4*T4_11 + g5*T5_11 + g6*T6_11 + g7*T7_11 + g8*T8_11 + g9*T9_11
    F22 = g1 + g2*σ22 + g3*γd22 + g4*T4_22 + g5*T5_22 + g6*T6_22 + g7*T7_22 + g8*T8_22 + g9*T9_22

The driver function is called at fixed time intervals time steps. I wish to capture coef and trace at saveat. Is there a simple flag I could test inside the function to determine whether or not I am at one of the saveat times? I do not wish to introduce additional interpolations into the problem. Thanks!

the probability you will be at a saveat time is effectively zero. Did you mean tstop times?

I was thinking saveat times. Ok, here are my thoughts. I run a solver with saveat=0.2 since the solution is saved at those times, I assume that tstops is a superset of saveat times.

I would like to print out auxiliary variables, calculated from derived functions of the solution, at the same saved times. Alter actively, I would like this auxiliary data every nth time level computed from the saveat times.

In reality, I am inside an UODE, which is quite complex, where the NN outputs the coefficiens of a tensor base expansion. this expansion is added to the RHS of the ODE system

saveat and tstops are normally distinct. The solver almost never steps to a saveat time.

FunctionCallingCallback and SavingCallback can be helpful for these kinds of things.

Will check them out again. Thanks.