Skip to content

Commit

Permalink
Merge branch 'allAustria' of github.com:vitelot/training into allAustria
Browse files Browse the repository at this point in the history
  • Loading branch information
snehal-shekatkar committed Nov 6, 2023
2 parents aeb3354 + 87091bb commit 04925b5
Show file tree
Hide file tree
Showing 9 changed files with 316 additions and 149 deletions.
20 changes: 6 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,18 @@
# environment.
# Manifest.toml

# my things
vari
out*
.DS_Store
# data/*.csv
# data/*.gz
# data/OeBB
# data/data_password
p?pp*
*.ini
# hidden_data/
# scripts/help.txt
*.pdf
*.csv
*.dat
*.agr
*.png
*.zip
data/
old/
.vscode/

# Simone things
# data/img
# data/delays
# postprocessing # commented by Vito
preprocessing/trainIni.in
preprocessing/train_starts.ipynb
map/
15 changes: 5 additions & 10 deletions configuration/configure.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,8 @@ configure.jl
OLD README, must be changed
Input:
1) a csv file with the daily PAD Zuglaufdaten as provided by OeBB
2) a csv file with the preprocessed xml containing the yearly scheduled timetable
3) a csv file with the blocks found from the RINF data: "rinf-blocks.csv"
4) a csv file with the operational points determined from RINF: "rinf-OperationalPoints.csv"
outfile = "blocks.csv"
Output:
1) a csv file with the timetable to use in the simulation: "timetable.csv"
2) a csv file with the list of blocks for the simulation: "blocks.csv"
3) a csv file with the list of operational points with more than one track (stations, junctions)
- an intermediate file "blocks-xml-YEAR.csv" distilled from RINF and XML
Description:
The task of this script is to cure the many issues present in data.
Expand Down Expand Up @@ -91,7 +83,7 @@ source_path::String = parsed_args["source_data_path"]
target_path::String = parsed_args["target_data_path"]
nr_exo_delays::Int = parsed_args["exo_delays"];
delays_only::Bool = parsed_args["delays_only"];
# use_real_time = parsed_args["use_real_time"];
use_real_time = parsed_args["use_real_time"];
find_rotations::Bool = parsed_args["rotations"];
pad_schedule::Bool = parsed_args["pad_schedule"];
select_line::String = parsed_args["select_line"];
Expand Down Expand Up @@ -173,6 +165,9 @@ function loadPAD(file::String)::DataFrame
types = String,
skipto = 2) |> DataFrame;

# use a dirty trick to work with real time instead of scheduled
use_real_time && rename!(bigpad, :scheduledtime => :unusedtime, :realtime => :scheduledtime);

dropmissing!(bigpad, :scheduledtime);
filter!(x->length(x.scheduledtime)>0, bigpad );

