Skip to main content

CAREamics Portfolio

License PyPI Python Version CI Datasets CI codecov

A helper package based on pooch allowing downloading various example datasets used in publications by the Jug lab, including data featured in N2V, P(P)N2V, DivNoising, HDN, EmbedSeg, etc.

The complete list of datasets can be found in datasets.json.

CAREamics-portfolio tooling was generated using pydev-guide/pyrepo-copier.

Installation

To install the portfolio in your conda environment, simply use pip:

$ pip install careamics-portfolio

Usage

Follow the example notebook for details on how to use the package.

The portfolio can be instantiated as follow:

from careamics_portfolio import PortfolioManager

portfolio = PortfolioManager()

You can explore the different datasets easily:

print(portfolio)
print(portfolio.denoising)
print(portfolio.denoising.N2V_SEM)

Finally, you can download the dataset of your choice:

from pathlib import Path

data_path = Path('data')

# to the path of your choice
portfolio.denoising.N2V_SEM.download(data_path)

# or to your system's cache
portfolio.denoising.N2V_SEM.download()

By default, if you do not pass path to the download() method, all datasets will be saved in your system's cache. New queries to download will not cause the files to be downloaded again (thanks pooch!!).

Important: if you download all datasets of interest using the same path, pooch will maintain a regsitry of files and you will not have to download them again!

Add a dataset to the portfolio

There are a few steps to follow in order to add a new dataset to the repository:

✅ 1 - Create a PortfolioEntry child class

✅ 2 - Instantiate the portfolio entry in an IterablePortfolio

✅ 3 - Update registry.txt

✅ 4 - Make sure all tests pass

Note: To run the tests, you will need to have pytest installed. You can create an environment with careamics-portfolio and pytest by running:

pip install "careamics-portfolio[test]"

1 - Create a portfolio entry

To add a dataset, subclass a PortfolioEntry and enter the following information (preferably in one of the current categories, e.g. denoising_datasets.py):

class MyDataset(PortfolioEntry):
    def __init__(self) -> None:
        super().__init__(
            portfolio="Denoising", # for instance
            name="MyDataset",
            url="https://url.to.myfile/MyFile.zip",
            file_name="MyFile.zip",
            hash="953a815333805a423b7342971289h10121263917019bd16cc3341", # sha256
            description="Description of the dataset.",
            license="CC-BY 3.0",
            citation="Citation of the dataset",
            files={
                "/folder/in/the/zip": ["file1.tif", "file2.tif"], # folder can be "."
            },
            size=13.0, # size in MB
            tags=["tag1", "tag2"],
            is_zip=True,
        )

To obtain sha256 hash of your file, you can run the following code and read out the sha256 from the pooch prompt:

import pooch

url = "https://url.to.myfile/MyFile.zip"
pooch.retrieve(url, known_hash=None)

Likewise, to get the size in MB of your file:

import os

os.path.getsize(file_path) / 1024 / 1024

2 - Add the entry to a portfolio

Add the file class to one of the categories (e.g. denoising) in portfolio.py:

class Denoising(IterablePortfolio):
    def __init__(self) -> None:
        self._N2V_BSD68 = N2V_BSD68()
        self._N2V_SEM = N2V_SEM()
        self._N2V_RGB = N2V_RGB()
        self._flywing = Flywing()

        # add your dataset as a private attribute
        self._myDataset = MyDataset()

        [...]

    # and add a public getter
    @property
    def MyDataset(self) -> MyDataset:
        return self._myDataset

3 - Update registry

Finally, update the registry by running the following pythons script:

python scripts/update_registry.py

or run:

from careamics_portfolio import update_registry
update_registry()

The datasets.json file is updated using:

python scripts/update_json.py

4 - Verify that all tests pass

Verify that all tests pass, it can take a while:

pytest

Metadata

Release files for careamics-portfolio 0.0.15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for careamics-portfolio 0.0.15
File Size Uploaded
careamics_portfolio-0.0.15.tar.gz 26.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for careamics-portfolio 0.0.15
File Interpreter ABI Platform
careamics_portfolio-0.0.15-py3-none-any.whl Python 3 none any Details

Total release size: 47.3 kB

Release files / careamics_portfolio-0.0.15.tar.gz

Download URL careamics_portfolio-0.0.15.tar.gz
Size 26.8 kB
Tags Source
SHA-256 checksum
How to use checksums
768d51a569bea47d40dfb5def0bbd5b1582bb91bf454f95c2acd57edff619a08
BLAKE2b-256 checksum
How to use checksums
ab6fbcc595b533380de2ccbc716fe918c8b021d9b6d4f8a56a55088432519382
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 12, 2025.

Transparency log

Release files / careamics_portfolio-0.0.15-py3-none-any.whl

Download URL careamics_portfolio-0.0.15-py3-none-any.whl
Size 20.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8a5759950ac05d19684186bdbfb88ab3365057971485f348d4d940bc1758c6e2
BLAKE2b-256 checksum
How to use checksums
6f4d3091955c97370649ec8fadb7907931e52bc815bd782d83eb8c6b8d3612be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 12, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.15 This release

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page