Full error output, just in case
``` sh
Traceback (most recent call last):
File "/path/to/some.py", line 33, in
flcc = flcd.characterize_flares(ampl_bins=10, dur_bins=10)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/AltaiPony/altaipony/flarelc.py", line 947, in characterize_flares
flares = wrap_characterization_of_flares(flc.fake_flares, flc.flares,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/AltaiPony/altaipony/injrecanalysis.py", line 54, in wrap_characterization_of_flares
fl = fl.merge(flcc)
^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pandas/core/frame.py", line 9843, in merge
return merge(
^^^^^^
File "/usr/local/lib/python3.11/site-packages/pandas/core/reshape/merge.py", line 162, in merge
return op.get_result(copy=copy)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pandas/core/reshape/merge.py", line 809, in get_result
join_index, left_indexer, right_indexer = self._get_join_info()
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pandas/core/reshape/merge.py", line 1065, in _get_join_info
(left_indexer, right_indexer) = self._get_join_indexers()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pandas/core/reshape/merge.py", line 1038, in _get_join_indexers
return get_join_indexers(
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pandas/core/reshape/merge.py", line 1665, in get_join_indexers
zipped = zip(*mapped)
^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pandas/core/reshape/merge.py", line 1662, in
_factorize_keys(left_keys[n], right_keys[n], sort=sort, how=how)
File "/usr/local/lib/python3.11/site-packages/pandas/core/reshape/merge.py", line 2442, in _factorize_keys
llab = rizer.factorize(lk) # type: ignore[arg-type]
^^^^^^^^^^^^^^^^^^^
File "pandas/_libs/hashtable.pyx", line 122, in pandas._libs.hashtable.ObjectFactorizer.factorize
File "pandas/_libs/hashtable_class_helper.pxi", line 7288, in pandas._libs.hashtable.PyObjectHashTable.get_labels
File "pandas/_libs/hashtable_class_helper.pxi", line 7194, in pandas._libs.hashtable.PyObjectHashTable._unique
TypeError: unhashable type: 'MaskedNDArray'
```
I get it when I call characterize_flares() function.
A script to reproduce the problem
``` py
from altaipony.lcio import from_mast
import pandas
flc = from_mast(
"Kepler-114",
mode="LC",
cadence="short",
mission="Kepler"
)
for j in range(len(flc)):
print(f"\n--- {j} ---\n")
# detrend curve
flcd = flc[j].detrend("savgol")
# find flares
flcd = flcd.find_flares(N1=3, N2=1, N3=3, minsep=3)
flcdpanda = flcd.flares
# print(flcdpanda)
if not flcdpanda.empty:
# injection of simulated flares
flcd, fakeflc = flcd.sample_flare_recovery(
inject_before_detrending=True,
mode="savgol",
iterations=20,
fakefreq=2,
ampl=[1e-4, 0.5],
dur=[.001/6., 0.1/6.]
)
print(f"Total number of injected flares is {flcd.fake_flares.shape[0]}")
# here it fails
flcc = flcd.characterize_flares(ampl_bins=10, dur_bins=10)
else:
print("DataFrame is empty, no flares")
```
Since it was working fine before in older versions of AltaiPony (the ones using older Astropy depedcency, such as v4.3.1), this problem is likely caused by something from newer Astropy versions.
Tested with aa6ba8d202566d1b69d8b7744eba39617056bbb7 revision.
This problem can be reproduced after #77 is fixed.
There is some error in wrap_characterization_of_flares() function on the line
fl = fl.merge(flcc)
:Full error output, just in case
``` sh Traceback (most recent call last): File "/path/to/some.py", line 33, inI get it when I call
characterize_flares()
function.A script to reproduce the problem
``` py from altaipony.lcio import from_mast import pandas flc = from_mast( "Kepler-114", mode="LC", cadence="short", mission="Kepler" ) for j in range(len(flc)): print(f"\n--- {j} ---\n") # detrend curve flcd = flc[j].detrend("savgol") # find flares flcd = flcd.find_flares(N1=3, N2=1, N3=3, minsep=3) flcdpanda = flcd.flares # print(flcdpanda) if not flcdpanda.empty: # injection of simulated flares flcd, fakeflc = flcd.sample_flare_recovery( inject_before_detrending=True, mode="savgol", iterations=20, fakefreq=2, ampl=[1e-4, 0.5], dur=[.001/6., 0.1/6.] ) print(f"Total number of injected flares is {flcd.fake_flares.shape[0]}") # here it fails flcc = flcd.characterize_flares(ampl_bins=10, dur_bins=10) else: print("DataFrame is empty, no flares") ```Since it was working fine before in older versions of AltaiPony (the ones using older Astropy depedcency, such as v4.3.1), this problem is likely caused by something from newer Astropy versions.
Tested with aa6ba8d202566d1b69d8b7744eba39617056bbb7 revision.