calzone 1.1.7__tar.gz → 1.1.8__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.
Files changed (72) hide show
  1. {calzone-1.1.7 → calzone-1.1.8}/Cargo.toml +1 -1
  2. {calzone-1.1.7/src/python/calzone.egg-info → calzone-1.1.8}/PKG-INFO +1 -1
  3. {calzone-1.1.7 → calzone-1.1.8}/pyproject.toml +1 -1
  4. {calzone-1.1.7 → calzone-1.1.8}/src/geometry/map.rs +30 -3
  5. {calzone-1.1.7 → calzone-1.1.8}/src/python/calzone/__init__.py +1 -1
  6. {calzone-1.1.7 → calzone-1.1.8/src/python/calzone.egg-info}/PKG-INFO +1 -1
  7. {calzone-1.1.7 → calzone-1.1.8}/COPYING.LESSER +0 -0
  8. {calzone-1.1.7 → calzone-1.1.8}/LICENSE +0 -0
  9. {calzone-1.1.7 → calzone-1.1.8}/MANIFEST.in +0 -0
  10. {calzone-1.1.7 → calzone-1.1.8}/README.md +0 -0
  11. {calzone-1.1.7 → calzone-1.1.8}/setup.cfg +0 -0
  12. {calzone-1.1.7 → calzone-1.1.8}/src/calzone.h +0 -0
  13. {calzone-1.1.7 → calzone-1.1.8}/src/cxx.rs +0 -0
  14. {calzone-1.1.7 → calzone-1.1.8}/src/geometry/bytes.rs +0 -0
  15. {calzone-1.1.7 → calzone-1.1.8}/src/geometry/goupil.rs +0 -0
  16. {calzone-1.1.7 → calzone-1.1.8}/src/geometry/materials/gate.rs +0 -0
  17. {calzone-1.1.7 → calzone-1.1.8}/src/geometry/materials/hash.rs +0 -0
  18. {calzone-1.1.7 → calzone-1.1.8}/src/geometry/materials.cc +0 -0
  19. {calzone-1.1.7 → calzone-1.1.8}/src/geometry/materials.rs +0 -0
  20. {calzone-1.1.7 → calzone-1.1.8}/src/geometry/mesh.cc +0 -0
  21. {calzone-1.1.7 → calzone-1.1.8}/src/geometry/mesh.h +0 -0
  22. {calzone-1.1.7 → calzone-1.1.8}/src/geometry/mesh.rs +0 -0
  23. {calzone-1.1.7 → calzone-1.1.8}/src/geometry/mulder.rs +0 -0
  24. {calzone-1.1.7 → calzone-1.1.8}/src/geometry/solids.cc +0 -0
  25. {calzone-1.1.7 → calzone-1.1.8}/src/geometry/solids.h +0 -0
  26. {calzone-1.1.7 → calzone-1.1.8}/src/geometry/volume.rs +0 -0
  27. {calzone-1.1.7 → calzone-1.1.8}/src/geometry.cc +0 -0
  28. {calzone-1.1.7 → calzone-1.1.8}/src/geometry.rs +0 -0
  29. {calzone-1.1.7 → calzone-1.1.8}/src/lib.rs +0 -0
  30. {calzone-1.1.7 → calzone-1.1.8}/src/python/calzone/__main__.py +0 -0
  31. {calzone-1.1.7 → calzone-1.1.8}/src/python/calzone.egg-info/SOURCES.txt +0 -0
  32. {calzone-1.1.7 → calzone-1.1.8}/src/python/calzone.egg-info/dependency_links.txt +0 -0
  33. {calzone-1.1.7 → calzone-1.1.8}/src/python/calzone.egg-info/entry_points.txt +0 -0
  34. {calzone-1.1.7 → calzone-1.1.8}/src/python/calzone.egg-info/requires.txt +0 -0
  35. {calzone-1.1.7 → calzone-1.1.8}/src/python/calzone.egg-info/top_level.txt +0 -0
  36. {calzone-1.1.7 → calzone-1.1.8}/src/simulation/geometry.cc +0 -0
  37. {calzone-1.1.7 → calzone-1.1.8}/src/simulation/geometry.h +0 -0
  38. {calzone-1.1.7 → calzone-1.1.8}/src/simulation/physics.cc +0 -0
  39. {calzone-1.1.7 → calzone-1.1.8}/src/simulation/physics.h +0 -0
  40. {calzone-1.1.7 → calzone-1.1.8}/src/simulation/physics.rs +0 -0
  41. {calzone-1.1.7 → calzone-1.1.8}/src/simulation/random.cc +0 -0
  42. {calzone-1.1.7 → calzone-1.1.8}/src/simulation/random.h +0 -0
  43. {calzone-1.1.7 → calzone-1.1.8}/src/simulation/random.rs +0 -0
  44. {calzone-1.1.7 → calzone-1.1.8}/src/simulation/sampler.cc +0 -0
  45. {calzone-1.1.7 → calzone-1.1.8}/src/simulation/sampler.h +0 -0
  46. {calzone-1.1.7 → calzone-1.1.8}/src/simulation/sampler.rs +0 -0
  47. {calzone-1.1.7 → calzone-1.1.8}/src/simulation/source.cc +0 -0
  48. {calzone-1.1.7 → calzone-1.1.8}/src/simulation/source.h +0 -0
  49. {calzone-1.1.7 → calzone-1.1.8}/src/simulation/source.rs +0 -0
  50. {calzone-1.1.7 → calzone-1.1.8}/src/simulation/tracker.cc +0 -0
  51. {calzone-1.1.7 → calzone-1.1.8}/src/simulation/tracker.h +0 -0
  52. {calzone-1.1.7 → calzone-1.1.8}/src/simulation/tracker.rs +0 -0
  53. {calzone-1.1.7 → calzone-1.1.8}/src/simulation.cc +0 -0
  54. {calzone-1.1.7 → calzone-1.1.8}/src/simulation.rs +0 -0
  55. {calzone-1.1.7 → calzone-1.1.8}/src/utils/convert.cc +0 -0
  56. {calzone-1.1.7 → calzone-1.1.8}/src/utils/data.rs +0 -0
  57. {calzone-1.1.7 → calzone-1.1.8}/src/utils/error.cc +0 -0
  58. {calzone-1.1.7 → calzone-1.1.8}/src/utils/error.rs +0 -0
  59. {calzone-1.1.7 → calzone-1.1.8}/src/utils/export.rs +0 -0
  60. {calzone-1.1.7 → calzone-1.1.8}/src/utils/extract.rs +0 -0
  61. {calzone-1.1.7 → calzone-1.1.8}/src/utils/float.rs +0 -0
  62. {calzone-1.1.7 → calzone-1.1.8}/src/utils/io.rs +0 -0
  63. {calzone-1.1.7 → calzone-1.1.8}/src/utils/namespace.rs +0 -0
  64. {calzone-1.1.7 → calzone-1.1.8}/src/utils/numpy.rs +0 -0
  65. {calzone-1.1.7 → calzone-1.1.8}/src/utils/os.cc +0 -0
  66. {calzone-1.1.7 → calzone-1.1.8}/src/utils/units.cc +0 -0
  67. {calzone-1.1.7 → calzone-1.1.8}/src/utils/units.rs +0 -0
  68. {calzone-1.1.7 → calzone-1.1.8}/src/utils.rs +0 -0
  69. {calzone-1.1.7 → calzone-1.1.8}/tests/test_examples.py +0 -0
  70. {calzone-1.1.7 → calzone-1.1.8}/tests/test_geometry.py +0 -0
  71. {calzone-1.1.7 → calzone-1.1.8}/tests/test_materials.py +0 -0
  72. {calzone-1.1.7 → calzone-1.1.8}/tests/test_simulation.py +0 -0
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "calzone"
3
- version = "1.1.7"
3
+ version = "1.1.8"
4
4
  edition = "2021"
