1
0
mirror of https://github.com/kalmarek/SmallHyperbolic synced 2024-12-28 03:00:28 +01:00

add script to generate json

This commit is contained in:
Marek Kaluba 2022-01-17 22:36:58 +01:00
parent 9312637873
commit 9319fb2186
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
3 changed files with 77 additions and 0 deletions

30
data/Manifest.toml Normal file
View File

@ -0,0 +1,30 @@
# This file is machine-generated - editing it directly is not advised
julia_version = "1.7.1"
manifest_format = "2.0"
[[deps.Dates]]
deps = ["Printf"]
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
[[deps.JSON]]
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
git-tree-sha1 = "8076680b162ada2a031f707ac7b4953e30667a37"
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
version = "0.21.2"
[[deps.Mmap]]
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
[[deps.Parsers]]
deps = ["Dates"]
git-tree-sha1 = "92f91ba9e5941fc781fecf5494ac1da87bdac775"
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version = "2.2.0"
[[deps.Printf]]
deps = ["Unicode"]
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
[[deps.Unicode]]
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"

2
data/Project.toml Normal file
View File

@ -0,0 +1,2 @@
[deps]
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"

45
data/create_json.jl Normal file
View File

@ -0,0 +1,45 @@
using Pkg
Pkg.activate(@__DIR__)
using DelimitedFiles
using JSON
include(joinpath(@__DIR__, "parse_presentations.jl"))
include(joinpath(@__DIR__, "smallhyperbolicgrp.jl"))
all_grps_presentations =
let tables = [
joinpath(@__DIR__, f) for f in readdir(@__DIR__) if
isfile(joinpath(@__DIR__, f)) && endswith(f, ".txt")
]
mapreduce(parse_grouppresentations_abstract, union, tables) |> Dict
end
tr_grps =
let csvs = [
joinpath(@__DIR__, f) for f in readdir(@__DIR__) if
isfile(joinpath(@__DIR__, f)) && endswith(f, ".csv")
]
trGrps = map(csvs) do file
data = readdlm(file, '&')
labels = Symbol.(replace.(strip.(data[1, :]), ' ' => '_', '-' => '_'))
groups = data[2:end, :]
grps = map(enumerate(eachrow(groups))) do (i, props)
nt = (; (Symbol(l) => v for (l, v) in zip(labels, props))...)
@debug i, grp_name(nt)
P = all_grps_presentations[grp_name(nt)]
grp = TriangleGrp(P.generators, P.relations, nt)
latex_name(grp) => grp
end |> Dict
m = match(r".*_(\d)_(\d)_(\d).csv", basename(file))
@assert !isnothing(m)
type = parse.(Int, tuple(m[1], m[2], m[3]))
type => grps
end |> Dict
# Dict(name(G) => G for G in trGrps)
end
open(joinpath(@__DIR__, "triangle_groups.json"), "w") do io
JSON.print(io, tr_grps, 4)
end