ch-acwe
Code used to generate and evaluate Coronal Hole (CH) segmentations, including confidence maps of CH locations and extents.
Science Score: 57.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 4 DOI reference(s) in README -
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.0%) to scientific vocabulary
Repository
Code used to generate and evaluate Coronal Hole (CH) segmentations, including confidence maps of CH locations and extents.
Basic Info
Statistics
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
- Releases: 5
Metadata Files
README.md
CH-ACWE
This is an implementation of active contours without edges (ACWE) on solar extreme ultraviolet (EUV) images from the Atmospheric Imager Assembly aboard the Solar Dynamics Observatory (SDO-AIA). This implementation includes the ability to generate Confidence Maps based on the homogeneity of each region with respect to the core of the observed region. This code is related the paper https://doi.org/10.1007/s11207-023-02228-0.
Requirements: environment.yml
This environment file specifies the packages necessary to implement all code contained within this repository, including packages necessary for downloading the dataset, generating segmentations (including confidence maps), and analyzing segmentation results.
Downloading the Dataset
The dataset can be downloaded, and new datasets can be created, using the the tools provided in the DatasetTools folder.
DownloadLists: This folder contains an organized lists of the dataset. These lists are organized into four.csvfiles, one for each Carrington Rotation (CR).Carrington Rotation Start Dates.csv: This file is a list of the start dates for each Carrington Rotation from CR -10 through CR 2300. This file is used byDownloadByRotation.pyfor both downloading and organizing the dataset.DataManagmentTools.py: Tools/functions for formatting dates to allow for request of data from jsoc.stanford.edu.RebuildDataset.py: Find and download any file that is missing from the dataset folder.- This script will rebuild the dataset direcly from the specified file present in the
DownloadListsfolder. - User will need to adjust the variables in the
Key Variablescell (In[2]) to point to the correct directories. - User will need to register their email at http://jsoc.stanford.edu/ajax/register_email.html and add that email to the appropriate variable in the
Key Variablescell.
- This script will rebuild the dataset direcly from the specified file present in the
DownloadByRotation.py: Downloadaia.lev1_euv_12sandhmi.M_720simages at a 1 hour cadence for the specified Carrington rotation(s).- This script will attempt to omit any time frame wherein at least one file is missing or does not and have a
QUALITYkey of0. - User will need to adjust the variables in the
Key Variablescell (In[2]) to point to the correct directories. - User will need to register their email at http://jsoc.stanford.edu/ajax/register_email.html and add that email to the appropriate variable in the
Key Variablescell. - This script can be used to speed up the process of rebuilding the dataset. This is achieved by
- Creating a temporary subfolder within the
DatasetToolsfolder - Ensuring that the variable
traceFolderpoints to that temporary subfolder - Setting the remaining variables in the
Key Variablescell to ensure the correct CR is downloaded and saved where the user wishes - Running
DownloadByRotation.py - Deleting the temporary subfolder
- Running
RebuildDataset.pywithtraceFolder = 'DownloadLists/'to download any missing files
- This script will attempt to omit any time frame wherein at least one file is missing or does not and have a
GapCheck.py: Inform the user as to the largest hour gap between entries in the specified CR within the dataset.
Generating ACWE Segmentations

