From 268da3e9b5df2c8c5b886431a360e8578e1f7389 Mon Sep 17 00:00:00 2001 From: Michiel Cottaar <michiel.cottaar@ndcn.ox.ac.uk> Date: Fri, 16 Feb 2024 11:53:08 +0000 Subject: [PATCH] Do not set oversample by default --- src/components/readouts/ADCs.jl | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/components/readouts/ADCs.jl b/src/components/readouts/ADCs.jl index 45adf0b..c97efd5 100644 --- a/src/components/readouts/ADCs.jl +++ b/src/components/readouts/ADCs.jl @@ -12,7 +12,7 @@ Adds a readout event. ## Parameters - `center_halfway`: by default the `time_to_center` is assumed to be half of the `duration`. Set this to false to disable this assumption. -- `oversample`: by how much the ADC should oversample (default: 2, unless both `resolution` and `nsamples` are set). +- `oversample`: by how much the ADC should oversample (minimum of 1). ## Variables - `resolution`: number of voxels in the readout direction. This can be a non-integer value during optimisation. @@ -29,11 +29,7 @@ struct ADC <: ReadoutComponent oversample :: VariableType end -function ADC(; resolution=nothing, dwell_time=nothing, time_to_center=nothing, center_halfway=true, oversample=nothing, nsamples=nothing, kwargs...) - if (isnothing(resolution) || isnothing(nsamples)) && isnothing(oversample) - oversample = 2. - end - +function ADC(; resolution=nothing, dwell_time=nothing, time_to_center=nothing, center_halfway=true, oversample=nothing, kwargs...) res = ADC( get_free_variable(resolution), get_free_variable(dwell_time), @@ -41,13 +37,13 @@ function ADC(; resolution=nothing, dwell_time=nothing, time_to_center=nothing, c get_free_variable(oversample), ) @constraint global_model() res.dwell_time >= 0 + @constraint global_model() res.oversample >= 1 if center_halfway apply_simple_constraint!(duration(res), 2 * res.time_to_center) else @constraint global_model() res.time_to_center >= 0 @constraint global_model() res.time_to_center <= duration(res) end - apply_simple_constraint!(res.resolution * res.oversample, nsamples) set_simple_constraints!(res, kwargs) return res end -- GitLab