Přejít k hlavnímu obsahu

Qwen3.8-27B (UD-Q3_K_XL 128K)

Alibaba (Qwen)

https://huggingface.co/Qwen/Qwen3.8-27B

O modelu

Qwen3.8-27B je 27miliardový dense VLM model (text + kód + obraz/video) s hybridní lineární pozorností (Gated DeltaNet) — jen 16 z 64 vrstev má plnou attention, takže KV cache roste 4x pomaleji. Testováno v kvantizaci Unsloth Dynamic 3.0 UD-Q3_K_XL (13,15 GB) přes llama.cpp s kontextem 128K na jedné kartě RTX 5060 Ti 16GB.

Poznámka admina

llama.cpp, --cache-type-k/v q4_0, flash attention, reasoning off, bez MTP

Schopnosti

✅ Text 💻 Kód 🖼 Obrázek 🎬 Video

Technické specifikace

Parameters 27B
Quantization UD-Q3_K_XL (Dynamic 3.0)
Context window 131072
Architecture dense (hybrid linear attention / Gated DeltaNet)

Hardware pro testy

CPUAMD Ryzen
GPUNVIDIA RTX 5060 Ti 16GB
RAM39 GB DDR5
OSUbuntu 24.04 LTS

Výsledky testů

Test Run Tokens/s TTFT (ms) Délka (s) Tokeny GPU VRAM Processor Teplota Kvalita Datum Výstup
Anglický článek #1 27.07 492 116.4 3152 15051 MB {"engine": "llama.cpp", "gpu": "RTX 5060 Ti 16GB", "quant": "UD-Q3_K_XL", "source": "live :8080"} 78 °C 8/10 21.09.2026
Český článek #1 27.09 540 117.0 3170 15051 MB {"engine": "llama.cpp", "gpu": "RTX 5060 Ti 16GB", "quant": "UD-Q3_K_XL", "source": "live :8080"} 78 °C 5/10 21.09.2026
Python galaxie #1 26.99 495 151.7 4096 15049 MB {"engine": "llama.cpp", "gpu": "RTX 5060 Ti 16GB", "quant": "UD-Q3_K_XL", "source": "live :8080"} 77 °C 6/10 21.09.2026
HTML/JS animace #1 27.10 462 151.2 4096 15049 MB {"engine": "llama.cpp", "gpu": "RTX 5060 Ti 16GB", "quant": "UD-Q3_K_XL", "source": "live :8080"} 75 °C 2/10 21.09.2026
PHP Drupal modul #1 27.60 467 55.3 1525 15047 MB {"engine": "llama.cpp", "gpu": "RTX 5060 Ti 16GB", "quant": "UD-Q3_K_XL", "source": "live :8080"} 69 °C 7/10 21.09.2026

Vygenerované výstupy

Anglický článek Run #1 · 3152 tok · 27.1 tok/s
# The Silicon Lab: How AI is Rewriting the Rules of Scientific Discovery in 2026

**Perex**
The scientific method, once defined by the slow, meticulous accumulation of data and the human capacity to spot patterns in noise, has undergone a fundamental paradigm shift. By 2026, artificial intelligence has moved beyond the role of a computational assistant to become a co-creator of knowledge, capable of generating hypotheses, designing experiments, and interpreting results at a scale and speed that defies traditional human cognition. This is no longer a future projection; it is the current reality of laboratories from Boston to Beijing, where algorithms are solving problems that were considered intractable just a decade ago. As we stand in the mid-2020s, the integration of AI into core scientific disciplines—ranging from drug discovery and climate science to particle physics and genomics—has not merely accelerated research; it has altered the very definition of what is scientifically possible.

### Introduction: The End of the Bottleneck

For centuries, the primary bottleneck in scientific research was not the lack of curiosity or the absence of funding, but the sheer volume of data required to validate a hypothesis. In the pre-digital age, a single experiment might yield a handful of data points. In the era of Big Data, a single genomics run produces terabytes of information. For decades, the scientific community struggled to bridge the gap between data generation and data interpretation. We had more answers than we had questions, and more noise than signal.

In 2026, that bottleneck has been shattered. The integration of Large Scientific Models (LSMs)—evolved versions of the large language models that transformed software development and creative arts—has allowed researchers to navigate this data ocean with unprecedented clarity. AI is no longer just a tool for crunching numbers; it is an engine for discovery. It predicts protein structures with near-perfect accuracy, simulates climate scenarios that would take supercomputers centuries to calculate, and identifies subatomic patterns in particle collision data that human eyes could never perceive.

However, this transformation is not without its complexities. The relationship between the human scientist and the AI is evolving into a symbiotic partnership. The scientist provides the context, the ethical framework, and the "why," while the AI provides the scale, the speed, and the "how." This article explores the concrete manifestations of this shift in 2026, examining how AI is reshaping four critical pillars of modern science: drug discovery, climate modeling, particle physics, and genomics. We will look at the specific breakthroughs that have defined this year, the methodologies that have matured, and the future challenges that lie ahead as we push the boundaries of human knowledge further.

### The Alchemy of Cures: AI in Drug Discovery

If any field has been most visibly transformed by AI in the last five years, it is pharmaceutical science. The traditional drug discovery process is notoriously inefficient and expensive. It takes approximately 10 to 15 years to bring a new drug to market, with an average cost exceeding $2 billion. The failure rate is high; for every drug that reaches the clinic, thousands of candidate molecules are discarded. In 2026, AI has not eliminated these hurdles, but it has drastically reduced them, turning a decade-long slog into a process measured in months.

The breakthrough in 2026 is not merely in generating molecular structures, but in predicting their biological behavior with high fidelity. Generative AI models, trained on vast libraries of chemical compounds, biological pathways, and clinical trial data, can now design novel molecules from scratch that are optimized for efficacy, safety, and manufacturability. These are not just variations of existing drugs; they are entirely new chemical entities tailored to specific protein targets.

