[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7EN1K0J0CB8GXT5R847ESG2":3,"skill-same:01M7EN1K0J0CB8GXT5R847ESG2":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":6,"updatedAt":32,"install":33,"resources":46},"01M7EN1K0J0CB8GXT5R847ESG2","fits-workflows",null,"Working with FITS astronomical data — headers, WCS, image calibration, and stacking with astropy.","TanNhatCMS\u002Fjarvis","TanNhatCMS","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F113796420?v=4","01M753MV17KG5CD3152G3WQEQY","KietNT","01M7EKEDYVYQ6PWVJJMZ911VMX",0,"MIT","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fams-fits-workflows\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: fits-workflows\ndescription: Working with FITS astronomical data — headers, WCS, image calibration, and stacking with astropy.\ncategory: scientific\n---\n\n## Overview\n\nFITS is astronomy's universal container: n-dimensional arrays plus rich\nheaders carrying coordinates, instrument state, and provenance. This skill\ncovers reading and manipulating FITS files with astropy, understanding\nWCS (world coordinate systems), the CCD calibration chain (bias, dark,\nflat), and stacking — the unglamorous pipeline every pretty picture\nstands on.\n\n## When to use\n\n- Opening and inspecting any astronomical image, spectrum, or data cube\n- Calibrating raw CCD\u002FCMOS frames: bias subtraction, dark correction, flat-fielding\n- Aligning and stacking exposures to go deeper\n- Converting pixel coordinates to RA\u002FDec (and back) with WCS\n- Writing FITS files with proper headers for archiving or publication\n\n## Core concepts\n\n- **HDUList structure:** Primary HDU + extensions (image, binary table, compressed); headers are keyword = value \u002F comment cards — always inspect before assuming (BITPIX, BUNIT, BSCALE\u002FBZERO).\n- **WCS:** the mapping from pixel (x, y) to sky (RA, Dec) via reference pixel (CRPIX), reference value (CRVAL), and transformation matrix (CD\u002FPC + CDELT); distortions need SIP or TPV extensions — linear WCS is approximate at field edges.\n- **Calibration chain:** raw − bias (zero-point) − scaled dark (thermal current) → ÷ normalized flat (pixel response) — in that order; each step needs master frames built from many exposures with sigma-clipping.\n- **Noise model:** read noise (per read), photon\u002FPoisson noise (√N), dark current — propagate into weight\u002Ferror maps; don't stack without tracking noise.\n- **Units and scaling:** BSCALE\u002FBZERO pseudo-floats, BUNIT strings (check them — \"counts\" vs \"electrons\" vs \"ADU\" changes every downstream calculation), exposure time and gain in headers for flux calibration.\n- **Provenance:** DATE-OBS, INSTRUME, TELESCOP, FILTER, EXPTIME, GAIN, RDNOISE — a FITS file without these is barely science-ready; preserve and extend headers through the pipeline.\n\n- **Data cubes:** 3D FITS (RA, Dec, wavelength\u002Fvelocity) from integral-field spectrographs and radio interferometers — slice, collapse (moment maps), and visualize with spectral-cube; mind the beam\u002FPSF varying with frequency.\n- **Table extensions:** binary tables carry catalogs, spectra, and light curves in the same container — learn fits.getdata on extensions, not just images; column units live in TUNITn keywords.\n- **Checksums:** DATASUM and CHECKSUM keywords verify file integrity through archives and transfers — verify before long pipelines, not after mysterious failures.\n\n## Practical workflow\n\n### 1. Inspect before you touch\n\n```python\nfrom astropy.io import fits\nhdul = fits.open(\"frame.fits\")\nhdul.info()                    # HDU layout\nhdr = hdul[0].header\nprint(repr(hdr))               # read every keyword that matters\ndata = hdul[0].data.astype(float)\n```\n\n1. Verify dimensions, BITPIX, BUNIT, and that the WCS is present and sane (plot a coordinate grid).\n2. Check for BSCALE\u002FBZERO — astropy applies them by default; know whether your array is in raw ADU or scaled units.\n3. Look at the data: statistics, a quick display with sensible scaling (zscale), and a histogram — saturated, blank, or gradient-dominated frames announce themselves.\n\n### 2. Build masters and calibrate\n\n```python\nfrom astropy.io.fits import getdata\nimport numpy as np\n# Sigma-clipped master bias from N frames; same pattern for darks and flats\nbias = np.median([getdata(f).astype(float) for f in bias_files], axis=0)\n```\n\n1. Combine ≥15 biases (median), darks matched to science exposure time and temperature, flats per filter (dome + sky, or twilight).\n2. Normalize flats by their mode\u002Fmedian — never divide by a flat containing zeros or cosmic rays (clip and smooth appropriately).\n3. Apply: (raw − master_bias − scaled_master_dark) \u002F normalized_master_flat; propagate or at least record the noise terms.\n4. Fix cosmic rays (LACosmic \u002F astroscrappy) after calibration, before stacking — and keep a mask.\n\n### 3. Align, stack, and solve astrometry\n\n1. Register frames via WCS reprojection (reproject package) or star matching; verify alignment by blinking subtracted pairs.\n2. Stack with sigma-clipped mean\u002Fmedian; generate exposure\u002Fweight maps alongside — the stack is only half the product.\n3. If WCS is missing or wrong, solve with astrometry.net (local solve-field) and verify against a catalog (Gaia) — residuals should be sub-pixel.\n\n### 4. Write it back properly\n\n1. Update headers: processing steps in HISTORY, calibration files used, software versions.\n2. Keep BUNIT honest through every operation; stacking changes \"counts\" to \"counts\u002Fs\" only if you divided by exposure — say which.\n3. Compress wisely (Rice for integers, float quantization only if you understand the precision cost); never lossy-compress science data silently.\n\n### 5. Build a reproducible reduction pipeline\n\n1. Script every step (no interactive GUI-only operations) with logged parameters — the pipeline script plus raw data plus calibration files reproduces the product.\n2. Version-control the pipeline; tag the version used for each data release — \"reduced with v2.3.1\" belongs in every paper's methods.\n3. Validate end-to-end on a standard field: photometric zero points against catalogs, astrometry against Gaia — pipeline outputs get the same QA as the science.\n\n## Common pitfalls\n\n- **Calibrating in the wrong order:** dividing by the flat before subtracting bias bakes the bias structure into every frame.\n- **Single master frames:** one bias frame adds its noise to every science frame — always combine many.\n- **Ignoring BUNIT\u002FBSCALE:** mixing ADU and electron units between frames corrupts flat-fielding and photometry.\n- **Blind WCS trust:** linear WCS at wide-field edges can be arcseconds off — check residuals against Gaia.\n- **Stacking misaligned frames:** sub-pixel shifts smear PSFs and fake extended structure — verify registration first.\n- **Header amnesia:** processing without recording it makes the product irreproducible — HISTORY cards are cheap.\n- **Lossy compression of science frames:** quantizing float images to save space is irreversible — keep lossless masters; compress only distribution copies, and say so.\n- **Header keyword collisions:** non-standard keywords overwritten by software defaults (BUNIT, OBJECT) — audit headers after each pipeline stage, not just at the end.\n","## Overview\n\nFITS is astronomy's universal container: n-dimensional arrays plus rich\nheaders carrying coordinates, instrument state, and provenance. This skill\ncovers reading and manipulating FITS files with astropy, understanding\nWCS (world coordinate systems), the CCD calibration chain (bias, dark,\nflat), and stacking — the unglamorous pipeline every pretty picture\nstands on.\n\n## When to use\n\n- Opening and inspecting any astronomical image, spectrum, or data cube\n- Calibrating raw CCD\u002FCMOS frames: bias subtraction, dark correction, flat-fielding\n- Aligning and stacking exposures to go deeper\n- Converting pixel coordinates to RA\u002FDec (and back) with WCS\n- Writing FITS files with proper headers for archiving or publication\n\n## Core concepts\n\n- **HDUList structure:** Primary HDU + extensions (image, binary table, compressed); headers are keyword = value \u002F comment cards — always inspect before assuming (BITPIX, BUNIT, BSCALE\u002FBZERO).\n- **WCS:** the mapping from pixel (x, y) to sky (RA, Dec) via reference pixel (CRPIX), reference value (CRVAL), and transformation matrix (CD\u002FPC + CDELT); distortions need SIP or TPV extensions — linear WCS is approximate at field edges.\n- **Calibration chain:** raw − bias (zero-point) − scaled dark (thermal current) → ÷ normalized flat (pixel response) — in that order; each step needs master frames built from many exposures with sigma-clipping.\n- **Noise model:** read noise (per read), photon\u002FPoisson noise (√N), dark current — propagate into weight\u002Ferror maps; don't stack without tracking noise.\n- **Units and scaling:** BSCALE\u002FBZERO pseudo-floats, BUNIT strings (check them — \"counts\" vs \"electrons\" vs \"ADU\" changes every downstream calculation), exposure time and gain in headers for flux calibration.\n- **Provenance:** DATE-OBS, INSTRUME, TELESCOP, FILTER, EXPTIME, GAIN, RDNOISE — a FITS file without these is barely science-ready; preserve and extend headers through the pipeline.\n\n- **Data cubes:** 3D FITS (RA, Dec, wavelength\u002Fvelocity) from integral-field spectrographs and radio interferometers — slice, collapse (moment maps), and visualize with spectral-cube; mind the beam\u002FPSF varying with frequency.\n- **Table extensions:** binary tables carry catalogs, spectra, and light curves in the same container — learn fits.getdata on extensions, not just images; column units live in TUNITn keywords.\n- **Checksums:** DATASUM and CHECKSUM keywords verify file integrity through archives and transfers — verify before long pipelines, not after mysterious failures.\n\n## Practical workflow\n\n### 1. Inspect before you touch\n\n```python\nfrom astropy.io import fits\nhdul = fits.open(\"frame.fits\")\nhdul.info()                    # HDU layout\nhdr = hdul[0].header\nprint(repr(hdr))               # read every keyword that matters\ndata = hdul[0].data.astype(float)\n```\n\n1. Verify dimensions, BITPIX, BUNIT, and that the WCS is present and sane (plot a coordinate grid).\n2. Check for BSCALE\u002FBZERO — astropy applies them by default; know whether your array is in raw ADU or scaled units.\n3. Look at the data: statistics, a quick display with sensible scaling (zscale), and a histogram — saturated, blank, or gradient-dominated frames announce themselves.\n\n### 2. Build masters and calibrate\n\n```python\nfrom astropy.io.fits import getdata\nimport numpy as np\n# Sigma-clipped master bias from N frames; same pattern for darks and flats\nbias = np.median([getdata(f).astype(float) for f in bias_files], axis=0)\n```\n\n1. Combine ≥15 biases (median), darks matched to science exposure time and temperature, flats per filter (dome + sky, or twilight).\n2. Normalize flats by their mode\u002Fmedian — never divide by a flat containing zeros or cosmic rays (clip and smooth appropriately).\n3. Apply: (raw − master_bias − scaled_master_dark) \u002F normalized_master_flat; propagate or at least record the noise terms.\n4. Fix cosmic rays (LACosmic \u002F astroscrappy) after calibration, before stacking — and keep a mask.\n\n### 3. Align, stack, and solve astrometry\n\n1. Register frames via WCS reprojection (reproject package) or star matching; verify alignment by blinking subtracted pairs.\n2. Stack with sigma-clipped mean\u002Fmedian; generate exposure\u002Fweight maps alongside — the stack is only half the product.\n3. If WCS is missing or wrong, solve with astrometry.net (local solve-field) and verify against a catalog (Gaia) — residuals should be sub-pixel.\n\n### 4. Write it back properly\n\n1. Update headers: processing steps in HISTORY, calibration files used, software versions.\n2. Keep BUNIT honest through every operation; stacking changes \"counts\" to \"counts\u002Fs\" only if you divided by exposure — say which.\n3. Compress wisely (Rice for integers, float quantization only if you understand the precision cost); never lossy-compress science data silently.\n\n### 5. Build a reproducible reduction pipeline\n\n1. Script every step (no interactive GUI-only operations) with logged parameters — the pipeline script plus raw data plus calibration files reproduces the product.\n2. Version-control the pipeline; tag the version used for each data release — \"reduced with v2.3.1\" belongs in every paper's methods.\n3. Validate end-to-end on a standard field: photometric zero points against catalogs, astrometry against Gaia — pipeline outputs get the same QA as the science.\n\n## Common pitfalls\n\n- **Calibrating in the wrong order:** dividing by the flat before subtracting bias bakes the bias structure into every frame.\n- **Single master frames:** one bias frame adds its noise to every science frame — always combine many.\n- **Ignoring BUNIT\u002FBSCALE:** mixing ADU and electron units between frames corrupts flat-fielding and photometry.\n- **Blind WCS trust:** linear WCS at wide-field edges can be arcseconds off — check residuals against Gaia.\n- **Stacking misaligned frames:** sub-pixel shifts smear PSFs and fake extended structure — verify registration first.\n- **Header amnesia:** processing without recording it makes the product irreproducible — HISTORY cards are cheap.\n- **Lossy compression of science frames:** quantizing float images to save space is irreversible — keep lossless masters; compress only distribution copies, and say so.\n- **Header keyword collisions:** non-standard keywords overwritten by software defaults (BUNIT, OBJECT) — audit headers after each pipeline stage, not just at the end.\n",{"name":5,"category":24,"description":7},"scientific","main","af388a77c2fe5e0b4fd879cca4300a0ffa9a6579","skills\u002Fams-fits-workflows",1,"https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis","https:\u002F\u002Fgithub.com\u002FTanNhatCMS","https:\u002F\u002Fmrkiet.name.vn","2026-11-07 14:23:08",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add TanNhatCMS\u002Fjarvis --skill fits-workflows",{"tool":39,"command":40},"bunx","bunx skills add TanNhatCMS\u002Fjarvis --skill fits-workflows",{"tool":42,"command":43},"pnpm","pnpm dlx skills add TanNhatCMS\u002Fjarvis --skill fits-workflows","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fams-fits-workflows\u002FSKILL.md",true,[],[48,55,63,70,77,84],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":19},"01M7EWYJR0J8DARY7E59Z6Y9MV","web-scrape","Turn web pages into LLM-ready markdown via the Firecrawl API (renders JS, anti-bot handling). Use when browser_open\u002Ffetch fails on JS-heavy pages, or when you need clean markdown\u002Fstructured extraction from a site. Requires FIRECRAWL_API_KEY.","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fweb-scrape\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":59,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M7EWYBN5P6F2AJG3FR24T9BP","design-taste-frontend","tasteskill v2, the anti-slop frontend skill. Art direction for websites, distilled from a study of 247 curated gallery sites (One Page Love, Awwwards Sites of the Day). Deals researched directions (idea, composition, type, palette, photographs, section blueprints) from a library, enforces a strict no-slop house style with a real-browser inspector, and runs a look-and-fix loop on screenshots. Use this whenever you build, design, redesign, restyle, polish or review a landing page, marketing site, portfolio, product page, one-pager, hero or any public-facing web page, in any stack (HTML\u002FCSS, React, Next.js, Vue, Svelte, Astro, Tailwind) — also when the user says a page looks generic, templated, \"AI-made\", sloppy, or asks to make it look designed, premium, award-level or less like every other site. Not for dashboards or app screens.","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Ftaste-design\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Ftaste-design\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7EWY8FQFNQ2GB7NZZWGSSDX","test-driven-development","Use when implementing any feature or bugfix, before writing implementation code","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fsuperpowers-tdd\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M7EWY5SHBFRH1HDHVWM9K7TV","systematic-debugging","Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fsuperpowers-debugging\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M7EWY3NM0Z0JAKS7HDZ24K66","requesting-code-review","Use when completing tasks, implementing major features, or before merging to verify work meets requirements","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fsuperpowers-code-review\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M7EWY0WRMWX4M9ZFY0WKC593","brainstorming","You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fsuperpowers-brainstorming\u002FSKILL.md",[],[]]