INNER CODE UNIT · Python

luminance

ssebastianmag/hydrogen-wavefunctions · hwf_plots.py:188

    luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b
    qn_color = "#ffffff" if luminance < 0.5 else "#000000"
    qn_outline = "#000000" if qn_color == "#ffffff" else "#ffffff"

    ax.text(
        x=0.04, y=0.95, s=f"({wf.n}, {wf.l}, {wf.m})",
        transform=ax.transAxes, ha="left", va="top",
        fontsize=42, color=qn_color,
        path_effects=[patheffects.withStroke(linewidth=3.0, foreground=qn_outline)]
    )

    # Save and display figure
    ts = datetime.now().strftime("%Y%m%d%H%M%S")
    filename = f"({wf.n},{wf.l},{wf.m})_{ts}"
    plt.savefig(filename)
    plt.show()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…