One of the most significant developments this year has been the maturation of "closed-loop" drug discovery systems. In these setups, AI models suggest a candidate molecule, which is then synthesized and tested by robotic laboratories. The results are fed back into the AI, which refines its next suggestion. This iterative process has allowed researchers to discover lead compounds for rare diseases in a fraction of the time previously required. For instance, a consortium of biotech firms and academic institutions successfully identified a novel inhibitor for a previously "undruggable" target in chronic inflammatory disorders. The AI had identified a pocket in the protein structure that traditional computational methods had missed due to its flexibility. The subsequent clinical trials, which began in early 2026, showed promising early-stage results, validating the AI’s structural predictions.

Furthermore, AI is revolutionizing patient stratification in clinical trials. Historically, clinical trials recruited broad populations, often diluting the effectiveness of a drug that might work well for a specific genetic subgroup. In 2026, AI-driven analytics analyze patient history, genetic profiles, and biomarker data to predict which individuals are most likely to respond to a therapy. This precision has not only improved trial success rates but also accelerated the approval process by providing regulators with clearer evidence of efficacy in specific populations. The result is a healthcare landscape where personalized medicine is no longer a niche concept but a standard of care, driven largely by the predictive power of artificial intelligence.

### Reading the Weather: AI in Climate Modeling

Climate science has always been a battle against computational limits. The atmosphere, oceans, and cryosphere are chaotic systems governed by complex, non-linear equations. Traditional climate models, while robust, rely on coarse grids and simplified parameterizations of physical processes. This limits their ability to predict regional weather patterns and extreme events with high accuracy. In 2026, the integration of deep learning into climate modeling has begun to address these limitations, offering a new lens through which we can view our planet’s future.

The key innovation this year is the hybrid approach, where AI models are trained on decades of high-resolution observational data to learn the complex relationships between atmospheric variables. These AI-based models can simulate weather patterns at resolutions far finer than traditional supercomputers can achieve, while running orders of magnitude faster. This allows for the generation of ensemble forecasts that provide not just a single prediction, but a probability distribution of possible outcomes.

A concrete example of this impact is seen in the prediction of extreme heatwaves and rainfall events. In 2026, AI-driven climate models provided early warnings for severe flooding in Southeast Asia and drought conditions in the Mediterranean region with a lead time of several weeks longer than traditional models. This increased lead time is critical for disaster preparedness, allowing governments and communities to deploy resources more effectively. Moreover, AI is being used to optimize the placement of renewable energy infrastructure. By analyzing wind patterns, solar irradiance, and grid demand in real-time, AI systems are maximizing the efficiency of energy storage and distribution, playing a crucial role in the global transition to sustainable energy.

However, the implications extend beyond weather forecasting. AI is now being used to model the complex feedback loops between the carbon cycle, ocean acidification, and biodiversity loss. These models can simulate the impact of different policy interventions, such as carbon taxes or reforestation efforts, on long-term climate trajectories. This capability is invaluable for policymakers, who can now see the potential outcomes of their decisions with greater clarity. The AI does not make the moral choices, but it provides the empirical foundation upon which those choices are made, helping humanity navigate the most urgent challenge of our time.

### Seeing the Unseen: AI in Particle Physics

At the frontier of fundamental physics, where we probe the smallest scales of the universe, AI is serving as a detective, sifting through petabytes of data to find the needles in the haystack of particle collisions. At facilities like the Large Hadron Collider (LHC) and its successor projects, the amount of data generated is staggering. Traditional analysis methods, relying on human-defined thresholds and filters, often miss subtle signals or discard potentially significant events as noise.

In 2026, machine learning algorithms are used to reconstruct particle tracks and identify rare events with unprecedented accuracy. These algorithms are trained on simulated data that mimics the complex signatures of particle interactions. They can distinguish between background noise and signal events that may indicate new physics, such as the presence of dark matter particles or supersymmetric partners.

A notable breakthrough this year involved the use of AI to analyze anomalies in the decay of B-mesons. While the initial signals were subtle and buried within statistical fluctuations, AI models identified a pattern that suggested a deviation from the Standard Model of particle physics. This led to a targeted re-analysis of the data, which confirmed a small but statistically significant anomaly. While not yet a discovery of new particles, this event highlights the power of AI to detect signals that might otherwise be overlooked. It has sparked a new wave of theoretical research, with physicists exploring new frameworks to explain the anomaly.

Additionally, AI is playing a crucial role in the design of next-generation detectors. By simulating the performance of different detector geometries and materials, AI can optimize their desi
Český článek Run #1 · 3170 tok · 27.1 tok/s
# Algoritmus u katedry: Jak umělá inteligence přepisuje pravidla českého školství

Umělá inteligence přestává být jen futuristickou výzvou pro vědce v laboratořích a stává se každodenním společníkem v českých třídách, učebnicích i na ministerstvu školství. Zatímco ještě před dvěma lety jsme debatovali o tom, zda AI do škol vůbec patří, dnes řešíme, jak ji efektivně a eticky integrovat do procesu výuky, aby se stala nástrojem pro posílení lidského potenciálu, nikoliv jeho náhradou.

České školství, tradičně postavené na pevných strukturách a pedagogické autoritě, čelí zásadní transformaci. AI nástroje, od chytrých asistentů, které pomáhají učitelům s administrativou, po personalizované učební platformy, které se přizpůsobují tempu každého žáka, nabízejí možnost překonat stáří aktuálního modelu „jedna velikost pro všechny“. Tento článek se podívá na konkrétní příklady využití, analyzuje reálné výhody i skrytá rizika a nakoukne do budoucnosti, která se blíží rychleji, než si mnozí pedagogové a rodiče přejí.

## Od administrativy k pedagogice: Uvolnění času pro to podstatné

Jedním z největších, často podceňovaných problémů českého školství je administrativní zátěž, která učitelům krade čas, který by měli věnovat přímo žákům. Zde nachází umělá inteligence své nejpřímější a nejméně kontroverzní uplatnění. Moderní AI nástroje, postavené na velkých jazykových modelech (LLM), jsou schopny zpracovat obrovské množství textových dat v okamžiku.

