NIFTy merge requestshttps://gitlab.mpcdf.mpg.de/ift/nifty/-/merge_requests2023-05-02T13:50:13Zhttps://gitlab.mpcdf.mpg.de/ift/nifty/-/merge_requests/842Introduce a more flexible sequential map2023-05-02T13:50:13ZGordian EdenhoferIntroduce a more flexible sequential mapGordian EdenhoferGordian Edenhoferhttps://gitlab.mpcdf.mpg.de/ift/nifty/-/merge_requests/840Reintroduce `plt.figure()` to protect user figures from closing2023-02-22T14:11:28ZLukas PlatzReintroduce `plt.figure()` to protect user figures from closingPhilipp FrankPhilipp Frankhttps://gitlab.mpcdf.mpg.de/ift/nifty/-/merge_requests/839change from last to latest2023-02-02T16:41:18ZVincent Eberlechange from last to latest#359#359Martin ReineckeMartin Reineckehttps://gitlab.mpcdf.mpg.de/ift/nifty/-/merge_requests/838don't open new fig in every iteration2023-02-13T09:36:48ZJakob Rothdon't open new fig in every iterationCurrently, opimize_kl opens a new figure, when plotting the minisanity history, in every iteration of the optimisation (See this line in the code: https://gitlab.mpcdf.mpg.de/ift/nifty/-/blob/NIFTy_8/src/minimization/optimize_kl.py#L613)...Currently, opimize_kl opens a new figure, when plotting the minisanity history, in every iteration of the optimisation (See this line in the code: https://gitlab.mpcdf.mpg.de/ift/nifty/-/blob/NIFTy_8/src/minimization/optimize_kl.py#L613). After the minisanity plot the figure is cleared but not closed. Thus after an `optimize_kl` run with n iterations, there are n open matplotlib figures. If one calls `plt.show()` after `optimize_kl` n empty figures will open. Here is a small demo:
```
import nifty8 as ift
import matplotlib.pyplot as plt
import numpy as np
from mpi4py import MPI
comm = MPI.COMM_WORLD
master = comm.Get_rank() == 0
############ some nifty with optimize_kl ##############
sp = ift.RGSpace(1)
op = ift.makeOp(ift.full(sp, 1)).ducktape('blub')
d = ift.full(sp, 1.)
n = ift.ScalingOperator(sp, 0.1, np.float64)
lh = ift.GaussianEnergy(d, inverse_covariance=n.inverse) @ op
n_iterations = 3
n_samples = 2
ic_sampling = ift.AbsDeltaEnergyController(name="Sampling (linear)",
deltaE=0.05, iteration_limit=100)
ic_newton = ift.AbsDeltaEnergyController(name='Newton', deltaE=0.5,
convergence_level=2, iteration_limit=35)
ic_sampling_nl = ift.AbsDeltaEnergyController(name='Sampling (nonlin)',
deltaE=0.5, iteration_limit=15,
convergence_level=2)
minimizer = ift.NewtonCG(ic_newton)
minimizer_sampling = ift.NewtonCG(ic_sampling_nl)
samples = ift.optimize_kl(lh, n_iterations, 2,
minimizer, ic_sampling, minimizer_sampling,
output_directory="folder",
comm=comm, plot_energy_history=True,
plot_minisanity_history=True)
#######################################################
x = np.linspace(1,10,100)
plt.plot(x,x**2)
if master:
plt.show()
```
Is there a reason to create a new figure every time? I guess this is a bug. I have removed the `plt.figure()`. Note: also in the energy history we don't have a `plt.figure()`.https://gitlab.mpcdf.mpg.de/ift/nifty/-/merge_requests/836remove note mpi tasks in sample_list2023-01-25T12:09:28ZJakob Rothremove note mpi tasks in sample_listIn the Sample List documentation, we have a note that a sample list has to be loaded with the sample number of MPI tasks with which the Sample List was saved. Actually, this condition is not necessary. The number of MPI tasks does neithe...In the Sample List documentation, we have a note that a sample list has to be loaded with the sample number of MPI tasks with which the Sample List was saved. Actually, this condition is not necessary. The number of MPI tasks does neither affect the order in which the samples are stored nor the order in which the samples are loaded again. To convince yourself, here are two code snippets:
Save a sample list:
```
import nifty8 as ift
from mpi4py import MPI
comm = MPI.COMM_WORLD
n_tasks = comm.Get_size()
my_rank = comm.Get_rank()
master = my_rank == 0
n_samples = 5
sp = ift.RGSpace(1)
mean = ift.full(sp, 0)
# create samples with "value of sample=index in list"
# create samples mpi parallel according to nifty convention
loc_inds = ift.utilities.shareRange(n_samples, n_tasks, my_rank)
smps = [ift.full(sp, ii) for ii in range(*loc_inds)]
neg = [False for _ in range(*loc_inds)]
samples = ift.ResidualSampleList(mean, smps, neg, comm)
samples.save('smp')
if master:
print(f'saved sample list with {n_samples} samples distributed on {n_tasks} tasks')
```
Read the sample list and verify the number of samples and their order:
```
import nifty8 as ift
from mpi4py import MPI
comm = MPI.COMM_WORLD
n_tasks = comm.Get_size()
my_rank = comm.Get_rank()
master = my_rank == 0
samples = ift.ResidualSampleList.load('smp', comm)
n_samples = samples.n_samples
# check order of samples
for ii, smp in enumerate(samples.iterator()):
assert(ii == smp.val[0])
if master:
print(f'read sample list with {n_samples} samples, and distribute on {n_tasks} tasks')
print('verified order of samples')
```
Thanks for noticing this Maximilian!https://gitlab.mpcdf.mpg.de/ift/nifty/-/merge_requests/835Sampling: Do not raise on not converged samples2023-01-13T11:59:35ZGordian EdenhoferSampling: Do not raise on not converged samplesGordian EdenhoferGordian Edenhoferhttps://gitlab.mpcdf.mpg.de/ift/nifty/-/merge_requests/834HarmonicSKI: Make pad symmetric2023-01-13T11:28:37ZGordian EdenhoferHarmonicSKI: Make pad symmetricGordian EdenhoferGordian Edenhoferhttps://gitlab.mpcdf.mpg.de/ift/nifty/-/merge_requests/833re: cg: Relax energy error criterium within Newton2023-01-13T11:29:35ZGordian Edenhoferre: cg: Relax energy error criterium within NewtonSciPy does not compute the energy, so at least we should not do worse than SciPy...SciPy does not compute the energy, so at least we should not do worse than SciPy...Gordian EdenhoferGordian Edenhoferhttps://gitlab.mpcdf.mpg.de/ift/nifty/-/merge_requests/832Better Lanczos interface2023-01-13T11:29:43ZGordian EdenhoferBetter Lanczos interfaceWhile this path contains the changes for a working geomap implementation, it is mostly about minor changes to the interface of the Lanczos algorithm.While this path contains the changes for a working geomap implementation, it is mostly about minor changes to the interface of the Lanczos algorithm.Gordian EdenhoferGordian Edenhoferhttps://gitlab.mpcdf.mpg.de/ift/nifty/-/merge_requests/831AbstractModel: Dynamically initialize attr2023-01-12T14:22:19ZGordian EdenhoferAbstractModel: Dynamically initialize attrInitialize `_init`, `_target`, and `_linear_transpose` within the
corresponding method if they are not present.
Furthermore, add some comments on how AbstractModel should be extended
to a custom JAX type once JAX features easier python ...Initialize `_init`, `_target`, and `_linear_transpose` within the
corresponding method if they are not present.
Furthermore, add some comments on how AbstractModel should be extended
to a custom JAX type once JAX features easier python convenience method
to do so.Gordian EdenhoferGordian Edenhoferhttps://gitlab.mpcdf.mpg.de/ift/nifty/-/merge_requests/830FIX: add missing sqrt, save real std2023-01-13T09:55:54ZVincent EberleFIX: add missing sqrt, save real stdHere the variance was saved, not the standard deviation
Bugfix described in #358
# Fixes:
- std is saved in last_std.fits
- new test checking for equality of mean and std in fits and hdf5 files against the SampleListHere the variance was saved, not the standard deviation
Bugfix described in #358
# Fixes:
- std is saved in last_std.fits
- new test checking for equality of mean and std in fits and hdf5 files against the SampleListPhilipp FrankPhilipp Frankhttps://gitlab.mpcdf.mpg.de/ift/nifty/-/merge_requests/829backport of fix docu again2023-01-04T11:13:03ZVincent Eberlebackport of fix docu againThis is the backport of the fix in !828 concerning the issue #356This is the backport of the fix in !828 concerning the issue #356Philipp FrankPhilipp Frankhttps://gitlab.mpcdf.mpg.de/ift/nifty/-/merge_requests/828Fix Docu Again2023-01-04T11:10:03ZVincent EberleFix Docu Againrecover logo, replace search button with field
- more changes for issue #356
- backport for nifty7 in !829recover logo, replace search button with field
- more changes for issue #356
- backport for nifty7 in !829Philipp FrankPhilipp Frankhttps://gitlab.mpcdf.mpg.de/ift/nifty/-/merge_requests/827Update weblinks2023-01-02T13:59:00ZPhilipp FrankUpdate weblinksFix readme links to point to correct website (former ~/nifty/nifty8/ is now the default page ~/nifty/)Fix readme links to point to correct website (former ~/nifty/nifty8/ is now the default page ~/nifty/)Philipp FrankPhilipp Frankhttps://gitlab.mpcdf.mpg.de/ift/nifty/-/merge_requests/826_register_cmaps: Un-deprecate CMAP registration2023-01-02T12:50:39ZGordian Edenhofer_register_cmaps: Un-deprecate CMAP registrationFix #357 .Fix #357 .Gordian EdenhoferGordian Edenhoferhttps://gitlab.mpcdf.mpg.de/ift/nifty/-/merge_requests/825gitlab-ci: Update to new GitLab coverage reporting2023-01-02T12:50:30ZGordian Edenhofergitlab-ci: Update to new GitLab coverage reportingGordian EdenhoferGordian Edenhoferhttps://gitlab.mpcdf.mpg.de/ift/nifty/-/merge_requests/824Fix docu nifty72023-01-02T11:45:00ZVincent EberleFix docu nifty7Backport of !823 fixing the issue #356Backport of !823 fixing the issue #356Gordian EdenhoferGordian Edenhoferhttps://gitlab.mpcdf.mpg.de/ift/nifty/-/merge_requests/823fix docu2023-01-02T11:46:54ZVincent Eberlefix docu# Fixes issue #356
sphinx removed logo variables from 5.3 to 6. These lines fix the CI and produce the same page as before.
```python
html_theme_options = {
"logo": {
"image_light": "nifty_logo_black.png",
"image_d...# Fixes issue #356
sphinx removed logo variables from 5.3 to 6. These lines fix the CI and produce the same page as before.
```python
html_theme_options = {
"logo": {
"image_light": "nifty_logo_black.png",
"image_dark": "nifty_logo_black.png"
},
```
The rest is cosmetics.https://gitlab.mpcdf.mpg.de/ift/nifty/-/merge_requests/822DOFDistributor: Fix `Field` ref in doc-string2023-01-02T09:40:08ZGordian EdenhoferDOFDistributor: Fix `Field` ref in doc-stringGordian EdenhoferGordian Edenhoferhttps://gitlab.mpcdf.mpg.de/ift/nifty/-/merge_requests/821User Experience: Fix `optimize_kl` minisanity plotting for runs with many par...2023-02-21T15:43:03ZLukas PlatzUser Experience: Fix `optimize_kl` minisanity plotting for runs with many parametersCurrently, the reduced-ChiĀ² plots produced by `optimize_kl` become unreadable when reconstructing a model with many parameter keys or when doing many MGVI/GeoVI iterations.
This patch relocates the minisanity plot legend to outside of t...Currently, the reduced-ChiĀ² plots produced by `optimize_kl` become unreadable when reconstructing a model with many parameter keys or when doing many MGVI/GeoVI iterations.
This patch relocates the minisanity plot legend to outside of the graph area and resizes the figure adaptively to make it readable in both named scenarios. Adaptive resizing is also added to the energy history plot.
@mtr: Are you the right maintainer to ask to merge this? Has somebody been assigned to take over @parras position as maintainer?
Cheers, Lukas
# Before:
![minisanity_history_last](/uploads/65f87d0a8b13f3906f317d6f322736b5/minisanity_history_last.png)
# After:
![minisanity_history_last](/uploads/6c8419dbfd52f28d31c9e5b3f56add2a/minisanity_history_last.png)