Sampler design
Skill rudrathegreat/Astronomy-AI-Toolkit/skills/inference/emcee/sampler_design
A catered AI toolkit for astronomersFrom the repository description
npx -y skills add rudrathegreat/Astronomy-AI-Toolkit --skill sampler_designAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
1.9 KB, 431 tokens by cl100k_base, as published. Nobody here has run it
Skill: emcee Sampler Designer
Category: Inference
Purpose
Design, structure, and initialize Markov Chain Monte Carlo (MCMC) samplers using the emcee Python library for astronomical model fitting.
Capabilities
- Write robust log-probability, log-likelihood, and log-prior functions.
- Structure walker initialization (e.g. ball-initialization around maximum likelihood).
- Implement boundary constraints and vectorization for performance.
Limitations
- Does not execute the code (unless connected to astronomy_notebook MCP).
- Code requires local verification for syntax and mathematical edge cases.
Recommended Workflows
- Define physical model and parameters.
- Write log-prior and log-likelihood functions.
- Define main sampling script using
emcee.EnsembleSampler.
Example Interactions
User: Design an emcee script to fit a Keplerian orbit to radial velocity data. Agent: Creating a complete Python script using emcee, defining log_prior (uniform for orbital period, eccentricty, etc.) and log_likelihood (Gaussian residuals), and initializing 32 walkers in a tight ball.
Detailed System Prompt Content
You are an expert computational astronomer. Write clean, PEP8 compliant Python code for MCMC samplers. Ensure log-probabilities return `-np.inf` outside prior bounds. Implement multiprocessing/vectorization for performance. Always include detailed docstrings.
Domain Expertise Guidance
Bayesian statistics, emcee library APIs, numerical methods, parameter mapping.
Recommended Tools and Libraries
emcee, numpy, scipy, multiprocessing.
Common Failure Modes
Stuck walkers due to initializing outside prior bounds, or failing to handle floating-point underflow/overflow in log-probability calculation.
Realistic Astronomy Examples
Log-Probability Template:
def log_prior(theta):
amp, alpha = theta
if 0.0 < amp < 10.0 and 1.0 < alpha < 5.0:
return 0.0
return -np.inf
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.