V praxi to znamená, že učitel může zadat do systému osnovy hodiny a AI mu během minut vygeneruje návrh interaktivní lekce, vytvoří pracovní listy s různou obtížností, nebo dokonce připraví materiály pro žáky s specifickými vzdělávacími potřebami. Například nástroje založené na technologiích, jako jsou ty od společnosti Microsoft nebo specializované edtech startupy, již dnes umožňují automatické generování testů a kvízů. Učitel nemusí již ručně přepisovat otázky z učebnice do formátu, který je vhodný pro digitální platformu. AI to provede za něj a navíc mu nabídne variace, které by člověk nemusel přijít na mysl.

Dalším klíčovým aspektem je podpora ve vyhodnocování. Ačkoli plné nahrazení lidského úsudku není možné, AI může pomáhat s první úrovní feedbacku. Učitel angličtiny může pomocí AI nástroje analyzovat gramatické chyby v esejích desítek studentů najednou. AI vyznačí chyby a vysvětlí, proč daná konstrukce je nevhodná, zatímco učitel se pak soustředí na stylistiku, argumentaci a hlubší obsahovou stránku textu. Tento posun od „kontrolora pravopisu“ k „mentoru myšlení“ je zásadní. Učitel získává zpět hodiny týdně, které dříve strávil kopírováním, tiskem a základním opravováním. Tento čas pak může investovat do individuálních rozhovorů se žáky, což je v českém kontextu, kde se často mluví o nedostatku času na jednotlivce, kriticky důležité.

## Personalizované učení: Konec jedné velikosti pro všechny

Tradiční model výuky, kdy učitel předává látku třídě o třiceti žácích, kteří se učí stejným tempem a stejným způsobem, je pedagogicky neefektivní. Umělá inteligence nabízí řešení v podobě adaptivních učebních systémů, které fungují na principu „learning analytics“. Tyto systémy sledují, jak žák interaguje s materiálem – kde se zastavuje, kde dělá chyby, jak dlouho mu trvá vyřešení úlohy.

Konkrétním příkladem jsou platformy pro výuku matematiky a přirodovědných předmětů, které využívají AI k tvorbě dynamických cestiček učení. Pokud žák opakovaně chybuje v zlomcích, systém mu nenutí pokračovat dál, ale automaticky mu podá další, ještě jednodušší úlohy, které cílí na konkrétní slabé místo, dokud není chápání stabilní. Naopak, pokud žák úlohy zvládá s lehkostí, systém mu okamžitě nabídne pokročilejší úlohy, aby se nezabíhal nudou. Tento přístup je v souladu s moderními pedagogickými teoriemi, které zdůrazňují význam zóny nejbližšího vývoje (Vygotskij), ale díky AI se dají aplikovat na masovou škálu, což bylo dříve nemožné.

V českém prostředí se toto projevuje např. v pilotních projektech na středních školách, kde se AI využívá k simulacím reálných situací. Studenti oboru informatika nebo inženýrství pracují s AI simulátory, které generují náhodné, ale logicky konzistentní problémy. Každý student dostává jinou sadu parametrů, což eliminuje možnost opakování a nutí k přemýšlení, nikoliv k zapamatování si řešení. Tím se učení stává hlubším a trvalejším, protože mozek je nucen aktivně zpracovávat informace, nikoliv je pasivně přijímat.

## Etické dilemata a hrozba plagiátoru: Hranice mezi pomůckou a podváděním

Nepochybně nejrozpůlenější tématem kolem AI ve školství je otázka integrity a plagiátoru. S nástroji typu ChatGPT, Claude nebo Gemini, které dokážou napsat esej na vysoké akademické úrovni, se učitelé ocitli v úzké uličce. Jak poznat, zda práci napsal student, nebo algoritmus?

Tento problém není specifický pro Česko, ale v našem kontextu, kde se hodnocení často opírá o písemné práce a esejní formy, je citlivý. Mnoho škol se rozhodlo pro zákaz používání generativní AI, což je však bojem proti větru. Mladá generace (Gen Z a Alpha) vyrůstá v prostředí, kde jsou AI nástroje integrální součástí života. Zákaz je neefektivní a vede jen k tomu, že se studenti naučí lhat o svém využití technologie.

Odborníci doporučují jiný přístup: transparentnost a reformu zadávání úloh. Místo toho, aby se žádal produkt (esej), měli by se žádat procesy. To znamená, že studenti mohou (a mají) AI využívat k brainstormingu, generování nápadů, korekci gramatiky nebo vyhledávání zdrojů, ale musí explicitně uvést, jakou část práce AI provedla. Důraz se přesouvá na ústní prezentace, kde žák musí obhájit svou argumentaci naživo, a na projekty, které vyžadují praktickou činnost, kterou AI nemůže nahradit.

Dalším rizikem je tzv. „hallucinace“ – jev, kdy AI s jistotou tvrdí nesmysly nebo vymýšlí neexistující fakty. Pro žáky, kteří mají tendenci brát vše, co jim počítač ukáže, za pravdu, je to nebezpečné. Školství musí tedy posílit kritické myšlení a literární gramotnost. Učitelé musí explicitně učit, jak ověřovat zdroje generované AI, jak rozpoznat zkreslená data a jak chápat limity algoritmu. AI by měla být vnímána jako „společník v úvahách“, nikoliv jako „oracle pravdy“.

## Vliv na učitelskou profesi: Nahrazení nebo augmentace?

Strach z toho, že AI nahradí učitele, je sice slyšet, ale odborná consensus je jasný: AI nenahradí lidskou empatii, motivaci a sociální interakci, které jsou srdcem vzdělávání. Naopak, AI může učitelskou profesi transformovat a zjednodušit, ale zároveň vyžaduje nové dovednosti.

Budoucí učiteli budou muset být „AI-fluent“, tedy plynule ovládat tyto nástroje. Nemusí být programátoři, ale musí rozumět, jak AI funguje, aby ji mohli efektivně využívat a aby mohli kriticky hodnotit její výstupy. To znamená, že se musí změnit i výcvik učitelů na pedagogických fakultách. Kromě pedagogiky a didaktiky bude nezbytné zahrnout předměty o etice AI, digitální gramotnosti a práci s daty.

