Skip to main content
QMSQMS
QMS
  • Welcome to your QMS
  • Quality Manual
  • Procedures
  • Records
  • Legit.Health Plus Version 1.1.0.0
    • CAPA Plan - BSI CE Mark Closeout
    • Index
    • Overview and Device Description
    • Information provided by the Manufacturer
    • Design and Manufacturing Information
      • R-TF-012-019 SOUPs
        • Aioboto3
        • Albumentations
        • Argon2-CFFI
        • Authlib
        • Boto3
        • Dependency Injector
        • Dill
        • FastAPI
        • PyTorch Grad-CAM
        • Httpx
        • NumPy
        • PyNVML
        • OpenCV
        • Pillow
        • Psutil
        • Pydantic
        • Pydantic Settings
        • PyYAML
        • Segmentation Models PyTorch
        • Starlette
        • Timm
        • PyTorch
        • TorchVision
        • Ultralytics YOLO
        • Uvicorn
      • R-TF-012-028 Software Requirement Specification
      • R-TF-012-029 Software Architecture Description
      • R-TF-012-030 Software Configuration Management Plan
      • R-TF-012-031 Product requirements specification
      • R-TF-012-037 Labeling and IFU Requirements
      • R-TF-012-040 Documentation level FDA
      • R-TF-012-041 Software Classification 62304
      • R-TF-012-043 Traceability Matrix
      • Review meetings
    • GSPR
    • Benefit-Risk Analysis and Risk Management
    • Product Verification and Validation
    • Post-Market Surveillance
  • Legit.Health Plus Version 1.1.0.1
  • Legit.Health Utilities
  • Licenses and accreditations
  • Applicable Standards and Regulations
  • Pricing
  • Public tenders
  • Legit.Health Plus Version 1.1.0.0
  • Design and Manufacturing Information
  • R-TF-012-019 SOUPs
  • NumPy

NumPy

General Information​

FieldValue
Package Namenumpy (NumPy)
Manufacturer / VendorNumPy Community / NumFOCUS (NumPy organization and contributors)
Software CategoryLibrary
Primary DocumentationDocumentation, GitHub, PyPI
Programming Language(s)Python, C
LicenseBSD-3-Clause
Deployed Version(s)>=1.26.0 (version-locked at 2.3.5, 2.4.0, and 2.4.1 across microservices)
Most Recent Available Version2.4.1
Last Review Date2026-01-27

Overview​

NumPy is the fundamental package for scientific computing with Python. It provides a powerful N-dimensional array object, sophisticated broadcasting functions, tools for integrating C/C++ and Fortran code, and useful linear algebra, Fourier transform, and random number capabilities. NumPy brings the computational power of languages like C and Fortran to Python while maintaining ease of use. With over 31,000 GitHub stars, it is the de facto standard for numerical computing in the Python ecosystem and forms the foundation upon which nearly all scientific Python libraries are built.

Within the medical device software, NumPy serves as the foundational numerical computing layer that underpins all image processing, machine learning inference, and statistical operations. It is integrated throughout the legithp-expert framework and all AI expert microservices. Specifically, NumPy is used for:

  • Image data representation: All images are stored as NDArray[np.uint8] arrays with shape (H, W, 3) for RGB data, providing a standardized pixel representation across the computer vision infrastructure
  • Mask operations: Segmentation masks are represented as 2D np.uint8 arrays with probabilistic values (0-255), enabling contour extraction, coverage calculations, and overlay rendering
  • Array interoperability: Bidirectional conversion between NumPy arrays, PIL Image objects, and PyTorch tensors via np.array(), Image.fromarray(), and tensor operations
  • Probability distributions: Managing classification outputs with np.float64 precision for skin condition probability distributions, including entropy calculation and mean aggregation across multi-view predictions
  • Test-time augmentation: Stacking multiple augmented image views using np.stack() for ensemble predictions
  • Explainability support: GradCAM++ saliency maps are generated as NumPy arrays with float values (0-1) for clinical interpretation

The library was selected for its industry-standard status as the foundation of the scientific Python ecosystem, seamless integration with PyTorch and PIL/Pillow, comprehensive array manipulation capabilities, well-optimized C code providing performance critical for real-time inference, and permissive BSD licensing compatible with commercial medical device software.

Functional Requirements​

The following functional capabilities of this SOUP are relied upon by the medical device software.

Requirement IDDescriptionSource / Reference
FR-001Represent multi-dimensional arrays with typed elements (uint8, float32, float64)numpy.ndarray class, numpy.dtype
FR-002Convert Python sequences and PIL images to NumPy arraysnumpy.array() function
FR-003Create zero-filled arrays for mask initializationnumpy.zeros() function
FR-004Create arrays filled with specified valuesnumpy.full() function
FR-005Stack multiple arrays along new dimensions for batch processingnumpy.stack() function
FR-006Conditional element selection based on boolean conditionsnumpy.where() function
FR-007Pad arrays with specified border values for image preprocessingnumpy.pad() function
FR-008Compute mean values across arrays for probability aggregationnumpy.mean() function
FR-009Compute variance for color channel analysisnumpy.var() function
FR-010Compute natural logarithm for Shannon entropy calculationnumpy.log() function
FR-011Clamp array values within specified boundsnumpy.clip() function
FR-012Flip arrays along specified axes for augmentationnumpy.flip() function
FR-013Generate random samples for pixel sampling optimizationnumpy.random.choice() function
FR-014Perform exact and approximate array comparison for testingnumpy.array_equal(), numpy.allclose()
FR-015Sum array elements for coverage and counting operationsnumpy.sum() function

Performance Requirements​

The following performance expectations are relevant to the medical device software.

