Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in “mayo_learned_primal_dual.py” #9

Open
mimeng123 opened this issue Aug 30, 2020 · 11 comments
Open

in “mayo_learned_primal_dual.py” #9

mimeng123 opened this issue Aug 30, 2020 · 11 comments

Comments

@mimeng123
Copy link

dear adler
I have some question about your work,I run the “mayo_learned_primal_dual.py” ,the value of resuslut would became nan or inf. I compare the “mayo_learned_primal_dual_log.py”,As shown in the figure below,it has the Statement on line 36 and 37 ,but “mayo_learned_primal_dual.py” don't have.
I want to ask Is this two statements necessary for “mayo_learned_primal_dual.py”?why?
微信图片_20200830142611

@mimeng123
Copy link
Author

Do I need to add these two sentences?

@adler-j
Copy link
Owner

adler-j commented Aug 30, 2020

That should not be needed (in fact, in the non-linear case the forward operator has units and the scaling actually matters).

When this happens, it's commonly the case that astra has been installed wrongly, have you tried running the ODL test suite?

@mimeng123
Copy link
Author

Dear adler:
I had tried running the ODL test suite these days. I received the error as follow .
how to slove this problem?
$ py.test
============================================== test session starts ===============================================
platform linux -- Python 3.7.7, pytest-6.0.1, py-1.9.0, pluggy-0.13.1
rootdir: /home4/ypb
plugins: hypothesis-5.30.0, odl-1.0.0.dev0
collected 0 items / 1 error
===================================================== ERRORS =====================================================
_________________________________________ ERROR collecting test session __________________________________________
anaconda3/envs/ct_tf=1.14/lib/python3.7/site-packages/_pytest/config/init.py:557: in _importconftest
mod = import_path(conftestpath, mode=importmode)
anaconda3/envs/ct_tf=1.14/lib/python3.7/site-packages/_pytest/pathlib.py:540: in import_path
raise ImportPathMismatchError(module_name, module_file, path)
E _pytest.pathlib.ImportPathMismatchError: ('pywt.conftest', '/home4/ypb/anaconda3/envs/ct_tf=1.14/lib/python3.7/site-packages/pywt/conftest.py', PosixPath('/home4/ypb/anaconda3/envs/ct_odl/lib/python3.7/site-packages/pywt/conftest.py'))
============================================ short test summary info =============================================
ERROR - _pytest.pathlib.ImportPathMismatchError: ('pywt.conftest', '/home4/ypb/anaconda3/envs/ct_tf=1.14/lib/p...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

@adler-j
Copy link
Owner

adler-j commented Sep 2, 2020

In what folder did you run py.test?

@mimeng123
Copy link
Author

In what folder did you run py.test?

I installed odl by pip. I dont't choose any folder, I run py.test in root directory. excurse me,do I run in the wrong folder?

@adler-j
Copy link
Owner

adler-j commented Sep 2, 2020

You need to tell pytest which tests to run, e.g. by going to the ODL folder. If you installed with pip, you should probably run odl.test() from python.

@mimeng123
Copy link
Author

dear adler,thank for your help.

just now,I have tried the command python -c "import odl; odl.test()" , I received 1 xfailed ,but there are no relevant tips .

sorry,I am not familiar with pytest , I want to ask if I need to deal with this problem , how can I find the detail about this?

@adler-j
Copy link
Owner

adler-j commented Sep 3, 2020

Pytest is a very widely used python library for testing and there's heaps of documentation online.

What was the error message you got, more exactly?

@mimeng123
Copy link
Author

dear adler, Sorry for the late response.
I was re-installed the odl, I had passed the test. Thanks for your help.

@adler-j
Copy link
Owner

adler-j commented Sep 10, 2020

Ok great to hear! If this is solved can we close it?

@mimeng123
Copy link
Author

dear adler.I also have a problem which I want to ask you.
In the "mayo_learned_primal_dual_log.py",why you deal with log_noisy_data need multiply the (1 / opnorm) ?
(in the "log_noisy_data = np.log(noisy_data) * (-1 / mu_water) * (1 / opnorm)")

- def generate_data(validation=False):
-     """Generate a set of random data."""
-     n_iter = 1 if validation else n_data
- 
-     y_arr = np.empty((n_iter, operator.range.shape[0], operator.range.shape[1], 1), dtype='float32')
-     x_true_arr = np.empty((n_iter, space.shape[0], space.shape[1], 1), dtype='float32')
- 
-     for i in range(n_iter):
-         if validation:
-             fi = "../../../DataSet/water/L_test/L064_008.npy"
-         else:
-             fi = "../../../DataSet/water/L_train/" + file_loader.next_file()
- 
-         data = np.load(fi)
- 
-         phantom = space.element(np.rot90(data, -1))
-         phantom /= 1000.0  # convert go g/cm^3
- 
-         data = ray_transform(phantom)
-         data = np.exp(-data * mu_water)
- 
-         noisy_data = odl.phantom.poisson_noise(data * photons_per_pixel)
-         noisy_data = np.maximum(noisy_data, 1) / photons_per_pixel
- 
-         log_noisy_data = np.log(noisy_data) * (-1 / mu_water) * (1 / opnorm)
- 
-         x_true_arr[i, ..., 0] = phantom
-         y_arr[i, ..., 0] = log_noisy_data
- 
-     return y_arr, x_true_arr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants