#!/usr/bin/env python3
# Baalbek megalith mass recomputation, used on truthinstone.com
# Published by Truth in Stone (https://truthinstone.com/claims/baalbek-megaliths-pre-roman/).
# License: CC0 1.0 Universal. https://creativecommons.org/publicdomain/zero/1.0/
"""
Mass = volume x density. Blocks are treated as rectangular prisms, except the Stone of the Pregnant Woman,
whose published cross-section is a trapezoid (4 m wide at the base, 4.14-5.29 m at the top).
Densities: 2.6-2.7 t/m3 is typical for compact limestone; 2.8 t/m3 is shown as an upper bound because
the 1999 Linz survey reportedly used 2.6-2.8 g/cm3. 1 g/cm3 = 1 t/m3.
Dimension sources:
  * 2014 block: DAI press release, 21 Nov 2014 (19.60 m x 6 m x at least 5.5 m; 'about 1,650 t').
  * Stone of the Pregnant Woman and 'Stone of the South' (1990s block): Ruprechtsberger (1999), Linzer
    Archaeologische Forschungen 30, p. 15 and p. 17, as summarised in secondary sources (not seen first-hand).
    An archived 1990s Linz project page gives 20 x 5 x 4.6 m for the second block.
  * Trilithon: Lohmann (2010), Bollettino di Archeologia on line, '4 by 4 by 20 meters' (rounded);
    commonly quoted 19 x 4.2 x 3.6 m (not traced to a primary survey).
"""
DENS = (2.6, 2.7, 2.8)
blocks = [
 # name, quoted tonnes, list of (label, volume m3)
 ("2014 block (DAI), height at least 5.5 m", "about 1,650", [("19.6 x 6 x 5.5 m (minimum)", 19.6*6*5.5)]),
 ("Stone of the Pregnant Woman (Hajjar al-Hibla)", "about 1,000", [
     ("smallest: 20.31 m long, trapezoid 4.00/4.14 m wide, 4.21 m high", 20.31*(4.00+4.14)/2*4.21),
     ("middle: 20.5 m, 4.00/4.70 m, 4.27 m", 20.5*(4.00+4.70)/2*4.27),
     ("largest: 20.76 m, 4.00/5.29 m, 4.32 m", 20.76*(4.00+5.29)/2*4.32)]),
 ("'Stone of the South' (found 1990s)", "about 1,242", [
     ("smallest: 19.5 x 4.34 x 4.5 m", 19.5*4.34*4.5),
     ("largest: 20.5 x 4.56 x 4.5 m", 20.5*4.56*4.5),
     ("archived Linz page: 20 x 5 x 4.6 m", 20*5*4.6)]),
 ("Trilithon block (each)", "750-800", [
     ("commonly quoted 19 x 4.2 x 3.6 m", 19*4.2*3.6),
     ("Lohmann rounded 20 x 4 x 4 m", 20*4*4)]),
]
if __name__ == "__main__":
    print(f"{'block / dimensions':62s} {'m3':>7s} " + " ".join(f"{d} t/m3".rjust(10) for d in DENS) + "  quoted")
    for name, quoted, vs in blocks:
        print(name)
        for lab, v in vs:
            print(f"   {lab:59s} {v:7.0f} " + " ".join(f"{v*d:10,.0f}" for d in DENS) + f"  {quoted}")
    v = 19.6*6*5.5
    print(f"\nDensity implied by 1,650 t for the minimum 2014-block volume: {1650/v:.2f} t/m3")
    print(f"Density implied by 1,242 t for 20 x 5 x 4.6 m: {1242/(20*5*4.6):.2f} t/m3;"
          f" for the largest 19.5-20.5 x 4.34-4.56 x 4.5 m box: {1242/(20.5*4.56*4.5):.2f} t/m3")
