Atreyee Sinha

Results 138 comments of Atreyee Sinha

I did some tests by comparing the dev version vs this branch on my Ubuntu laptop, and the run times are almost compatible with a small improvement (~1%) using numba...

This could be a recipe rather than a tutorial?

Thanks @adonath !I ran in the terminal `psrecord "python memory_test.py" --log memory_issue.txt --plot plot.png` and the resulting plot is: ![Image](https://github.com/user-attachments/assets/10ed531d-4143-4080-a854-20c3f69c1a2c) In this case, the process was automatically killed after 80-90...

Ok I suppose there is a bug in psrecord. Running `psrecord pid --plot plot2.png` generates a very different plot ![Image](https://github.com/user-attachments/assets/1b3f521a-cb40-4818-9950-c96dea3ab9eb) In this case it is clear that the memory usage...

The issue seems to persist both for the options `scale` and `fit` in the `FoVBackgroundMaker`. Here is the memory usage for only 20 iterations `method=fit` ![Image](https://github.com/user-attachments/assets/8d33c1a3-f3b2-4811-bf5d-64ed1100d7e4) `method=scale` ![Image](https://github.com/user-attachments/assets/ddee26e6-791c-4acd-9e29-1ea8220ffea2)

The problem is not specfic only to the `FoVBackgournd maker`. It is somehow related to the caching of geoms as @QRemy guessed during the dev call. For ex: 1. Has...

Thanks @adonath ! It is indeed the caching. Commenting out the two lines ``` self.get_coord = lru_cache()(self.get_coord) self.get_pix = lru_cache()(self.get_pix) ``` you linked to in `WcsGeom.__init__` solves the memory issue.

Can we do something for this for 2.0 ? Bare minima, we can add something in the HowTo

Note that changing this will mean adapting all our benchmarks, where we rely on this to read N observations. eg https://github.com/gammapy/gammapy-benchmarks/blob/66143e05073ed392c39cf7cbd23fc8d8055a3e5b/benchmarks/analysis_3d.py#L25

Should we postpone this again? Or do we remove support for 1.x files from 2.x? @registerrier @bkhelifi @QRemy @adonath ?