Extending DataViewer
to support more data formats
DataViewer.recurse_into
— Functionrecurse_into(x) -> Bool
Tells whether x
is some form of "container" that can be recursed into, or a "leaf" data.
DataViewer.filetype
— Functionfiletype(fname::String)
Get the file type associated to a file named fname
, according to its extension.
filetype(v::Val)
Get the file type associated to the name extension given by v = Val(Symbol(extension))
.
Example
julia> filetype(Val(Symbol(".jld2")))
JLD2File
DataViewer.open_datafile
— Functionopen_datafile(fun, fname, ftype)
Load the data contained in fname
, which should be stored using the format described by ftype
. Apply fun
on the loaded data. This function guarantees that the file stays open as long as needed, but is closed before the function returns.
Example
julia> ftype = filetype(Val(Symbol(".jld2")))
JLD2File
julia> open_datafile("sample.jld2", ftype) do data
println(typeof(data))
end
Dict
DataViewer.graphic_repr
— Function(options, repr) = graphic_repr(x)
If x
supports one or more graphical representation(s), options
is a non-empty Vector{RepresentationOption}
. In that case, calling repr(options[i].param)
should produce the graphical representation corresponding to the i-th entry in the list.
DataViewer.get_data
— Functionget_data(container, path)
Get the piece of data stored in container
under path
.
get_data(container, (a, b, b))
should be more or less equivalent to
container[a][b][c]
DataViewer.pretty_repr
— Functionpretty_repr(x) -> String
Return a pretty textual representation of x
. By default it is based on show
, but can be customized as needed.