Requirement IDDescriptionAcceptance Criteria
PR-001Array operations shall complete within acceptable API latency boundsArray operations do not dominate inference latency
PR-002Memory allocation shall scale linearly with array dimensionsNo memory leaks during repeated array operations
PR-003Numerical operations shall maintain IEEE 754 floating-point precisionNo loss of precision affecting probability calculations
PR-004Array type conversions (uint8/float32/float64) shall preserve data fidelityNo data loss or corruption during type conversions
PR-005Random sampling operations shall provide statistically representative distributionsPixel sampling produces representative color statistics

Hardware Requirements​

The following hardware dependencies or constraints are imposed by this SOUP component.

Requirement IDDescriptionNotes / Limitations
HR-001Sufficient system memory for array dataMemory requirements scale with array dimensions (height × width × channels)
HR-002x86-64 or ARM64 processor architecturePre-built wheels available for common platforms
HR-003CPU with SIMD support for optimized operationsSSE/AVX on x86-64, NEON on ARM64 for vectorized operations

Software Requirements​

The following software dependencies and environmental assumptions are required by this SOUP component.

Requirement IDDescriptionDependency / Version Constraints
SR-001Python runtime environmentPython >=3.10
SR-002C library for low-level array operationsSystem libc (bundled in wheels)
SR-003BLAS/LAPACK for linear algebra (optional)OpenBLAS or Intel MKL if available

Known Anomalies Assessment​

This section evaluates publicly reported issues, defects, or security vulnerabilities associated with this SOUP component and their relevance to the medical device software.

Anomaly ReferenceStatusApplicableRationaleReviewed At
CVE-2021-41495 (Null pointer dereference in numpy.sort)FixedNoAffects NumPy <1.22.2; the device uses version-locked 2.3.5–2.4.1 which includes the fix. Vendor notes attack requires exhausting memory, which implies attacker is already privileged2026-01-27
CVE-2021-41496 (Buffer overflow in array_from_pyobj)FixedNoAffects NumPy <1.22.0; the device uses version-locked 2.3.5–2.4.1 which includes the fix. The device does not use the affected Fortran interface functions2026-01-27
CVE-2021-34141 (Incomplete string comparison)FixedNoAffects NumPy <1.22.0; the device uses version-locked 2.3.5–2.4.1 which includes the fix. Vendor states behavior is "completely harmless"2026-01-27
CVE-2019-6446 (Pickle deserialization arbitrary code execution)FixedNoAffects NumPy <1.16.3; the device uses version-locked 2.3.5–2.4.1 which includes the fix. Disputed as it requires loading untrusted pickle files; the device does not load external .npy files2026-01-27

NumPy is actively maintained by the NumPy community under the NumFOCUS fiscal sponsorship, with a robust security response process. The project maintains a security policy with Tidelift partnership for coordinated vulnerability disclosure. According to the Snyk vulnerability database, all known high-severity vulnerabilities have been addressed in versions prior to 1.22.2.

The device's usage pattern minimizes attack surface exposure:

  • No external data loading: The device does not use numpy.load() to load .npy or .npz files from external sources; all arrays are created programmatically from validated image data
  • Version locking: Requirements lock files pin NumPy to versions 2.3.5, 2.4.0, and 2.4.1 across microservices, ensuring reproducible and auditable deployments with all known security vulnerabilities addressed
  • Input validation: All image data is validated at API boundaries before being converted to NumPy arrays
  • No pickle operations: The device does not use NumPy's pickle-based serialization; model weights use PyTorch's serialization with weights_only=True
  • Controlled array dimensions: Image dimensions are bounded by API input validation, preventing denial-of-service via excessive memory allocation
  • Type safety: Extensive use of numpy.typing.NDArray type hints ensures array operations receive expected data types

Risk Control Measures​

The following risk control measures are implemented to mitigate potential security and operational risks associated with this SOUP component:

  • Version locking via requirements_lock.txt files ensures reproducible, auditable deployments with known-secure versions
  • All array data originates from validated API inputs or internal computations
  • No external NumPy file loading or pickle deserialization
  • Array dimension bounds enforced at API boundaries
  • Type validation at domain entity boundaries (Image, Mask, SaliencyMap classes)

Assessment Methodology​

The following methodology was used to identify and assess known anomalies:

  • Sources consulted:

    • National Vulnerability Database (NVD) search for "numpy"
    • GitHub Security Advisories for numpy/numpy
    • NumPy security policy
    • Snyk vulnerability database
    • CVE Details for NumPy
    • PyPI package security reports
  • Criteria for determining applicability:

    • Vulnerability must affect deployed versions (2.3.5, 2.4.0, 2.4.1)
    • Vulnerability must be exploitable in the device's operational context (image processing, inference pipelines)
    • Attack vector must be reachable through the device's interfaces (no external file loading, no untrusted pickle data)
    • Input validation and version constraints must not already mitigate the vulnerability

Signature meaning

The signatures for the approval process of this document can be found in the verified commits at the repository for the QMS. As a reference, the team members who are expected to participate in this document and their roles in the approval process, as defined in Annex I Responsibility Matrix of the GP-001, are:

  • Author: Team members involved
  • Reviewer: JD-003, JD-004
  • Approver: JD-001
Previous
Httpx
Next
PyNVML
  • General Information
  • Overview
  • Functional Requirements
  • Performance Requirements
  • Hardware Requirements
  • Software Requirements
  • Known Anomalies Assessment
    • Risk Control Measures
    • Assessment Methodology
All the information contained in this QMS is confidential. The recipient agrees not to transmit or reproduce the information, neither by himself nor by third parties, through whichever means, without obtaining the prior written permission of Legit.Health (AI Labs Group S.L.)