Skip to main content

ImgMerlictPythonLogo

TestStatus PyPiStatus BlackStyle BlackPackStyle GPLv3LicenseBadge

More light than you can handle! Also: This is in beta state. Don’t judge me! Merlict would not exist without the author’s past and present affiliations:

  • Max-Planck-Institute for Nuclear Physics, Saupfercheckweg 1, 69117 Heidelberg, Germany :de:

  • Institute for Particle Physics and Astrophysics, ETH-Zurich, Otto-Stern-Weg 5, 8093 Zurich, Switzerland :switzerland:

  • Experimental Physics Vb, Astroparticle Physics, TU-Dortmund, Otto-Hahn-Str. 4a, 44227 Dortmund, Germany :de:

Install

pip install merlict

Minimal example

Load an existing scenery

import merlict
import importlib
from importlib import resources
import os

path = os.path.join(
    str(importlib.resources.files("merlict")),
    "tests",
    "resources",
    "segmented_reflector.tar"
)

sceneryPy = merlict.scenery.read_tar(path)

mli = merlict.compile(sceneryPy)
mli.view()

Query the intersection of rays with the scenery

rays = merlict.ray.init(size=1)  # only one ray for demonstration

rays["support.x"] = 0.3
rays["support.y"] = 0.1
rays["support.z"] = 2.3

rays["direction.x"] = 0
rays["direction.y"] = 0
rays["direction.z"] = -1

hits, intersections = mli.query_intersectionSurfaceNormal(rays)

if hits[0]:
    print("The ray intersects with the surface")
    print("of (object, face): ({:d}, {:d}),".format(
            intersections[0]["geometry_id.robj"],
            intersections[0]["geometry_id.face"],
        )
    )
    print("in distance: {:f},".format(intersections[0]["distance_of_ray"]))
    print("at position: ({:f}, {:f}, {:f}),".format(
            intersections[0]["position.x"],
            intersections[0]["position.y"],
            intersections[0]["position.z"],
        )
    )
    print("and with surface-normal: ({:f}, {:f}, {:f}).".format(
            intersections[0]["surface_normal.x"],
            intersections[0]["surface_normal.y"],
            intersections[0]["surface_normal.z"],
        )
    )
    print(
        "With respect to the frame "
        "of the intersected object the ray intersected"
    )
    print("at position: ({:f}, {:f}, {:f}),".format(
            intersections[0]["position_local.x"],
            intersections[0]["position_local.y"],
            intersections[0]["position_local.z"],
        )
    )
    print("and with surface-normal: ({:f}, {:f}, {:f}).".format(
            intersections[0]["surface_normal_local.x"],
            intersections[0]["surface_normal_local.y"],
            intersections[0]["surface_normal_local.z"],
        )
    )
else:
    print("The ray does not intersect with any surface.")

will yield

The ray intersects with the surface
of (object, face): (28, 35),
in distance: 2.287463,
at position: (0.300000, 0.100000, 0.012537),
and with surface-normal: (-0.075000, -0.025000, 0.996870).
With respect to the frame of the intersected object the ray intersected
at position: (0.009082, 0.044013, 0.000270),
and with surface-normal: (-0.002270, -0.011003, 0.999937).

Metadata

Release files for merlict 0.2.5.2.2.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for merlict 0.2.5.2.2.7
File Size Uploaded Provenance
merlict-0.2.5.2.2.7.tar.gz 308.0 kB Without provenance Details

Release files / merlict-0.2.5.2.2.7.tar.gz

Download URL merlict-0.2.5.2.2.7.tar.gz
Size 308.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c3f98b108c5eefdf07f938f4ebf3d65d866d4ed7c1f1bec4fb7c4a0f71a5fe55
BLAKE2b-256 checksum
How to use checksums
27f2be086d310db31d423c076778191531354f9039b66eca567bd1c77a5bb869
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Security for merlict 0.2.5.2.2.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page