From ff73bdb6bbb3336a52946c2738d612c502420e55 Mon Sep 17 00:00:00 2001
From: Michiel Cottaar <MichielCottaar@protonmail.com>
Date: Wed, 18 Sep 2024 13:54:38 +0100
Subject: [PATCH] Actually convert integer variables into integers

---
 src/build_sequences.jl          |  1 +
 src/components/readouts/ADCs.jl | 11 -----------
 2 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/src/build_sequences.jl b/src/build_sequences.jl
index 6115899..8ae15d6 100644
--- a/src/build_sequences.jl
+++ b/src/build_sequences.jl
@@ -228,6 +228,7 @@ It is used internally by [`build_sequence`](@ref).
 """
 fixed(some_value) = some_value
 fixed(jump_variable::AbstractJuMPScalar) = value(jump_variable)
+fixed(jump_variable::GenericVariableRef) = is_integer(jump_variable) ? Int(value(jump_variable)) : value(jump_variable)
 fixed(jump_variable::AbstractArray) = fixed.(jump_variable)
 fixed(dict_variable::AbstractDict) = typeof(dict_variable)(k => fixed(v) for (k, v) in pairs(dict_variable))
 fixed(tuple_variable::Tuple) = fixed.(tuple_variable)
diff --git a/src/components/readouts/ADCs.jl b/src/components/readouts/ADCs.jl
index 5e74584..116fe5a 100644
--- a/src/components/readouts/ADCs.jl
+++ b/src/components/readouts/ADCs.jl
@@ -99,17 +99,6 @@ variables.nsamples
     effective_time(adc::ADC) = variables.time_to_center(adc)
 end
 
-function fixed(adc::ADC)
-    # round nsamples during fixing
-    r = Int(round(value(variables.resolution(adc)), RoundNearest))
-    n = Int(round(value(variables.nsamples(adc)), RoundNearest))
-    if iszero(n)
-        return ADC(0, NaN, NaN, NaN)
-    end
-    oversample = n // r
-    return ADC(r, value(adc.dwell_time), value(adc.time_to_center), oversample)
-end
-
 make_generic(adc::ADC) = adc
 
 end
\ No newline at end of file
-- 
GitLab