Skip to content

Commit 4bd3a24

Browse files
Merge pull request #4 from microscopic-image-analysis/downloader-script
Data downloader script + adding requirements.txt
2 parents a346571 + e45fda5 commit 4bd3a24

File tree

4 files changed

+244
-12
lines changed

4 files changed

+244
-12
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ __pycache__/
1414
# folders
1515
data
1616
dist
17+
*.zip

README.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,25 +73,29 @@ fused_ptyem_stack, em_flux_factors = launch_mef.run_em(n_iter, n_cpus)
7373

7474
For a detailed usage, please check [synthetic_mef.py](scripts/synthetic_mef.py) that uses synthetic ptychography data.
7575

76-
## Publication results
76+
## Reproducing results
7777

78-
Ptychography data used for the publication results can be found at [Zenodo](https://doi.org/10.5281/zenodo.10809893). It also includes the code which is in this repository. Therefore, to replicate the publication results, please follow the below steps:
79-
1. Download and unzip the dataset and the code from [Zenodo](https://doi.org/10.5281/zenodo.10809893).
80-
2. Create a virtual environment and install the dependencies as
81-
78+
To reproduce the ptychographic reconstruction results from the paper, please follow the below steps:
79+
80+
1. Please clone this repository and install the *pinned* dependencies in a conda environment.
8281
```bash
82+
git clone https://github.com/microscopic-image-analysis/bayes-mef.git
8383
cd bayes-mef
84-
conda create --name bayes-mef-venv python=3.10.13 # or python version satisfying ">=3.9, <3.12"
84+
conda create --name bayes-mef-venv python=3.11.5
85+
```
86+
2. Now activate the environment and install the *pinned* dependencies.
87+
```bash
8588
conda activate bayes-mef-venv
86-
pip install -e .
89+
pip install -r requirements.txt
8790
```
88-
3. An additional dependency of `ptylab` is required for processing ptychography data
89-
91+
3. Download the data from [Zenodo](https://zenodo.org/doi/10.5281/zenodo.10964222) with the following command:
9092
```bash
91-
pip install git+https://github.com/PtyLab/PtyLab.py.git@main
93+
./download_data.sh
9294
```
93-
4. Please run python scripts under [scripts/](scripts) directory to replicate results in the publication.
94-
5. Optional: For faster ptychographic reconstructions using GPU, please install `cupy` as given under its [installation guide](https://docs.cupy.dev/en/stable/install.html).
95+
96+
4. Optional: For faster ptychographic reconstructions using GPU, please install `cupy` as given under its [installation guide](https://docs.cupy.dev/en/stable/install.html).
97+
98+
5. Run files from the [scripts/](scripts) directory for plotting the results.
9599

96100
## Citation
97101
If you found this algorithm or the publication useful, please cite us at:

download_data.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
3+
# Function to check if the OS is Windows
4+
is_windows() {
5+
if [[ "$(uname -s)" =~ "MINGW" || "$(uname -s)" =~ "MSYS" || "$(uname -o)" =~ "Msys" ]]; then
6+
return 0
7+
else
8+
return 1
9+
fi
10+
}
11+
12+
# Function to download the zip file
13+
download_zip() {
14+
local URL="$1"
15+
local ZIP_FILE=$(basename "$URL")
16+
if is_windows; then
17+
curl -o "$ZIP_FILE" "$URL" || { echo "Error: Failed to download $ZIP_FILE"; exit 1; }
18+
else
19+
wget "$URL" || { echo "Error: Failed to download $ZIP_FILE"; exit 1; }
20+
fi
21+
}
22+
23+
# Function to unzip the file
24+
unzip_file() {
25+
local ZIP_FILE="$1"
26+
if is_windows; then
27+
powershell Expand-Archive -Path "$ZIP_FILE" -DestinationPath . || { echo "Error: Failed to unzip $ZIP_FILE"; exit 1; }
28+
else
29+
unzip "$ZIP_FILE" || { echo "Error: Failed to unzip $ZIP_FILE"; exit 1; }
30+
fi
31+
}
32+
33+
# Function to delete the zip file
34+
delete_zip() {
35+
local ZIP_FILE="$1"
36+
if is_windows; then
37+
del "$ZIP_FILE" || { echo "Error: Failed to delete $ZIP_FILE"; exit 1; }
38+
else
39+
rm "$ZIP_FILE" || { echo "Error: Failed to delete $ZIP_FILE"; exit 1; }
40+
fi
41+
}
42+
43+
# URL of the zip file
44+
URL="https://zenodo.org/records/10964223/files/data.zip?download=1"
45+
46+
# File name of the zip file
47+
ZIP_FILE=$(basename "$URL")
48+
49+
# Download the zip file
50+
download_zip "$URL"
51+
52+
# Unzip the file
53+
unzip_file "$ZIP_FILE"
54+
55+
# Delete the zip file
56+
delete_zip "$ZIP_FILE"
57+
58+
# Optional: Print a message indicating completion
59+
echo "Downloaded the data successfully"

requirements.txt

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
absl-py==2.1.0
2+
alabaster==0.7.16
3+
app-model==0.2.4
4+
appdirs==1.4.4
5+
asttokens==2.4.1
6+
astunparse==1.6.3
7+
attrs==23.2.0
8+
Babel==2.14.0
9+
-e git+https://github.com/microscopic-image-analysis/bayes-mef.git@366e654b2cfa5ab2b426d6d890638c6452bc624a#egg=bayes_mef
10+
black==23.12.1
11+
blosc2==2.5.1
12+
bokeh==3.3.4
13+
build==1.1.1
14+
cachetools==5.3.3
15+
cachey==0.2.1
16+
certifi==2024.2.2
17+
charset-normalizer==3.3.2
18+
click==8.1.7
19+
cloudpickle==3.0.0
20+
comm==0.2.1
21+
contourpy==1.2.0
22+
cycler==0.12.1
23+
dask==2024.3.0
24+
debugpy==1.8.1
25+
decorator==5.1.1
26+
docstring-parser==0.15
27+
docutils==0.20.1
28+
executing==2.0.1
29+
flatbuffers==24.3.7
30+
fonttools==4.49.0
31+
freetype-py==2.4.0
32+
fsspec==2024.2.0
33+
gast==0.4.0
34+
google-auth==2.28.2
35+
google-auth-oauthlib==1.0.0
36+
google-pasta==0.2.0
37+
grpcio==1.62.1
38+
h5py==3.10.0
39+
HeapDict==1.0.1
40+
hsluv==5.0.4
41+
idna==3.6
42+
imageio==2.34.0
43+
imagesize==1.4.1
44+
importlib_metadata==7.0.2
45+
in-n-out==0.1.9
46+
ipykernel==6.29.3
47+
ipython==8.18.1
48+
jedi==0.19.1
49+
Jinja2==3.1.3
50+
joblib==1.3.2
51+
jsonschema==4.21.1
52+
jsonschema-specifications==2023.12.1
53+
jupyter_client==8.6.1
54+
jupyter_core==5.7.2
55+
keras==2.13.1
56+
kiwisolver==1.4.5
57+
lazy_loader==0.3
58+
libclang==16.0.6
59+
llvmlite==0.42.0
60+
locket==1.0.0
61+
magicgui==0.8.2
62+
Markdown==3.5.2
63+
markdown-it-py==3.0.0
64+
MarkupSafe==2.1.5
65+
matplotlib==3.8.3
66+
matplotlib-inline==0.1.6
67+
mdurl==0.1.2
68+
msgpack==1.0.8
69+
mypy-extensions==1.0.0
70+
napari==0.4.19.post1
71+
napari-console==0.0.9
72+
napari-plugin-engine==0.2.0
73+
napari-plugin-manager==0.1.0a2
74+
napari-svg==0.1.10
75+
ndindex==1.8
76+
nest-asyncio==1.6.0
77+
networkx==3.2.1
78+
npe2==0.7.4
79+
numba==0.59.0
80+
numexpr==2.9.0
81+
numpy==1.24.3
82+
numpydoc==1.6.0
83+
oauthlib==3.2.2
84+
opt-einsum==3.3.0
85+
packaging==24.0
86+
pandas==2.2.1
87+
parso==0.8.3
88+
partd==1.4.1
89+
pathspec==0.12.1
90+
pexpect==4.9.0
91+
pillow==10.2.0
92+
Pint==0.23
93+
platformdirs==4.2.0
94+
pooch==1.8.1
95+
prompt-toolkit==3.0.43
96+
protobuf==4.25.3
97+
psutil==5.9.8
98+
psygnal==0.10.1
99+
ptylab @ git+https://github.com/PtyLab/PtyLab.py.git@94663644c36722b2dc16011c33048a183a9f92de
100+
ptyprocess==0.7.0
101+
pure-eval==0.2.2
102+
py-cpuinfo==9.0.0
103+
pyasn1==0.5.1
104+
pyasn1-modules==0.3.0
105+
pyconify==0.1.6
106+
pydantic==1.10.14
107+
pydantic-compat==0.1.2
108+
Pygments==2.17.2
109+
PyOpenGL==3.1.7
110+
pyparsing==3.1.2
111+
pyproject_hooks==1.0.0
112+
PyQt5==5.15.10
113+
PyQt5-Qt5==5.15.2
114+
PyQt5-sip==12.13.0
115+
pyqtgraph==0.13.4
116+
python-dateutil==2.9.0.post0
117+
pytz==2024.1
118+
PyWavelets==1.5.0
119+
PyYAML==6.0.1
120+
pyzmq==25.1.2
121+
qtconsole==5.5.1
122+
QtPy==2.4.1
123+
referencing==0.33.0
124+
requests==2.31.0
125+
requests-oauthlib==1.4.0
126+
rich==13.7.1
127+
rpds-py==0.18.0
128+
rsa==4.9
129+
scikit-image==0.21.0
130+
scikit-learn==1.4.1.post1
131+
scipy==1.12.0
132+
six==1.16.0
133+
snowballstemmer==2.2.0
134+
Sphinx==7.2.6
135+
sphinxcontrib-applehelp==1.0.8
136+
sphinxcontrib-devhelp==1.0.6
137+
sphinxcontrib-htmlhelp==2.0.5
138+
sphinxcontrib-jsmath==1.0.1
139+
sphinxcontrib-qthelp==1.0.7
140+
sphinxcontrib-serializinghtml==1.1.10
141+
stack-data==0.6.3
142+
superqt==0.6.2
143+
tables==3.9.2
144+
tabulate==0.9.0
145+
tensorboard==2.13.0
146+
tensorboard-data-server==0.7.2
147+
tensorflow==2.13.0
148+
tensorflow-estimator==2.13.0
149+
tensorflow-io-gcs-filesystem==0.36.0
150+
termcolor==2.4.0
151+
threadpoolctl==3.3.0
152+
tifffile==2024.2.12
153+
tomli_w==1.0.0
154+
toolz==0.12.1
155+
tornado==6.4
156+
tqdm==4.66.2
157+
traitlets==5.14.2
158+
triangle==20230923
159+
typer==0.9.0
160+
typing_extensions==4.5.0
161+
tzdata==2024.1
162+
urllib3==2.2.1
163+
vispy==0.14.1
164+
wcwidth==0.2.13
165+
Werkzeug==3.0.1
166+
wrapt==1.16.0
167+
xyzservices==2023.10.1
168+
zipp==3.17.0

0 commit comments

Comments
 (0)