Skip to content

Commit

Permalink
first_step_information_Filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Ishaanj18 committed Sep 22, 2023
1 parent 2f08096 commit 638f1a7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions xbitinfo/xbitinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def load_bitinformation(label):
raise FileNotFoundError(f"No bitinformation could be found at {label+'.json'}")


def get_keepbits(info_per_bit, inflevel=0.99):
def get_keepbits(info_per_bit, inflevel=0.99, information_filter = False):
"""Get the number of mantissa bits to keep. To be used in :py:func:`xbitinfo.bitround.xr_bitround` and :py:func:`xbitinfo.bitround.jl_bitround`.
Parameters
Expand Down Expand Up @@ -439,7 +439,10 @@ def get_keepbits(info_per_bit, inflevel=0.99):
# get only variables of bitdim
bit_vars = [v for v in info_per_bit.data_vars if bitdim in info_per_bit[v].dims]
if bit_vars != []:
cdf = _cdf_from_info_per_bit(info_per_bit[bit_vars], bitdim)
if(information_filter == True):

else:
cdf = _cdf_from_info_per_bit(info_per_bit[bit_vars], bitdim)
bitdim_non_mantissa_bits = NMBITS[int(bitdim[3:])]
keepmantissabits_bitdim = (
(cdf > inflevel).argmax(bitdim) + 1 - bitdim_non_mantissa_bits
Expand Down

0 comments on commit 638f1a7

Please sign in to comment.