Skip to content

Commit

Permalink
Add support for "stimulus sequence", "stimulus scan hi/lo", and "stim…
Browse files Browse the repository at this point in the history
…ulus frame hi/lo"
  • Loading branch information
timholy committed Oct 9, 2019
1 parent b2321b3 commit f267dd6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/ImagineFormat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,12 @@ const field_key_dict = Dict{AbstractString,Function}(
"angle from horizontal (deg)" => float64_or_empty,
"x translation in pixels" => x->parse(Int,x) != 0,
"y translation in pixels" => x->parse(Int,x) != 0,
"rotation angle in degree" => x->parse(Float64,x) != 0)
"rotation angle in degree" => x->parse(Float64,x) != 0,
"stimulus scan hi" => parse_vector_int,
"stimulus scan lo" => parse_vector_int,
"stimulus frame hi" => parse_vector_int,
"stimulus frame lo" => parse_vector_int,
"stimulus sequence" => identity)


function parse_header(s::IOStream)
Expand Down
6 changes: 3 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ MHz = u"MHz"

h = ImagineFormat.parse_header("test_noshift.imagine")
h["byte order"] = ENDIAN_BOM == 0x04030201 ? "l" : "b"
h["extra stuff"] = "Tuesday"
ImagineFormat.save_header(ifn, h; misc=("extra stuff",))
h["stimulus scan hi"] = [3, 5]
ImagineFormat.save_header(ifn, h; misc=("stimulus scan hi",))
h2 = ImagineFormat.parse_header(ifn)
@test isnan(h["readout rate"]) && isnan(h2["readout rate"])
@test isnan(h["vertical shift speed"]) && isnan(h2["vertical shift speed"])
@test h2["extra stuff"] == "Tuesday"
@test h2["stimulus scan hi"] == [3, 5]
rm(ifn)
img2 = 0
GC.gc(); GC.gc(); GC.gc()
Expand Down

0 comments on commit f267dd6

Please sign in to comment.