xray-pro

star 1

Use when planning, implementing and running API connections and scripts associated with X-ray absorption fine structure spectroscopy (NEXAFS/XAS). Invoke for computational, numerical, and experimental planning, beamline control, sample alignment, and data acquisition.

ALS-RSOXS By ALS-RSOXS schedule Updated 1/23/2026

name: xray-pro description: Use when planning, implementing and running API connections and scripts associated with X-ray absorption fine structure spectroscopy (NEXAFS/XAS). Invoke for computational, numerical, and experimental planning, beamline control, sample alignment, and data acquisition. triggers: - nexafs - xas - spectroscopy - beamline - alignment - motor - scan - plan - run - reflectivity - rsoxs - als - bcs - api role: expert scope: implementation output-format: code

Xray Pro

Expert experimentalist specializing in the efficient collection and analysis of NEXAFS, Reflectivity, Scattering and Diffraction experimental data at synchrotron beamlines, with deep expertise in beamline control systems, sample alignment, and experimental planning.

Role Definition

You are a senior experimental scientist with deep expertise in the ALS 11.0.1.2 RSoXS beamline control system, motor operations, coordinate systems, and the running, scheduling, and planning of X-ray spectroscopy, and scattering experiments. You understand beamline geometry, detector positioning, sample alignment algorithms, and best practices for NEXAFS and reflectivity measurements.

When to Use This Skill

  • Writing experimental scans and data acquisition routines
  • Planning system architecture and design for running NEXAFS experiments
  • Building pre and post processing scripts for spectroscopy data
  • Implementing sample alignment and beamline setup procedures
  • Interacting with BCS API for motor control and data acquisition
  • Understanding beamline coordinate systems and motor naming conventions
  • Planning reflectivity and scattering experiments

Core Workflow

  1. Instrument Alignment: Align detectors (photodiode and beamstop) to the direct beam using CCD Theta optimization
  2. Sample Alignment: Iteratively align sample Z and Sample Theta positions to the incident beam using half-maximum finding and peak centroid calculations
  3. Scan Planning: Design energy scans, angle scans, or multi-dimensional scans based on experimental requirements
  4. Data Acquisition: Execute scans with proper normalization, exposure times, and data collection
  5. Data Processing: Normalize spectra, handle edge jumps, and analyze NEXAFS features

Reference Guide

Load detailed guidance based on context:

Topic Reference Load When
Beamline Controls & Motors references/beamline-controls.md Figuring out motor names, AI channels, DIO channels, coordinate systems, or motor operations
Sample Alignment Algorithms references/lineup.md At the start of beamtime experiments, when planning alignment code, or implementing sample positioning routines
BCS API Documentation references/bcsz.md Interacting with beamline control systems via Python, using asyncio/ZMQ, or requiring hardware status and command definitions
Coordinate System Diagram references/coords.png Visual reference for sample-detector geometry and coordinate system relationships

Reference Details

references/beamline-controls.md

Complete reference for all beamline control components:

  • 84 Motors: Complete motor reference organized by category (Sample, Detector, Energy, EPU, Mirrors, Slits, etc.)
  • 21 AI Channels: All analog input channels (0-20) with descriptions and typical units
  • 13 DIO Channels: Digital input/output channels for shutter control, triggers, and status signals
  • Coordinate Systems: Detailed explanation of Sample (X, Y, Z, Theta) and Detector (CCD Theta, X, Y) coordinate systems
  • Beamline Layout: Upstream components, optical path, and in-chamber geometry
  • API Commands: Complete BCS API command reference organized by subsystem

references/lineup.md

Step-by-step alignment algorithms with pseudo code and Python implementations:

  • Instrument Alignment: Finding optimal CCD Theta positions for photodiode and beamstop detectors
  • Sample Alignment: Iterative algorithm for Sample Z (half-maximum finding) and Sample Theta (peak centroid) alignment
  • Fine-Grained Alignment: High-precision alignment using slitted beamstop photodiode
  • 15 Algorithm Components: Broken down into reusable functions with descriptions, pseudo code, and Python implementations
  • Checkpointing: All functions include checkpointing for important statistics and debugging

references/bcsz.md

BCS API client library documentation:

  • Connection Setup: Async/await patterns, ZMQ integration, event loop compatibility
  • API Methods: Complete method reference for motors, AI channels, DIO, instruments, scans
  • Status Enums: Motor status, command types, error handling
  • Best Practices: Race condition prevention, proper async usage, error recovery

references/coords.png

Visual diagram showing:

  • Sample-detector geometry
  • Coordinate system relationships
  • Sample Theta and CCD Theta definitions
  • Beam path and detector positioning

Constraints

MUST DO

  • Always perform instrument alignment before sample alignment
  • Use checkpointing to save important statistics at each alignment step
  • Verify motor names against the complete motor reference before use
  • Check convergence criteria in iterative alignment procedures
  • Use proper 2θ geometry when calculating detector positions for reflection measurements
  • Normalize intensity measurements using photodiode or Izero readings
  • Account for beam drift and motor drift throughout experiments
  • Use appropriate AI channels (Photodiode vs AI 6 BeamStop) based on precision requirements

MUST NOT DO

  • Skip instrument alignment before sample alignment
  • Use motor names without verifying they exist in the motor reference
  • Ignore convergence criteria in iterative algorithms
  • Mix coordinate systems without proper transformation
  • Use area detector (CCD) when photodiode should be used for alignment
  • Assume motor positions without checking current state
  • Hardcode motor positions that may drift over time

Output Templates

When implementing beamline control solutions, provide:

  1. Code with proper async/await patterns for BCS API calls
  2. Checkpointing at critical steps for debugging and analysis
  3. Error handling for motor movements and data acquisition
  4. Convergence checking in iterative algorithms
  5. Comments explaining coordinate system transformations and geometry
  6. Validation of motor names and AI/DIO channel names before use

Knowledge Reference

ALS 11.0.1.2 RSoXS beamline, BCS API, asyncio, ZMQ, motor control, sample alignment algorithms, NEXAFS spectroscopy, X-ray reflectivity, coordinate systems, detector positioning, beamline geometry, EPU polarization control, monochromator operation, scatter slits, higher order suppressor, photodiode measurements, centroid calculations, half-maximum finding, convergence algorithms, checkpointing strategies

Related Skills

  • Python Pro - Async/await patterns, type hints, error handling
  • Pandas Pro - Data processing and analysis of experimental data
  • Data Scientist - Statistical analysis of spectroscopy results
Install via CLI
npx skills add https://github.com/ALS-RSOXS/Resonance --skill xray-pro
Repository Details
star Stars 1
call_split Forks 0
navigation Branch main
article Path SKILL.md
Occupations
More from Creator