[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7C0TZKDK5K8PFX6BJAEW7E4":3,"skill-same:01M7C0TZKDK5K8PFX6BJAEW7E4":45},{"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":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M7C0TZKDK5K8PFX6BJAEW7E4","light-curve-preprocessing",null,"Preprocessing and cleaning techniques for astronomical light curves. Use when preparing light curve data for period analysis, including outlier removal, trend removal, flattening, and handling data quality flags. Works with lightkurve and general time series data.","linyouxue\u002Fskill-repair-benchmark","linyouxue","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F216151464?v=4","01M7BJEVCXKD74KH6FG9CBVSQB","林宥学","01M7BJEVE02NP217V93BKZFC0J",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fevaluation\u002Fresults\u002FSkillOpt-adapted-gpt52-n3L4R2-v25\u002Ftasks\u002Fexoplanet-detection-period\u002Frepaired_skill\u002Flight-curve-preprocessing\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: light-curve-preprocessing\ndescription: Preprocessing and cleaning techniques for astronomical light curves. Use when preparing light curve data for period analysis, including outlier removal, trend removal, flattening, and handling data quality flags. Works with lightkurve and general time series data.\n---\n\n# Light Curve Preprocessing\n\nPreprocessing is essential before period analysis. Raw light curves often contain outliers, long-term trends, and instrumental effects that can mask or create false periodic signals.\n\n## Overview\n\nCommon preprocessing steps:\n1. Remove outliers\n2. Remove long-term trends\n3. Handle data quality flags\n4. Remove stellar variability (optional)\n\n## Outlier Removal\n\n### Using Lightkurve\n\n```python\nimport lightkurve as lk\n\n# Remove outliers using sigma clipping\nlc_clean, mask = lc.remove_outliers(sigma=3, return_mask=True)\noutliers = lc[mask]  # Points that were removed\n\n# Common sigma values:\n# sigma=3: Standard (removes ~0.3% of data)\n# sigma=5: Conservative (removes fewer points)\n# sigma=2: Aggressive (removes more points)\n```\n\n### Manual Outlier Removal\n\n```python\nimport numpy as np\n\n# Calculate median and standard deviation\nmedian = np.median(flux)\nstd = np.std(flux)\n\n# Remove points beyond 3 sigma\ngood = np.abs(flux - median) \u003C 3 * std\ntime_clean = time[good]\nflux_clean = flux[good]\nerror_clean = error[good]\n```\n\n## Removing Long-Term Trends\n\n### Flattening with Lightkurve\n\nA fixed `window_length` is not generally safe because its physical timescale depends on cadence and transit duration. Estimate the cadence from sorted time differences and choose several baseline timescales that are comfortably longer than plausible transit durations; test the result rather than assuming that a particular number of cadences preserves transits. Prefer a robust rolling baseline, spline, or comparable low-frequency model, and divide (or subtract, consistently) the flux by that baseline. Fit the baseline after masking candidate negative dips, or iteratively refit: make an initial robust baseline, identify candidate transit windows, exclude those windows from the baseline fit, and refit. This prevents shallow repeated transits from being absorbed into the activity model.\n\nTransform uncertainties with the same operations. For multiplicative flattening, `flux_flat = flux \u002F baseline` and `error_flat = flux_err \u002F abs(baseline)`; renormalizing by a scalar requires dividing both arrays by that scalar. Do not use a smoothing scale so short that it follows transit ingress\u002Fegress or so long that strong stellar oscillations remain. Compare multiple physically plausible scales and retain only transit-like signals that persist while low-frequency residual power decreases.\n\n### Iterative Sine Fitting\n\nFor removing high-frequency stellar variability (rotation, pulsation):\n\n```python\ndef sine_fitting(lc):\n    \"\"\"Remove dominant periodic signal by fitting sine wave.\"\"\"\n    pg = lc.to_periodogram()\n    model = pg.model(time=lc.time, frequency=pg.frequency_at_max_power)\n    lc_new = lc.copy()\n    lc_new.flux = lc_new.flux \u002F model.flux\n    return lc_new, model\n\n# Iterate multiple times to remove multiple periodic components\nlc_processed = lc_clean.copy()\nfor i in range(50):  # Number of iterations\n    lc_processed, model = sine_fitting(lc_processed)\n```\n\n**Warning**: This removes periodic signals, so use carefully if you're searching for periodic transits.\n\n## Handling Data Quality Flags\n\nParse and validate the columns together. For the standard TESS convention, quality flag `0` means usable data, so retain `flag == 0`; do not invert this rule merely because the alternative looks visually cleaner. Remove rows with nonfinite MJD, flux, flag, or uncertainty, and require finite strictly positive uncertainties. Validate that the time values are in MJD days, sort all columns by time, and remove duplicate or non-increasing timestamps if the downstream method requires strictly increasing time. Every mask, gap split, normalization, and detrending operation must be applied to the uncertainty array as well as the flux array.\n\n## Preprocessing Pipeline Considerations\n\nWhen building a preprocessing pipeline for exoplanet detection:\n\n### Key Steps (Order Matters!)\n\n1. **Quality filtering**: Apply data quality flags first\n2. **Outlier removal**: Remove bad data points (flares, cosmic rays)\n3. **Trend removal**: Remove long-term variations (stellar rotation, instrumental drift)\n4. **Optional second pass**: Additional outlier removal after detrending\n\n### Important Principles\n\n- **Always include flux_err**: Critical for proper weighting in period search algorithms\n- **Preserve transit shapes**: Use methods like `flatten()` that preserve short-duration dips\n- **Don't over-process**: Too aggressive preprocessing can remove real signals\n- **Verify visually**: Plot each step to ensure quality\n\n### Parameter Selection\n\n- **Outlier removal sigma**: Lower sigma (2-3) is aggressive, higher (5-7) is conservative\n- **Flattening window**: Should be longer than transit duration but shorter than stellar rotation period\n- **When to do two passes**: Remove obvious outliers before detrending, then remove residual outliers after\n\n## Preprocessing for Exoplanet Detection\n\nFor transit detection, be careful not to remove the transit signal:\n\n1. **Remove outliers first**: Use sigma=3 or sigma=5\n2. **Flatten trends**: Use window_length appropriate for your data\n3. **Don't over-process**: Too much smoothing can remove shallow transits\n\n## Visualizing Results\n\nAlways plot your light curve to verify preprocessing quality:\n\n```python\nimport matplotlib.pyplot as plt\n\n# Use .plot() method on LightCurve objects\nlc.plot()\nplt.show()\n```\n\n**Best practice**: Plot before and after each major step to ensure you're improving data quality, not removing real signals.\n\n## Dependencies\n\n```bash\npip install lightkurve numpy matplotlib\n```\n\n## References\n\n- [Lightkurve Preprocessing Tutorials](https:\u002F\u002Flightkurve.github.io\u002Flightkurve\u002Ftutorials\u002Findex.html)\n- [Removing Instrumental Noise](https:\u002F\u002Flightkurve.github.io\u002Flightkurve\u002Ftutorials\u002F2.3-removing-noise.html)\n\n## Best Practices\n\n1. **Always check quality flags first**: Remove bad data before processing\n2. **Remove outliers before flattening**: Outliers can affect trend removal\n3. **Choose appropriate window length**: Too short = doesn't remove trends, too long = removes transits\n4. **Visualize each step**: Make sure preprocessing improves the data\n5. **Don't over-process**: More preprocessing isn't always better\n\n\n\n## Reproducible Activity-Dominated Transit Preprocessing\n\nFor a four-column TESS text file containing MJD, normalized flux, quality flag, and flux uncertainty, use this order: load and validate exactly four numeric columns; retain finite rows with `quality == 0` and `flux_err > 0`; sort by MJD; and apply any isolated-outlier mask to all columns. Estimate the cadence from robust central time differences and identify gaps substantially larger than the cadence. Treat separated segments independently when a gap or sector boundary makes a single baseline inappropriate, normalizing each segment by a robust median while scaling its uncertainty by the same factor.\n\nEstimate stellar activity with a robust low-frequency model such as a spline or rolling median\u002FLOWESS. Its physical timescale must be longer than plausible transit durations, and it should be evaluated at several scales rather than selected from cadence alone. Before fitting, mask provisional negative transit-like points; then refit the activity baseline and repeat once or twice. Alternatively, use iterative sigma-clipped robust fitting that clips only baseline residuals and does not discard coherent, repeated dips. Divide flux and uncertainty by the fitted baseline for multiplicative flattening. Preserve the original time and row mapping so candidate events can be inspected in the unflattened data.\n\nRun the transit search on each detrending variant with the corresponding uncertainty array. Compare residual low-frequency power or RMS before and after detrending, and compare the candidate's search significance, depth, duration, number of distinct events, and phase-folded morphology across baseline timescales. A useful preprocessing choice reduces the oscillatory residuals without erasing repeated transit-shaped dips; a peak that appears only for one aggressive window, or disappears when candidate dips are masked during baseline fitting, is not robust. Save or plot the masks, segment boundaries, baselines, uncertainties, and residual light curves for verification.\n","# Light Curve Preprocessing\n\nPreprocessing is essential before period analysis. Raw light curves often contain outliers, long-term trends, and instrumental effects that can mask or create false periodic signals.\n\n## Overview\n\nCommon preprocessing steps:\n1. Remove outliers\n2. Remove long-term trends\n3. Handle data quality flags\n4. Remove stellar variability (optional)\n\n## Outlier Removal\n\n### Using Lightkurve\n\n```python\nimport lightkurve as lk\n\n# Remove outliers using sigma clipping\nlc_clean, mask = lc.remove_outliers(sigma=3, return_mask=True)\noutliers = lc[mask]  # Points that were removed\n\n# Common sigma values:\n# sigma=3: Standard (removes ~0.3% of data)\n# sigma=5: Conservative (removes fewer points)\n# sigma=2: Aggressive (removes more points)\n```\n\n### Manual Outlier Removal\n\n```python\nimport numpy as np\n\n# Calculate median and standard deviation\nmedian = np.median(flux)\nstd = np.std(flux)\n\n# Remove points beyond 3 sigma\ngood = np.abs(flux - median) \u003C 3 * std\ntime_clean = time[good]\nflux_clean = flux[good]\nerror_clean = error[good]\n```\n\n## Removing Long-Term Trends\n\n### Flattening with Lightkurve\n\nA fixed `window_length` is not generally safe because its physical timescale depends on cadence and transit duration. Estimate the cadence from sorted time differences and choose several baseline timescales that are comfortably longer than plausible transit durations; test the result rather than assuming that a particular number of cadences preserves transits. Prefer a robust rolling baseline, spline, or comparable low-frequency model, and divide (or subtract, consistently) the flux by that baseline. Fit the baseline after masking candidate negative dips, or iteratively refit: make an initial robust baseline, identify candidate transit windows, exclude those windows from the baseline fit, and refit. This prevents shallow repeated transits from being absorbed into the activity model.\n\nTransform uncertainties with the same operations. For multiplicative flattening, `flux_flat = flux \u002F baseline` and `error_flat = flux_err \u002F abs(baseline)`; renormalizing by a scalar requires dividing both arrays by that scalar. Do not use a smoothing scale so short that it follows transit ingress\u002Fegress or so long that strong stellar oscillations remain. Compare multiple physically plausible scales and retain only transit-like signals that persist while low-frequency residual power decreases.\n\n### Iterative Sine Fitting\n\nFor removing high-frequency stellar variability (rotation, pulsation):\n\n```python\ndef sine_fitting(lc):\n    \"\"\"Remove dominant periodic signal by fitting sine wave.\"\"\"\n    pg = lc.to_periodogram()\n    model = pg.model(time=lc.time, frequency=pg.frequency_at_max_power)\n    lc_new = lc.copy()\n    lc_new.flux = lc_new.flux \u002F model.flux\n    return lc_new, model\n\n# Iterate multiple times to remove multiple periodic components\nlc_processed = lc_clean.copy()\nfor i in range(50):  # Number of iterations\n    lc_processed, model = sine_fitting(lc_processed)\n```\n\n**Warning**: This removes periodic signals, so use carefully if you're searching for periodic transits.\n\n## Handling Data Quality Flags\n\nParse and validate the columns together. For the standard TESS convention, quality flag `0` means usable data, so retain `flag == 0`; do not invert this rule merely because the alternative looks visually cleaner. Remove rows with nonfinite MJD, flux, flag, or uncertainty, and require finite strictly positive uncertainties. Validate that the time values are in MJD days, sort all columns by time, and remove duplicate or non-increasing timestamps if the downstream method requires strictly increasing time. Every mask, gap split, normalization, and detrending operation must be applied to the uncertainty array as well as the flux array.\n\n## Preprocessing Pipeline Considerations\n\nWhen building a preprocessing pipeline for exoplanet detection:\n\n### Key Steps (Order Matters!)\n\n1. **Quality filtering**: Apply data quality flags first\n2. **Outlier removal**: Remove bad data points (flares, cosmic rays)\n3. **Trend removal**: Remove long-term variations (stellar rotation, instrumental drift)\n4. **Optional second pass**: Additional outlier removal after detrending\n\n### Important Principles\n\n- **Always include flux_err**: Critical for proper weighting in period search algorithms\n- **Preserve transit shapes**: Use methods like `flatten()` that preserve short-duration dips\n- **Don't over-process**: Too aggressive preprocessing can remove real signals\n- **Verify visually**: Plot each step to ensure quality\n\n### Parameter Selection\n\n- **Outlier removal sigma**: Lower sigma (2-3) is aggressive, higher (5-7) is conservative\n- **Flattening window**: Should be longer than transit duration but shorter than stellar rotation period\n- **When to do two passes**: Remove obvious outliers before detrending, then remove residual outliers after\n\n## Preprocessing for Exoplanet Detection\n\nFor transit detection, be careful not to remove the transit signal:\n\n1. **Remove outliers first**: Use sigma=3 or sigma=5\n2. **Flatten trends**: Use window_length appropriate for your data\n3. **Don't over-process**: Too much smoothing can remove shallow transits\n\n## Visualizing Results\n\nAlways plot your light curve to verify preprocessing quality:\n\n```python\nimport matplotlib.pyplot as plt\n\n# Use .plot() method on LightCurve objects\nlc.plot()\nplt.show()\n```\n\n**Best practice**: Plot before and after each major step to ensure you're improving data quality, not removing real signals.\n\n## Dependencies\n\n```bash\npip install lightkurve numpy matplotlib\n```\n\n## References\n\n- [Lightkurve Preprocessing Tutorials](https:\u002F\u002Flightkurve.github.io\u002Flightkurve\u002Ftutorials\u002Findex.html)\n- [Removing Instrumental Noise](https:\u002F\u002Flightkurve.github.io\u002Flightkurve\u002Ftutorials\u002F2.3-removing-noise.html)\n\n## Best Practices\n\n1. **Always check quality flags first**: Remove bad data before processing\n2. **Remove outliers before flattening**: Outliers can affect trend removal\n3. **Choose appropriate window length**: Too short = doesn't remove trends, too long = removes transits\n4. **Visualize each step**: Make sure preprocessing improves the data\n5. **Don't over-process**: More preprocessing isn't always better\n\n\n\n## Reproducible Activity-Dominated Transit Preprocessing\n\nFor a four-column TESS text file containing MJD, normalized flux, quality flag, and flux uncertainty, use this order: load and validate exactly four numeric columns; retain finite rows with `quality == 0` and `flux_err > 0`; sort by MJD; and apply any isolated-outlier mask to all columns. Estimate the cadence from robust central time differences and identify gaps substantially larger than the cadence. Treat separated segments independently when a gap or sector boundary makes a single baseline inappropriate, normalizing each segment by a robust median while scaling its uncertainty by the same factor.\n\nEstimate stellar activity with a robust low-frequency model such as a spline or rolling median\u002FLOWESS. Its physical timescale must be longer than plausible transit durations, and it should be evaluated at several scales rather than selected from cadence alone. Before fitting, mask provisional negative transit-like points; then refit the activity baseline and repeat once or twice. Alternatively, use iterative sigma-clipped robust fitting that clips only baseline residuals and does not discard coherent, repeated dips. Divide flux and uncertainty by the fitted baseline for multiplicative flattening. Preserve the original time and row mapping so candidate events can be inspected in the unflattened data.\n\nRun the transit search on each detrending variant with the corresponding uncertainty array. Compare residual low-frequency power or RMS before and after detrending, and compare the candidate's search significance, depth, duration, number of distinct events, and phase-folded morphology across baseline timescales. A useful preprocessing choice reduces the oscillatory residuals without erasing repeated transit-shaped dips; a peak that appears only for one aggressive window, or disappears when candidate dips are masked during baseline fitting, is not robust. Save or plot the masks, segment boundaries, baselines, uncertainties, and residual light curves for verification.\n",{"name":5,"description":7},"main","cdcb6d230f3b15c3c33f8a2bdd16439f43602cbe","evaluation\u002Fresults\u002FSkillOpt-adapted-gpt52-n3L4R2-v25\u002Ftasks\u002Fexoplanet-detection-period\u002Frepaired_skill\u002Flight-curve-preprocessing",1,"https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark","https:\u002F\u002Fgithub.com\u002Flinyouxue","2026-11-14 20:28:35",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add linyouxue\u002Fskill-repair-benchmark --skill light-curve-preprocessing",{"tool":37,"command":38},"bunx","bunx skills add linyouxue\u002Fskill-repair-benchmark --skill light-curve-preprocessing",{"tool":40,"command":41},"pnpm","pnpm dlx skills add linyouxue\u002Fskill-repair-benchmark --skill light-curve-preprocessing","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fevaluation\u002Fresults\u002FSkillOpt-adapted-gpt52-n3L4R2-v25\u002Ftasks\u002Fexoplanet-detection-period\u002Frepaired_skill\u002Flight-curve-preprocessing\u002FSKILL.md",true,[],[46,53,60,67,72,77],{"skillNo":47,"name":48,"nameZh":6,"description":49,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":50,"categories":51,"keywords":52,"publishedAt":19},"01M7E1HGVRY73NBJ022CJG13X6","video-frame-extraction","Extract frames from video files and save them as images using OpenCV","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_03\u002Finputs\u002Fskills\u002Fvideo-frame-extraction\u002FSKILL.md",[],[],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":19},"01M7E1HAG5R7CJ9C8NYJS771MB","openai-vision","Analyze images and multi-frame sequences using OpenAI GPT vision models","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_03\u002Finputs\u002Fskills\u002Fopenai-vision\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M7E1H7DADKB6QBWKC2KQ63SZ","image-ocr","Extract text content from images using Tesseract OCR via Python, including structured field extraction from receipts and forms","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_03\u002Finputs\u002Fskills\u002Fimage-ocr\u002FSKILL.md",[],[],{"skillNo":68,"name":48,"nameZh":6,"description":49,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":19},"01M7E1H0WBNT43TENGQY7AVZHD","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_02\u002Finputs\u002Fskills\u002Fvideo-frame-extraction\u002FSKILL.md",[],[],{"skillNo":73,"name":55,"nameZh":6,"description":56,"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},"01M7E1GTC7D4N4Q2EF03875J9E","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_02\u002Finputs\u002Fskills\u002Fopenai-vision\u002FSKILL.md",[],[],{"skillNo":78,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M7E1GQ92CWFMGH53KSSE4WER","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_02\u002Finputs\u002Fskills\u002Fimage-ocr\u002FSKILL.md",[],[]]