CLMM icon indicating copy to clipboard operation
CLMM copied to clipboard

Issue/635/Modify coordinate system implementation

Open caioolivv opened this issue 1 year ago • 10 comments

Recreating PR #636 with correct branch name.

caioolivv avatar Nov 08 '24 14:11 caioolivv

I've noticed I still have to update other notebooks that had coordinate system examples. Working on it right now.

caioolivv avatar Nov 08 '24 14:11 caioolivv

Coverage Status

coverage: 100.0%. remained the same when pulling 8fcea5add59b1472bedd44eaf27cf54b1551e5c0 on issue/635/coordinate_implementation into 1525a26f0c3d664a2fff145303f1bb1d883bb53f on main.

coveralls avatar Nov 14 '24 15:11 coveralls

@caioolivv is this PR ready for review? If so, could you convert from 'draft' to 'ready to review' ?

marina-ricci avatar Nov 15 '24 15:11 marina-ricci

@caioolivv is this PR ready for review? If so, could you convert from 'draft' to 'ready to review' ?

Hi, its done now! Sorry for the delay

caioolivv avatar Nov 19 '24 11:11 caioolivv

@caioolivv There seems to be a problem with the cross shear. image

marina-ricci avatar Nov 19 '24 18:11 marina-ricci

@caioolivv There seems to be a problem with the cross shear. image

I believe the that's double precision floating point error? g_x should be 0 for all since there's no shapenoice, and we're getting a random signal in the order of 10^-17. I can try to see if the same happens if we add shapenoise.

caioolivv avatar Nov 19 '24 18:11 caioolivv

Okay, they're definitely flipping the signal for g_x even with shapenoise. I'll try and find where's the bug.

image

caioolivv avatar Nov 19 '24 18:11 caioolivv

Thanks! I was just testing the same thing.

In the notebook, I suggest adding shapenoise=0.05"` in the source kwargs. Also for the histogram of values, could you change to (for visibility) :

f, ax = plt.subplots(1, 2, figsize=(10, 4))

ax[0].hist(cl_euclidean.galcat["et"], bins=50, color="tab:blue", alpha=0.5, label='euclidean')
ax[0].hist(cl_celestial.galcat["et"], bins=50, color="tab:red", histtype='step', label='celestial')
ax[0].hist(cl_wrong.galcat["et"], bins=50, color="tab:orange", alpha=0.5,  histtype='stepfilled', label='incorrect coordinate system')
ax[0].set_xlabel("$\\epsilon_t$", fontsize="xx-large")

ax[1].hist(cl_euclidean.galcat["ex"], bins=50, color="tab:blue", alpha=0.5, label='euclidean')
ax[1].hist(cl_celestial.galcat["ex"], bins=50, color="tab:red", histtype='step', label='celestial')
ax[1].hist(cl_wrong.galcat["ex"], bins=50, color="tab:orange", alpha=0.5,  histtype='stepfilled', label='incorrect coordinate system')
ax[1].set_xlabel("$\\epsilon_x$", fontsize="xx-large")
ax[1].set_yscale("log")

plt.legend()
plt.show()

marina-ricci avatar Nov 19 '24 19:11 marina-ricci

What worries me is that this bug seemed to have pass the tests...

marina-ricci avatar Nov 19 '24 19:11 marina-ricci

Wait, isn't that right though? Mirroring the x-axis consists of doing phi -> pi - phi, which is supposed to change the sign of e_x too.

caioolivv avatar Nov 19 '24 19:11 caioolivv

Hi @caioolivv, @m-aguena, @marina-ricci - I'm starting the review this PR. Here are a first few things I noticed:

  • [x] there's currently a minor conflict to be solved with main.
  • [x] the demo_coordinate_system notebook is missing two imports for the "HSC Y3" section to work properly. Namely
from astropy.io import fits
from scipy import spatial
  • [x] maybe consider adding a warning to the update_coordinate_system function to warn the user that no conversion is undertaken if coordinate_system == in_coordinate_system?

combet avatar May 16 '25 10:05 combet

@caioolivv can you save a copy of the data generated by the demo_coordinate_system_datasets.ipynb notebook at cc-in2p3 in

/sps/lsst/groups/clusters/CLMM/HSC_data_example/

and comment it on the notebook?

Thanks

m-aguena avatar May 29 '25 20:05 m-aguena

Thanks @m-aguena! Though merging is still blocked. I don't have permission to push to main. Can you approve the PR?

caioolivv avatar Sep 20 '25 01:09 caioolivv