How aicip/mvcnmf-python works
Project Type and Purpose
• The MVCNMF project is a research and experimental tool implementing an unsupervised endmember extraction algorithm based on Minimum Volume Constrained Non-negative Matrix Factorization (NMF). The main goal is to handle highly mixed image data.
• The project is implemented in Python and includes several scripts for algorithm implementation, testing, and visualization, along with Jupyter notebooks for interactive data processing.
Analyzing the File Structure
• Top-level files include several Python scripts (e.g., conjugate.py, mvcnmf.py, nmf_test.py, steepdescent.py, vca.py, getSynData.py) that represent different parts or variants of the algorithm.
• The presence of the inputs directory with .mat files (A.mat, BANDS.mat) indicates where the necessary input data is stored.
• The conda environment config (env.yml) encapsulates the project’s dependencies and is key for replication.
• A README and LICENSE provide context and attribution, while the .gitignore hints at version control practices.
Main Components of the System
a. Environment Setup:
• Conda environment (env.yml) to ensure the correct dependencies.
b. Data Inputs:
• The inputs directory containing data files (A.mat, BANDS.mat).
c. Algorithm Modules:
• Core algorithm implementation is in mvcnmf.py.
• Supporting algorithmic scripts include conjugate.py, steepdescent.py, and vca.py (likely used for initialization or alternative optimization strategies).
• getSynData.py may be used for generating synthetic datasets for testing.
d. Testing & Execution:
• nmf_test.py is the main driver script used to execute the algorithm.
e. Data Processing and Visualization:
Relationships and Interactions
• The environment setup (env.yml) is foundational and is used to run any of the scripts.
• Data flows from the “inputs” directory into the algorithm modules.
• The nmf_test.py script acts as the central orchestrator, invoking various computation modules (mvcnmf.py for the core algorithm, with helper functions possibly spread across conjugate.py, steepdescent.py, and vca.py).
• The results produced from the algorithm may then be used in interactive notebooks for analysis and visualization.
• getSynData.py, if used, generates synthetic data that can be combined with real data in the workflow.
Architectural Patterns and Design Principles
• Input/Data Layer (inputs directory)
• Processing Layer (algorithm scripts performing data manipulation, factorization, and optimization)
• Output/Visualization Layer (notebooks for result analysis)
• The design follows a procedural experimental structure where each component has a specific role (data ingestion, algorithm computation, and output visualization).
Elements
• Use clear labels for each component:
• “Environment Setup” (env.yml configuration)
• “Data Input Layer” (inputs: A.mat, BANDS.mat)
• “Algorithm Core” (mvcnmf.py, conjugate.py, steepdescent.py, vca.py)
• “Test Execution” (nmf_test.py)
• (Optionally) “Synthetic Data Generator” (getSynData.py)
• Data moving from the “Data Input Layer” into the “Algorithm Core.”
• The “Algorithm Core” output flowing into the “Visualization/Analysis” components.
• The environment layer influencing all script executions.
• Orchestration/testing scripts (another styling)
• Interactive notebooks (again, a different visual style)