physics-validator
Validate optical physics parameters including Fresnel numbers, diffraction regimes, and resolution limits. This skill should be used when configuring Telescope, Microscope, or Camera instruments to ensure physically realistic parameters.
Install
mkdir -p .claude/skills/physics-validator && curl -L -o skill.zip "https://mcp.directory/api/skills/download/418" && unzip -o skill.zip -d .claude/skills/physics-validator && rm skill.zipInstalls to .claude/skills/physics-validator
About this skill
Physics Validator
Validate optical physics parameters for PRISM instruments to ensure physically realistic configurations.
Purpose
Optical imaging simulations require careful parameter selection to produce physically meaningful results. This skill validates that instrument configurations respect fundamental optical physics constraints.
When to Use
Use this skill when:
- Configuring Telescope, Microscope, or Camera instruments
- Checking if parameters are physically realistic
- Validating diffraction regime (Fresnel vs Fraunhofer)
- Ensuring Nyquist sampling requirements are met
- Debugging unexpected simulation results
- Setting up new experiments or configurations
Validation Checks
1. Fresnel Number Analysis
The Fresnel number determines the diffraction regime:
# Fresnel number formula
F = d**2 / (wavelength * distance)
# where:
# d = aperture diameter
# wavelength = light wavelength
# distance = propagation distance
Interpretation:
| Fresnel Number | Regime | Propagation Method |
|---|---|---|
| F << 0.1 | Fraunhofer (far-field) | FFT-based |
| F >> 10 | Fresnel (near-field) | Angular Spectrum |
| 0.1 <= F <= 10 | Transition | Angular Spectrum recommended |
PRISM Implementation:
from prism.config.constants import is_fraunhofer, is_fresnel
# Check diffraction regime
wavelength = 500e-9 # 500 nm
aperture_diameter = 0.1 # 10 cm
distance = 1000 # 1 km
fresnel_number = aperture_diameter**2 / (wavelength * distance)
if fresnel_number < 0.1:
print("Fraunhofer regime - use FFT propagation")
elif fresnel_number > 10:
print("Fresnel regime - use Angular Spectrum")
else:
print("Transition regime - Angular Spectrum recommended")
2. Resolution Limits
Each instrument type has different resolution limits:
Telescope (Rayleigh Criterion)
# Angular resolution (radians)
theta_rayleigh = 1.22 * wavelength / diameter
# Spatial resolution at distance
resolution = 1.22 * wavelength * distance / diameter
# Example: 10cm aperture, 500nm light, 1km distance
# resolution = 1.22 * 500e-9 * 1000 / 0.1 = 6.1 mm
Microscope (Abbe Limit)
# Minimum resolvable feature
d_abbe = 0.61 * wavelength / NA
# where NA = numerical aperture = n * sin(theta)
# For air (n=1) with half-angle 60deg: NA = 0.866
# Example: 500nm light, NA=0.5
# d_abbe = 0.61 * 500e-9 / 0.5 = 610 nm
Camera (Airy Disk)
# Airy disk diameter
d_airy = 2.44 * wavelength * f_number
# where f_number = focal_length / aperture_diameter
# Example: 500nm light, f/2.8 lens
# d_airy = 2.44 * 500e-9 * 2.8 = 3.4 um
3. Nyquist Sampling
For proper sampling, pixel size must satisfy:
# Nyquist criterion
pixel_size <= resolution_limit / 2
# Examples:
# Telescope with 6mm resolution: pixel_size <= 3mm
# Microscope with 610nm resolution: pixel_size <= 305nm
# Camera with 3.4um Airy disk: pixel_size <= 1.7um
Validation Function:
def validate_nyquist(pixel_size: float, resolution_limit: float) -> bool:
"""Check if pixel size satisfies Nyquist criterion."""
nyquist_limit = resolution_limit / 2
is_valid = pixel_size <= nyquist_limit
if not is_valid:
print(f"WARNING: Pixel size {pixel_size:.2e} exceeds Nyquist limit {nyquist_limit:.2e}")
print(f" Aliasing may occur. Reduce pixel size or increase resolution limit.")
return is_valid
4. Physical Parameter Ranges
Common valid ranges for optical parameters:
| Parameter | Typical Range | Notes |
|---|---|---|
| Wavelength | 300nm - 1100nm | Visible + near-IR |
| Telescope aperture | 1cm - 10m | Small to large telescopes |
| Microscope NA | 0.1 - 1.4 | Air to oil immersion |
| Camera f-number | f/1.0 - f/22 | Fast to slow lenses |
| SNR | 10 - 1000 | Typical imaging conditions |
Validation:
def validate_wavelength(wavelength: float) -> bool:
"""Validate wavelength is in reasonable range."""
if not (100e-9 <= wavelength <= 10e-6):
print(f"WARNING: Wavelength {wavelength:.2e} outside typical range (100nm - 10um)")
return False
return True
def validate_numerical_aperture(na: float) -> bool:
"""Validate NA is physically possible."""
if not (0 < na <= 1.5): # 1.5 for oil immersion
print(f"WARNING: NA {na} is physically impossible (must be 0 < NA <= 1.5)")
return False
return True
5. Depth of Field
For 3D imaging, check depth of field:
# Microscope depth of field
DOF_microscope = wavelength / NA**2
# Camera depth of field (approximate)
DOF_camera = 2 * f_number * wavelength * (magnification + 1)**2
# Example: 500nm, NA=0.5
# DOF = 500e-9 / 0.25 = 2 um
Complete Validation Workflow
def validate_telescope_config(config: dict) -> list[str]:
"""Validate telescope configuration."""
issues = []
wavelength = config['wavelength']
diameter = config['aperture_diameter']
distance = config['distance']
pixel_size = config.get('pixel_size')
# 1. Check wavelength
if not (100e-9 <= wavelength <= 10e-6):
issues.append(f"Wavelength {wavelength:.2e} outside typical range")
# 2. Check Fresnel number
F = diameter**2 / (wavelength * distance)
if 0.1 <= F <= 10:
issues.append(f"Fresnel number {F:.2f} in transition regime - results may be approximate")
# 3. Check resolution
resolution = 1.22 * wavelength * distance / diameter
# 4. Check Nyquist (if pixel size provided)
if pixel_size and pixel_size > resolution / 2:
issues.append(f"Pixel size {pixel_size:.2e} violates Nyquist (limit: {resolution/2:.2e})")
# 5. Check aperture size
if diameter > distance / 10:
issues.append(f"Aperture {diameter} may be too large for distance {distance}")
return issues
def validate_microscope_config(config: dict) -> list[str]:
"""Validate microscope configuration."""
issues = []
wavelength = config['wavelength']
na = config['numerical_aperture']
pixel_size = config.get('pixel_size')
# 1. Check NA
if not (0 < na <= 1.5):
issues.append(f"NA {na} is physically impossible")
# 2. Check resolution
resolution = 0.61 * wavelength / na
# 3. Check Nyquist
if pixel_size and pixel_size > resolution / 2:
issues.append(f"Pixel size {pixel_size:.2e} violates Nyquist (limit: {resolution/2:.2e})")
# 4. Check depth of field
dof = wavelength / na**2
if dof < 100e-9:
issues.append(f"Very shallow DOF ({dof:.2e}m) - focus stability critical")
return issues
Common Issues and Solutions
Issue 1: Aliasing Artifacts
Symptoms: Rings, moiré patterns, or jagged edges in reconstruction Cause: Pixel size too large (Nyquist violation) Solution: Reduce pixel size or use anti-aliasing
Issue 2: Missing High Frequencies
Symptoms: Blurry reconstruction, loss of fine detail Cause: Aperture too small, resolution limit too coarse Solution: Increase aperture size or reduce wavelength
Issue 3: Incorrect Diffraction Pattern
Symptoms: Wrong PSF shape, unexpected propagation behavior Cause: Using wrong propagation method for Fresnel number Solution: Check Fresnel number and select appropriate method
Issue 4: Numerical Instabilities
Symptoms: NaN values, diverging iterations Cause: Parameters outside valid range Solution: Validate all parameters before simulation
Quick Reference
Fresnel Number
F = d² / (λ × z)
F < 0.1 → Far-field (Fraunhofer)
F > 10 → Near-field (Fresnel)
Resolution Formulas
Telescope: θ = 1.22 λ/D, δ = 1.22 λz/D
Microscope: d = 0.61 λ/NA
Camera: d = 2.44 λ × f/#
Nyquist
pixel_size ≤ resolution_limit / 2
Related Skills
- torch-shape-validator: Validate tensor dimensions in optical computations
- complex-tensor-handler: Handle complex-valued fields in Fourier optics
- unit-test-generator: Create tests for physics validation functions
Checklist
Before running simulations:
- Wavelength in valid range (100nm - 10um)
- Fresnel number checked, appropriate propagation selected
- Resolution limit calculated for instrument type
- Nyquist sampling satisfied
- Aperture/NA in physical range
- Depth of field adequate for sample thickness
- SNR appropriate for detection conditions
You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
rust-coding-skill
UtakataKyosui
Guides Claude in writing idiomatic, efficient, well-structured Rust code using proper data modeling, traits, impl organization, macros, and build-speed best practices.
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.