General Tools
The folder ACWE_python_spring_2023 contains functions for running ACWE and saving the results.
ACWE_python_v3: This folder contains the original ACWE functions, updated to operate on python version 3.0 or greater.acweConfidenceMapTools_v3.py: Tools/functions for combining a segmentation group (collection of segmentations from the same EUV observation) in order to generate a confidence map.acweFunctions_v6.py: Tools/functions for preprocessing an EUV image, generating an initial mask, and running ACWE for both single output/segmentation and for a confidence map.- The function
run_acweperforms all processing and returns the final segmentation and initial mask. - The function
run_acwe_confidenceMapperforms all processing and returns the final confidence map as a series of segmentations and initial mask. - Additional functions are also provided to perform each step separately.
- These functions will work for both AIA and Solar Terrestrial RElations Observatory (STEREO) observations, however a resize parameter of 4 and seeding parameter
alphain the range [0.8,0.9] are recommended for STEREO data.
- The function
acweRestoreScale.py: Tools/functions for resizing a segmentation to match the spatial resolution of the input image.- Upscale a confidence map using
upscaleConMap - Upscale a single segmentation using
upscale - Both functions take in the ACWE header and the segmentation or confidence map and return the same segmentation or confidence map, upscaled to match the resolution of the original EUV image.
- Upscale a confidence map using
acweSaveSeg_v5.py: Tools/functions for saving and opening segmentations.- The function
saveSegtakes in the header of the original EUV image, the final segmentation(s), and the list of ACWE parameters. It generates an .npz file which saves the final segmentation with a header outlining the ACWE parameters and a copy of the header for the original EUV image. - The function
openSegopens and returns the header of the original EUV image, as a dictionary, the header outlining the options used to generate the ACWE segmentation, organized as a dictionary, and the final ACWE segmentation(s). - Both functions work for both single segmentations and for confidence maps.
- The function
Standard Segmentation
The script runACWEdefault.py, which generates the default implementation of ACWE on Solar EUV images generated by AIA is located in the folder Standard.
Note:
- User will need to adjust the variables in the Key Variables cell (In[2]) to point to the correct directories and desired EUV wavelength (193 angstroms is the assumed default).
- The script will assume that the data are organized by CR, with a sub directory for each record time in the .csv file in the DownloadLists subfolder within the DatasetTools directory. Both DownloadByRotation.py and RebuildDataset.py will organize the dataset appropriately.
Confidence Maps
The standard implementation of ACWE confidence maps is generated using the script runACWEconfidenceLevelSet_Default.py, within the ConfidenceMapping folder.
Note:
- User will need to adjust the variables in the Key Variables cell (In[2]) to point to the correct directories and desired EUV wavelength (193 angstroms is the assumed default).
- The script will assume that the data are organized by CR, with a sub directory for each record time in the .csv file in the DownloadLists subfolder within the DatasetTools directory. Both DownloadByRotation.py and RebuildDataset.py will organize the dataset appropriately.
- This script will generate all specified segmentations, regardless of whether or not a change of target will occur with the given parameters chosen in in the Key Variables cell. When change of target occurs, a valid confidence map can be extracted from the ensemble using the smartConMap function provided in acweConfidenceMapTools_v3.py (in the ACWE_python_spring_2023 folder).
Other Segmentations
- Segmentations generated at any spatial resolution other than 512x512 pixels should be performed using the script
runACWEscaledDefault.pylocated within theScaledfolder.- User will need to adjust the variables in the
Key Variablescell (In[2]) to point to the correct directories and desired EUV wavelength (193 angstroms is the assumed default). - The script will assume that the data are organized by CR, with a sub directory for each record time in the
.csvfile in theDownloadListssubfolder within theDatasetToolsdirectory. BothDownloadByRotation.pyandRebuildDataset.pywill organize the dataset appropriately. - Under the assumption that the input image is 4096x4096 pixels (the resolution of AIA), if the resize parameter variable
resize_param = 8, this function will generate a standard segmentation.
- User will need to adjust the variables in the
- The script
runACWEconfidenceIndependent_Old.py(inside of theConfidenceMapping) can be used to generate confidence maps.- This script is not optimized, and operates by generating each map independently, starting from the initial seed each time. It is >2.9 times slower than the optimized script
runACWEconfidenceLevelSet_Default.py. - User will need to adjust the variables in the
Key Variablescell (In[2]) to point to the correct directories and desired EUV wavelength (193 angstroms is the assumed default). - The script will assume that the data are organized by CR, with a sub directory for each record time in the
.csvfile in theDownloadListssubfolder within theDatasetToolsdirectory. BothDownloadByRotation.pyandRebuildDataset.pywill organize the dataset appropriately. - This script will generate all specified segmentations, regardless of whether or not a change of target will occur with the given parameters chosen in in the
Key Variablescell. When change of target occurs, a valid confidence map can be extracted from the ensemble using thesmartConMapfunction provided inacweConfidenceMapTools_v3.py(in theACWE_python_spring_2023folder).
- This script is not optimized, and operates by generating each map independently, starting from the initial seed each time. It is >2.9 times slower than the optimized script
Analyzing ACWE Segmentations
Analysis of the stability and consistency of ACWE can be performed using the following tools.
Spatial Resolution Effects
The tools in the folder Scaled/Analysis/ can be used to to determine the effect that spatial decimation of the input image has on final segmentation.
- The script
analizeACWEscaledDefault.pygenerates an.npzfile which outlines the similarity of segmentation at the specified scales, compared to an ACWE segmentation generated from the EUV image at full scale.- This script will return the intersection over union (Jacquard Index/IOU), structural similarity (SSIM), global consistency error (GCE), and local consistency error (LCE) for each segmentation at each spatial resolution as a function of interpolation method used to upscale the image to the original resolution.
- Before running this script be sure to adjust the variables in the
Key Variablescell (In[2]) to point to the correct directories.
- The Jupyter Notebook
visulization_earlyData-BW.ipynbgenerates a box and whisker plot for a block of CRs, from the data generated byanalizeACWEscaledDefault.py. - The Jupyter Notebook
visulization_singleCR-BW.ipynbgenerates a box and whisker plot for the specific CR the user chooses in theKey Variablescell, from the data generated byanalizeACWEscaledDefault.py - The Jupyter Notebook
Scaling Samples.ipynbwill generate, display, and save a figure showing the effects of spatial decimation for the files specified in the second cell (In[2])- The figures will be saved in a folder within the project space that the notebook creates
- User will need to adjust the variables in the second cell (
In[2]) to point to the correct directories.
- The script
TimeCheckScaled.py, which is located in theScaled/folder, can be used to determine the speed increase offered by reducing the spatial resolution of the input EUV images.- In order to run this script the user will need to un-comment, in
Scaled/runACWEscaledDefault.pyandStandard/runACWEdefault.py, all blocks with the headerTimeas well as the variables in theTime ACWEsection of theKey Variablescell prior to running either script on the specified CR. - The variable
CRin theKey Variablescell must match across all three aforementioned scripts. - The function assumes that the standard resolution segmentations were generated using
Standard/runACWEdefault.pyand will search theStandard/folder for data related to the time needed to generate the standard resolution segmentations.
- In order to run this script the user will need to un-comment, in
Effects Across Small Temporal Changes
The tools in the folder TemporalEffects/Analysis/ can be used to determine the consistency of ACWE segmentation across short time spans where CH evolution is expected to be minimal. This can be used to determine how consistent ACWE is in identifying and segmenting CH regions.
- The script
analizeTempEffects.pygenerates an.npzfile which outlines the similarity of segmentation at the specified scale (the default 1/8th spatial resolution), compared to ACWE segmentation at the same scale generated from all EUV images in the same CR that are within +-12 hours.- This script will return the IOU, SSIM, GCE, and LCE for each segmentation compared to the succeeding and preceding 12 hours of segmentations.
- Before running this script be sure to adjust the variables in the
Key Variablescell (In[2]) to point to the correct directories.
- The Jupyter Notebook
visulization_earlyData.ipynbgenerates a plot from the data created byanalizeTempEffects.pyfor a block of CRs. - The Jupyter Notebook
visulization_earlyData.ipynbgenerates a plot from the data created byanalizeTempEffects.pyfor the specific CR the user chooses in theKey Variablescell. - The Jupyter Notebook
visulization_IndividualExamples-SingleCR.ipynbgenerates a plot showing the IOU into the future for each user-specified entry in the user-specified CR. Both variables are in theKey Variablescell.
Effects of Confidence Map Optimization
The standard implementation of ACWE confidence maps optimizes ensemble generation by relying on the previous finalized segmentation as input for generating the next segmentation in the ensemble. In order to determine how this process effects final segmentation quality, the following tools are provided:
- The script
TimeCheck.pycan be used to determine the speed increase offered by the optimized confidence map process (runACWEconfidenceLevelSet_Default.py) over the non-optimized approach (runACWEconfidenceIndependent_Old.py).- In order to run this script the user will need to un-comment, in
runACWEconfidenceLevelSet_Default.pyandrunACWEconfidenceIndependent_Old.py, all blocks with the headerTimeas well as the variables in theTime ACWEsection of theKey Variablescell prior to running either script on the specified CR. - The variable
CRin theKey Variablescell must match across all three aforementioned scripts.
- In order to run this script the user will need to un-comment, in
- The script
analizeConmapSim.py, in the folderConfidenceMapping/AnalysisInternal/, performs three analyses:- Determine, using weighted IOU, SSIM, GCE, and LCE how similar the confidence maps generated using the optimized approach are to confidence maps generated from an ensemble of independent segmentations.
- Determine, for the confidence maps generated from an ensemble of independent segmentations, the area of each segmentation that was not present in the previous segmentation, and the area that was not carried over to the succeeding segmentation.
- Determine, for the optimized confidence map process, the area of each segmentation that was not present in the previous segmentation, and the area that was not carried over to the succeeding segmentation.
- Before running this script be sure to adjust the variables in the
Key Variablescell (In[2]) to point to the correct directories.
- The jupyter notebook
ConMapStats_FullData.ipynb(in the folderConfidenceMapping/AnalysisInternal/), reports on all analyses performed inanalizeConmapSim.py. - The jupyter notebook
ConmapSamples.ipynb(in the folderConfidenceMapping/AnalysisInternal/) will generate, display, and save visualizations of the confidence maps that exist for the files specified in the second cell (In[2]).- The figures will be saved in a folder within the project space that the notebook creates.
- User will need to adjust the variables in the second cell (
In[2]) to point to the correct directories.
Confidence Map Change of Target Analsis
The folder ConfidenceMapping/AnalysisGrowthAndIntensity/ contains tools to evaluate the behaviour of the ensemble of segmentations used to generate confidence maps to help identify the characteristics that can be used to find and correct change of target cases.
- The script
analizeGrowthAndIntensity.pycompares segmentations to the input seed to allow the user to determine what differences exist between change of target cases and valid segmentations.- The script will report on the intensity of the input seed and each segmentation, providing min, mean, and max for each.
- The script will report the area of the input seed, area of each segmentation, and the percentage of the initial seed that is retained in each segmentation.
- Before running this script be sure to adjust the variables in the
Key Variablescell (In[2]) to point to the correct directories.
- The Jupyter Notebook
Growth Rate and mean intensity_SingleCR.ipynbreports the results fromanalizeGrowthAndIntensity.pyfor the user-specified CR. - The Jupyter Notebook
Change of Target Methology Check 5percent.ipynbreports the list of change of target cases that were identified via the method implemented in thesmartConMapfunction. - The Jupyter Notebooks
Special Cases CR2099.ipynbandSpecial Cases CR2133.ipynbprovide figures for the specified cases, showing the effects of thesmartConMapfunction. These examples include genuine cases of change of target, as well as cases without change of target to ensure the method operates properly.
Validation of Confidence Maps
The folder ConfidenceMapping/AnalysisMagentogram/ contains tools used to determine the skew of the underlying magnetic field, as a function of confidence level, for the confidence maps generated via ACWE.
- The script
ConMapSkewness.pycalculates and returns the skew of the underlying magnetic field as a function of confidence for each CH identified in each segmentation.- Before running this script be sure to adjust the variables in the
Key Variablescell (In[2]) to point to the correct directories.
- Before running this script be sure to adjust the variables in the
- The script
Skew Check SingleCR.pyconverts the results fromConMapSkewness.pyinto a series of figures to aid the user in determining if CH regions correspond to regions of high unpopularity in the magnetic field.- Before running this script be sure to adjust the variables in the
Key Variablescell (In[2]) to point to the correct directories.
- Before running this script be sure to adjust the variables in the
- the script
FigureMassCopy.pytakes the figures generated bySkew Check SingleCR.py, which are organized by record time, and groups them in a single folder, to help the user parse through all figures.- Before running this script be sure to adjust the variables in the
Key Variablescell (In[2]) to point to the correct directories.
- Before running this script be sure to adjust the variables in the
Intensity and Dynamic range Effects
The Intensity/ folder and the Intensity/Analysis/ subfolder contain tools used to determine the effects that compressing SDO-AIA observations by representing all intesnity using 265 discretized values (such as .png) have on the quality of ACWE segmentations.
- The script
runIntensityInvDefault.pygenerates a series of segmentations. Each segmentation is generated from a copy of the EUV image that has been remapped touint8(similar to popular image formats like.pngandjpeg) via various remapping schemes.- User will need to adjust the variables in the
Key Variablescell (In[2]) to point to the correct directories and desired EUV wavelength (193 angstroms is the assumed default). - The script will assume that the data are organized by CR, with a sub directory for each record time in the
.csvfile in theDownloadListssubfolder within theDatasetToolsdirectory. BothDownloadByRotation.pyandRebuildDataset.pywill organize the dataset appropriately. - The script relies on the functions in
pngScale2.py
- User will need to adjust the variables in the
- The file
pngScale2.pycontains tools/functions to facilitate remapping of the EUV images to the 256 desecrate values. - the script
Intensity Data.pyreports, for the specified CR, the range of intensities present in the original EUV images- User will need to adjust the variables in the
Key Variablescell (In[2]) to point to the correct directories and desired EUV wavelength (193 angstroms is the assumed default). - The script will assume that the data are organized by CR, with a sub directory for each record time in the
.csvfile in theDownloadListssubfolder within theDatasetToolsdirectory. BothDownloadByRotation.pyandRebuildDataset.pywill organize the dataset appropriately.
- User will need to adjust the variables in the
- The script
analizeIntInvEffects.py, located within theIntensity/Analysis/subfolder determines the similarity of segmentations generated from the remapped images compared to segmentations generated from the original EUV image.- This script will return the IOU, SSIM, GCE, and LCE for each comparison.
- Before running this script be sure to adjust the variables in the
Key Variablescell (In[2]) to point to the correct directories.
- The Jupyter Notebook
visulization_earlyData-BW.ipynbgenerates a box and whisker plot for a block of CRs, from the data generated byanalizeIntInvEffects.py. - The Jupyter Notebook
visulization_singleCR-BW.ipynbgenerates a box and whisker plot for the specific CR the user chooses in theKey Variablescell, from the data generated byanalizeIntInvEffects.py - The Jupyter Notebook
Intensity Samples.ipynbwill generate, display, and save a figure showing the effects of intensity remapping and dynamic range decimation for the files specified in the second cell (In[2])- The figures will be saved in a folder within the project space that the notebook creates.
- User will need to adjust the variables in the second cell (
In[2]) to point to the correct directories.
Owner
- Name: DuckDuckPig
- Login: DuckDuckPig
- Kind: organization
- Repositories: 1
- Profile: https://github.com/DuckDuckPig
Citation (CITATION.cff)
cff-version: 1.2.0
title: CH-ACWE
message: 'If you use this software, please cite it as below.'
type: software
authors:
- given-names: Jeremy A.
family-names: Grajeda
affiliation: New Mexico State University
orcid: 'https://orcid.org/0009-0008-3189-8200'
- given-names: Laura E.
family-names: Boucheron
affiliation: New Mexico State University
email: lboucher@nmsu.edu
orcid: 'https://orcid.org/0000-0002-8187-1566'
repository-code: 'https://github.com/DuckDuckPig/CH-ACWE'
license: GPL-3.0
preferred-citation:
type: article
authors:
- given-names: Jeremy A.
family-names: Grajeda
affiliation: Klipsch School of Electrical and Computer Engineering, New Mexico State University, Las Cruces, NM, USA
orcid: 'https://orcid.org/0009-0008-3189-8200'
- given-names: Laura E.
family-names: Boucheron
affiliation: Klipsch School of Electrical and Computer Engineering, New Mexico State University, Las Cruces, NM, USA
email: lboucher@nmsu.edu
orcid: 'https://orcid.org/0000-0002-8187-1566'
- given-names: Michael S.
family-names: Kirk
affiliation: Heliophysics Space Division, Goddard Space Flight Center, National Aeronautics and Space Administration, Greenbelt, MD, USA
email: michael.s.kirk@nasa.gov
orcid: 'https://orcid.org/0000-0001-9874-1429'
- given-names: Andrew
family-names: Leisner
affiliation: Department of Physics and Astronomy, George Mason University, Fairfax, VA, USA
email: aleisner@gmu.edu
orcid: 'https://orcid.org/0000-0002-4752-7534'
- given-names: C. Nick
family-names: Arge
affiliation: Heliophysics Space Division, Goddard Space Flight Center, National Aeronautics and Space Administration, Greenbelt, MD, USA
email: charles.n.arge@nasa.gov
orcid: 'https://orcid.org/0000-0001-9326-3448'
journal: Sol Phys
title: 'Quantifying the Consistency and Characterizing the Confidence of Coronal Holes Detected by Active Contours Without Edges (ACWE)'
year: 2023
doi: '10.1007/s11207-023-02228-0'
GitHub Events
Total
- Watch event: 1
Last Year
- Watch event: 1