diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml index 31fd4e6..800a2e5 100644 --- a/.github/workflows/formatting.yml +++ b/.github/workflows/formatting.yml @@ -13,11 +13,16 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + # Pin the ruff version: the action otherwise resolves to the latest + # release, so a new ruff can fail CI on unchanged code (0.16 began + # formatting fenced code blocks in Markdown). - uses: astral-sh/ruff-action@v3 with: + version: "0.16.0" args: "check" src: "." - uses: astral-sh/ruff-action@v3 with: + version: "0.16.0" args: "format --check" src: "." \ No newline at end of file diff --git a/README.md b/README.md index a2bfe58..74856e0 100644 --- a/README.md +++ b/README.md @@ -122,7 +122,8 @@ pip install "git+https://github.com/esa/AnomalyMatch.git@v1.3.0" You can view any saved session using: ```python import anomaly_match as am -am.print_session('/path/to/session/directory') + +am.print_session("/path/to/session/directory") ``` Session tracking is automatic and integrates seamlessly with existing workflows. @@ -158,7 +159,7 @@ am.set_log_level("info", cfg) # Run evaluation session = am.Session(cfg) -session.load_model() # loads checkpoint and restores normalisation settings +session.load_model() # loads checkpoint and restores normalisation settings session.evaluate_all_images(top_N=1000) session.save_session() @@ -242,11 +243,12 @@ pip install images_to_zarr ```python # Convert a directory of images to 150x150 pixel zarr format import images_to_zarr as i2z + i2z.convert( output_dir="path/to/output.zarr", - folders="path/to/images", - resize=(150, 150), - chunk_shape=(1000, 4, 150, 150) # 1000 images per chunk + folders="path/to/images", + resize=(150, 150), + chunk_shape=(1000, 4, 150, 150), # 1000 images per chunk ) ``` @@ -350,11 +352,13 @@ import numpy as np # 4 FITS extensions → 3 RGB output channels cfg.normalisation.fits_extension = ["VIS", "NIR-H", "NIR-J", "NIR-Y"] -cfg.normalisation.channel_combination = np.array([ - [1, 0, 0, 0], # R = VIS - [0, 0.5, 0.5, 0], # G = average of NIR-H and NIR-J - [0, 0, 0, 1], # B = NIR-Y -]) +cfg.normalisation.channel_combination = np.array( + [ + [1, 0, 0, 0], # R = VIS + [0, 0.5, 0.5, 0], # G = average of NIR-H and NIR-J + [0, 0, 0, 1], # B = NIR-Y + ] +) ``` Each row defines one output channel as a weighted sum of the input extensions. `n_output_channels` is set to the number of rows in the matrix. When `channel_combination` is `None` (default), an identity matrix is created automatically for multi-extension configs. diff --git a/anomaly_match/image_processing/Normalisationreadme.md b/anomaly_match/image_processing/Normalisationreadme.md index ff2d938..1f85898 100644 --- a/anomaly_match/image_processing/Normalisationreadme.md +++ b/anomaly_match/image_processing/Normalisationreadme.md @@ -64,11 +64,14 @@ Each row of the array defines one output channel as a weighted sum of the input ```python import numpy as np -cfg.normalisation.channel_combination = np.array([ - [1, 0, 0, 0], # Channel 0 = extension 0 - [0, 0.5, 0.5, 0], # Channel 1 = average of extensions 1 and 2 - [0, 0, 0, 1], # Channel 2 = extension 3 -]) + +cfg.normalisation.channel_combination = np.array( + [ + [1, 0, 0, 0], # Channel 0 = extension 0 + [0, 0.5, 0.5, 0], # Channel 1 = average of extensions 1 and 2 + [0, 0, 0, 1], # Channel 2 = extension 3 + ] +) ``` ## Normalisation settings (optional) diff --git a/paper_scripts/README.md b/paper_scripts/README.md index 8ba0b38..c9399be 100644 --- a/paper_scripts/README.md +++ b/paper_scripts/README.md @@ -56,10 +56,10 @@ You will now need to copy the input image files from the galaxyzoo dataset manua 2. **Configure experiments** in `create_results.py` by setting the appropriate flags: ```python # Toggle which experiment sets to run - RUN_MINIIMAGENET = True # MiniImageNet experiments - RUN_GALAXYMNIST = True # GalaxyMNIST experiments + RUN_MINIIMAGENET = True # MiniImageNet experiments + RUN_GALAXYMNIST = True # GalaxyMNIST experiments RUN_TRAINING_ITERATIONS_STUDY = True # Different training iterations - RUN_ACTIVE_LEARNING_ABLATION = True # With/without active learning + RUN_ACTIVE_LEARNING_ABLATION = True # With/without active learning RUN_N_SAMPLES_ABLATION = True # Ablation study with varying sample sizes ```