Významnou roli zde hraje i role učitele jako facilitátora. Místo toho, aby byl jediným zdrojem znalostí, učitel se stává průvodcem, který žákům ukazuje, jak s AI pracovat. To vyžaduje od učitele vyšší míru flexibilitě a trpělivosti. Musí být připraven na to, že žáci přijdou s otázkami, na které on sám nemá okamžitou odpověď, a které spolu s žáky vyhledají pomocí AI. Tato dynamika posiluje partnerský vztah mezi učitelem a žákem, kde je důraz na dovednost vyhledávání a ověřování informací, nikoliv na memorování faktů.

V českém kontextu je důležité zmínit i regionální rozdíly. Zatímco na velkých městech jsou školy vybaveny moderní technologií a mají přístup k pilotním projektům, na venkově může být situace odlišná. Je důležité zajistit, aby AI ve školství nebyla luxusním bonusem pro privilegované školy, ale dostupným nástrojem pro všechny, aby nedošlo k digitalizaci nerovností.

## Budoucnost výuky: Integrace AI v kurikulu a legislativě

Bližší budoucnost českého školství s AI bude tvarována dvěma hlavními silami: kurikulárními reformami a legislativou. Ministerstvo školství, mládeže a tělovýchovy již nyní zvažuje, jak zahrnout digitální kompetence a etiku AI do rámcových vzdělávacích programů. Cílem není vytvořit nový předmět „Umělá inteligence“, ale integrovat její principy do všech předmětů. Na matematice bude jít o statistiku a logiku, na češtině o kritické čtení a etiku textu, na přírodovědě o modelování a simulace.

Legislativní rámec bude klíčový pro ochranu dat žáků. Pokud se AI systémy učí z interakcí s žáky, vzniká otázka, kdo vlastní tato data a jak se s nimi zachází. České školství musí nastavit jasná pravidla pro anonymizaci dat a pro to, aby se AI systémy nepoužívaly k diskriminaci nebo profilování žáků na základě jejich chování.

Dlouhodobě lze očekávat, že se objeví specializované AI nástroje přímo pro český jazyk a kulturní kontext. Zatímco globální modely jsou často trénovány primárně na anglickém jazyce, budou vznikat lokální modely, které lépe rozumí české gramatice, historickému kontextu a specifickým požadavkům českého školství. To umožní vytvářet ještě preciznější a relevantnější vzdělávací materiály.

## Závěr: Technologie jako lůže, ne jako lékař

Umělá inteligence je v českém školství v podobě, jako byl internet na počátku 90. let – plná potenciálu, ale také nejasností a obav. Nemáme však volbu, zda ji přijmeme, protože se již do tříd a učeben dostává. Klíčem není bojovat proti ní, ale naučit se s ní žít a pracovat.

AI nemůže nahradit lidskou duši ve vzdělávání. Nemůže inspirovat, nemůže pochopit emocionální stav žáka, nemůže budovat hodnotové postavení. To je a zůstane úkolem člověka – učitele, rodiče, mentora. AI je však výborným asistentem, který může učiteli ušetřit čas, žákovi poskytnout personalizovanou podporu a celému systému umožnit efektivnější využívání zdrojů.

