mimical 0.1.1__tar.gz → 0.1.3__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mimical
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: Intesity modelling of multiply-imaged objects
5
5
  Author: Struan Stevenson
6
6
  Author-email: struan.stevenson@ed.ac.uk
@@ -17,7 +17,9 @@ Dynamic: description-content-type
17
17
  Dynamic: requires-dist
18
18
  Dynamic: summary
19
19
 
20
- # Mimical (Modelling the Intensity of Multiply-Imaged Celestial Ancient Light)
20
+ ** Mimical (Modelling the Intensity of Multiply-Imaged Celestial Ancient Light)
21
21
 
22
22
 
23
- #### Mimical is an intensity modelling code for multiply-imaged objects, performing simultaenous Bayseian inference of model parameters via the nested sampling algorithm. Mimical supports any astropy model, and supports user defined parameter polynomial depenency with image wavelength.
23
+ Mimical is an intensity modelling code for multiply-imaged objects, performing simultaenous Bayseian inference of model parameters via the nested sampling algorithm. Mimical supports any astropy model, and supports user defined parameter polynomial depenency with image wavelength.
24
+
25
+ .. image:: docs/mimical_workflow.pdf
@@ -0,0 +1,6 @@
1
+ ** Mimical (Modelling the Intensity of Multiply-Imaged Celestial Ancient Light)
2
+
3
+
4
+ Mimical is an intensity modelling code for multiply-imaged objects, performing simultaenous Bayseian inference of model parameters via the nested sampling algorithm. Mimical supports any astropy model, and supports user defined parameter polynomial depenency with image wavelength.
5
+
6
+ .. image:: docs/mimical_workflow.pdf
@@ -14,11 +14,15 @@ from ..plotting import Plotter
14
14
 
15
15
  from ..utils import filter_set
16
16
 
17
+ from tqdm import tqdm
18
+
19
+
17
20
  dir_path = os.getcwd()
18
21
  if not os.path.isdir(dir_path + "/mimical"):
19
22
  os.system('mkdir ' + dir_path + "/mimical")
20
23
  os.system('mkdir ' + dir_path + "/mimical/plots")
21
24
  os.system('mkdir ' + dir_path + "/mimical/posteriors")
25
+ os.system('mkdir ' + dir_path + "/mimical/cats")
22
26
 
23
27
 
24
28
 
@@ -162,6 +166,7 @@ class mimical(object):
162
166
  self.samples = pd.read_csv(dir_path+'/mimical/posteriors' + f'/{self.id}.txt', delimiter=' ').to_numpy()
163
167
  fit_dic = dict(zip((np.array((list(self.fitter_prior.keys)))+"_50").tolist(), np.median(self.samples, axis=0).tolist()))
164
168
  print(f"Loading existing posterior at " + dir_path + '/mimical/posteriors' + f'/{self.id}.txt')
169
+ self.save_cat()
165
170
  print(" ")
166
171
  return fit_dic
167
172
 
@@ -200,7 +205,35 @@ class mimical(object):
200
205
  print("Sampling finished successfully.")
201
206
  print(" ")
202
207
 
208
+ self.save_cat()
209
+
203
210
  return fit_dic
211
+
212
+
213
+ def save_cat(self):
214
+
215
+ user_samples = np.zeros((self.samples.shape[0], len(self.wavs), len(self.user_prior.keys())))
216
+ # Get median Nautilus parameters and transalte into median model parameters.
217
+ for j in tqdm(range(self.samples.shape[0])):
218
+ # Get median Nautilus parameters and transalte into median model parameters.
219
+ param_dict = dict(zip(list(self.fitter_prior.keys), self.samples[j]))
220
+ pars = self.prior_handler.revert(param_dict, self.wavs)
221
+ user_samples[j] = pars
222
+
223
+ quantiles = np.percentile(user_samples, q=(16, 50, 84), axis=0)
224
+
225
+ dic = {}
226
+ for j in range(len(self.filter_names)):
227
+ for i in range(len(self.user_prior.keys())):
228
+ key = list(self.user_prior.keys())[i]
229
+ dic[key + "_" + self.filter_names[j] + "_16"] = [quantiles[0, j, i]]
230
+ dic[key + "_" + self.filter_names[j] + "_50"] = [quantiles[1, j, i]]
231
+ dic[key + "_" + self.filter_names[j] + "_84"] = [quantiles[2, j, i]]
232
+
233
+ df = pd.DataFrame(dic)
234
+ df.to_csv(dir_path+'/mimical/cats' + f'/{self.id}.csv', index=False)
235
+
236
+
204
237
 
