Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • 9753e50
  • /
  • test_random.py
Raw File Download
Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge Iframe embedding
swh:1:cnt:1383c6be3e5a22468a35bfc2bc88a029d08201bc
directory badge Iframe embedding
swh:1:dir:9753e50b7268a47325aaba182ffb3074cc1a3a21
Citations

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
test_random.py
import time

from paraview import simple

import compare_diags
import gen_random
import main as compute_diags


def generate_explicit(inp, out, rs):
    # read random.vti
    rand = simple.XMLImageDataReader(FileName=inp)
    # compute order field
    arrprec = simple.TTKArrayPreconditioning(Input=rand)
    arrprec.PointDataArrays = ["RandomPointScalars"]
    # trash input scalar field, save order field
    pa = simple.PassArrays(Input=arrprec)
    pa.PointDataArrays = ["RandomPointScalars_Order"]
    # randomize scalar field?
    ir = simple.TTKIdentifierRandomizer(Input=pa)
    ir.ScalarField = ["POINTS", "RandomPointScalars_Order"]
    ir.RandomSeed = rs
    # tetrahedralize grid
    tetrah = simple.Tetrahedralize(Input=ir)

    # vtkUnstructuredGrid (TTK)
    simple.SaveData(out + ".vtu", proxy=tetrah)
    # Dipha Explicit Complex (Dipha)
    simple.SaveData(out + ".dipha", proxy=tetrah)


def main():
    fname = "random_order_sfnorm_expl"
    for i in range(0, 8):
        print(i)
        gen_random.main(4, "rand")
        ds = "datasets/" + fname
        generate_explicit("random.vti", ds, i)
        return
        tm = dict()
        tm[fname.split("/")[-1]] = dict()
        compute_diags.compute_ttk(ds + ".vtu", "ttkPersistenceDiagramCmd", tm)
        compute_diags.compute_dipha(ds + ".dipha", "build_dipha/dipha", tm)
        diag = "diagrams/" + fname
        compare_diags.main(diag + ".vtu", diag + ".dipha", True)
        time.sleep(2)


if __name__ == "__main__":
    main()

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Contact— JavaScript license information— Web API

back to top