ppdmod 2.0.0__tar.gz → 2.0.1__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: ppdmod
3
- Version: 2.0.0
3
+ Version: 2.0.1
4
4
  Summary: A package for modelling and model-fitting protoplanetary disks
5
5
  Author-email: Marten Scheuck <code@mbscheuck.com>
6
6
  License: MIT License
@@ -35,14 +35,12 @@ Classifier: Programming Language :: Python :: 3
35
35
  Classifier: Programming Language :: Python :: 3.9
36
36
  Classifier: Topic :: Scientific/Engineering :: Astronomy
37
37
  Classifier: Topic :: Scientific/Engineering :: Physics
38
- Requires-Python: <3.11,>=3.10
38
+ Requires-Python: >=3.11
39
39
  Description-Content-Type: text/markdown
40
40
  License-File: LICENSE
41
41
  Requires-Dist: astropy>=6.1.4
42
42
  Requires-Dist: corner>=2.2.2
43
43
  Requires-Dist: dynesty>=2.1.4
44
- Requires-Dist: emcee>=3.1.6
45
- Requires-Dist: h5py>=3.12.1
46
44
  Requires-Dist: matplotlib>=3.9.2
47
45
  Requires-Dist: numpy>=2.0.2
48
46
  Requires-Dist: openpyxl>=3.1.5
