update doc
This commit is contained in:
parent
49fa679d9a
commit
69a47a24e8
6 changed files with 97 additions and 12 deletions
15
README.adoc
15
README.adoc
|
@ -13,6 +13,21 @@
|
|||
* Visualize with GLMakie (or CairoMakie)
|
||||
** Inspecting with GUI
|
||||
|
||||
== Docs
|
||||
Clone this repo, and
|
||||
```sh
|
||||
$ cd docs
|
||||
|
||||
$ julia --project -e 'using Pkg; Pkg.instantiate()'
|
||||
|
||||
$ julia --project make.jl
|
||||
|
||||
$ cd build
|
||||
|
||||
$ python -m http.server --bind localhost
|
||||
|
||||
```
|
||||
|
||||
== TODO
|
||||
- [x] Printing
|
||||
- [ ] visualize
|
||||
|
|
|
@ -6,3 +6,9 @@
|
|||
```@autodocs
|
||||
Modules = [CoordVisualize]
|
||||
```
|
||||
|
||||
# ColorMapFuncs
|
||||
|
||||
```@autodocs
|
||||
Modules = [CoordVisualize.ColorMapFuncs]
|
||||
```
|
||||
|
|
|
@ -12,7 +12,7 @@ Readers are expected to be familiar with basics of julia.
|
|||
### Preparing
|
||||
This will take a few minutes.
|
||||
|
||||
```juliarepl
|
||||
```julia-repl
|
||||
julia> # type ]
|
||||
|
||||
(@v1.10) Pkg> activate .
|
||||
|
@ -21,24 +21,52 @@ julia> # type ]
|
|||
```
|
||||
|
||||
### Parse log
|
||||
```juliarepl
|
||||
```julia-repl
|
||||
julia> using CoordVisualize
|
||||
|
||||
julia> interactive_edit_log("coord_log_1.txt", "coord_log_2.txt")
|
||||
julia> iedit_log("coord_log_1.txt", "coord_log_2.txt")
|
||||
...
|
||||
Follow the instruction
|
||||
...
|
||||
```
|
||||
|
||||
### CoordVisualize
|
||||
Get map image file and place it as "map.png".
|
||||
### Visualize the log
|
||||
Get map image file and place it as "map.png" beforehand.
|
||||
|
||||
```juliarepl
|
||||
```julia-repl
|
||||
julia> using GLMakie, CoordVisualize
|
||||
|
||||
julia> tlog = include("<exported log file>");
|
||||
julia> tlog = Observable(include("<exported log file>"))
|
||||
...
|
||||
|
||||
julia> # or
|
||||
|
||||
julia> tlog = Observable(interactive_edit_log("log files", "log file2"))
|
||||
...
|
||||
|
||||
julia> include("<path to root>/interactive_viz.jl")
|
||||
...
|
||||
```
|
||||
|
||||
Available colorschemes at https://juliagraphics.github.io/ColorSchemes.jl/stable/catalogue/ .
|
||||
Available colors at https://juliagraphics.github.io/Colors.jl/stable/constructionandconversion/#Color-Parsing and https://juliagraphics.github.io/Colors.jl/stable/namedcolors/ .
|
||||
|
||||
### Edit the log
|
||||
```julia-repl
|
||||
julia> isplit_log!(tlog[], 3, 30)
|
||||
... <with some prompts>
|
||||
|
||||
julia> iedit_note!(tlog[], 3)
|
||||
... <with some promots>
|
||||
|
||||
julia> ijoin_logs!(tlog[], 5, 7)
|
||||
... <with some prompts>
|
||||
|
||||
```
|
||||
|
||||
### Export the log
|
||||
```julia-repl
|
||||
julia> export_log(tlog[], "<filename>")
|
||||
```
|
||||
|
||||
## Low level
|
||||
|
|
|
@ -94,7 +94,7 @@ inspector_options = grid!(
|
|||
[1, 2] => toggle_inspector,
|
||||
width = options_width,
|
||||
)
|
||||
fig[1:2, 2] = grid!(
|
||||
fig[1:2, 3] = grid!(
|
||||
[0, :] => Label(fig, "Line", font = :bold),
|
||||
[1, :] => line_options,
|
||||
[2, :] => Label(fig, "Marker", font = :bold),
|
||||
|
@ -143,7 +143,7 @@ cbm = Colorbar(
|
|||
ticklabelsize = 10,
|
||||
label = menu_mcolormapfunc.selection,
|
||||
)
|
||||
fig[1:2, 3] = grid!(
|
||||
fig[1:2, 2] = grid!(
|
||||
[0, 1] => Label(fig, "line", font = :bold),
|
||||
[1, 1] => cbl,
|
||||
[2, 1] => Label(fig, "marker", font = :bold),
|
||||
|
|
|
@ -2,6 +2,9 @@ using Statistics
|
|||
using Dates
|
||||
using Printf
|
||||
|
||||
"""
|
||||
Interactively parse log files and edit the log.
|
||||
"""
|
||||
function iedit_log(filenames...; writetofile = true)
|
||||
printstyled(stdout, "[CoordLog Editor] \n", color = :blue, bold = true)
|
||||
logs = CoordLog[]
|
||||
|
@ -118,6 +121,15 @@ function iedit_log(filenames...; writetofile = true)
|
|||
return edited_logs
|
||||
end
|
||||
|
||||
"""
|
||||
isplit_log!(
|
||||
logs::AbstractVector{CoordLog{T}},
|
||||
logid::Integer,
|
||||
pointid::Integer,
|
||||
) where {T}
|
||||
|
||||
Split the log. Supply notes interactively.
|
||||
"""
|
||||
function isplit_log!(
|
||||
logs::AbstractVector{CoordLog{T}},
|
||||
logid::Integer,
|
||||
|
@ -143,6 +155,11 @@ function isplit_log!(
|
|||
insert!(logs, logid + 1, new_logs[2])
|
||||
end
|
||||
|
||||
"""
|
||||
iedit_note!(logs::AbstractVector{CoordLog{T}}, logid::Integer) where {T}
|
||||
|
||||
Edit the note at `logid`. Supply new note interactively.
|
||||
"""
|
||||
function iedit_note!(logs::AbstractVector{CoordLog{T}}, logid::Integer) where {T}
|
||||
1 ≤ logid ≤ length(logs) ||
|
||||
throw(ArgumentError("logid out of index: ¬ 1 ≤ $(logid) ≤ $(length(logid))"))
|
||||
|
@ -151,6 +168,11 @@ function iedit_note!(logs::AbstractVector{CoordLog{T}}, logid::Integer) where {T
|
|||
logs[logid].note = note
|
||||
end
|
||||
|
||||
"""
|
||||
ijoin_logs!(logs::AbstractVector{CoordLog{T}}, logid1::Integer, logid2::Integer) where {T}
|
||||
|
||||
Join the logs at `logid1` and `logid2`. Supply new note interactively.
|
||||
"""
|
||||
function ijoin_logs!(logs::AbstractVector{CoordLog{T}}, logid1::Integer, logid2::Integer) where {T}
|
||||
1 ≤ logid1 ≤ length(logs) ||
|
||||
throw(ArgumentError("logid1 out of index: ¬ 1 ≤ $(logid1) ≤ $(length(logid1))"))
|
||||
|
|
|
@ -4,16 +4,29 @@ using ColorSchemes
|
|||
|
||||
"""
|
||||
Predefined color map functions.
|
||||
Receives
|
||||
- `cmap`: colormap
|
||||
- `logs`: vector of `CoordLog`
|
||||
- `n`: number of returning ticks
|
||||
|
||||
and returns tuple of
|
||||
1. vector of `Colorant`
|
||||
2. ticks to pass to `Colorbar`, which is a Tuple of
|
||||
1. vector of tick location (0 to 1)
|
||||
2. vector of tick labels (strings)
|
||||
|
||||
Any function (or struct) which behaves like this can be used for
|
||||
`lcolormapfunc` and `mcolormapfunc` kwargs of `trace2ds`.
|
||||
|
||||
# Types
|
||||
|
||||
[`ColorMapFunc`](@ref)
|
||||
[`ColorMapFunc`](@ref) is a supertype of all of these.
|
||||
|
||||
# Interface
|
||||
|
||||
Define these methods for the ColorMapFunc.
|
||||
|
||||
(AbstractVector{CoordLog}) -> Vector{∈ [0, 1]}, ticks
|
||||
(cmap, logs, n) -> Vector{Colorant}, ticks
|
||||
"""
|
||||
module ColorMapFuncs
|
||||
|
||||
|
@ -26,7 +39,8 @@ using Makie: wong_colors, Scene
|
|||
# Methods
|
||||
(f::ColorMapFunc)(cmap, logs)
|
||||
|
||||
Helper method.
|
||||
Helper struct for those use vector of 0 to 1 floats.
|
||||
Example functions are [`Date`](@ref) and [`Altitude`](@ref).
|
||||
"""
|
||||
abstract type ColorMapFunc end
|
||||
|
||||
|
|
Loading…
Reference in a new issue