5
5
 
6
6
  [lib]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: calzone
3
- Version: 1.1.7
3
+ Version: 1.1.8
4
4
  Summary: A Geant4 Python wrapper.
5
5
  Author-email: Valentin Niess <valentin.niess@gmail.com>
6
6
  License: LGPLv3
@@ -15,7 +15,7 @@ classifiers = [
15
15
  "Intended Audience :: Science/Research",
16
16
  "Topic :: Scientific/Engineering :: Physics"
17
17
  ]
18
- version = "1.1.7"
18
+ version = "1.1.8"
19
19
  requires-python = ">=3.7.0"
20
20
  dependencies = [
21
21
  "numpy >= 1.6.0",
@@ -4,7 +4,7 @@ use crate::utils::extract::{Extractor, Property, Tag};
4
4
  use crate::utils::float::f64x3;
5
5
  use crate::utils::io::{dump_stl, PathString};
6
6
  use crate::utils::numpy::{PyArray, PyArrayMethods, PyUntypedArray};
7
- use geotiff::GeoTiff;
7
+ use geotiff::{GeoTiff, RasterType};
8
8
  use geo_types::geometry::Coord;
9
9
  use pyo3::prelude::*;
10
10
  use pyo3::types::PyDict;
@@ -486,12 +486,39 @@ impl Map {
486
486
  (x, y)
487
487
  };
488
488
 
489
+ let raster_type = match geotiff.geo_key_directory.raster_type
490
+ .unwrap_or(RasterType::Undefined) {
491
+ RasterType::RasterPixelIsArea => RasterType::RasterPixelIsArea,
492
+ RasterType::RasterPixelIsPoint => RasterType::RasterPixelIsPoint,
493
+ _ => if geotiff
494
+ .get_value_at::<f64>(&Coord { x: x0, y: y0 }, 0)
495
+ .or_else(|| geotiff.get_value_at::<f64>(&Coord { x: x1, y: y0 }, 0))
496
+ .or_else(|| geotiff.get_value_at::<f64>(&Coord { x: x0, y: y1 }, 0))
497
+ .or_else(|| geotiff.get_value_at::<f64>(&Coord { x: x1, y: y1 }, 0))
498
+ .is_none() {
499
+ RasterType::RasterPixelIsPoint
500
+ } else {
501
+ RasterType::RasterPixelIsArea
502
+ },
503
+ };
504
+ let (x0, x1, dx, y0, y1, dy) = match raster_type {
505
+ RasterType::RasterPixelIsArea => {
506
+ let dx = (x1 - x0) / (nx as f64);
507
+ let dy = (y1 - y0) / (ny as f64);
508
+ (x0 + 0.5 * dx, x1 - 0.5 * dx, dx, y0 + 0.5 * dy, y1 - 0.5 * dy, dy)
509
+ },
510
+ RasterType::RasterPixelIsPoint => {
511
+ let dx = (x1 - x0) / ((nx - 1) as f64);
512
+ let dy = (y1 - y0) / ((ny - 1) as f64);
513
+ (x0, x1, dx, y0, y1, dy)
514
+ },
515
+ _ => unreachable!(),
516
+ };
517
+
489
518
  let array = PyArray::<f32>::empty(py, &[ny, nx])?;
490
519
  let size = nx * ny;
491
520
  if size > 0 {
492
521
  let z = unsafe { array.slice_mut()? };
493
- let dx = (x1 - x0) / ((nx - 1) as f64);
494
- let dy = (y1 - y0) / ((ny - 1) as f64);
495
522
  for iy in 0..ny {
496
523
  let y = if iy == ny - 1 { y1 } else { y0 + iy as f64 * dy };
497
524
  for ix in 0..nx {
@@ -11,4 +11,4 @@ def init():
11
11
  init()
12
12
  del init
13
13
 
14
- VERSION = "1.1.7"
14
+ VERSION = "1.1.8"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: calzone
3
- Version: 1.1.7
3
+ Version: 1.1.8
4
4
  Summary: A Geant4 Python wrapper.
5
5
  Author-email: Valentin Niess <valentin.niess@gmail.com>
6
6
  License: LGPLv3
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
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
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