mimical 0.0.6__tar.gz → 0.0.7__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.
- {mimical-0.0.6 → mimical-0.0.7}/PKG-INFO +1 -1
- {mimical-0.0.6 → mimical-0.0.7}/mimical/fitting/fitter.py +30 -16
- {mimical-0.0.6 → mimical-0.0.7}/mimical.egg-info/PKG-INFO +1 -1
- {mimical-0.0.6 → mimical-0.0.7}/setup.py +1 -1
- {mimical-0.0.6 → mimical-0.0.7}/README.md +0 -0
- {mimical-0.0.6 → mimical-0.0.7}/mimical/__init__.py +0 -0
- {mimical-0.0.6 → mimical-0.0.7}/mimical/fitting/__init__.py +0 -0
- {mimical-0.0.6 → mimical-0.0.7}/mimical/fitting/prior_handler.py +0 -0
- {mimical-0.0.6 → mimical-0.0.7}/mimical/plotting/__init__.py +0 -0
- {mimical-0.0.6 → mimical-0.0.7}/mimical/plotting/plotting.py +0 -0
- {mimical-0.0.6 → mimical-0.0.7}/mimical/utils/__init__.py +0 -0
- {mimical-0.0.6 → mimical-0.0.7}/mimical/utils/filter_set.py +0 -0
- {mimical-0.0.6 → mimical-0.0.7}/mimical.egg-info/SOURCES.txt +0 -0
- {mimical-0.0.6 → mimical-0.0.7}/mimical.egg-info/dependency_links.txt +0 -0
- {mimical-0.0.6 → mimical-0.0.7}/mimical.egg-info/requires.txt +0 -0
- {mimical-0.0.6 → mimical-0.0.7}/mimical.egg-info/top_level.txt +0 -0
- {mimical-0.0.6 → mimical-0.0.7}/setup.cfg +0 -0
|
@@ -149,16 +149,27 @@ class mimical(object):
|
|
|
149
149
|
|
|
150
150
|
|
|
151
151
|
if os.path.isfile(dir_path+'/mimical/posteriors' + f'/{self.id}.txt'):
|
|
152
|
+
self.success = True
|
|
152
153
|
self.samples = pd.read_csv(dir_path+'/mimical/posteriors' + f'/{self.id}.txt', delimiter=' ').to_numpy()
|
|
153
|
-
|
|
154
|
+
fit_dic = dict(zip((np.array((list(self.fitter_prior.keys)))+"_50").tolist(), np.median(self.samples, axis=0).tolist()))
|
|
155
|
+
print("Finished.")
|
|
156
|
+
print(" ")
|
|
157
|
+
return fit_dic
|
|
158
|
+
|
|
159
|
+
# Run sampler
|
|
160
|
+
t0 = time.time()
|
|
161
|
+
#sampler = Sampler(self.fitter_prior, self.lnlike, n_live=400, filepath= dir_path+'/bogout'+f'/{self.id}.hdf5', resume=True, pool=self.pool)
|
|
162
|
+
sampler = Sampler(self.fitter_prior, self.lnlike, n_live=400, pool=self.pool)
|
|
163
|
+
self.success = sampler.run(verbose=True, timeout=self.timeout)
|
|
164
|
+
print(f"Sampling time (minutes): {(time.time()-t0)/60}")
|
|
165
|
+
|
|
166
|
+
if self.success != True:
|
|
167
|
+
|
|
168
|
+
print("Sampling failed (timout).")
|
|
169
|
+
print(" ")
|
|
170
|
+
return {}
|
|
171
|
+
|
|
154
172
|
else:
|
|
155
|
-
# Run sampler
|
|
156
|
-
t0 = time.time()
|
|
157
|
-
#sampler = Sampler(self.fitter_prior, self.lnlike, n_live=400, filepath= dir_path+'/bogout'+f'/{self.id}.hdf5', resume=True, pool=self.pool)
|
|
158
|
-
sampler = Sampler(self.fitter_prior, self.lnlike, n_live=400, pool=self.pool)
|
|
159
|
-
sampler.run(verbose=True, timeout=self.timeout)
|
|
160
|
-
print(f"Sampling time (minutes): {(time.time()-t0)/60}")
|
|
161
|
-
|
|
162
173
|
# Sample the posterior information
|
|
163
174
|
points, log_w, log_l = sampler.posterior()
|
|
164
175
|
|
|
@@ -173,18 +184,21 @@ class mimical(object):
|
|
|
173
184
|
samples_df = pd.DataFrame(data=self.samples, columns=self.fitter_prior.keys)
|
|
174
185
|
samples_df.to_csv(dir_path+'/mimical/posteriors' + f'/{self.id}.txt', sep=' ', index=False)
|
|
175
186
|
|
|
176
|
-
|
|
177
|
-
|
|
187
|
+
# Return the median-parameter model
|
|
188
|
+
fit_dic = dict(zip((np.array((list(self.fitter_prior.keys)))+"_50").tolist(), np.median(self.samples, axis=0).tolist()))
|
|
178
189
|
|
|
179
|
-
|
|
180
|
-
|
|
190
|
+
print("Finished.")
|
|
191
|
+
print(" ")
|
|
181
192
|
|
|
182
|
-
|
|
193
|
+
return fit_dic
|
|
183
194
|
|
|
184
195
|
|
|
185
196
|
def plot_model(self):
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
197
|
+
if self.success != True:
|
|
198
|
+
print(f'Failed sampling - cannot plot model for {self.id}.')
|
|
199
|
+
else:
|
|
200
|
+
# Plot and save the median-parameter fit
|
|
201
|
+
Plotter().plot_median(self.images, self.wavs, self.convolved_models, self.samples, list(self.fitter_prior.keys), self.prior_handler)
|
|
202
|
+
plt.savefig(dir_path+'/mimical/plots' + f'/{self.id}_best_model.pdf', bbox_inches='tight')
|
|
189
203
|
|
|
190
204
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|