From 4efd8ff4b3baeb2787ecf0ce131dd64a4f08b7d1 Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Wed, 18 Dec 2024 00:01:16 +0000 Subject: [PATCH] build based on 1c20de9 --- dev/.documenter-siteinfo.json | 2 +- dev/assets/documenter.js | 302 ++++++++++++++++++---------------- dev/examples/index.html | 2 +- dev/index.html | 2 +- dev/objects.inv | Bin 489 -> 489 bytes dev/reading/index.html | 2 +- dev/writing/index.html | 4 +- 7 files changed, 166 insertions(+), 148 deletions(-) diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index d28b3e9..1e34af1 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-09-26T18:44:01","documenter_version":"1.7.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.11.2","generation_timestamp":"2024-12-18T00:01:11","documenter_version":"1.8.0"}} \ No newline at end of file diff --git a/dev/assets/documenter.js b/dev/assets/documenter.js index a05c9c2..d5ea5a8 100644 --- a/dev/assets/documenter.js +++ b/dev/assets/documenter.js @@ -621,176 +621,194 @@ function worker_function(documenterSearchIndex, documenterBaseURL, filters) { }; } -// `worker = Threads.@spawn worker_function(documenterSearchIndex)`, but in JavaScript! -const filters = [ - ...new Set(documenterSearchIndex["docs"].map((x) => x.category)), -]; -const worker_str = - "(" + - worker_function.toString() + - ")(" + - JSON.stringify(documenterSearchIndex["docs"]) + - "," + - JSON.stringify(documenterBaseURL) + - "," + - JSON.stringify(filters) + - ")"; -const worker_blob = new Blob([worker_str], { type: "text/javascript" }); -const worker = new Worker(URL.createObjectURL(worker_blob)); - /////// SEARCH MAIN /////// -// Whether the worker is currently handling a search. This is a boolean -// as the worker only ever handles 1 or 0 searches at a time. -var worker_is_running = false; - -// The last search text that was sent to the worker. This is used to determine -// if the worker should be launched again when it reports back results. -var last_search_text = ""; - -// The results of the last search. This, in combination with the state of the filters -// in the DOM, is used compute the results to display on calls to update_search. -var unfiltered_results = []; - -// Which filter is currently selected -var selected_filter = ""; - -$(document).on("input", ".documenter-search-input", function (event) { - if (!worker_is_running) { - launch_search(); - } -}); - -function launch_search() { - worker_is_running = true; - last_search_text = $(".documenter-search-input").val(); - worker.postMessage(last_search_text); -} - -worker.onmessage = function (e) { - if (last_search_text !== $(".documenter-search-input").val()) { - launch_search(); - } else { - worker_is_running = false; - } - - unfiltered_results = e.data; - update_search(); -}; +function runSearchMainCode() { + // `worker = Threads.@spawn worker_function(documenterSearchIndex)`, but in JavaScript! + const filters = [ + ...new Set(documenterSearchIndex["docs"].map((x) => x.category)), + ]; + const worker_str = + "(" + + worker_function.toString() + + ")(" + + JSON.stringify(documenterSearchIndex["docs"]) + + "," + + JSON.stringify(documenterBaseURL) + + "," + + JSON.stringify(filters) + + ")"; + const worker_blob = new Blob([worker_str], { type: "text/javascript" }); + const worker = new Worker(URL.createObjectURL(worker_blob)); + + // Whether the worker is currently handling a search. This is a boolean + // as the worker only ever handles 1 or 0 searches at a time. + var worker_is_running = false; + + // The last search text that was sent to the worker. This is used to determine + // if the worker should be launched again when it reports back results. + var last_search_text = ""; + + // The results of the last search. This, in combination with the state of the filters + // in the DOM, is used compute the results to display on calls to update_search. + var unfiltered_results = []; + + // Which filter is currently selected + var selected_filter = ""; + + $(document).on("input", ".documenter-search-input", function (event) { + if (!worker_is_running) { + launch_search(); + } + }); -$(document).on("click", ".search-filter", function () { - if ($(this).hasClass("search-filter-selected")) { - selected_filter = ""; - } else { - selected_filter = $(this).text().toLowerCase(); + function launch_search() { + worker_is_running = true; + last_search_text = $(".documenter-search-input").val(); + worker.postMessage(last_search_text); } - // This updates search results and toggles classes for UI: - update_search(); -}); + worker.onmessage = function (e) { + if (last_search_text !== $(".documenter-search-input").val()) { + launch_search(); + } else { + worker_is_running = false; + } -/** - * Make/Update the search component - */ -function update_search() { - let querystring = $(".documenter-search-input").val(); + unfiltered_results = e.data; + update_search(); + }; - if (querystring.trim()) { - if (selected_filter == "") { - results = unfiltered_results; + $(document).on("click", ".search-filter", function () { + if ($(this).hasClass("search-filter-selected")) { + selected_filter = ""; } else { - results = unfiltered_results.filter((result) => { - return selected_filter == result.category.toLowerCase(); - }); + selected_filter = $(this).text().toLowerCase(); } - let search_result_container = ``; - let modal_filters = make_modal_body_filters(); - let search_divider = `
`; + // This updates search results and toggles classes for UI: + update_search(); + }); - if (results.length) { - let links = []; - let count = 0; - let search_results = ""; - - for (var i = 0, n = results.length; i < n && count < 200; ++i) { - let result = results[i]; - if (result.location && !links.includes(result.location)) { - search_results += result.div; - count++; - links.push(result.location); - } - } + /** + * Make/Update the search component + */ + function update_search() { + let querystring = $(".documenter-search-input").val(); - if (count == 1) { - count_str = "1 result"; - } else if (count == 200) { - count_str = "200+ results"; + if (querystring.trim()) { + if (selected_filter == "") { + results = unfiltered_results; } else { - count_str = count + " results"; + results = unfiltered_results.filter((result) => { + return selected_filter == result.category.toLowerCase(); + }); } - let result_count = `
${count_str}
`; - search_result_container = ` + let search_result_container = ``; + let modal_filters = make_modal_body_filters(); + let search_divider = `
`; + + if (results.length) { + let links = []; + let count = 0; + let search_results = ""; + + for (var i = 0, n = results.length; i < n && count < 200; ++i) { + let result = results[i]; + if (result.location && !links.includes(result.location)) { + search_results += result.div; + count++; + links.push(result.location); + } + } + + if (count == 1) { + count_str = "1 result"; + } else if (count == 200) { + count_str = "200+ results"; + } else { + count_str = count + " results"; + } + let result_count = `
${count_str}
`; + + search_result_container = ` +
+ ${modal_filters} + ${search_divider} + ${result_count} +
+ ${search_results} +
+
+ `; + } else { + search_result_container = `
${modal_filters} ${search_divider} - ${result_count} -
- ${search_results} -
-
+
0 result(s)
+ +
No result found!
`; - } else { - search_result_container = ` -
- ${modal_filters} - ${search_divider} -
0 result(s)
-
-
No result found!
- `; - } + } - if ($(".search-modal-card-body").hasClass("is-justify-content-center")) { - $(".search-modal-card-body").removeClass("is-justify-content-center"); - } + if ($(".search-modal-card-body").hasClass("is-justify-content-center")) { + $(".search-modal-card-body").removeClass("is-justify-content-center"); + } - $(".search-modal-card-body").html(search_result_container); - } else { - if (!$(".search-modal-card-body").hasClass("is-justify-content-center")) { - $(".search-modal-card-body").addClass("is-justify-content-center"); + $(".search-modal-card-body").html(search_result_container); + } else { + if (!$(".search-modal-card-body").hasClass("is-justify-content-center")) { + $(".search-modal-card-body").addClass("is-justify-content-center"); + } + + $(".search-modal-card-body").html(` +
Type something to get started!
+ `); } + } - $(".search-modal-card-body").html(` -
Type something to get started!
- `); + /** + * Make the modal filter html + * + * @returns string + */ + function make_modal_body_filters() { + let str = filters + .map((val) => { + if (selected_filter == val.toLowerCase()) { + return `${val}`; + } else { + return `${val}`; + } + }) + .join(""); + + return ` +
+ Filters: + ${str} +
`; } } -/** - * Make the modal filter html - * - * @returns string - */ -function make_modal_body_filters() { - let str = filters - .map((val) => { - if (selected_filter == val.toLowerCase()) { - return `${val}`; - } else { - return `${val}`; - } - }) - .join(""); - - return ` -
- Filters: - ${str} -
`; +function waitUntilSearchIndexAvailable() { + // It is possible that the documenter.js script runs before the page + // has finished loading and documenterSearchIndex gets defined. + // So we need to wait until the search index actually loads before setting + // up all the search-related stuff. + if (typeof documenterSearchIndex !== "undefined") { + runSearchMainCode(); + } else { + console.warn("Search Index not available, waiting"); + setTimeout(waitUntilSearchIndexAvailable, 1000); + } } +// The actual entry point to the search code +waitUntilSearchIndexAvailable(); + }) //////////////////////////////////////////////////////////////////////////////// require(['jquery'], function($) { diff --git a/dev/examples/index.html b/dev/examples/index.html index 3966ccd..e9d0fad 100644 --- a/dev/examples/index.html +++ b/dev/examples/index.html @@ -67,4 +67,4 @@ dimension_size = [num_stages, num_scenarios, num_blocks] # Merge the files -Quiver.merge(filename, filenames, Quiver.binary)
+Quiver.merge(filename, filenames, Quiver.binary)
diff --git a/dev/index.html b/dev/index.html index 7f67740..b6ae1ae 100644 --- a/dev/index.html +++ b/dev/index.html @@ -9,4 +9,4 @@ labels = ["agent_1", "agent_2", "agent_3"]

And the data is stored in a csv or binary file that contains the values of the time series. The csv format is as follows:

stage,scenario,block,agent_1,agent_2,agent_3
 1,1,1,1.0,1.0,1.0
 1,1,2,1.0,1.0,1.0
-1,1,3,1.0,1.0,1.0

Installation

pkg> add Quiver
+1,1,3,1.0,1.0,1.0

Installation

pkg> add Quiver
diff --git a/dev/objects.inv b/dev/objects.inv index cebd19049526497708bf9dbd8872a4ad96628482..5f28134c9bcff4e1149774a4b76ab550de430c63 100644 GIT binary patch delta 12 TcmaFK{E~TsBcu67r{#

Key Functions:

Quiver.goto!Function
goto!(reader::Reader; dims...)

This function moves the reader to the specified dimensions and returns the corresponding data. It updates the internal cache and retrieves the necessary time series values.

  • For binary files, goto! allows random access to any part of the time series, meaning you can jump between stages, scenarios, and blocks in any order. This provides greater flexibility for accessing specific points in the data.

  • For CSV files, goto! works differently. It only supports forward sequential access, meaning that while you can still navigate through stages, scenarios, and blocks, you cannot randomly jump to previous positions. The function moves forward through the file, reading data sequentially.

Parameters

  • reader::Reader: The time series reader.
  • dims...: Specific dimensions to move the reader to.

Returns

  • The data at the specified dimensions.

Simple Example:

data = goto!(reader, stage = 1, scenario = 2, block = 5)
source
Quiver.next_dimension!Function
next_dimension!(reader::Reader)

This function advances the reader to the next dimension and returns the updated data. It's useful when iterating over multiple dimensions sequentially. This function is especially useful for CSV files, where random access is not available. It allows for easy iteration through multiple dimensions in a forward-only manner.

Parameters

  • reader::Reader: The time series reader.

Returns

  • The data in the next dimension.

Simples Example:

next_data = next_dimension!(reader)
source
Quiver.file_to_arrayFunction
file_to_array(filename::String, implementation::Type{I}; labels_to_read::Vector{String} = String[]) where {I <: Implementation}

Reads a file and returns the data and metadata as a tuple.

Parameters

  • filename::String: The name of the file to be read.
  • implementation::Type{I}: The implementation type for reading the file (binary or CSV).
  • labels_to_read::Vector{String}: Specific labels to read (optional).

Returns

  • A tuple containing the read data and associated metadata.
source
Quiver.file_to_dfFunction
file_to_df(filename::String, implementation::Type{I}; labels_to_read::Vector{String} = String[]) where {I <: Implementation}

Reads a file and returns the data and metadata as a DataFrame.

Parameters

  • filename::String: The name of the file to be read.
  • implementation::Type{I}: The implementation type for reading the file (binary or CSV).
  • labels_to_read::Vector{String}: Specific labels to read (optional).

Returns

  • A DataFrame with the read data and metadata.
source

Closing the Reader:

Always close the reader when done to release resources.

Quiver.close!Function
close!(reader::Reader)

Closes the reader and releases associated resources.

Parameters

  • reader::Reader: The time series reader to close.

Returns

  • nothing.

Simple Example:

close!(reader)
source
+println(data)

Key Functions:

Quiver.goto!Function
goto!(reader::Reader; dims...)

This function moves the reader to the specified dimensions and returns the corresponding data. It updates the internal cache and retrieves the necessary time series values.

  • For binary files, goto! allows random access to any part of the time series, meaning you can jump between stages, scenarios, and blocks in any order. This provides greater flexibility for accessing specific points in the data.

  • For CSV files, goto! works differently. It only supports forward sequential access, meaning that while you can still navigate through stages, scenarios, and blocks, you cannot randomly jump to previous positions. The function moves forward through the file, reading data sequentially.

Parameters

  • reader::Reader: The time series reader.
  • dims...: Specific dimensions to move the reader to.

Returns

  • The data at the specified dimensions.

Simple Example:

data = goto!(reader, stage = 1, scenario = 2, block = 5)
source
Quiver.next_dimension!Function
next_dimension!(reader::Reader)

This function advances the reader to the next dimension and returns the updated data. It's useful when iterating over multiple dimensions sequentially. This function is especially useful for CSV files, where random access is not available. It allows for easy iteration through multiple dimensions in a forward-only manner.

Parameters

  • reader::Reader: The time series reader.

Returns

  • The data in the next dimension.

Simples Example:

next_data = next_dimension!(reader)
source
Quiver.file_to_arrayFunction
file_to_array(filename::String, implementation::Type{I}; labels_to_read::Vector{String} = String[]) where {I <: Implementation}

Reads a file and returns the data and metadata as a tuple.

Parameters

  • filename::String: The name of the file to be read.
  • implementation::Type{I}: The implementation type for reading the file (binary or CSV).
  • labels_to_read::Vector{String}: Specific labels to read (optional).

Returns

  • A tuple containing the read data and associated metadata.
source
Quiver.file_to_dfFunction
file_to_df(filename::String, implementation::Type{I}; labels_to_read::Vector{String} = String[]) where {I <: Implementation}

Reads a file and returns the data and metadata as a DataFrame.

Parameters

  • filename::String: The name of the file to be read.
  • implementation::Type{I}: The implementation type for reading the file (binary or CSV).
  • labels_to_read::Vector{String}: Specific labels to read (optional).

Returns

  • A DataFrame with the read data and metadata.
source

Closing the Reader:

Always close the reader when done to release resources.

Quiver.close!Function
close!(reader::Reader)

Closes the reader and releases associated resources.

Parameters

  • reader::Reader: The time series reader to close.

Returns

  • nothing.

Simple Example:

close!(reader)
source
diff --git a/dev/writing/index.html b/dev/writing/index.html index 8d81f14..cf09214 100644 --- a/dev/writing/index.html +++ b/dev/writing/index.html @@ -73,7 +73,7 @@ end # Close the writer -Quiver.close!(writer)source

Key Functions:

Key Functions:

Quiver.array_to_fileFunction
array_to_file(
     filename::String,
     data::Array{T, N},
     implementation::Type{I};
@@ -84,4 +84,4 @@
     initial_date::Union{String, DateTime} = "",
     unit::String = "",
     digits::Union{Int, Nothing} = nothing,
-) where {I <:Implementation, T, N}

Write a time series file in Quiver format.

Required arguments:

  • file_path::String: Path to file.
  • data::Array{T, N}: Data to be written.
  • implementation::Type{I}: Implementation to be used. It can be Quiver.csv or Quiver.binary.
  • dimensions::Vector{String}: Dimensions of the data.
  • labels::Vector{String}: Labels of the data.
  • time_dimension::String: Name of the time dimension.
  • dimension_size::Vector{Int}: Size of each dimension.
  • initial_date::Union{String, DateTime}: Initial date of the time series. If a string is provided, it should be in the format "yyyy-mm-ddTHH:MM:SS".

Optional arguments:

  • digits::Union{Int, Nothing}: Number of digits to round the data. If nothing is provided, the data is not rounded.
  • unit::String: Unit of the time series data.
source
+) where {I <:Implementation, T, N}

Write a time series file in Quiver format.

Required arguments:

Optional arguments:

source