Skip to content

Commit

Permalink
Merge pull request #73 from Jammy2211/feature/native_binned
Browse files Browse the repository at this point in the history
Force Native Binned Array2D Objects Only
  • Loading branch information
Jammy2211 authored Oct 3, 2023
2 parents e512c02 + fb39ce7 commit 1080133
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions autoarray/structures/arrays/uniform_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from pathlib import Path
from typing import List, Optional, Tuple, Union

from autoconf import conf

from autoarray.mask.mask_2d import Mask2D
from autoarray.structures.abstract_structure import Structure
from autoarray.structures.header import Header
Expand Down Expand Up @@ -257,6 +259,10 @@ def __new__(
array_2d.slim[7] = value of first sub-pixel in pixel 7.
array_2d.slim[8] = value of first sub-pixel in pixel 8.
In **PyAutoCTI** all `Array2D` objects are used in their `native` representation without sub-gridding.
Significant memory can be saved by only store this format, thus the `native_binned_only` config override
can force this behaviour. It is recommended users do not use this option to avoid unexpected behaviour.
Parameters
----------
values
Expand Down Expand Up @@ -333,6 +339,9 @@ def __new__(
array_2d.output_to_fits(file_path="/path/for/output")
"""

if conf.instance["general"]["structures"]["native_binned_only"]:
store_native = True

values = array_2d_util.convert_array_2d(
array_2d=values,
mask_2d=mask,
Expand Down Expand Up @@ -416,7 +425,13 @@ def binned(self) -> "Array2D":
performed by taking the mean of all (y,x) values in each sub pixel.
If the array is stored in 1D it is return as is. If it is stored in 2D, it must first be mapped from 2D to 1D.
In **PyAutoCTI** all `Array2D` objects are used in their `native` representation without sub-gridding.
Significant memory can be saved by only store this format, thus the `native_binned_only` config override
can force this behaviour. It is recommended users do not use this option to avoid unexpected behaviour.
"""
if conf.instance["general"]["structures"]["native_binned_only"]:
return self

array_2d_slim = self.slim

Expand Down

0 comments on commit 1080133

Please sign in to comment.