From 28b15f62e4d5aa74f5d9150c8f15c388a80ba1fb Mon Sep 17 00:00:00 2001 From: m-wells Date: Fri, 14 Feb 2020 15:44:41 -0500 Subject: [PATCH] removed debugging statement --- Project.toml | 2 +- README.ipynb | 82 ++++++++++++++++++-------------------- README.md | 76 +++++++++++++++++------------------ src/AlignedBinaryFormat.jl | 8 +++- 4 files changed, 84 insertions(+), 84 deletions(-) diff --git a/Project.toml b/Project.toml index 2182efc..8e08294 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "AlignedBinaryFormat" uuid = "94fc9360-1a5e-4d84-93be-ddbadb32b3a7" authors = ["m-wells "] -version = "0.5.2" +version = "0.5.3" [deps] Mmap = "a63ad114-7e13-5084-954f-fe012c677804" diff --git a/README.ipynb b/README.ipynb index 48b22d8..2fa7ab4 100644 --- a/README.ipynb +++ b/README.ipynb @@ -22,7 +22,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -85,17 +85,10 @@ "execution_count": 4, "metadata": {}, "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "string(AbfSerializer) = \"AbfSerializer\"\n" - ] - }, { "data": { "text/plain": [ - "AlignedBinaryFormat.AbfFile([read] )\n", + "AlignedBinaryFormat.AbfFile([read] )\n", "┌────────────┬──────────────────┬───────────┬────────┬────────────┐\n", "│ label │ type │ shape │ bytes │ status │\n", "├────────────┼──────────────────┼───────────┼────────┼────────────┤\n", @@ -151,11 +144,11 @@ "name": "stdout", "output_type": "stream", "text": [ - "count(abf[\"bitmat\"]) = 5\n", + "count(abf[\"bitmat\"]) = 3\n", "this is what I did\n", "and how!\n", "\n", - "AlignedBinaryFormat.AbfFile([read] )\n", + "AlignedBinaryFormat.AbfFile([read] )\n", "┌────────────┬──────────────────┬───────────┬────────┬────────────┐\n", "│ label │ type │ shape │ bytes │ status │\n", "├────────────┼──────────────────┼───────────┼────────┼────────────┤\n", @@ -223,18 +216,18 @@ "output_type": "stream", "text": [ "x = 10-element Array{Float64,1}:\n", - " 0.41808342392430364\n", - " 0.8340965780634206 \n", - " 0.4422525925297145 \n", - " 0.7464876087842214 \n", - " 0.8760053500303144 \n", - " 0.8812312947613306 \n", - " 0.12907825453926614\n", - " 0.8227926275555029 \n", - " 0.5770610771209626 \n", - " 0.2427376128034029 \n", + " 0.6737894194841203 \n", + " 0.28704212997665324\n", + " 0.8980864989824102 \n", + " 0.5948813070093115 \n", + " 0.03298590842249727\n", + " 0.9587674078053836 \n", + " 0.4213390775874484 \n", + " 0.8851345495595084 \n", + " 0.35869029635893646\n", + " 0.4629117484636671 \n", "\n", - "AlignedBinaryFormat.AbfFile([read/write] )\n", + "AlignedBinaryFormat.AbfFile([read/write] )\n", "┌───────┬──────────────────┬───────┬───────┬────────┐\n", "│ label │ type │ shape │ bytes │ status │\n", "├───────┼──────────────────┼───────┼───────┼────────┤\n", @@ -242,23 +235,23 @@ "└───────┴──────────────────┴───────┴───────┴────────┘\n", "\n", "\n", - "AlignedBinaryFormat.AbfFile([closed] )\n", + "AlignedBinaryFormat.AbfFile([closed] )\n", "┌───────┬──────┬───────┬───────┬────────┐\n", "│ label │ type │ shape │ bytes │ status │\n", "├───────┼──────┼───────┼───────┼────────┤\n", "└───────┴──────┴───────┴───────┴────────┘\n", "\n", "x = 10-element Array{Float64,1}:\n", - " 0.41808342392430364\n", - " 0.8340965780634206 \n", - " 0.4422525925297145 \n", - " 0.7464876087842214 \n", - " 0.8760053500303144 \n", - " 0.8812312947613306 \n", - " 0.12907825453926614\n", - " 0.8227926275555029 \n", - " 0.5770610771209626 \n", - " 0.2427376128034029 \n", + " 0.6737894194841203 \n", + " 0.28704212997665324\n", + " 0.8980864989824102 \n", + " 0.5948813070093115 \n", + " 0.03298590842249727\n", + " 0.9587674078053836 \n", + " 0.4213390775874484 \n", + " 0.8851345495595084 \n", + " 0.35869029635893646\n", + " 0.4629117484636671 \n", "\n" ] } @@ -309,27 +302,27 @@ "output_type": "stream", "text": [ "file opened with \"w\"\n", - "AlignedBinaryFormat.ReadOnlyError(IOStream())\n", + "AlignedBinaryFormat.AbfReadError(IOStream())\n", "\n", "file opened with \"w+\"\n", - "x[1] = 0.9897101065968341\n", + "x[1] = 0.3923187061956266\n", "x[1] = -1.0\n", "\n", "file opened with \"r+\"\n", "(abf[\"x\"])[1] = 3.0\n", - "abf[\"y\"] = [0.8188509909345121, 0.7005578254412208]\n", + "abf[\"y\"] = [0.3650633407781294, 0.06535729174631832]\n", "\n", "file opened with \"r\"\n", "x[1] = 3.0\n", - "abf[\"y\"] = [0.8188509909345121, 0.7005578254412208]\n", + "abf[\"y\"] = [0.3650633407781294, 0.06535729174631832]\n", "ReadOnlyMemoryError()\n", "\n", "file opened with \"a\"\n", - "AlignedBinaryFormat.ReadOnlyError(IOStream())\n", + "AlignedBinaryFormat.AbfReadError(IOStream())\n", "\n", "file opened with \"a+\"\n", "(read(abf, \"x\"))[1] = 3.0\n", - "(read(abf, \"z\"))[1] = 0.07216051054053385\n" + "(read(abf, \"z\"))[1] = 0.9387386553608443\n" ] } ], @@ -340,7 +333,8 @@ " try\n", " x = read(abf, \"x\")\n", " catch e\n", - " println(e)\n", + " show(e)\n", + " println()\n", " end\n", "end\n", "println(\"\\nfile opened with \\\"w+\\\"\")\n", @@ -366,7 +360,8 @@ " try\n", " x[1] = 3\n", " catch e\n", - " println(e)\n", + " show(e)\n", + " println()\n", " end\n", "end;\n", "println(\"\\nfile opened with \\\"a\\\"\")\n", @@ -374,7 +369,8 @@ " try\n", " x = read(abf, \"x\")\n", " catch e\n", - " println(e)\n", + " show(e)\n", + " println()\n", " end\n", " write(abf, \"z\", rand(3))\n", "end;\n", @@ -475,7 +471,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "AlignedBinaryFormat.AbfFile([read/write] )\n", + "AlignedBinaryFormat.AbfFile([read/write] )\n", "┌───────────┬──────────────────┬─────────┬────────┬────────────┐\n", "│ label │ type │ shape │ bytes │ status │\n", "├───────────┼──────────────────┼─────────┼────────┼────────────┤\n", diff --git a/README.md b/README.md index ae48398..b5ec251 100644 --- a/README.md +++ b/README.md @@ -65,13 +65,10 @@ end abf = abfopen(temp, "r") ``` - string(AbfSerializer) = "AbfSerializer" - - - AlignedBinaryFormat.AbfFile([read] ) + AlignedBinaryFormat.AbfFile([read] ) ┌────────────┬──────────────────┬───────────┬────────┬────────────┐ │ label │ type │ shape │ bytes │ status │ ├────────────┼──────────────────┼───────────┼────────┼────────────┤ @@ -100,11 +97,11 @@ println(read(abf, "log")) show(abf) ``` - count(abf["bitmat"]) = 5 + count(abf["bitmat"]) = 3 this is what I did and how! - AlignedBinaryFormat.AbfFile([read] ) + AlignedBinaryFormat.AbfFile([read] ) ┌────────────┬──────────────────┬───────────┬────────┬────────────┐ │ label │ type │ shape │ bytes │ status │ ├────────────┼──────────────────┼───────────┼────────┼────────────┤ @@ -153,18 +150,18 @@ println("\n") ``` x = 10-element Array{Float64,1}: - 0.41808342392430364 - 0.8340965780634206 - 0.4422525925297145 - 0.7464876087842214 - 0.8760053500303144 - 0.8812312947613306 - 0.12907825453926614 - 0.8227926275555029 - 0.5770610771209626 - 0.2427376128034029 + 0.6737894194841203 + 0.28704212997665324 + 0.8980864989824102 + 0.5948813070093115 + 0.03298590842249727 + 0.9587674078053836 + 0.4213390775874484 + 0.8851345495595084 + 0.35869029635893646 + 0.4629117484636671 - AlignedBinaryFormat.AbfFile([read/write] ) + AlignedBinaryFormat.AbfFile([read/write] ) ┌───────┬──────────────────┬───────┬───────┬────────┐ │ label │ type │ shape │ bytes │ status │ ├───────┼──────────────────┼───────┼───────┼────────┤ @@ -172,23 +169,23 @@ println("\n") └───────┴──────────────────┴───────┴───────┴────────┘ - AlignedBinaryFormat.AbfFile([closed] ) + AlignedBinaryFormat.AbfFile([closed] ) ┌───────┬──────┬───────┬───────┬────────┐ │ label │ type │ shape │ bytes │ status │ ├───────┼──────┼───────┼───────┼────────┤ └───────┴──────┴───────┴───────┴────────┘ x = 10-element Array{Float64,1}: - 0.41808342392430364 - 0.8340965780634206 - 0.4422525925297145 - 0.7464876087842214 - 0.8760053500303144 - 0.8812312947613306 - 0.12907825453926614 - 0.8227926275555029 - 0.5770610771209626 - 0.2427376128034029 + 0.6737894194841203 + 0.28704212997665324 + 0.8980864989824102 + 0.5948813070093115 + 0.03298590842249727 + 0.9587674078053836 + 0.4213390775874484 + 0.8851345495595084 + 0.35869029635893646 + 0.4629117484636671 @@ -215,7 +212,8 @@ abfopen(temp, "w") do abf try x = read(abf, "x") catch e - println(e) + show(e) + println() end end println("\nfile opened with \"w+\"") @@ -241,7 +239,8 @@ abfopen(temp, "r") do abf try x[1] = 3 catch e - println(e) + show(e) + println() end end; println("\nfile opened with \"a\"") @@ -249,7 +248,8 @@ abfopen(temp, "a") do abf try x = read(abf, "x") catch e - println(e) + show(e) + println() end write(abf, "z", rand(3)) end; @@ -261,27 +261,27 @@ end; ``` file opened with "w" - AlignedBinaryFormat.ReadOnlyError(IOStream()) + AlignedBinaryFormat.AbfReadError(IOStream()) file opened with "w+" - x[1] = 0.9897101065968341 + x[1] = 0.3923187061956266 x[1] = -1.0 file opened with "r+" (abf["x"])[1] = 3.0 - abf["y"] = [0.8188509909345121, 0.7005578254412208] + abf["y"] = [0.3650633407781294, 0.06535729174631832] file opened with "r" x[1] = 3.0 - abf["y"] = [0.8188509909345121, 0.7005578254412208] + abf["y"] = [0.3650633407781294, 0.06535729174631832] ReadOnlyMemoryError() file opened with "a" - AlignedBinaryFormat.ReadOnlyError(IOStream()) + AlignedBinaryFormat.AbfReadError(IOStream()) file opened with "a+" (read(abf, "x"))[1] = 3.0 - (read(abf, "z"))[1] = 0.07216051054053385 + (read(abf, "z"))[1] = 0.9387386553608443 ## Why not use `JLD/HDF5`? @@ -348,7 +348,7 @@ abfopen(temp, "w+") do abf end; ``` - AlignedBinaryFormat.AbfFile([read/write] ) + AlignedBinaryFormat.AbfFile([read/write] ) ┌───────────┬──────────────────┬─────────┬────────┬────────────┐ │ label │ type │ shape │ bytes │ status │ ├───────────┼──────────────────┼─────────┼────────┼────────────┤ diff --git a/src/AlignedBinaryFormat.jl b/src/AlignedBinaryFormat.jl index 99ddfed..c9c9129 100644 --- a/src/AlignedBinaryFormat.jl +++ b/src/AlignedBinaryFormat.jl @@ -12,8 +12,8 @@ struct AbfReadError <: Exception io::IOStream end -function Base.showerror(io::IO, e::T) where T<:AbfReadError - print(io, T, ": isreadable(", e.io.name, ") = ", isreadable(e.io)) +function Base.showerror(io::IO, e::AbfReadError) + print(io, "AbfReadError: isreadable(", e.io.name, ") = ", isreadable(e.io)) end check_readable(io::IOStream) = isreadable(io) ? nothing : throw(AbfReadError(io)) @@ -22,6 +22,10 @@ struct AbfWriteError <: Exception io::IOStream end +function Base.showerror(io::IO, e::AbfWriteError) + print(io, "AbfWriteError: iswritable(", e.io.name, ") = ", iswritable(e.io)) +end + #function Base.showerror(io::IO, e::AbfWriteError) # print(io, "iswritable(", e.io.name, ") = ", iswritable(e.io)) #end