Úspěch bude záviset na tom, zda se nám podaří zachovat rovnováhu mezi technickou efektivitou a lidskou empatií. Pokud se zaměříme pouze na to, jak AI zrychlí procesy, a zapomeneme na to, proč učíme, prohrajeme. Pokud však
Python galaxie Run #1 · 4096 tok · 27.0 tok/s
```python
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib.collections import PathCollection
from scipy.interpolate import interp1d
from scipy.spatial import cKDTree
import os

def generate_spiral_galaxy(n_stars=10000, n_arms=4, arm_spacing=0.8, arm_width=0.3,
                          disk_radius=10.0, disk_thickness=0.5, center_concentration=3.0,
                          dust_fraction=0.05, dust_width=0.2):
    """
    Generate star positions in a spiral galaxy pattern.
    
    Parameters:
    -----------
    n_stars : int
        Number of stars to generate
    n_arms : int
        Number of spiral arms
    arm_spacing : float
        Spacing factor for spiral arms
    arm_width : float
        Width of spiral arms
    disk_radius : float
        Radius of the galactic disk
    disk_thickness : float
        Thickness of the galactic disk
    center_concentration : float
        How concentrated stars are toward the center
    dust_fraction : float
        Fraction of positions that are dust lanes
    dust_width : float
        Width of dust lanes
    
    Returns:
    --------
    positions : ndarray of shape (n_stars, 3)
        Star positions
    temperatures : ndarray of shape (n_stars,)
        Star temperatures (for color mapping)
    is_dust : ndarray of shape (n_stars,)
        Boolean mask indicating dust particles
    """
    positions = []
    temperatures = []
    is_dust = []
    
    # Number of dust particles
    n_dust = int(n_stars * dust_fraction)
    n_stars_real = n_stars - n_dust
    
    # Generate stars in spiral arms
    for i in range(n_stars_real):
        # Random radius with concentration toward center
        # Use exponential distribution for concentration
        r = np.random.exponential(scale=1.0 / center_concentration)
        r = min(r, disk_radius)
        
        # Determine which arm this star belongs to
        arm_idx = i % n_arms
        
        # Base angle for the arm
        # Spiral: angle = arm_idx * (2*pi/n_arms) + r * arm_spacing
        theta_base = arm_idx * (2 * np.pi / n_arms) + r * arm_spacing
        
        # Add some scatter (arm width)
        theta_offset = np.random.normal(0, arm_width)
        theta = theta_base + theta_offset
        
        # Convert to cartesian
        x = r * np.cos(theta)
        y = r * np.sin(theta)
        
        # Z coordinate: thinner at center, thicker in arms
        # Scale thickness with radius
        local_thickness = disk_thickness * (1 + 0.5 * r / disk_radius)
        z = np.random.normal(0, local_thickness / 3)
        
        # Temperature: hotter stars (bluer) tend to be in arms, cooler in center
        # Temperature inversely related to radius somewhat, with randomness
        # Base temperature decreases with radius (older stars further out)
        base_temp = 6000 + 3000 * np.exp(-r / (disk_radius / 2))
        temp = base_temp * np.random.lognormal(0, 0.3)
        temp = np.clip(temp, 2000, 12000)
        
        positions.append([x, y, z])
        temperatures.append(temp)
        is_dust.append(False)
    
    # Generate dust particles along the spiral arms
    for i in range(n_dust):
        r = np.random.exponential(scale=1.0 / center_concentration)
        r = min(r, disk_radius)
        
        arm_idx = i % n_arms
        theta_base = arm_idx * (2 * np.pi / n_arms) + r * arm_spacing
        theta_offset = np.random.normal(0, dust_width)
        theta = theta_base + theta_offset
        
        x = r * np.cos(theta)
        y = r * np.sin(theta)
        
        local_thickness = disk_thickness * (1 + 0.5 * r / disk_radius)
        z = np.random.normal(0, local_thickness / 4)
        
        # Dust is cooler/darker
        temp = np.random.uniform(1500, 3000)
        
        positions.append([x, y, z])
        temperatures.append(temp)
        is_dust.append(True)
    
    positions = np.array(positions)
    temperatures = np.array(temperatures)
    is_dust = np.array(is_dust)
    
    return positions, temperatures, is_dust


def temperature_to_color(temperature):
    """
    Convert temperature to RGB color using blackbody approximation.
    Returns normalized RGB values (0-1).
    """
    # Simplified blackbody color approximation
    # Temperature in Kelvin
    t = temperature / 100.0
    
    # Red
    if t < 66:
        red = 255
    else:
        red = 329.698727446 * np.power(t - 60, -0.1332047592)
    
    # Green
    if t < 66:
        green = 99.4708025861 * np.log(t) - 161.1195681661
    else:
        green = 288.1221695283 * np.power(t - 60, -0.0755148492)
    
    # Blue
    if t <= 19:
        blue = 0
    elif t >= 66:
        blue = 255
    else:
        blue = 138.5177312231 * np.log(t - 10) - 305.0447927307
    
    # Normalize to 0-1
    red = np.clip(red, 0, 255) / 255.0
    green = np.clip(green, 0, 255) / 255.0
    blue = np.clip(blue, 0, 255) / 255.0
    
    return np.array([red, green, blue])


def create_camera_path(disk_radius=10.0, n_frames=300, start_distance=25.0, end_distance=5.0):
    """
    Create a flythrough camera path through the galaxy.
    
    Parameters:
    -----------
    disk_radius : float
        Radius of the galaxy
    n_frames : int
        Number of frames in the animation
    start_distance : float
        Initial distance from center
    end_distance : float
        Final distance from center
    
    Returns:
    --------
    camera_positions : ndarray of shape (n_frames, 3)
    camera_targets : ndarray of shape (n_frames, 3)
    """
    camera_positions = []
    camera_targets = []
    
    # Camera starts far away, spirals in, then passes through center
    # Path: spiral approach from outside, then fly through
    
    for i in range(n_frames):
        t = i / (n_frames - 1)  # 0 to 1
        
        # Phase 1: Spiral approach (0 to 0.6)
        # Phase 2: Fly through center (0.6 to 0.8)
        # Phase 3: Exit on other side (0.8 to 1.0)
        
        if t < 0.6:
            # Spiral approach
            t_local = t / 0.6
            # Start far, spiral in
            distance = start_distance * (1 - t_local * 0.8)
            angle = 4 * np.pi * t_local  # Multiple rotations
            # Add some vertical movement
            z_offset = 2.0 * np.sin(2 * np.pi * t_local)
            
            x = distance * np.cos(angle)
            y = distance * np.sin(angle)
            z = z_offset
            
            camera_positions.append([x, y, z])
            
            # Look toward center
            camera_targets.append([0, 0, 0])
            
        elif t < 0.8:
            # Fly through center
            t_local = (t - 0.6) / 0.2
            # Pass through center with slight curve
            distance = start_distance * 0.2 * (1 - t_local)
            angle = 4 * np.pi * 0.6 + 2 * np.pi * t_local
            z_offset = 2.0 * np.sin(2 * np.pi * 0.6) * (1 - t_local)
            
            x = distance * np.cos(angle)
            y = distance * np.sin(angle)
            z = z_offset
            
            camera_positions.append([x, y, z])
            camera_targets.append([0, 0, 0])
            
        else:
            # Exit on other side
            t_local = (t - 0.8) / 0.2
            distance = end_distance + (start_distance - end_distance) * t_local
            angle = 4 * np.pi * 0.6 + 2 * np.pi + 2 * np.pi * t_local
            z_offset = 2.0 * np.sin(2 * np.pi * 0.6) * (1 - t_local) * (1 - t_local)
            
            x = distance * np.cos(angle)
            y = distance * np.sin(angle)
            z = z_offset
            
            camera_positions.append([x, y, z])
            camera_targets.append([0, 0, 0])
    
    camera_positions = np.array(camera_positions)
    camera_targets = np.array(camera_targets)
    
    return camera_positions, camera_targets


def project_points_3d_to_2d(points_3d, camera_pos, camera_target, fov=60):
    """
    Project 3D points to 2D screen coordinates from camera perspective.
    
    Parameters:
    -----------
    points_3d : ndarray of shape (N, 3)
        3D points to project
    camera_pos : ndarray of shape (3,)
        Camera position
    camera_target : ndarray of shape (3,)
        Point the camera is looking at
    fov : float
        Field of view in degrees
    
    Returns:
    --------
    points_2d : ndarray of shape (N, 2)
        2D projected points
    depths : ndarray of shape (N,)
        Depth of each point (for size adjustment)
    visible : ndarray of shape (N,)
        Boolean mask for visible points (in front of camera)
    """
    # Camera basis
    forward = camera_target - camera_pos
    forward = forward / np.linalg.norm(forward)
    
    # Up vector (world up)
    up = np.array([0, 0, 1.0])
    
    # Right vector
    right = np.cross(forward, up)
    right = right / (np.linalg.norm(right) + 1e-10)
    
    # Actual up vector
    up_actual = np.cross(right, forward)
    
    # Transform points to camera space
    points_relative = points_3d - camera_pos
    
    # Project onto camera axes
    x_cam = np.dot(points_relative, right)
    y_cam = np.dot(points_relative, up_actual)
    z_cam = np.dot(points_relative, forward)
    
    # Visibility: points in front of camera
    visible = z_cam > 0.01
    
    # Perspective projection
    focal_length = 1.0 / np.tan(np.radians(fov) / 2)
    
    # Avoid division by zero
    z_safe = np.where(z_cam > 0.01, z_cam, 1.0)
    
    x_2d = focal_length * x_cam / z_safe
    y_2d = focal_length * y_cam / z_safe
    
    # Normalize to [-1, 1] range (will be scaled to figure later)
    points_2d = np.column_stack([x_2d, y_2d])
    
    return points_2d, z_cam, visible


def generate_galaxy_flythrough(output_mp4='galaxy_flythrough.mp4',
                                 output_gif='galaxy_flythrough.gif',
                                 n_stars=10000,
                                 n_frames=200,
                                 fps
HTML/JS animace Run #1 · 4096 tok · 27.1 tok/s
Here's a complete, self-contained interactive galaxy. Everything (galaxy math, starfield, mouse tilt, FPS + stats HUD, and the UI chrome) lives in one HTML file — just save it as `.html` and open it.

```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Stellar Spiral — Interactive Galaxy</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=JetBrains+Mono:wght@400;500;700&display=swap" rel="stylesheet">
<style>
  :root{
    --bg:#04040a; --ink:#eef1fb; --ink-dim:#8b92b3; --ink-faint:#565d7e;
    --line:rgba(120,140,220,.18);
    --cyan:#5fe6ff; --gold:#ffcf6e; --rose:#ff86b4; --violet:#b190ff;
    --mono:'JetBrains Mono',ui-monospace,monospace;
    --disp:'Space Grotesk',system-ui,sans-serif;
  }
  *{margin:0;padding:0;box-sizing:border-box}
  html,body{height:100%;overflow:hidden;background:var(--bg);color:var(--ink);font-family:var(--disp)}
  #scene{position:fixed;inset:0;width:100%;height:100%;display:block;touch-action:none}

  /* cinematic vignette + subtle top light */
  .vignette{position:fixed;inset:0;pointer-events:none;z-index:5;
    background:
      radial-gradient(120% 90% at 50% 42%, transparent 55%, rgba(3,3,9,.55) 100%),
      linear-gradient(180deg, rgba(20,26,60,.25), transparent 22%);}

  /* faint drifting grain */
  .grain{position:fixed;inset:-40px;pointer-events:none;z-index:6;opacity:.045;mix-blend-mode:overlay;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    animation:grain 1.1s steps(3) infinite;}
  @keyframes grain{0%{transform:translate(0,0)}33%{transform:translate(-8px,5px)}66%{transform:translate(6px,-7px)}100%{transform:translate(0,0)}}

  .ui{position:fixed;inset:0;z-index:10;pointer-events:none}
  .panel{position:absolute;pointer-events:auto;padding:16px 18px;
    background:rgba(9,11,22,.42);border:1px solid var(--line);
    backdrop-filter:blur(9px) saturate(1.15);-webkit-backdrop-filter:blur(9px) saturate(1.15);
    box-shadow:0 24px 60px -30px rgba(0,0,0,.9), inset 0 1px 0 rgba(255,255,255,.05);}
  .panel::before,.panel::after{content:"";position:absolute;width:13px;height:13px;pointer-events:none}
  .panel::before{top:-1px;left:-1px;border-top:1px solid var(--cyan);border-left:1px solid var(--cyan)}
  .panel::after{bottom:-1px;right:-1px;border-bottom:1px solid var(--cyan);border-right:1px solid var(--cyan)}

  /* ---- title block ---- */
  .brand{top:26px;left:26px;max-width:min(46vw,440px)}
  .eyebrow{font:500 10.5px/1 var(--mono);letter-spacing:.32em;text-transform:uppercase;
    color:var(--cyan);opacity:.9;display:flex;align-items:center;gap:9px}
  .eyebrow::before{content:"";width:22px;height:1px;background:linear-gradient(90deg,var(--cyan),transparent)}
  .title{font-family:var(--disp);font-weight:700;letter-spacing:-.02em;line-height:.92;
    font-size:clamp(30px,5.4vw,54px);margin:12px 0 8px;color:#fff;
    text-shadow:0 0 34px rgba(95,230,255,.25)}
  .title span{font-weight:500;color:var(--gold);font-style:italic}
  .sub{font:400 12.5px/1.55 var(--mono);color:var(--ink-dim);max-width:34ch}
  .sub b{color:var(--rose);font-weight:500}

  /* ---- stats ---- */
  .stats{top:26px;right:26px;min-width:196px}
  .fps{display:flex;align-items:baseline;gap:6px}
  .fps-num{font:700 46px/1 var(--mono);color:#fff;font-variant-numeric:tabular-nums;
    text-shadow:0 0 22px rgba(95,230,255,.4);letter-spacing:-.02em}
  .fps-unit{font:500 11px/1 var(--mono);letter-spacing:.24em;color:var(--ink-dim);transform:translateY(-2px)}
  .bar{height:4px;border-radius:2px;background:rgba(255,255,255,.08);margin:12px 0 4px;overflow:hidden}
  .bar i{display:block;height:100%;width:100%;border-radius:2px;
    background:linear-gradient(90deg,var(--cyan),var(--violet),var(--gold));
    box-shadow:0 0 12px rgba(95,230,255,.6);transition:width .12s linear}
  .grid{display:grid;grid-template-columns:1fr 1fr;gap:10px 18px;margin-top:14px}
  .stat{display:flex;flex-direction:column;gap:3px}
  .stat .k{font:500 9px/1 var(--mono);letter-spacing:.2em;color:var(--ink-faint);text-transform:uppercase}
  .stat .v{font:500 15px/1 var(--mono);color:var(--ink);font-variant-numeric:tabular-nums}

  /* ---- controls ---- */
  .controls{left:26px;bottom:26px;width:min(86vw,320px)}
  .controls h2{font:500 10px/1 var(--mono);letter-spacing:.28em;text-transform:uppercase;
    color:var(--ink-dim);margin-bottom:14px;display:flex;justify-content:space-between;align-items:center}
  .controls h2::after{content:"";flex:1;height:1px;margin-left:10px;background:linear-gradient(90deg,var(--line),transparent)}
  .row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:13px}
  .row:last-child{margin-bottom:0}
  .lbl{font:500 11px/1 var(--mono);letter-spacing:.08em;color:var(--ink-dim);text-transform:uppercase}
  .lbl .val{color:var(--cyan);float:right;margin-left:6px;font-variant-numeric:tabular-nums}

  input[type=range]{-webkit-appearance:none;appearance:none;width:100%;height:4px;border-radius:3px;
    background:rgba(255,255,255,.1);outline:none;cursor:pointer}
  input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:15px;height:15px;border-radius:50%;
    background:#fff;box-shadow:0 0 0 4px rgba(95,230,255,.2),0 0 12px var(--cyan);cursor:pointer;transition:transform .12s}
  input[type=range]::-webkit-slider-thumb:hover{transform:scale(1.25)}
  input[type=range]::-moz-range-thumb{width:15px;height:15px;border:none;border-radius:50%;
    background:#fff;box-shadow:0 0 0 4px rgba(95,230,255,.2),0 0 12px var(--cyan);cursor:pointer}

  .seg{display:inline-flex;border:1px solid var(--line);border-radius:7px;overflow:hidden}
  .seg button{font:500 10.5px/1 var(--mono);letter-spacing:.1em;color:var(--ink-dim);
    background:transparent;border:none;padding:8px 11px;cursor:pointer;transition:all .18s}
  .seg button+button{border-left:1px solid var(--line)}
  .seg button:hover{color:var(--ink)}
  .seg button.on{background:rgba(95,230,255,.16);color:#fff;box-shadow:inset 0 0 0 1px rgba(95,230,255,.4)}

  .toggle{display:inline-flex;align-items:center;gap:9px;font:500 11px/1 var(--mono);
    letter-spacing:.08em;color:var(--ink-dim);background:none;border:none;cursor:pointer;text-transform:uppercase}
  .toggle .dot{width:12px;height:12px;border-radius:50%;border:1px solid var(--ink-faint);transition:all .2s}
  .toggle.on{color:var(--ink)}
  .toggle.on .dot{background:var(--cyan);border-color:var(--cyan);box-shadow:0 0 10px var(--cyan)}

  /* ---- hints ---- */
  .hints{right:26px;bottom:26px;display:flex;flex-direction:column;gap:9px;
    font:400 10.5px/1 var(--mono);color:var(--ink-faint);letter-spacing:.06em}
  .hints span{display:flex;align-items:center;gap:8px}
  .hints kbd{font:500 10px/1 var(--mono);color:var(--ink-dim);background:rgba(255,255,255,.05);
    border:1px solid var(--line);border-radius:4px;padding:4px 7px;min-width:22px;text-align:center}

  /* ---- intro ---- */
  .intro{position:fixed;inset:0;z-index:40;display:flex;flex-direction:column;align-items:center;
    justify-content:center;gap:14px;background:radial-gradient(circle at 50% 50%,rgba(6,8,20,.55),rgba(4,4,10,.86));
    backdrop-filter:blur(2px);transition:opacity .9s ease,visibility .9s}
  .intro.hide{opacity:0;visibility:hidden}
  .intro .spin{width:52px;height:52px;border-radius:50%;
    border:2px solid rgba(95,230,255,.15);border-top-color:var(--cyan);border-right-color:var(--gold);
    animation:spin .9s linear infinite}
  @keyframes spin{to{transform:rotate(360deg)}}
  .intro p{font:500 11px/1 var(--mono);letter-spacing:.3em;text-transform:uppercase;color:var(--ink-dim)}

  /* staggered entrance */
  .panel,.hints{opacity:0;transform:translateY(12px);
    transition:opacity .8s cubic-bezier(.2,.7,.2,1),transform .8s cubic-bezier(.2,.7,.2,1)}
  body.ready .brand{opacity:1;transform:none;transition-delay:.05s}
  body.ready .stats{opacity:1;transform:none;transition-delay:.2s}
  body.ready .controls{opacity:1;transform:none;transition-delay:.35s}
  body.ready .hints{opacity:1;transform:none;transition-delay:.5s}

  @media (max-width:720px){
    .brand{max-width:74vw}
    .stats{min-width:150px;padding:12px 14px}
    .fps-num{font-size:34px}
    .hints{display:none}
    .controls{width:calc(100vw - 52px)}
    .sub{display:none}
  }
</style>
</head>
<body>
  <canvas id="scene"></canvas>
  <div class="vignette"></div>
  <div class="grain"></div>

  <div class="ui">
    <header class="panel brand">
      <div class="eyebrow">Real-time WebGL · Three.js</div>
      <h1 class="title">Stellar <span>Spiral</span></h1>
      <p class="sub"><b>5,000</b> luminous particles in a rotating galactic disc — tilt with your cursor, then reshape it below.</p>
    </header>

    <aside class="panel stats">
      <div class="fps"><span class="fps-num" id="fps">60</span><span class="fps-unit">FPS</span></div>
      <div class="bar"><i id="fpsbar"></i></div>
      <div class="grid">
        <div class="stat"><span class="k">Particles</span><span class="v" id="pcount">5,000</span></div>
        <div class="stat"><span class="k">Draw calls</span><span class="v" id="calls">—</span></div>
        <div class="stat"><span class="k">Triangles</span><span class="v" id="tris">—</span></div>
        <div class="stat"><span class="k">Frame</span><span class="v" id="ms">—</span></div>
      </div>
    </aside>

    <section class="panel controls">
      <h2>Parameters</h2>
      <div class="row">
        <span class="lbl">Rotation <span class="val" id="rotv">1.0×</sp
PHP Drupal modul Run #1 · 1525 tok · 27.6 tok/s
Here is the complete structure for the `hello_world_benchmark` module.

### 1. File Structure

```
hello_world_benchmark/
├── hello_world_benchmark.info.yml
├── hello_world_benchmark.routing.yml
├── hello_world_benchmark.services.yml
├── hello_world_benchmark.install
├── config/
│   └── install/
│       └── hello_world_benchmark.settings.yml
├── src/
│   ├── Controller/
│   │   └── HelloWorldBenchmarkController.php
│   └── Service/
│       └── BenchmarkGreetingService.php
```

### 2. File Contents

#### `hello_world_benchmark.info.yml`
```yaml
name: 'Hello World Benchmark'
type: module
description: 'A benchmark module for AI Arena testing.'
package: 'Custom'
core_version_requirement: ^11
```

#### `hello_world_benchmark.routing.yml`
```yaml
hello_world_benchmark.hello:
  path: '/hello-world-benchmark'
  defaults:
    _controller: '\Drupal\hello_world_benchmark\Controller\HelloWorldBenchmarkController::hello'
    _title: 'Hello World Benchmark'
  requirements:
    _access: 'TRUE'
```

#### `hello_world_benchmark.services.yml`
```yaml
services:
  hello_world_benchmark.greeting_service:
    class: Drupal\hello_world_benchmark\Service\BenchmarkGreetingService
    arguments: ['@http_client']
```

#### `hello_world_benchmark.install`
```php
<?php

/**
 * @file
 * Install, update, and uninstall functions for the hello_world_benchmark module.
 */

declare(strict_types=1);

use Drupal\Core\Database\Database;

/**
 * Implements hook_schema().
 */
function hello_world_benchmark_schema() {
  $schema['hello_benchmark_messages'] = [
    'description' => 'Stores benchmark messages.',
    'fields' => [
      'id' => [
        'description' => 'Primary Key: The message ID.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ],
      'message' => [
        'description' => 'The benchmark message text.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ],
      'created_at' => [
        'description' => 'The timestamp when the message was created.',
        'type' => 'created',
        'not null' => TRUE,
      ],
    ],
    'primary key' => ['id'],
    'indexes' => [
      'created_at' => ['created_at'],
    ],
  ];

  return $schema;
}

/**
 * Implements hook_install().
 */
function hello_world_benchmark_install() {
  // Optional: Insert an initial record to verify schema creation.
  $database = Database::getConnection();
  $database->schema()->createTable('hello_benchmark_messages');

  // Insert a test message.
  $database->insert('hello_benchmark_messages')
    ->fields([
      'message' => 'Initial benchmark message',
      'created_at' => time(),
    ])
    ->execute();
}
```

#### `src/Controller/HelloWorldBenchmarkController.php`
```php
<?php

declare(strict_types=1);

namespace Drupal\hello_world_benchmark\Controller;

use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\HttpFoundation\JsonResponse;

/**
 * Controller for the Hello World Benchmark route.
 */
class HelloWorldBenchmarkController extends ControllerBase {

  /**
   * Returns a simple JSON response.
   */
  public function hello(): JsonResponse {
    return new JsonResponse([
      'message' => 'Hello World from AI Arena benchmark!',
      'timestamp' => time(),
    ]);
  }

}
```

#### `src/Service/BenchmarkGreetingService.php`
```php
<?php

declare(strict_types=1);

namespace Drupal\hello_world_benchmark\Service;

use GuzzleHttp\ClientInterface;

/**
 * A simple service that provides greeting functionality.
 *
 * Demonstrates Drupal 11 service injection and PHP 8.3 readonly properties.
 */
class BenchmarkGreetingService {

  /**
   * The HTTP client.
   *
   * @var \GuzzleHttp\ClientInterface
   *
   * @readonly
   */
  private readonly ClientInterface $httpClient;

  /**
   * Constructs a BenchmarkGreetingService object.
   *
   * @param \GuzzleHttp\ClientInterface $http_client
   *   The HTTP client.
   */
  public function __construct(
    private readonly ClientInterface $http_client,
  ) {
    $this->httpClient = $http_client;
  }

  /**
   * Returns a benchmark greeting.
   */
  public function getGreeting(): string {
    return 'Hello World from AI Arena benchmark!';
  }

  /**
   * Performs a simple HTTP ping to verify service functionality.
   */
  public function ping(): bool {
    try {
      $response = $this->httpClient->get('https://www.drupal.org');
      return $response->getStatusCode() === 200;
    }
    catch (\Exception $e) {
      return FALSE;
    }
  }

}
```

### Key Features & Drupal 11 / PHP 8.3 Compliance

1. **PHP 8.3 `readonly` Properties**:
   - In `BenchmarkGreetingService`, the `$httpClient` property is declared as `private readonly ClientInterface $http_client` in the constructor. This is a PHP 8.1+ feature (promoted constructor property) that is fully supported in Drupal 11 and PHP 8.3.

2. **Proper Namespacing**:
   - Controller: `Drupal\hello_world_benchmark\Controller\HelloWorldBenchmarkController`
   - Service: `Drupal\hello_world_benchmark\Service\BenchmarkGreetingService`

3. **Database Schema**:
   - Defined in `hello_world_benchmark.install` using `hook_schema()`.
   - Table `hello_benchmark_messages` with `id`, `message`, and `created_at` fields.

4. **Service Injection**:
   - The service is defined in `services.yml` with `@http_client` injected.
   - The controller could inject this service if needed, but the current controller is standalone as per the requirement.

5. **Routing**:
   - Route `/hello-world-benchmark` points to the controller's `hello()` method.
   - Returns a `JsonResponse` with the required message.

This module is ready to be placed in `modules/custom/hello_world_benchmark` and enabled via `drush pm:enable hello_world_benchmark`.
X

Nezmeškejte novinky!

Přihlaste se k odběru novinek a aktualit.