Expand Down
5 changes: 3 additions & 2 deletions configuration/exo_delays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ function SampleExoDelays(
@info "\tLoading data."

dfn=DataFrame(CSV.File(fileNdelay, select=[:number]));
dftbl=DataFrame(CSV.File(fileTimetable, select=[:trainid])); # Or Mon, Tue, ... Or timetable
dftbl=DataFrame(CSV.File(fileTimetable, select=[:trainid, :bst])); # Or Mon, Tue, ... Or timetable
trains=unique(dftbl.trainid);
ops = unique(dftbl.bst);

df=DataFrame(CSV.File(fileDelayList));

Expand All @@ -72,7 +73,7 @@ function SampleExoDelays(
sample_row_idxs = rand(1:dfnrow, effective_n); # It samples n rows
dfout = df[sample_row_idxs, :];
unique!(dfout);
filter!(x-> x.trainid trains, dfout);
filter!(x-> (x.trainid trains)&&(x.block ops), dfout); # REMINDER: check when there is a blk instead of a station
@info "\tFile nr $i, $n delays required, $(nrow(dfout)) delays created instead ($(round(Int,100*nrow(dfout)/n))%)";
sequence = lpad(i,4,"0");
outfile = "$(baseoutfile)_$sequence" * "$extension";
Expand Down
7 changes: 3 additions & 4 deletions configuration/parser.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ function parse_commandline()
help = "Skip *ALL* the configuration actions except the sampling of delays."
action = :store_true


# "--use_real_time"
# help = "Use the real time column of the PAD timetable instead of the scheduled time."
# action = :store_true
"--use_real_time"
help = "Use the real time column of the PAD timetable instead of the scheduled time."
action = :store_true

"--pad_schedule"
help = "Use the scheduled time in the PAD file instead of the scheduled time found in XML."
Expand Down
112 changes: 52 additions & 60 deletions environment/Manifest.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is machine-generated - editing it directly is not advised

julia_version = "1.9.2"
julia_version = "1.9.3"
manifest_format = "2.0"
project_hash = "af233d7f8b553209c7409fda7c02d46300d5c3ee"

Expand Down Expand Up @@ -33,15 +33,15 @@ version = "0.10.11"

[[deps.CodecZlib]]
deps = ["TranscodingStreams", "Zlib_jll"]
git-tree-sha1 = "9c209fb7536406834aa938fb149964b985de6c83"
git-tree-sha1 = "cd67fc487743b2f0fd4380d4cbd3a24660d0eec8"
uuid = "944b1d66-785c-5afd-91f1-9de20f533193"
version = "0.7.1"
version = "0.7.3"

[[deps.Compat]]
deps = ["UUIDs"]
git-tree-sha1 = "4e88377ae7ebeaf29a047aa1ee40826e0b708a5d"
git-tree-sha1 = "8a62af3e248a8c4bad6b32cbbe663ae02275e32c"
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
version = "4.7.0"
version = "4.10.0"
weakdeps = ["Dates", "LinearAlgebra"]

[deps.Compat.extensions]
Expand All @@ -54,9 +54,9 @@ version = "1.0.5+0"

[[deps.ConcurrentUtilities]]
deps = ["Serialization", "Sockets"]
git-tree-sha1 = "96d823b94ba8d187a6d8f0826e731195a74b90e9"
git-tree-sha1 = "5372dbbf8f0bdb8c700db5367132925c0771ef7e"
uuid = "f0e56b4a-5159-44fe-b623-3e5288b988bb"
version = "2.2.0"
version = "2.2.1"

[[deps.Coverage]]
deps = ["CoverageTools", "HTTP", "JSON", "LibGit2", "MbedTLS"]
Expand All @@ -80,16 +80,16 @@ uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
version = "1.15.0"

[[deps.DataFrames]]
deps = ["Compat", "DataAPI", "Future", "InlineStrings", "InvertedIndices", "IteratorInterfaceExtensions", "LinearAlgebra", "Markdown", "Missings", "PooledArrays", "PrettyTables", "Printf", "REPL", "Random", "Reexport", "SentinelArrays", "SnoopPrecompile", "SortingAlgorithms", "Statistics", "TableTraits", "Tables", "Unicode"]
git-tree-sha1 = "aa51303df86f8626a962fccb878430cdb0a97eee"
deps = ["Compat", "DataAPI", "DataStructures", "Future", "InlineStrings", "InvertedIndices", "IteratorInterfaceExtensions", "LinearAlgebra", "Markdown", "Missings", "PooledArrays", "PrecompileTools", "PrettyTables", "Printf", "REPL", "Random", "Reexport", "SentinelArrays", "SortingAlgorithms", "Statistics", "TableTraits", "Tables", "Unicode"]
git-tree-sha1 = "04c738083f29f86e62c8afc341f0967d8717bdb8"
uuid = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
version = "1.5.0"
version = "1.6.1"

[[deps.DataStructures]]
deps = ["Compat", "InteractiveUtils", "OrderedCollections"]
git-tree-sha1 = "cf25ccb972fec4e4817764d01c82386ae94f77b4"
git-tree-sha1 = "3dbd312d370723b6bb43ba9d02fc36abade4518d"
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
version = "0.18.14"
version = "0.18.15"

[[deps.DataValueInterfaces]]
git-tree-sha1 = "bfc1187b79289637fa0ef6d4436ebdfe6905cbd6"
Expand All @@ -113,28 +113,22 @@ version = "0.1.9"

[[deps.FilePathsBase]]
deps = ["Compat", "Dates", "Mmap", "Printf", "Test", "UUIDs"]
git-tree-sha1 = "e27c4ebe80e8699540f2d6c805cc12203b614f12"
git-tree-sha1 = "9f00e42f8d99fdde64d40c8ea5d14269a2e2c1aa"
uuid = "48062228-2e41-5def-b9a4-89aafe57970f"
version = "0.9.20"
version = "0.9.21"

[[deps.FileWatching]]
uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"

[[deps.Formatting]]
deps = ["Printf"]
git-tree-sha1 = "8339d61043228fdd3eb658d86c926cb282ae72a8"
uuid = "59287772-0a20-5a39-b81b-1366585eb4c0"
version = "0.4.2"

[[deps.Future]]
deps = ["Random"]
uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820"

[[deps.HTTP]]
deps = ["Base64", "CodecZlib", "ConcurrentUtilities", "Dates", "ExceptionUnwrapping", "Logging", "LoggingExtras", "MbedTLS", "NetworkOptions", "OpenSSL", "Random", "SimpleBufferStream", "Sockets", "URIs", "UUIDs"]
git-tree-sha1 = "7f5ef966a02a8fdf3df2ca03108a88447cb3c6f0"
git-tree-sha1 = "5eab648309e2e060198b45820af1a37182de3cce"
uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3"
version = "1.9.8"
version = "1.10.0"

[[deps.InlineStrings]]
deps = ["Parsers"]
Expand All @@ -157,10 +151,10 @@ uuid = "82899510-4779-5014-852e-03e436cf321d"
version = "1.0.0"

[[deps.JLLWrappers]]
deps = ["Preferences"]
git-tree-sha1 = "abc9885a7ca2052a736a600f7fa66209f96506e1"
deps = ["Artifacts", "Preferences"]
git-tree-sha1 = "7e5d6779a1e09a36db2a7b6cff50942a0a7d0fca"
uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210"
version = "1.4.1"
version = "1.5.0"

[[deps.JSON]]
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
Expand Down Expand Up @@ -204,9 +198,9 @@ uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"

[[deps.LoggingExtras]]
deps = ["Dates", "Logging"]
git-tree-sha1 = "cedb76b37bc5a6c702ade66be44f831fa23c681e"
git-tree-sha1 = "c1dd6d7978c12545b4179fb6153b9250c96b0075"
uuid = "e6f89c97-d47a-5376-807f-9c37f3926c36"
version = "1.0.0"
version = "1.0.3"

[[deps.Markdown]]
deps = ["Base64"]
Expand Down Expand Up @@ -253,20 +247,20 @@ version = "1.4.1"

[[deps.OpenSSL_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "cae3153c7f6cf3f069a853883fd1919a6e5bab5b"
git-tree-sha1 = "ceeda72c9fd6bbebc4f4f598560789145a8b6c4c"
uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95"
version = "3.0.9+0"
version = "3.0.11+0"

[[deps.OrderedCollections]]
git-tree-sha1 = "d321bf2de576bf25ec4d3e4360faca399afca282"
git-tree-sha1 = "2e73fe17cac3c62ad1aebe70d44c963c3cfdc3e3"
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
version = "1.6.0"
version = "1.6.2"

[[deps.Parsers]]
deps = ["Dates", "PrecompileTools", "UUIDs"]
git-tree-sha1 = "4b2e829ee66d4218e0cef22c0a64ee37cf258c29"
git-tree-sha1 = "716e24b21538abc91f6205fd1d8363f39b442851"
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version = "2.7.1"
version = "2.7.2"

[[deps.Pkg]]
deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
Expand All @@ -275,32 +269,32 @@ version = "1.9.2"

[[deps.PooledArrays]]
deps = ["DataAPI", "Future"]
git-tree-sha1 = "a6062fe4063cdafe78f4a0a81cfffb89721b30e7"
git-tree-sha1 = "36d8b4b899628fb92c2749eb488d884a926614d3"
uuid = "2dfb63ee-cc39-5dd5-95bd-886bf059d720"
version = "1.4.2"
version = "1.4.3"

[[deps.PrecompileTools]]
deps = ["Preferences"]
git-tree-sha1 = "9673d39decc5feece56ef3940e5dafba15ba0f81"
git-tree-sha1 = "03b4c25b43cb84cee5c90aa9b5ea0a78fd848d2f"
uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
version = "1.1.2"
version = "1.2.0"

[[deps.Preferences]]
deps = ["TOML"]
git-tree-sha1 = "7eb1686b4f04b82f96ed7a4ea5890a4f0c7a09f1"
git-tree-sha1 = "00805cd429dcb4870060ff49ef443486c262e38e"
uuid = "21216c6a-2e73-6563-6e65-726566657250"
version = "1.4.0"
version = "1.4.1"

[[deps.PrettyPrint]]
git-tree-sha1 = "632eb4abab3449ab30c5e1afaa874f0b98b586e4"
uuid = "8162dcfd-2161-5ef2-ae6c-7681170c5f98"
version = "0.2.0"

[[deps.PrettyTables]]
deps = ["Crayons", "Formatting", "LaTeXStrings", "Markdown", "Reexport", "StringManipulation", "Tables"]
git-tree-sha1 = "213579618ec1f42dea7dd637a42785a608b1ea9c"
deps = ["Crayons", "LaTeXStrings", "Markdown", "Printf", "Reexport", "StringManipulation", "Tables"]
git-tree-sha1 = "6842ce83a836fbbc0cfeca0b5a4de1a4dcbdb8d1"
uuid = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
version = "2.2.4"
version = "2.2.8"

[[deps.Printf]]
deps = ["Unicode"]
Expand Down Expand Up @@ -337,20 +331,14 @@ git-tree-sha1 = "874e8867b33a00e784c8a7e4b60afe9e037b74e1"
uuid = "777ac1f9-54b0-4bf8-805c-2214025038e7"
version = "1.1.0"

[[deps.SnoopPrecompile]]
deps = ["Preferences"]
git-tree-sha1 = "e760a70afdcd461cf01a575947738d359234665c"
uuid = "66db9d55-30c0-4569-8b51-7e840670fc0c"
version = "1.0.3"

[[deps.Sockets]]
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"

[[deps.SortingAlgorithms]]
deps = ["DataStructures"]
git-tree-sha1 = "c60ec5c62180f27efea3ba2908480f8055e17cee"
git-tree-sha1 = "5165dfb9fd131cf0c6957a3a7605dede376e7b63"
uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c"
version = "1.1.1"
version = "1.2.0"

[[deps.SparseArrays]]
deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"]
Expand All @@ -362,9 +350,10 @@ uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
version = "1.9.0"

[[deps.StringManipulation]]
git-tree-sha1 = "46da2434b41f41ac3594ee9816ce5541c6096123"
deps = ["PrecompileTools"]
git-tree-sha1 = "a04cabe79c5f01f4d723cc6704070ada0b9d46d5"
uuid = "892a3eda-7b42-436c-8928-eab12a02cf0e"
version = "0.3.0"
version = "0.3.4"

[[deps.SuiteSparse_jll]]
deps = ["Artifacts", "Libdl", "Pkg", "libblastrampoline_jll"]
Expand All @@ -383,10 +372,10 @@ uuid = "3783bdb8-4a98-5b6b-af9a-565f29a5fe9c"
version = "1.0.1"

[[deps.Tables]]
deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "LinearAlgebra", "OrderedCollections", "TableTraits", "Test"]
git-tree-sha1 = "1544b926975372da01227b382066ab70e574a3ec"
deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "LinearAlgebra", "OrderedCollections", "TableTraits"]
git-tree-sha1 = "cb76cf677714c095e535e3501ac7954732aeea2d"
uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
version = "1.10.1"
version = "1.11.1"

[[deps.Tar]]
deps = ["ArgTools", "SHA"]
Expand All @@ -403,15 +392,18 @@ uuid = "b718987f-49a8-5099-9789-dcd902bef87d"
version = "1.0.1"

[[deps.TranscodingStreams]]
deps = ["Random", "Test"]
git-tree-sha1 = "9a6ae7ed916312b41236fcef7e0af564ef934769"
git-tree-sha1 = "49cbf7c74fafaed4c529d47d48c8f7da6a19eb75"
uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"
version = "0.9.13"
version = "0.10.1"
weakdeps = ["Random", "Test"]

[deps.TranscodingStreams.extensions]
TestExt = ["Test", "Random"]

[[deps.URIs]]
git-tree-sha1 = "074f993b0ca030848b897beff716d93aca60f06a"
git-tree-sha1 = "67db6cc7b3821e19ebe75791a9dd19c9b1188f2b"
uuid = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4"
version = "1.4.2"
version = "1.5.1"

[[deps.UUIDs]]
deps = ["Random", "SHA"]
Expand Down
12 changes: 12 additions & 0 deletions postprocessing/csv2dat.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using DataFrames,CSV;

filelist = readdir(".");
filter!(endswith(".csv"), filelist);

for file in filelist
# file = filelist[1]
df = CSV.read(file, DataFrame);
outfile = splitext(file)[1]*".dat";
CSV.write(outfile, df, header=false, delim=" ");
end

Loading

0 comments on commit 04925b5

Please sign in to comment.