Skip to content

split stackplotX to a new repo #273

@sageyu123

Description

@sageyu123

To make stackplotX independent of Suncasa and more flexible for future uses:

  1. Create a New Repository:

    • Extract stackplotX from the current Suncasa repository.
    • Initialize a new Git repository for stackplotX.
    • Ensure all dependencies are documented in a requirements.txt file or a setup.py file for easier installation.
  2. Refactor the Code:

    • Decouple the calculation logic from the plotting backend.
    • Define a clear interface for the calculation code, enabling it to be used as a standalone module.
    • Encapsulate Matplotlib-specific code within its own module or class, allowing for optional use.
  3. Enhance Compatibility:

    • Update the code to be compatible with sunpy version 5 or higher.
    • Replace any deprecated sunpy functionality with current APIs.
  4. Documentation and Examples:

    • Provide comprehensive documentation explaining how to use the calculation module independently.
    • Include examples demonstrating how to integrate the module with different UI frameworks or plotting libraries.
# calculation_module.py

class StackPlotXCalculator:
    def __init__(self, data):
        self.data = data

    def extract_intensity_along_path(self, path):
        """
        Extracts the intensity along a given path from the data.
        
        Parameters:
        path : array_like
            The path along which to extract intensity.
        
        Returns:
        intensity : array_like
            The extracted intensity values along the path.
        """
        # Implementation of intensity extraction.
        pass

And a separate plotting module using Matplotlib:

# matplotlib_backend.py
import matplotlib.pyplot as plt
from calculation_module import StackPlotXCalculator

class StackPlotXMatplotlib:
    def __init__(self, calculator: StackPlotXCalculator):
        self.calculator = calculator

    def plot(self, path):
        intensity = self.calculator.extract_intensity_along_path(path)
        plt.figure()
        plt.plot(intensity)
        plt.show()

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions