Skip to content

Optimiser update - #37

Open
EdoardoGiancarli wants to merge 4 commits into
peppedilillo:newSGfrom
EdoardoGiancarli:newSG
Open

Optimiser update#37
EdoardoGiancarli wants to merge 4 commits into
peppedilillo:newSGfrom
EdoardoGiancarli:newSG

Conversation

@EdoardoGiancarli

Copy link
Copy Markdown
Collaborator

Optimiser

Update for the Optimiser used during the IROS procedure to fit the sources (i) camera local-frame position and (ii) counts values.

  • updated source model used in the optimisation;
  • updated fit procedure: from minimize to curve_fit (from the scipy lib). Also removed the loss metric, since it is computed inside the curve_fit pipeline;
  • inserted starting fluence correction wrt the camera coding power value [1];
  • inserted narrower source local-frame coords boundaries for the fit (from tests we observed that the true source position does not deviate so much from the source peak position in the sky image --less than 2px--);

[1] Evangelista et al., "Design and performance of the coded mask for the Lunar Electromagnetic Monitor in X-rays (LEM-X)", in preparation (2025)

Tests

The optimiser tests have been commented, at the moment. They will be updated once we decide the final structure for the optimiser procedure.

Notes

With curve_fit, the optimisation procedure proved to be less computational expensive wrt minimize:

  • by a factor ~6 wrt non-cached version (used with source fractional shift)
  • by a factor ~3 wrt cached version for old source model

The source position and fluence residues are in the worse case similar to the ones obtained with the minimize procedure.
To resume, we improved the optimisation computational cost, while preserving the source parameters fit efficiency.

Comment thread bloodmoon/optim.py Outdated
vignetting: bool = True,
psfy: bool = True,
model: Literal["fast", "accurate"] = "fast",
verbose: bool = True,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set default to False

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okie

Comment thread bloodmoon/optim.py Outdated
camera.specs.mask_deltax / camera.upscale_f.x,
camera.specs.mask_deltay / camera.upscale_f.y,
)
camera_coding_power = 0.85

@peppedilillo peppedilillo Dec 10, 2025

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this number depend on the mask? If so it should not be hard coded but either 1. computed from the mask pattern here, 2. red from the mask FITS file

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the second option, as the coding power is computed from simulations

Comment thread bloodmoon/optim.py Outdated
@@ -443,7 +438,7 @@ def optimize(
vignetting: bool = True,
psfy: bool = True,
verbose: bool = False,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move verbose to last argument position.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

roger that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants