### Install SPXQuery Package Source: https://github.com/wenkeren/spxquery/blob/main/docs/index.md Install the SPXQuery package using pip. This command is used for initial setup. ```bash pip install spxquery ``` -------------------------------- ### Install SPXQuery with Poetry Source: https://github.com/wenkeren/spxquery/blob/main/INSTALL.md After cloning the repository and installing Poetry, use this command to install SPXQuery and its development dependencies. ```bash git clone https://github.com/WenkeRen/spxquery.git cd spxquery poetry install ``` -------------------------------- ### Import and Setup SPXQuery Pipeline Source: https://github.com/wenkeren/spxquery/blob/main/example/quickstart_demo.ipynb Imports necessary modules from the spxquery package and sets up basic logging. Ensure spxquery is installed. ```python # Import required modules from pathlib import Path from spxquery import QueryConfig, Source, SPXQueryPipeline from spxquery.core.pipeline import run_pipeline from spxquery.utils.helpers import setup_logging # Set up logging setup_logging("INFO") ``` -------------------------------- ### Initialize SPXQuery Pipeline with pip Source: https://github.com/wenkeren/spxquery/blob/main/INSTALL.md Example of how to use SPXQuery in a Python script after installation with pip. It demonstrates creating a source, configuration, and running the pipeline. ```python from spxquery import Source, QueryConfig, SPXQueryPipeline # Create a source and configuration source = Source(ra=304.69, dec=42.44, name="my_target") config = QueryConfig( source=source, output_dir="output", cutout_size="200px" ) # Run the pipeline pipeline = SPXQueryPipeline(config) pipeline.run_full_pipeline() ``` -------------------------------- ### Install SPXQuery from Source Source: https://github.com/wenkeren/spxquery/blob/main/README.md Clone the repository and install SPXQuery locally if you need the latest development version or want to contribute. ```bash git clone https://github.com/WenkeRen/spxquery.git cd spxquery pip install . ``` -------------------------------- ### Install Poetry Source: https://github.com/wenkeren/spxquery/blob/main/INSTALL.md Install Poetry using the provided script. This is a prerequisite for using the Poetry installation method. ```bash curl -sSL https://install.python-poetry.org | python3 - ``` ```powershell (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py - ``` -------------------------------- ### Install Poetry Source: https://github.com/wenkeren/spxquery/blob/main/CONTRIBUTING.md Installs Poetry, the recommended package manager for SPXQuery. Run this command in your terminal. ```bash curl -sSL https://install.python-poetry.org | python3 - ``` -------------------------------- ### Install SPXQuery from Source using pip Source: https://github.com/wenkeren/spxquery/blob/main/INSTALL.md Install SPXQuery and its dependencies directly from the pyproject.toml file. This is the recommended method for most users. ```bash pip install . ``` -------------------------------- ### Install Package with pip Source: https://github.com/wenkeren/spxquery/blob/main/CONTRIBUTING.md Installs the SPXQuery package in development mode along with its dev dependencies using pip. This is used with the pip alternative setup. ```bash pip install -e ".[dev]" ``` -------------------------------- ### Verify SPXQuery Installation Source: https://github.com/wenkeren/spxquery/blob/main/README.md Run this command in your terminal to confirm that SPXQuery has been installed correctly and to check its version. ```bash python -c "import spxquery; print(spxquery.__version__)" ``` -------------------------------- ### Install Dependencies with Poetry Source: https://github.com/wenkeren/spxquery/blob/main/README.md For developers managing dependencies with Poetry, use these commands to install Poetry and then the project's dependencies. ```bash # Install Poetry curl -sSL https://install.python-poetry.org | python3 - # Install with Poetry poetry install ``` -------------------------------- ### AdvancedConfig: Factory Method for Quick Setup Source: https://context7.com/wenkeren/spxquery/llms.txt Uses the `AdvancedConfig.create` factory method for a streamlined setup of pipeline configuration. Parameters are automatically routed to the appropriate sub-configuration objects. ```python from spxquery.core.config import ( AdvancedConfig, QueryConfig, PhotometryConfig, VisualizationConfig, DownloadConfig, Source ) from pathlib import Path # Method 1: Factory method for quick setup source = Source(ra=304.69, dec=42.44, name="My_Star") config = AdvancedConfig.create( source=source, output_dir=Path("output"), bands=['D1', 'D2'], aperture_diameter=5.0, # Routes to PhotometryConfig use_magnitude=True, # Routes to VisualizationConfig cutout_size='200px' # Routes to DownloadConfig ) ``` -------------------------------- ### Verify SPXQuery Installation (Poetry) Source: https://github.com/wenkeren/spxquery/blob/main/INSTALL.md Verify the SPXQuery installation when using Poetry by running the version check within the Poetry environment. ```python poetry run python -c "import spxquery; print(spxquery.__version__)" ``` -------------------------------- ### Verify Poetry Installation Source: https://github.com/wenkeren/spxquery/blob/main/INSTALL.md Check if Poetry has been installed successfully by verifying its version. ```bash poetry --version ``` -------------------------------- ### Cutout Parameter Validation Examples Source: https://github.com/wenkeren/spxquery/blob/main/docs/user_guide/cutouts.md Examples of valid and invalid `cutout_size` parameters, highlighting constraints and potential warnings. ```python # Valid cutout_size="200px" # ✓ cutout_size="3arcmin" # ✓ cutout_size="0.1" # ✓ cutout_size="100,200px" # ✓ # Invalid (raises ValueError) cutout_size="0px" # ✗ Zero size cutout_size="-100px" # ✗ Negative size cutout_size="2040,2040px" # ⚠ Warning: same as full image cutout_size="5000px" # ✗ Exceeds detector size ``` -------------------------------- ### Install Development Dependencies for SPXQuery Source: https://github.com/wenkeren/spxquery/blob/main/INSTALL.md Install SPXQuery along with development tools like pytest, black, and flake8, which are necessary for contributing to the project. ```bash poetry install --with dev ``` -------------------------------- ### SPXQuery Pipeline State File Example Source: https://github.com/wenkeren/spxquery/blob/main/docs/user_guide/pipeline.md This YAML structure represents the state of the SPXQuery pipeline, including completed stages, query results, and downloaded file information. It enables resuming after interruptions and configuration recovery. ```yaml # Pipeline state stage: complete completed_stages: - query - download - processing - visualization pipeline_stages: - query - download - processing - visualization # Query results query_results: observations: [...] time_span_days: 33.1 total_size_gb: 0.51 # Downloaded files and photometry downloaded_files: [...] photometry_results: [...] ``` -------------------------------- ### Clone SPXQuery Repository Source: https://github.com/wenkeren/spxquery/blob/main/INSTALL.md Use this command to clone the SPXQuery repository from GitHub. Navigate into the cloned directory to proceed with installation. ```bash git clone https://github.com/WenkeRen/spxquery.git cd spxquery ``` -------------------------------- ### Setup Fixed Aperture Configuration Source: https://github.com/wenkeren/spxquery/blob/main/example/quickstart_demo.ipynb Creates a configuration object for fixed aperture photometry using the 'fixed' method. This method uses a user-specified aperture diameter and a window-based background subtraction. Requires the AdvancedConfig class and a YAML file. ```python # Setup: Create configurations for both aperture methods # Configuration with fixed aperture (traditional) advanced_fixed = AdvancedConfig.from_yaml_file(output_dir / "cloverleaf.yaml") advanced_fixed.update(aperture_method="fixed", aperture_diameter=3.0, background_method="window", window_size=50) ``` -------------------------------- ### Initialize and Run SPXQuery Pipeline Source: https://context7.com/wenkeren/spxquery/llms.txt Demonstrates initializing the SPXQuery pipeline with an AdvancedConfig object and running the full pipeline. It also shows how to run pipeline stages individually and how to resume from a saved state. ```python source = Source(ra=213.9427080, dec=11.4953890, name="cloverleaf") output_dir = Path("./demo_data/cloverleaf") config = AdvancedConfig( query=QueryConfig( source=source, output_dir=output_dir, bands=["D1", "D2", "D3", "D4", "D5", "D6"] ), download=DownloadConfig( cutout_size="60px", max_download_workers=5, max_retries=3, timeout=300 ), photometry=PhotometryConfig( aperture_method="fwhm", # Adaptive aperture sizing fwhm_multiplier=2.5, # Aperture = FWHM * 2.5 background_method="window", # Window background estimation window_size=50, # 50x50 pixel window subtract_zodi=True, # Subtract zodiacal light max_processing_workers=10 ), visualization=VisualizationConfig( sigma_threshold=5.0, use_magnitude=False, show_errorbars=True, figsize=(10, 8), dpi=150 ) ) # Initialize and run full pipeline pipeline = SPXQueryPipeline(config) pipeline.run_full_pipeline(skip_existing_downloads=True) # Or run stages individually with dependency checking pipeline = SPXQueryPipeline(config) pipeline.run_query() # Query IRSA archive pipeline.run_download() # Download FITS files pipeline.run_processing() # Extract photometry pipeline.run_visualization() # Create plots # Check pipeline status pipeline.print_status() # Output: # Pipeline Status: # Completed stages: ['query', 'download', 'processing', 'visualization'] # Pending stages: None # Current stage: complete # Resume from saved state (after interruption) pipeline_resumed = SPXQueryPipeline( AdvancedConfig.from_yaml_file(output_dir / "cloverleaf.yaml") ) pipeline_resumed.resume(skip_existing_downloads=True) ``` -------------------------------- ### Get SPXQuery Version Source: https://github.com/wenkeren/spxquery/blob/main/CONTRIBUTING.md Retrieves the currently installed version of the SPXQuery library using Python. This is useful for reporting issues. ```python import spxquery print(spxquery.__version__) ``` -------------------------------- ### Run SPXQuery Pipeline with Basic Parameters Source: https://github.com/wenkeren/spxquery/blob/main/docs/user_guide/parameters.md Use this to initiate the SPXQuery pipeline with essential parameters like source coordinates, output directory, and cutout size. ```python from spxquery.core.pipeline import run_pipeline run_pipeline( ra=213.94, dec=11.50, output_dir="output", cutout_size="200px" ) ``` -------------------------------- ### Basic SPXQuery Pipeline Usage Source: https://github.com/wenkeren/spxquery/blob/main/docs/index.md Demonstrates basic usage of the SPXQuery pipeline. Configure a source, set query parameters including cutout size and SNR threshold, and run the full pipeline. ```python from spxquery import SPXQueryPipeline, Source, QueryConfig # Define your astronomical source source = Source(ra=304.69, dec=42.44, name="My_Star") # Configure the query with cutout support config = QueryConfig( source=source, output_dir="output", cutout_size="200px", # Download only 200×200 pixel region sigma_threshold=5.0, # Minimum SNR for quality control ) # Run the full pipeline pipeline = SPXQueryPipeline(config) pipeline.run_full_pipeline() ``` -------------------------------- ### Run SPxQuery Pipeline (Advanced Parameters) Source: https://github.com/wenkeren/spxquery/blob/main/docs/api/core.md Execute the pipeline using advanced parameters loaded from a JSON file. First, export default parameters to a file, then edit the file to customize settings before passing its path to `advanced_params_file`. This allows for fine-grained control over photometry, visualization, and download settings. ```python >>> # With advanced parameters >>> from spxquery.utils.params import export_default_parameters >>> params_file = export_default_parameters("output") >>> # Edit output/spxquery_default_params.json >>> run_pipeline(ra=304.69, dec=42.44, advanced_params_file=params_file) ``` -------------------------------- ### Configure and Run SPXQuery Pipeline Source: https://github.com/wenkeren/spxquery/blob/main/README.md Set up the analysis configuration for a specific astronomical source and then run the full SPXQuery pipeline. This provides more control over the analysis parameters. ```python from spxquery import Source, QueryConfig, SPXQueryPipeline # Configure your analysis for Cloverleaf quasar source = Source(ra=213.9427080, dec=11.4953890, name="cloverleaf") config = QueryConfig( source=source, output_dir="output", aperture_diameter=2.0, cutout_size="60px" ) # Run the pipeline pipeline = SPXQueryPipeline(config) pipeline.run_full_pipeline() ``` -------------------------------- ### SPXQuery Pipeline Initialization and Stages Source: https://github.com/wenkeren/spxquery/blob/main/example/quickstart_demo.ipynb Logs showing the initialization of the SPXQuery pipeline, including RA/Dec coordinates, pipeline stages, and state file. ```log 2025-11-13 00:33:00 - spxquery.core.pipeline - INFO - Initialized pipeline for source at RA=213.942708, Dec=11.495389 2025-11-13 00:33:00 - spxquery.core.pipeline - INFO - Pipeline stages: ['query', 'download', 'processing', 'visualization'] 2025-11-13 00:33:00 - spxquery.core.pipeline - INFO - State file: cloverleaf.yaml 2025-11-13 00:33:00 - spxquery.core.pipeline - INFO - Starting full pipeline execution 2025-11-13 00:33:00 - spxquery.core.pipeline - INFO - Pipeline stages: ['query', 'download', 'processing', 'visualization'] 2025-11-13 00:33:00 - spxquery.core.pipeline - INFO - Running query stage 2025-11-13 00:33:00 - spxquery.core.query - INFO - Querying SPHEREx observations for source at RA=213.942708, Dec=11.495389 ``` -------------------------------- ### Print Configuration Details Source: https://github.com/wenkeren/spxquery/blob/main/example/quickstart_demo.ipynb Prints the current configuration details for annulus and window background methods. Useful for verifying settings after updates. ```python print("✓ Configurations created:") print(f" Annulus: method={advanced_annulus.photometry.background_method}") print(f" Window: method={advanced_window.photometry.background_method}, size={advanced_window.photometry.window_size}") ``` -------------------------------- ### Conventional Commit Examples Source: https://github.com/wenkeren/spxquery/blob/main/CONTRIBUTING.md Examples of commit messages following the conventional commits format. This standardizes commit history for better understanding and automation. ```bash git commit -m "feat: add cutout size validation" git commit -m "fix: correct wavelength calculation in photometry" git commit -m "docs: update installation instructions for Poetry" ``` -------------------------------- ### Configure SPXQuery with Default Parameters Source: https://github.com/wenkeren/spxquery/blob/main/docs/user_guide/parameters.md Initialize QueryConfig using only source and output directory to leverage all built-in default settings for advanced parameters. ```python # Scenario 1: Use defaults config = QueryConfig(source=source, output_dir="output") # Result: Uses all built-in defaults ``` -------------------------------- ### Troubleshoot Permission Errors with pip Source: https://github.com/wenkeren/spxquery/blob/main/INSTALL.md If you encounter permission errors during pip installation, try installing the package for the current user only or use a virtual environment. ```bash pip install --user . # Or use a virtual environment: python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install . ``` -------------------------------- ### Use Custom Parameters with SPXQueryPipeline Source: https://github.com/wenkeren/spxquery/blob/main/example/quickstart_demo.ipynb Initializes `SPXQueryPipeline` with custom parameters loaded from a file. Verifies that parameters like visualization DPI and photometry settings are correctly applied. ```python # Method 1: Using SPXQueryPipeline with advanced_params_file print("\nMethod 1: Using SPXQueryPipeline with advanced_params_file") print("=" * 70) # Create source pipeline_custom = SPXQueryPipeline(config_all) # Verify parameters were loaded print("\n✓ Custom parameters loaded!") print(f" Visualization DPI: {pipeline_custom.config.visualization.dpi}") print(f" Figure size: {pipeline_custom.config.visualization.figsize}") print(f" Wavelength colormap: {pipeline_custom.config.visualization.wavelength_cmap}") print(f" BG sigma clipping: {pipeline_custom.config.photometry.bg_sigma_clip_sigma}") # Create and run pipeline ``` -------------------------------- ### Run SPXQuery Pipeline with Specific Stages Source: https://github.com/wenkeren/spxquery/blob/main/docs/user_guide/pipeline.md Instantiate SPXQueryPipeline with a configuration and specify 'query' and 'download' as the only pipeline stages to execute. This is useful for downloading data for later analysis or integrating SPXQuery into custom workflows. ```python pipeline = SPXQueryPipeline(config, pipeline_stages=["query", "download"]) pipeline.run_full_pipeline() ``` -------------------------------- ### Install Python 3.11 with pyenv Source: https://github.com/wenkeren/spxquery/blob/main/INSTALL.md Install a specific Python version (3.11 in this case) using pyenv, a tool for managing multiple Python versions. ```bash # Install pyenv (macOS/Linux) curl https://pyenv.run | bash # Install Python 3.11 pyenv install 3.11 ``` -------------------------------- ### CSV Light Curve Data Example Source: https://github.com/wenkeren/spxquery/blob/main/docs/user_guide/quality_control.md Example of the CSV format for light curve measurements, including observation ID, time, flux, errors, and quality flags. ```csv obs_id,mjd,flux,flux_error,wavelength,bandwidth,band,flag,snr,is_upper_limit 2025W25_1B_0062_1,60842.269794,1007.005,43.199,1.940,0.048,D3,2097152,23.3,False ... ``` -------------------------------- ### AdvancedConfig: Full Control with Explicit Sub-configs Source: https://context7.com/wenkeren/spxquery/llms.txt Demonstrates creating an `AdvancedConfig` object by explicitly defining each sub-configuration (QueryConfig, PhotometryConfig, VisualizationConfig, DownloadConfig). ```python # Method 2: Full control with explicit sub-configs config = AdvancedConfig( query=QueryConfig( source=Source(ra=213.94, dec=11.49, name="cloverleaf"), output_dir=Path("output"), bands=["D1", "D2", "D3"] ), photometry=PhotometryConfig( aperture_method="fwhm", fwhm_multiplier=2.5, background_method="annulus", bad_flags=[0, 1, 2, 6, 7, 9, 10, 11, 14, 15, 17, 19] ), visualization=VisualizationConfig( sigma_threshold=5.0, wavelength_cmap="rainbow", dpi=300 ), download=DownloadConfig( cutout_size="100px", max_download_workers=4 ) ) ``` -------------------------------- ### SPXQuery Pixel Flag Filtering Logic Example Source: https://github.com/wenkeren/spxquery/blob/main/docs/user_guide/quality_control.md Illustrates the core logic of SPXQuery's flag filtering: a pixel is rejected if any of its set flag bits are present in the 'bad_flags' list. This example checks a specific pixel flag against a defined set of bad flags. ```default pixel_flag = 2097152 # Binary: 1000000000000000000000 (bit 21 set) bad_flags = [0, 1, 2] # Check if any bad flags are set for bit in bad_flags: if pixel_flag & (1 << bit): reject_pixel() # Reject if bit is set # Result: Not rejected (bit 21 is not in bad_flags) ``` -------------------------------- ### Uninstall SPXQuery with pip Source: https://github.com/wenkeren/spxquery/blob/main/INSTALL.md Remove the SPXQuery package from your environment if it was installed using pip. ```bash pip uninstall spxquery ``` -------------------------------- ### Re-lock Poetry Dependencies Source: https://github.com/wenkeren/spxquery/blob/main/INSTALL.md Generate or update the `poetry.lock` file without updating existing dependencies, and then install the project dependencies. ```bash poetry lock --no-update poetry install ``` -------------------------------- ### Configure Advanced Window Background Source: https://github.com/wenkeren/spxquery/blob/main/example/quickstart_demo.ipynb Use this to set up advanced window background estimation. Load from a YAML file and update parameters like aperture method, diameter, and background method. ```python advanced_window = AdvancedConfig.from_yaml_file(output_dir / "cloverleaf.yaml") advanced_window.update(aperture_method="fixed", aperture_diameter=2.0, background_method="window", window_size=50) ``` -------------------------------- ### Configure Advanced Photometry Parameters Source: https://github.com/wenkeren/spxquery/blob/main/example/quickstart_demo.ipynb Imports necessary configuration classes for customizing SPXQuery photometry, including adaptive aperture sizing and background estimation methods. ```python # FWHM-based adaptive apertures from spxquery.core.config import ( PhotometryConfig, QueryConfig, Source, AdvancedConfig, DownloadConfig, VisualizationConfig, ) ``` -------------------------------- ### SPXQuery Pipeline Execution Log Source: https://github.com/wenkeren/spxquery/blob/main/example/quickstart_demo.ipynb Example log output from the SPXQuery pipeline execution, showing stages like query, download, and processing. ```log 2025-11-13 00:33:48 - spxquery.core.pipeline - INFO - Initialized pipeline for source at RA=213.942708, Dec=11.495389 2025-11-13 00:33:48 - spxquery.core.pipeline - INFO - Pipeline stages: ['query', 'download', 'processing', 'visualization'] 2025-11-13 00:33:48 - spxquery.core.pipeline - INFO - State file: cloverleaf.yaml 2025-11-13 00:33:48 - spxquery.core.pipeline - INFO - Starting full pipeline execution 2025-11-13 00:33:48 - spxquery.core.pipeline - INFO - Pipeline stages: ['query', 'download', 'processing', 'visualization'] 2025-11-13 00:33:48 - spxquery.core.pipeline - INFO - Running query stage 2025-11-13 00:33:48 - spxquery.core.query - INFO - Querying SPHEREx observations for source at RA=213.942708, Dec=11.495389 2025-11-13 00:33:52 - spxquery.core.query - INFO - Found 108 observations spanning 33.1 days 2025-11-13 00:33:52 - spxquery.core.pipeline - INFO - Marked stage 'query' as complete 2025-11-13 00:33:52 - spxquery.core.pipeline - INFO - Saved pipeline state: stage=download, completed=['query'] 2025-11-13 00:33:52 - spxquery.core.pipeline - INFO - Running download stage (skip_existing=True) 2025-11-13 00:33:52 - spxquery.core.download - INFO - Starting parallel download of 108 files 2025-11-13 00:33:52 - spxquery.core.download - INFO - Download settings: timeout=300s, retries=3, workers=4 ``` -------------------------------- ### Pipeline Initialization and Query Stage Log Source: https://github.com/wenkeren/spxquery/blob/main/example/quickstart_demo.ipynb Logs indicating successful loading of advanced parameters and the initialization of the pipeline for a specific source. It shows the query stage beginning. ```log 2025-11-13 00:33:11 - spxquery.core.config - INFO - Loaded advanced parameters from demo_data/cloverleaf/config_params.yaml 2025-11-13 00:33:11 - spxquery.utils.params - INFO - Loaded advanced parameters from demo_data/cloverleaf/config_params.yaml 2025-11-13 00:33:11 - spxquery.core.pipeline - INFO - Initialized pipeline for source at RA=213.942708, Dec=11.495389 2025-11-13 00:33:11 - spxquery.core.pipeline - INFO - Pipeline stages: ['query', 'download', 'processing', 'visualization'] 2025-11-13 00:33:11 - spxquery.core.pipeline - INFO - State file: cloverleaf.yaml 2025-11-13 00:33:11 - spxquery.core.pipeline - INFO - Starting full pipeline execution 2025-11-13 00:33:11 - spxquery.core.pipeline - INFO - Pipeline stages: ['query', 'download', 'processing', 'visualization'] 2025-11-13 00:33:11 - spxquery.core.pipeline - INFO - Running query stage 2025-11-13 00:33:11 - spxquery.core.query - INFO - Querying SPHEREx observations for source at RA=213.942708, Dec=11.495389 ``` -------------------------------- ### Log Messages for Variance Repair Source: https://github.com/wenkeren/spxquery/blob/main/docs/user_guide/quality_control.md Example log messages indicating that variance repair was applied due to NaN variance at the source position. ```text WARNING: Variance at source position is NaN for file_D3_20250325_062.fits INFO: Median variance from valid pixels: 2.34e-05 INFO: Using median variance as fallback for flux uncertainty calculation ``` -------------------------------- ### Run SPxQuery Pipeline (Basic) Source: https://github.com/wenkeren/spxquery/blob/main/docs/api/core.md Use this function for basic pipeline execution with essential parameters like RA, Dec, and output directory. Ensure the output directory exists or is specified. ```python >>> # Basic usage >>> run_pipeline(ra=304.69, dec=42.44, output_dir="output") ``` -------------------------------- ### Troubleshoot ImportError with pip Source: https://github.com/wenkeren/spxquery/blob/main/INSTALL.md If you encounter an ImportError after installing with pip, ensure you are not running Python from within the source directory. Navigate to a different directory and re-import. ```python cd ~ python -c "import spxquery; print(spxquery.__version__)" ``` -------------------------------- ### Crowded Field Filtering Parameters Source: https://github.com/wenkeren/spxquery/blob/main/docs/user_guide/quality_control.md Example of quality control parameters for analyzing sources in crowded fields, including the PHANTOM flag in the rejection criteria. ```python sigma_threshold=5.0 bad_flags=[0, 1, 2, 4, 6, 7, 9, 10, 11, 15] # Add PHANTOM flag ``` -------------------------------- ### Run SPXQuery Pipeline with Window Background Source: https://github.com/wenkeren/spxquery/blob/main/example/quickstart_demo.ipynb Initialize and run the full SPXQuery pipeline with window background processing. Ensure pandas is imported as pd and the output directory is defined. ```python config_window = SPXQueryPipeline(advanced_window) config_window.run_full_pipeline(skip_existing_downloads=True) df_window = pd.read_csv(output_dir / "results/lightcurve.csv", comment="#") print("Window method configuration ready.") print("Uncomment the code above to run the pipeline.") ``` -------------------------------- ### Pipeline Download Stage Log Source: https://github.com/wenkeren/spxquery/blob/main/example/quickstart_demo.ipynb Logs detailing the completion of the query stage and the start of the download stage, including download settings and the number of files to be downloaded. ```log 2025-11-13 00:33:37 - spxquery.core.query - INFO - Found 108 observations spanning 33.1 days 2025-11-13 00:33:37 - spxquery.core.pipeline - INFO - Marked stage 'query' as complete 2025-11-13 00:33:37 - spxquery.core.pipeline - INFO - Saved pipeline state: stage=download, completed=['query'] 2025-11-13 00:33:37 - spxquery.core.pipeline - INFO - Running download stage (skip_existing=True) 2025-11-13 00:33:37 - spxquery.core.download - INFO - Starting parallel download of 108 files 2025-11-13 00:33:37 - spxquery.core.download - INFO - Download settings: timeout=300s, retries=3, workers=4 ``` -------------------------------- ### Print Configuration Details Source: https://github.com/wenkeren/spxquery/blob/main/example/quickstart_demo.ipynb Print the current aperture method and diameter/multiplier for both fixed and FWHM configurations. This helps verify the applied settings. ```python print("✓ Configurations created:") print( f" Fixed: method={advanced_fixed.photometry.aperture_method}, diameter={advanced_fixed.photometry.aperture_diameter}" ) print( f" FWHM: method={advanced_fwhm.photometry.aperture_method}, multiplier={advanced_fwhm.photometry.fwhm_multiplier}" ) ``` -------------------------------- ### Log Message Example for Variance Repair Source: https://github.com/wenkeren/spxquery/blob/main/example/quickstart_demo.ipynb This log message indicates that pixels with NaN variance have been automatically repaired using the median variance, and that these pixels had non-zero flags. ```log INFO - Repaired 23 pixels with NaN variance using median variance (1.234e-06). All repaired pixels have non-zero flags. ``` -------------------------------- ### Faint Variable Source Filtering Parameters Source: https://github.com/wenkeren/spxquery/blob/main/docs/user_guide/quality_control.md Example of quality control parameters for analyzing faint variable sources, accepting marginal detections and removing specific pixel flags. ```python sigma_threshold=3.0 # Accept marginal detections bad_flags=[0, 1, 2, 6, 7, 9] # Remove hot/cold pixel flags ``` -------------------------------- ### Check Total Storage Usage Source: https://github.com/wenkeren/spxquery/blob/main/docs/user_guide/cutouts.md Load the `query_summary.json` file to check the total downloaded size in GB and the sizes per band. This requires the `json` library to be imported. ```python import json with open("output/results/query_summary.json") as f: summary = json.load(f) print(f"Total size: {summary['total_size_gb']:.2f} GB") print(f"Band sizes: {summary['band_sizes']}") ``` -------------------------------- ### Run Full SPXQuery Pipeline Source: https://github.com/wenkeren/spxquery/blob/main/example/quickstart_demo.ipynb Uncomment these lines to execute the complete SPXQuery pipeline. Ensure the pipeline_custom object is properly initialized. ```python # Uncomment to run: pipeline_custom.run_full_pipeline() print("\nTo run pipeline, uncomment the last two lines above.") ``` -------------------------------- ### Load and Filter CSV Data with Pandas Source: https://github.com/wenkeren/spxquery/blob/main/docs/user_guide/quality_control.md Loads a CSV file into a Pandas DataFrame and demonstrates custom filtering based on SNR and quality flags. Ensure the pandas library is installed. ```python import pandas as pd df = pd.read_csv("output/results/lightcurve.csv", comment="#") # Custom filtering good = df[(df['snr'] >= 5.0) & (df['flag'] == 0)] # Or more complex criteria def has_bad_flags(flag_value, bad_flags=[0, 1, 2]): return any(flag_value & (1 << bit) for bit in bad_flags) df['is_good'] = (df['snr'] >= 5.0) & ~df['flag'].apply(has_bad_flags) good = df[df['is_good']] ``` -------------------------------- ### Bright Stable Source Filtering Parameters Source: https://github.com/wenkeren/spxquery/blob/main/docs/user_guide/quality_control.md Example of quality control parameters for analyzing bright stable sources, requiring high confidence detections and strict rejection of various flags. ```python sigma_threshold=10.0 # High-confidence only bad_flags=[0, 1, 2, 6, 7, 9, 10, 11, 15, 17] # Strict rejection ```