ChessAnalysisPipeline 0.0.2__py3-none-any.whl → 0.0.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ChessAnalysisPipeline might be problematic. Click here for more details.

Files changed (47) hide show
  1. CHAP/__init__.py +3 -0
  2. CHAP/common/__init__.py +19 -0
  3. CHAP/common/models/__init__.py +2 -0
  4. CHAP/common/models/integration.py +515 -0
  5. CHAP/common/models/map.py +535 -0
  6. CHAP/common/processor.py +644 -0
  7. CHAP/common/reader.py +119 -0
  8. CHAP/common/utils/__init__.py +37 -0
  9. CHAP/common/utils/fit.py +2613 -0
  10. CHAP/common/utils/general.py +1225 -0
  11. CHAP/common/utils/material.py +231 -0
  12. CHAP/common/utils/scanparsers.py +785 -0
  13. CHAP/common/writer.py +96 -0
  14. CHAP/edd/__init__.py +7 -0
  15. CHAP/edd/models.py +215 -0
  16. CHAP/edd/processor.py +321 -0
  17. CHAP/edd/reader.py +5 -0
  18. CHAP/edd/writer.py +5 -0
  19. CHAP/inference/__init__.py +3 -0
  20. CHAP/inference/processor.py +68 -0
  21. CHAP/inference/reader.py +5 -0
  22. CHAP/inference/writer.py +5 -0
  23. CHAP/pipeline.py +1 -1
  24. CHAP/processor.py +11 -818
  25. CHAP/reader.py +18 -113
  26. CHAP/saxswaxs/__init__.py +6 -0
  27. CHAP/saxswaxs/processor.py +5 -0
  28. CHAP/saxswaxs/reader.py +5 -0
  29. CHAP/saxswaxs/writer.py +5 -0
  30. CHAP/sin2psi/__init__.py +7 -0
  31. CHAP/sin2psi/processor.py +5 -0
  32. CHAP/sin2psi/reader.py +5 -0
  33. CHAP/sin2psi/writer.py +5 -0
  34. CHAP/tomo/__init__.py +5 -0
  35. CHAP/tomo/models.py +125 -0
  36. CHAP/tomo/processor.py +2009 -0
  37. CHAP/tomo/reader.py +5 -0
  38. CHAP/tomo/writer.py +5 -0
  39. CHAP/writer.py +17 -167
  40. {ChessAnalysisPipeline-0.0.2.dist-info → ChessAnalysisPipeline-0.0.4.dist-info}/METADATA +1 -1
  41. ChessAnalysisPipeline-0.0.4.dist-info/RECORD +50 -0
  42. CHAP/async.py +0 -56
  43. ChessAnalysisPipeline-0.0.2.dist-info/RECORD +0 -17
  44. {ChessAnalysisPipeline-0.0.2.dist-info → ChessAnalysisPipeline-0.0.4.dist-info}/LICENSE +0 -0
  45. {ChessAnalysisPipeline-0.0.2.dist-info → ChessAnalysisPipeline-0.0.4.dist-info}/WHEEL +0 -0
  46. {ChessAnalysisPipeline-0.0.2.dist-info → ChessAnalysisPipeline-0.0.4.dist-info}/entry_points.txt +0 -0
  47. {ChessAnalysisPipeline-0.0.2.dist-info → ChessAnalysisPipeline-0.0.4.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env python
2
+ #-*- coding: utf-8 -*-
3
+ #pylint: disable=
4
+ '''
5
+ File : processor.py
6
+ Author : Valentin Kuznetsov <vkuznet AT gmail dot com>
7
+ Description: Processor module
8
+ '''
9
+
10
+ # system modules
11
+ from time import time
12
+
13
+ # local modules
14
+ from CHAP import Processor
15
+
16
+ class TFaaSImageProcessor(Processor):
17
+ '''
18
+ A Processor to get predictions from TFaaS inference server.
19
+ '''
20
+ def process(self, data, url, model, verbose=False):
21
+ '''
22
+ process data API
23
+ '''
24
+
25
+ t0 = time()
26
+ self.logger.info(f'Executing "process" with url {url} model {model}')
27
+
28
+ data = self._process(data, url, model, verbose)
29
+
30
+ self.logger.info(f'Finished "process" in {time()-t0:.3f} seconds\n')
31
+
32
+ return(data)
33
+
34
+ def _process(self, data, url, model, verbose):
35
+ '''Print and return the input data.
36
+
37
+ :param data: Input image data, either file name or actual image data
38
+ :type data: object
39
+ :return: `data`
40
+ :rtype: object
41
+ '''
42
+
43
+ from MLaaS.tfaas_client import predictImage
44
+ from pathlib import Path
45
+
46
+ self.logger.info(f'input data {type(data)}')
47
+ if isinstance(data, str) and Path(data).is_file():
48
+ imgFile = data
49
+ data = predictImage(url, imgFile, model, verbose)
50
+ else:
51
+ rdict = data[0]
52
+ import requests
53
+ img = rdict['data']
54
+ session = requests.Session()
55
+ rurl = url + '/predict/image'
56
+ payload = dict(model=model)
57
+ files = dict(image=img)
58
+ self.logger.info(f'HTTP request {rurl} with image file and {payload} payload')
59
+ req = session.post(rurl, files=files, data=payload )
60
+ data = req.content
61
+ data = data.decode('utf-8').replace('\n', '')
62
+ self.logger.info(f'HTTP response {data}')
63
+
64
+ return(data)
65
+
66
+ if __name__ == '__main__':
67
+ from CHAP.processor import main
68
+ main()
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env python
2
+
3
+ if __name__ == '__main__':
4
+ from CHAP.reader import main
5
+ main()
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env python
2
+
3
+ if __name__ == '__main__':
4
+ from CHAP.writer import main
5
+ main()
CHAP/pipeline.py CHANGED
@@ -50,7 +50,7 @@ class Pipeline():
50
50
  self.logger.info(f'Calling "write" on {item}')
51
51
  data = item.write(data, **kwargs)
52
52
 
53
- self.logger.info(f'Exectuted "exectute" in {time()-t0:.3f} seconds')
53
+ self.logger.info(f'Executed "execute" in {time()-t0:.3f} seconds')
54
54
 
55
55
  class PipelineObject():
56
56
  """