基于 SOC 职业分类
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/arm2arm/AstroAgentAssistant --skill shboost-plot-s3命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
S3/MinIO operations: connectivity, transfers, read benchmarks, and matplotlib visualization templates.
Complete guide to the REANA reproducible analytics platform: Dockerized client setup, multi-backend profiles, workflow authoring patterns, S3 dataset workflows, and best practices. Covers dev/prod backends, serial workflows, REANA_WORKSPACE usage, and self-learning from finished workflows.
Complete guide to working with Arepo simulation HDF5 files: structure inspection, unit conversion, radial profiles, slice projections, and dimensionality reduction (UMAP/t-SNE) for clustering analysis.
| name | shboost-plot-s3 |
| description | Plot a sampled subset of the ShBoost 2024 star dataset stored on a public S3 bucket. |
| author | Hermes |
| version | 1 |
Plot a sampled subset of the ShBoost 2024 star dataset stored on a public S3 bucket.
This skill contains a reusable operational workflow. Follow the existing task-specific steps and examples in the sections below.
This is a specialized or legacy example skill. For new work, start with astro-data-access-umbrella and route through:
s3-parquet-astro-accessastro-catalog-plotting-cacheKeep this skill for dataset-specific examples, but prefer the canonical skills for new implementations, live probes, REANA execution, and plotting/cache conventions.
Create a reusable script that reads the shboost2024 Parquet files from the public S3 bucket, samples a configurable number of stars (e.g., ~100 000), and produces a scatter plot using seaborn/matplotlib.
dask[dataframe], s3fs, matplotlib, seaborn, pandaspython3 -m venv ~/shboost-env
source ~/shboost-env/bin/activate
pip install --quiet dask[dataframe] s3fs matplotlib seaborn pandas
S3_ENDPOINT = "https://s3.data.aip.de:9000"
storage_opts = {
"use_ssl": True,
"anon": True,
"client_kwargs": {"endpoint_url": S3_ENDPOINT},
}
PARQUET_GLOB = "s3://shboost2024/shboost_08july2024_pub.parq/*.parquet"
import dask.dataframe as dd
df = dd.read_parquet(PARQUET_GLOB, storage_options=storage_opts)
TARGET_ROWS = 100_000 # modify as needed
total_rows = df.shape[0].compute()
sample_frac = min(TARGET_ROWS / total_rows, 1.0)
print(f"Sampling {sample_frac:.6%} → ~{TARGET_ROWS:,} rows (dataset size {total_rows:,})")
Pitfall: total_rows triggers a cheap metadata read; if the bucket were private you’d need credentials.df_sample = df.sample(frac=sample_frac, random_state=42).persist()
sample_pd = df_sample.compute()
print(f"Sampled {len(sample_pd):,} rows")
Tip: .persist() keeps the sampled partitions in memory, speeding up later operations.| Symptom | Likely Cause | Fix |
|---|---|---|
No module named 'dask' | Packages not installed | Re‑run the pip install step inside your venv |
ClientError: 403 Forbidden | Wrong endpoint or missing credentials (bucket is public, so ensure anon=True and correct endpoint) | Verify S3_ENDPOINT and storage_opts settings |
KeyError for hue column | Column not present in sampled data | Remove the hue= argument or pick an existing column |
| MemoryError when sampling large fraction | Not enough RAM for the sample | Decrease TARGET_ROWS or increase swap/available memory |
TARGET_ROWS to any number (e.g., 1 000 000) – the script automatically recalculates the fraction.x_col / y_col to visualise other parameters (e.g., xgb_logteff, xgb_logg).plt.savefig('shboost_plot.png') before plt.show() for offline usage.Usage: Save the script as shboost_plot.py, make it executable, and run ./shboost_plot.py.
Author note: This skill was distilled from an interactive troubleshooting session where the raw notebook was parsed, the sampling logic clarified, and a clean, end‑user‑friendly script was produced.
bprp0 vs mg0:
import matplotlib.pyplot as plt
import seaborn as sns
x_col, y_col = "bprp0", "mg0"
plt.figure(figsize=(10, 6))
sns.scatterplot(
data=sample_pd,
x=x_col,
y=y_col,
hue="xgb_inputflag", # optional, remove if column missing
palette="viridis",
s=10,
alpha=0.6,
linewidth=0,
)
plt.title(f"ShBoost 2024 – {len(sample_pd):,} random stars")
plt.xlabel(x_col)
plt.ylabel(y_col)
plt.tight_layout()
plt.show()
Pitfall: If the optional hue column does not exist, remove hue= argument to avoid a KeyError.