@@ -0,0 +1 @@
1
+ __version__ = "2.0.1"
@@ -241,7 +241,7 @@ def compute_observables(
241
241
  return flux_model, vis_model, t3_model
242
242
 
243
243
 
244
- def compute_nband_fit_chi_sq(
244
+ def compute_photometry_loglike(
245
245
  model_data: NDArray[Any],
246
246
  ndim: int,
247
247
  reduced: bool = False,
@@ -259,22 +259,67 @@ def compute_nband_fit_chi_sq(
259
259
 
260
260
  Returns
261
261
  -------
262
- chi_sq : float
263
- The chi square.
262
+ loglike : float
263
+ Returns either the loglike or the reduced chi sq.
264
264
  """
265
265
  # NOTE: The -1 here indicates that one of the parameters is actually fixed
266
266
  flux, ndim = OPTIONS.data.flux, ndim - 1
267
- val, err = map(lambda x: x.squeeze(), [flux.val, flux.err])
268
- chi_sq = compute_loglike(
269
- val.compressed(),
270
- err.compressed(),
271
- model_data.squeeze()[~val.mask],
272
- )
267
+ val, err = map(lambda x: x.squeeze().compressed(), [flux.val, flux.err])
268
+ model_data = model_data.squeeze()[~flux.val.mask]
273
269
 
274
270
  if reduced:
271
+ chi_sq = compute_chi_sq(val, err**2, model_data, "linear")
275
272
  return chi_sq / (flux.val.size - ndim)
276
273
 
277
- return chi_sq
274
+ return compute_loglike(val, err, model_data)
275
+
276
+
277
+ def compute_interferometric_loglike(
278
+ components: List[Component],
279
+ ) -> Tuple:
280
+ """Calculates the disc model's chi square.
281
+
282
+ Parameters
283
+ ----------
284
+ components : list of Component
285
+ The components to be used in the model.
286
+ method : bool
287
+ The method used to calculate the chi square.
288
+ Either "linear" or "logarithmic".
289
+ Default is "logarithmic".
290
+
291
+ Returns
292
+ -------
293
+ chi_sq : Tuple of floats
294
+ The total and the individual chi squares.
295
+ """
296
+ observables = ["flux", "vis", "t3"]
297
+ model_data = dict(zip(observables, compute_observables(components)))
298
+ wls = OPTIONS.fit.wls.value
299
+
300
+ loglikes = []
301
+ for key in OPTIONS.fit.data:
302
+ data = getattr(OPTIONS.data, key)
303
+ key = key if key != "vis2" else "vis"
304
+
305
+ loglikes_bands = []
306
+ for band in OPTIONS.fit.bands:
307
+ band_indices = get_band_indices(wls, [band])
308
+ mask = data.val[:, band_indices].mask
309
+ loglikes_bands.append(
310
+ compute_loglike(
311
+ data.val[:, band_indices].compressed(),
312
+ data.err[:, band_indices].compressed(),
313
+ model_data[key][:, band_indices][~mask],
314
+ kind="linear" if key != "t3" else "periodic",
315
+ )
316
+ )
317
+ loglikes.append(loglikes_bands)
318
+
319
+ loglikes = np.array(loglikes).astype(float)
320
+ weights_general = get_weights(kind="general")
321
+ weights_bands = get_weights(kind="bands")
322
+ return np.sum((weights_bands * loglikes).sum(1) * weights_general), loglikes
278
323
 
279
324
 
280
325
  def compute_interferometric_loglike(
@@ -341,7 +386,7 @@ def transform_uniform_prior(theta: NDArray[Any], priors: NDArray[Any]) -> float:
341
386
  return priors[:, 0] + (priors[:, 1] - priors[:, 0]) * theta
342
387
 
343
388
 
344
- def nband(params: NDArray[Any], labels: List[str], theta: NDArray[Any]) -> NDArray[Any]:
389
+ def photometry(params: NDArray[Any], labels: List[str], theta: NDArray[Any]) -> NDArray[Any]:
345
390
  """Transform that soft constrains successive radii to be smaller than the one before."""
346
391
  indices = list(map(labels.index, filter(lambda x: "weight" in x, labels)))
347
392
  remainder = 100
@@ -406,7 +451,7 @@ def param_transform(theta: List[float]) -> NDArray[Any]:
406
451
  """Transform that soft constrains successive radii to be smaller than the one before."""
407
452
  params = transform_uniform_prior(theta, get_priors(OPTIONS.model.components))
408
453
  if OPTIONS.fit.type == "nband":
409
- return nband(params, get_labels(OPTIONS.model.components), theta)
454
+ return photometry(params, get_labels(OPTIONS.model.components), theta)
410
455
 
411
456
  components = set_components_from_theta(params, theta)
412
457
  for option in OPTIONS.fit.conditions:
@@ -431,7 +476,7 @@ def lnprob(theta: NDArray[Any]) -> float:
431
476
  """
432
477
  components = set_components_from_theta(theta)
433
478
  if OPTIONS.fit.type == "nband":
434
- return compute_nband_fit_chi_sq(
479
+ return compute_photometry_loglike(
435
480
  components[0].compute_flux(0, OPTIONS.fit.wls),
436
481
  ndim=theta.size,
437
482
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ppdmod
3
- Version: 2.0.0
3
+ Version: 2.0.1
4
4
  Summary: A package for modelling and model-fitting protoplanetary disks
5
5
  Author-email: Marten Scheuck <code@mbscheuck.com>
6
6
  License: MIT License
@@ -35,14 +35,12 @@ Classifier: Programming Language :: Python :: 3
35
35
  Classifier: Programming Language :: Python :: 3.9
36
36
  Classifier: Topic :: Scientific/Engineering :: Astronomy
37
37
  Classifier: Topic :: Scientific/Engineering :: Physics
38
- Requires-Python: <3.11,>=3.10
38
+ Requires-Python: >=3.11
39
39
  Description-Content-Type: text/markdown
40
40
  License-File: LICENSE
41
41
  Requires-Dist: astropy>=6.1.4
42
42
  Requires-Dist: corner>=2.2.2
43
43
  Requires-Dist: dynesty>=2.1.4
44
- Requires-Dist: emcee>=3.1.6
45
- Requires-Dist: h5py>=3.12.1
46
44
  Requires-Dist: matplotlib>=3.9.2
47
45
  Requires-Dist: numpy>=2.0.2
48
46
  Requires-Dist: openpyxl>=3.1.5
@@ -1,8 +1,6 @@
1
1
  astropy>=6.1.4
2
2
  corner>=2.2.2
3
3
  dynesty>=2.1.4
4
- emcee>=3.1.6
5
- h5py>=3.12.1
6
4
  matplotlib>=3.9.2
7
5
  numpy>=2.0.2
8
6
  openpyxl>=3.1.5
@@ -3,7 +3,7 @@ name = "ppdmod"
3
3
  dynamic = ["version"]
4
4
  description = "A package for modelling and model-fitting protoplanetary disks"
5
5
  readme = "README.md"
6
- requires-python = ">=3.10,<3.11"
6
+ requires-python = ">=3.11"
7
7
  license = {file = "LICENSE"}
8
8
  authors = [
9
9
  {name = "Marten Scheuck", email = "code@mbscheuck.com"}
@@ -23,8 +23,6 @@ dependencies = [
23
23
  "astropy>=6.1.4",
24
24
  "corner>=2.2.2",
25
25
  "dynesty>=2.1.4",
26
- "emcee>=3.1.6",
27
- "h5py>=3.12.1",
28
26
  "matplotlib>=3.9.2",
29
27
  "numpy>=2.0.2",
30
28
  "openpyxl>=3.1.5",
@@ -1 +0,0 @@
1
- __version__ = "2.0.0"
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
File without changes