# gwac_image_analysis **Repository Path**: mseeworld/gwac_image_analysis ## Basic Information - **Project Name**: gwac_image_analysis - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-11-22 - **Last Updated**: 2025-11-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # GWAC Image Analysis This project provides tools for analyzing astronomical image data from the GWAC (Ground-based Wide Angle Camera) system. ## Features - Analysis of H_wcs_template directory statistics - Calculation of ratios between different catalogs and image data - Analysis of A_cat and G_diff_cat .cat files line count distributions ## Requirements - Python 3.7+ - numpy ## Installation 1. Install the required packages: ``` pip install -r requirements.txt ``` Or if you're using a conda environment: ``` python -m pip install -r requirements.txt ``` ## Usage There are several ways to run the analysis: ### Method 1: Direct script execution ```bash python run_analysis.py ``` ### Method 2: Module execution ```bash python -m src.main ``` ### Method 3: Import in your own scripts ```python from src.data_analyzer import GWACDataAnalyzer analyzer = GWACDataAnalyzer() h_wcs_data = analyzer.analyze_h_wcs_template() # ... additional analysis ``` ### Method 4: Using Docker (Recommended) The application can be run using Docker with pre-built images: ```bash # Build the Docker image docker build -t gwac_data_analyzer . # Run the analysis with default directories docker run --rm \ -v /path/to/your/data:/data \ -v /path/to/output/results:/results \ gwac_data_analyzer # Run with custom directories docker run --rm \ -v /path/to/your/data:/data \ -v /path/to/output/results:/results \ gwac_data_analyzer --data-dir /data --output-dir /results ``` The Docker image uses the base image `registry.cn-beijing.aliyuncs.com/astronomy/python:3.12-slim` and: - Mounts the input data directory to `/data` inside the container - Mounts the output results directory to `/results` inside the container - By default, looks for data in `/data` and writes results to `/results` ### Method 5: Using Docker Compose For easier management, you can also use Docker Compose: ```bash # Build and run with docker-compose docker-compose up --build # Run in detached mode docker-compose up -d # Stop the service docker-compose down ``` With Docker Compose, the data and results directories are mapped to the local `./data` and `./results` directories by default. A `docker-compose.override.yml` file is also provided for development purposes. This override maps the current directory to `/app` in the container, allowing you to modify the code and see changes without rebuilding the image. ## Program Output Explanation The program analyzes astronomical image data and produces several key statistics: 1. **H_wcs_template Directory Statistics**: - 3-second image target counts (from template.cat files) - 30-second image target counts (from template_4detection.cat files) - UCAC4 star catalog counts (from bright_star_align_filtered_correct.cat files) - Gaia bright star counts (magnitude ≤ 13, from bright_star_deep_align_filtered_correct.cat files) 2. **Calculated Ratios**: - 3-second image targets to UCAC4 stars ratio - 30-second image targets to UCAC4 stars ratio - UCAC4 stars to Gaia bright stars ratio 3. **A_cat Directory Statistics**: - Distribution of .cat file line counts - Number of files, range, and average line count 4. **G_diff_cat Directory Statistics**: - Distribution of .cat file line counts - Number of files, range, and average line count 5. **JSON Output Files**: - Statistics organized by data subdirectory and saved as JSON files in the `results/` directory - Each JSON file contains all statistics for a specific data subdirectory ## Data Structure The analyzer expects the following data structure: ``` data/ ├── YYYYMMDD/ │ └── 011_XXXXXXXX_XXXXXX/ │ ├── A_cat/ │ ├── G_diff_cat/ │ └── H_wcs_template/ │ └── [Observation directories] │ ├── template.cat │ ├── template_4detection.cat │ ├── bright_star_align_filtered_correct.cat │ └── bright_star_deep_align_filtered_correct.cat └── ... ``` The directory identification logic: - Date directories are identified by the pattern `YYYYMMDD` (starting with "20") - Data subdirectories are identified by the naming structure `011_XXXXXXXX_XXXXXX` (three parts separated by underscores, starting with "011") ## JSON Output Format The program saves all statistics as a single JSON array in `results/all_subdirectories_statistics.json`. Each element in the array represents one data subdirectory and contains: - `subdirectory`: Path to the data subdirectory - `h_wcs_template_data`: Statistics from H_wcs_template directory - `a_cat_data`: Statistics from A_cat directory including file counts and line counts - `g_diff_cat_data`: Statistics from G_diff_cat directory including file counts and line counts - `ratios`: Calculated ratios between different datasets ## Customization You can customize the data root directory by passing a parameter to the GWACDataAnalyzer constructor: ```python analyzer = GWACDataAnalyzer("/path/to/your/data") ``` docker build -t gwac_image_analysis:v1.0 . docker tag gwac_image_analysis:v1.0 10.36.1.155:5000/astronomy/gwac_image_analysis:v1.0 docker push 10.36.1.155:5000/astronomy/gwac_image_analysis:v1.0 docker pull 10.36.1.155:5000/astronomy/gwac_image_analysis:v1.0 docker tag 10.36.1.155:5000/astronomy/gwac_image_analysis:v1.0 sealos.hub:5000/astronomy/gwac_image_analysis:v1.0 docker push sealos.hub:5000/astronomy/gwac_image_analysis:v1.0