Coverage for src/ufig/plugins/cleanup_memory.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.6.9, created at 2024-12-12 19:08 +0000

1# Copyright (C) 2024 ETH Zurich 

2# Institute for Particle Physics and Astrophysics 

3# Author: Silvan Fischbacher 

4# created: Fri Mar 01 2024 

5 

6from ivy.plugin.base_plugin import BasePlugin 

7 

8NAME = "cleanup memory" 

9 

10 

11class Plugin(BasePlugin): 

12 """ 

13 Cleanup memory. 

14 """ 

15 

16 def __call__(self): 

17 params_to_delete = ["image", "image_mask", "bkg_noise_std"] 

18 self.delete(params_to_delete) 

19 

20 def delete(self, params): 

21 for p in params: 

22 self.ctx.__dict__.pop(p, None) 

23 self.ctx.parameters.__dict__.pop(p, None) 

24 

25 def __str__(self): 

26 return NAME