-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from siapy/develop
Develop
- Loading branch information
Showing
15 changed files
with
272 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Security Policy | ||
|
||
Security is very important for SiaPy and its community. 🔒 | ||
|
||
Learn more about it below. 👇 | ||
|
||
## Versions | ||
|
||
The latest version of SiaPy is supported. | ||
|
||
You are encouraged to update your SiaPy version frequently. This way you will benefit from the latest features, bug fixes, and **security fixes**. | ||
|
||
## Reporting a Vulnerability | ||
|
||
We take the security of our project seriously. If you have discovered a security vulnerability, we appreciate your cooperation in disclosing it to us in a responsible manner. | ||
|
||
Please report any security vulnerabilities by emailing us at [[email protected]]([email protected]). | ||
|
||
We will acknowledge receipt of your vulnerability report, assess it for validity and severity, and decide on the next steps. We ask that you do not publicly disclose the vulnerability until we have had a chance to address it. | ||
|
||
## What to include in your report | ||
|
||
To help us triage and prioritize the issue, please include as much information as possible, such as: | ||
|
||
- The version of our project you are using | ||
- A step-by-step description of how to reproduce the vulnerability | ||
- Any relevant logs or output | ||
- Any other information you think might be relevant | ||
|
||
## Public Discussions | ||
|
||
Please refrain from publicly discussing a potential security vulnerability. | ||
|
||
Discussing vulnerabilities in public forums before they are properly assessed and fixed can significantly increase the risk to the project and its users. It's better to discuss issues privately and work together to find a solution first, to limit the potential impact as much as possible. We appreciate your cooperation and understanding in handling sensitive matters with discretion. | ||
|
||
--- | ||
|
||
Thank you for helping to keep SiaPy and its users safe. 🏅 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
from dataclasses import dataclass | ||
from pathlib import Path | ||
from typing import Iterator | ||
|
||
from rich.progress import track | ||
|
||
from siapy.core import logger | ||
|
||
from .images import SpectralImage | ||
|
||
|
||
@dataclass | ||
class SpectralImageSet: | ||
def __init__(self, spectral_images: list[SpectralImage] | None = None): | ||
self._images = spectral_images if spectral_images is not None else [] | ||
|
||
def __len__(self) -> int: | ||
return len(self.images) | ||
|
||
def __str__(self) -> str: | ||
return f"<{self.__class__.__name__} object with {len(self)} spectral images>" | ||
|
||
def __iter__(self) -> Iterator[SpectralImage]: | ||
return iter(self.images) | ||
|
||
def __getitem__(self, index) -> SpectralImage: | ||
return self.images[index] | ||
|
||
@classmethod | ||
def from_paths( | ||
cls, | ||
*, | ||
header_paths: list[str | Path], | ||
image_paths: list[str | Path] | None = None, | ||
): | ||
if image_paths is not None and len(header_paths) != len(image_paths): | ||
raise ValueError("The length of hdr_paths and img_path must be equal.") | ||
|
||
if image_paths is None: | ||
spectral_images = [ | ||
SpectralImage.envi_open(header_path=hdr_path) | ||
for hdr_path in track( | ||
header_paths, description="Loading spectral images..." | ||
) | ||
] | ||
else: | ||
spectral_images = [ | ||
SpectralImage.envi_open(header_path=hdr_path, image_path=img_path) | ||
for hdr_path, img_path in track( | ||
zip(header_paths, image_paths), | ||
description="Loading spectral images...", | ||
) | ||
] | ||
logger.info("Spectral images loaded into memory.") | ||
return cls(spectral_images) | ||
|
||
@property | ||
def images(self) -> list[SpectralImage]: | ||
return self._images |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.