Skip to content

Commit

Permalink
fix CI errors (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdw503 authored Feb 12, 2025
1 parent 049705d commit 366e3aa
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.1'
- '1.10'
- '1'
os:
- ubuntu-latest
Expand All @@ -25,7 +25,7 @@ jobs:
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
- uses: actions/cache@v4
env:
cache-name: cache-artifacts
with:
Expand Down
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ImagineInterface"
uuid = "a9d8408c-0fb1-11e9-0067-cb067474114e"
version = "0.1.7"
version = "0.1.8"

[deps]
AxisArrays = "39de3d68-74b9-583c-8d2d-e117c070f3a9"
Expand All @@ -23,12 +23,12 @@ AxisArrays = "0.4"
DSP = "0.6, 0.7, 0.8"
DataStructures = "0.17, 0.18"
ImagineFormat = "1"
ImagineHardware = "0.0.1"
ImagineHardware = "0.0.1, 0.1"
IntervalSets = "0.4, 0.5, 0.6, 0.7"
JSON = "0.21"
MappedArrays = "0.2, 0.3, 0.4"
Statistics = "1"
UnitAliases = "0.0.1"
UnitAliases = "0.0.1, 0.1"
Unitful = "1"
julia = "0.7, 1"

Expand Down
1 change: 1 addition & 0 deletions src/ImagineInterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ using MappedArrays, IntervalSets, DataStructures, DSP
using ImagineFormat, ImagineHardware
import ImagineHardware:samprate
using AxisArrays
using DSP.Filters: normalize_freq
const axes = Base.axes

import Base: convert, show, length, size, isempty, ==, append!, prepend!, pop!, empty!, replace!#, scale
Expand Down
8 changes: 4 additions & 4 deletions src/hardware_templates.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ function default_samplemapper(rig::AbstractString, daq_chan_name::String; sample
end
end

function generic_ao_samplemapper(r::AbstractInterval{Traw},v::AbstractInterval{TV};
function generic_ao_samplemapper(r::AbstractInterval{Traw},v::AbstractInterval{TV}; rawtype=Int16,
sample_rate::HasInverseTimeUnits{Int, TU}=10000s^-1) where{Traw<:Integer,TV<:HasVoltageUnits, TU}
return SampleMapper(minimum(r), maximum(r), minimum(v), maximum(v), minimum(v), maximum(v), sample_rate)
return SampleMapper(rawtype(minimum(r)), rawtype(maximum(r)), minimum(v), maximum(v), minimum(v), maximum(v), sample_rate)
end

generic_ai_samplemapper = generic_ao_samplemapper

function piezo_samplemapper(r::AbstractInterval{Traw},p::AbstractInterval{TL}, v::AbstractInterval{TV};
function piezo_samplemapper(r::AbstractInterval{Traw},p::AbstractInterval{TL}, v::AbstractInterval{TV}; rawtype=Int16,
sample_rate::HasInverseTimeUnits{Int, TU}=10000s^-1) where{Traw<:Integer,TL<:HasLengthUnits,TV<:HasVoltageUnits, TU}
return SampleMapper(minimum(r), maximum(r), minimum(v), maximum(v), minimum(p), maximum(p), sample_rate)
return SampleMapper(rawtype(minimum(r)), rawtype(maximum(r)), minimum(v), maximum(v), minimum(p), maximum(p), sample_rate)
end

function galvo_ctrl_samplemapper(rawtype=Int16, sample_rate::HasInverseTimeUnits{Int, TU}=10000s^-1) where TU
Expand Down
2 changes: 1 addition & 1 deletion src/stack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function apply_lp(mod_samps::AbstractVector, sampr::HasInverseTimeUnits, cutoff:
mod_samps3 = repeat(mod_samps, 11)
fs = ustrip(uconvert(Unitful.Hz, sampr))
cutoff = ustrip(uconvert(Unitful.Hz, cutoff))
responsetype = Lowpass(cutoff; fs=fs)
responsetype = Lowpass(normalize_freq(cutoff, fs))
designmethod = Butterworth(4)
filtd = filtfilt(digitalfilter(responsetype, designmethod), ustrip.(mod_samps3)).*unit(mod_samps[1])
return filtd[5*length(mod_samps)+1:(6*length(mod_samps))]
Expand Down
8 changes: 7 additions & 1 deletion src/validate_single.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function check_piezo(pos::ImagineSignal; window_sz = 100, val_state::ValidationS
max_sp = PIEZO_MAX_SPEED[rig_name(pos)]
window_dur = window_sz / samprate(pos)
max_dist = max_sp * window_dur #length units
max_dist_raw = ceil(Int, (max_dist/width(interval_world(pos))) * width(interval_raw(pos)))
max_dist_raw = ceil(Int, (max_dist/width(interval_world(pos))) * width(convert(Int64,interval_raw(pos))))
val_func = (samps, win_sz) -> check_max_speed(samps, max_dist_raw, win_sz)
if length(pos) < window_sz #should this throw an error?
@warn "Insufficient samples to check this signal with a window size setting of $window_sz"
Expand All @@ -40,6 +40,12 @@ function check_piezo(pos::ImagineSignal; window_sz = 100, val_state::ValidationS
return val_state
end

function convert(::Type{T1}, i::AbstractInterval{T2}) where {T1,T2}
l = convert(T1,i.left)
r = convert(T1,i.right)
Interval{:closed,:closed,T1}(l,r)
end

function check_max_speed(raw_samps::Vector, raw_change::Int, in_n_samps::Int)
@assert length(raw_samps) >= in_n_samps
niter = length(raw_samps) - in_n_samps + 1
Expand Down
2 changes: 2 additions & 0 deletions test/validate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ replace!(sigs[1], "test3", samps)
############STACK PARAMETERS#################
pmin = 0.0*μm #Piezo start position in microns
pmax = 200.0*μm #Piezo stop position in microns
pms = ImagineInterface.PIEZO_MAX_SPEED[rig]
mn_stack_img_time = abs(pmax - pmin)/pms
stack_img_time = 0.26s #Time to complete the imaging sweep with the piezo (remember we also need to reset it to its starting position)
reset_time = 0.001s #Time to reset piezo to starting position. This time plus "stack_img_time" determines how long it takes to complete an entire stack and be ready to start a new stack
z_spacing = 3.1μm #The space between slices in the z-stack.
Expand Down

0 comments on commit 366e3aa

Please sign in to comment.