update the requirements files and fix a bug that prevented install when not in developer mode

This commit is contained in:
Abe Levitan
2023-01-13 11:59:07 -08:00
parent a260168d9d
commit 9f341fb4bd
5 changed files with 25 additions and 11 deletions
+8
View File
@@ -0,0 +1,8 @@
numpy>=1.0
scipy>=1.0
matplotlib>=2.0 # 2.0 introduces better colormaps which are used by default
h5py>=2.1
python-dateutil
pytest
sphinx
+8 -8
View File
@@ -17,22 +17,22 @@ The major dependency for CDTools is pytorch, and because the details of the inst
.. _`the pytorch site`: https://pytorch.org/get-started/locally/
If you manage your environment with conda, the remaining dependencies can be installe by running the following command in the top level directory of the package:
If you manage your environment with conda, the remaining dependencies can be installed by running the following command in the top level directory of the package:
.. code:: bash
$ conda install --file conda_requirements.txt -c conda-forge
$ conda install --file conda_requirements.txt
This will install all dependencies, including optional dependencies for the tests and docs. For convenience, the full set of dependencies are noted below:
This will install all dependencies which are available from the main repos, including some optional dependencies for the tests and docs. Following this, any final remining dependencies can be installed from conda-forge or pip. For convenience, the full set of dependencies are noted below:
CDTools depends on the following packages:
* `numpy <http://www.numpy.org>`_
* `scipy <http://www.scipy.org>`_
* `matplotlib <https://matplotlib.org>`_
* `pytorch <https://pytorch.org>`_
* `numpy <http://www.numpy.org>`_ >= 1.0
* `scipy <http://www.scipy.org>`_ >= 1.0
* `matplotlib <https://matplotlib.org>`_ >= 2.0
* `pytorch <https://pytorch.org>`_ >= 1.9.0
* `python-dateutil <https://github.com/dateutil/dateutil/>`_
* `h5py <https://www.h5py.org/>`_
* `h5py <https://www.h5py.org/>`_ >= 2.1
And has optional dependencies on
+1 -1
View File
@@ -25,7 +25,7 @@ setuptools.setup(
'docs': ["sphinx","sphinx-argparse","sphinx_rtd_theme"]
},
package_dir={"": "src"},
packages=setuptools.find_packages(),
packages=setuptools.find_packages("src"),
classifiers=[
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
+3
View File
@@ -146,6 +146,7 @@ class FancyPtycho(CDIModel):
randomize_ang=0,
padding=0,
n_modes=1,
n_obj_modes=1,
dm_rank=None,
translation_scale=1,
saturation=None,
@@ -240,6 +241,8 @@ class FancyPtycho(CDIModel):
probe = t.stack([probe, ] + probe_stack)
obj = t.exp(1j * randomize_ang * (t.rand(obj_size)-0.5))
if n_obj_modes != 1:
obj = t.stack([obj,] + [0.05*t.ones_like(obj),]*(n_obj_modes-1))
det_geo = dataset.detector_geometry
@@ -439,7 +439,7 @@ def ptycho_2D_sinc(probe, obj, translations, shift_probe=True, padding=10, multi
subpixel_translations = translations - integer_translations
integer_translations = integer_translations.to(dtype=t.int32)
if not polarized:
selections = t.stack([obj[tr[0]:tr[0]+probe.shape[-2],
selections = t.stack([obj[..., tr[0]:tr[0]+probe.shape[-2],
tr[1]:tr[1]+probe.shape[-1]]
for tr in integer_translations])
else:
@@ -474,9 +474,12 @@ def ptycho_2D_sinc(probe, obj, translations, shift_probe=True, padding=10, multi
shifted_probe = t.fft.ifft2(t.fft.ifftshift(shifted_fft_probe,
dim=(-1,-2)))
if not polarized:
if multiple_modes: # Multi-mode probe
# TODO This is a kludge, I will fix this. I need to handle
# multiple incoherently mixing polarized objects
if multiple_modes and len(selections.shape) == 3: # Multi-mode probe
output = shifted_probe * selections[...,None,:,:]
else:
# This will only work if the
output = shifted_probe * selections
# selections: Nx2x2xMxL
# probe: Nx(P)x2x1xMxL