205
238
 
206
239
  def plot_model(self, type='median'):
@@ -82,9 +82,6 @@ class Plotter(object):
82
82
  fig.set_size_inches(images.shape[0],4, forward=True)
83
83
 
84
84
 
85
-
86
-
87
-
88
85
  def plot_median(self, images, wavs, convolved_models, samples, fitter_keys, prior_handler, filter_names):
89
86
 
90
87
  fig = plt.figure()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mimical
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: Intesity modelling of multiply-imaged objects
5
5
  Author: Struan Stevenson
6
6
  Author-email: struan.stevenson@ed.ac.uk
@@ -17,7 +17,9 @@ Dynamic: description-content-type
17
17
  Dynamic: requires-dist
18
18
  Dynamic: summary
19
19
 
20
- # Mimical (Modelling the Intensity of Multiply-Imaged Celestial Ancient Light)
20
+ ** Mimical (Modelling the Intensity of Multiply-Imaged Celestial Ancient Light)
21
21
 
22
22
 
23
- #### Mimical is an intensity modelling code for multiply-imaged objects, performing simultaenous Bayseian inference of model parameters via the nested sampling algorithm. Mimical supports any astropy model, and supports user defined parameter polynomial depenency with image wavelength.
23
+ Mimical is an intensity modelling code for multiply-imaged objects, performing simultaenous Bayseian inference of model parameters via the nested sampling algorithm. Mimical supports any astropy model, and supports user defined parameter polynomial depenency with image wavelength.
24
+
25
+ .. image:: docs/mimical_workflow.pdf
@@ -1,4 +1,4 @@
1
- README.md
1
+ README.rst
2
2
  setup.py
3
3
  mimical/__init__.py
4
4
  mimical.egg-info/PKG-INFO
@@ -1,14 +1,16 @@
1
1
  import setuptools
2
2
  from setuptools import setup
3
- from pathlib import Path
3
+ from os import path
4
4
 
5
- this_directory = Path(__file__).parent
6
- long_description = (this_directory / "README.md").read_text()
5
+ here = path.abspath(path.dirname(__file__))
6
+ # Get the long description from the README file
7
+ with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
8
+ long_description = f.read()
7
9
 
8
10
  setup(
9
11
  name='mimical',
10
12
 
11
- version='0.1.1',
13
+ version='0.1.3',
12
14
 
13
15
  description='Intesity modelling of multiply-imaged objects',
14
16
 
@@ -22,7 +24,10 @@ setup(
22
24
 
23
25
  packages= setuptools.find_packages(),
24
26
 
25
- package_data = {'': ['*.txt', '*.fits'],},
27
+ package_data = {'': ['*.txt', '*.fits', '*.pdf'],},
28
+
29
+ include_package_data=True,
30
+
26
31
 
27
32
  install_requires=["numpy", "astropy", "matplotlib", "nautilus-sampler", "petrofit"],
28
33
 
mimical-0.1.1/README.md DELETED
@@ -1,4 +0,0 @@
1
- # Mimical (Modelling the Intensity of Multiply-Imaged Celestial Ancient Light)
2
-
3
-
4
- #### Mimical is an intensity modelling code for multiply-imaged objects, performing simultaenous Bayseian inference of model parameters via the nested sampling algorithm. Mimical supports any astropy model, and supports user defined parameter polynomial depenency with image wavelength.
File without changes
File without changes