Coverage for hiperta_stream/scripts/get_zfits_pixel_order.py: 0%

21 statements  

« prev     ^ index     » next       coverage.py v7.4.3, created at 2024-07-16 10:16 +0000

1#!/usr/bin/env python 

2# P. Aubert & E. Garcia - Nov 2020, lock-down Chap. II 

3 

4import numpy as np 

5import argparse 

6 

7 

8def main(): 

9 parser = argparse.ArgumentParser(description="Full pipeline hiperta analysis.") 

10 

11 parser.add_argument('--input', '-i', action='store', type=str, 

12 dest='input', 

13 help='Input zfits file', 

14 default=None) 

15 

16 parser.add_argument('--output', '-o', action='store', type=str, 

17 dest='output', 

18 help='Output binary file which contains the pixel order stored as uint16', 

19 default=False) 

20 

21 args = parser.parse_args() 

22 

23 zfitsInputFile = args.input 

24 outputNpFile = args.output 

25 

26 try: 

27 from protozfits import File 

28 zfitsFile = File(zfitsInputFile) 

29 cameraConfig = zfitsFile.CameraConfig 

30 config = next(cameraConfig) 

31 expectedPixelId = config.expected_pixels_id 

32 

33 tabOrderPix = np.asarray(expectedPixelId, dtype=np.uint16) 

34 tabOrderPix.tofile(outputNpFile) 

35 except: 

36 pass 

37 

38 

39if __name__ == "__main__": 

40 main()