Skip to content

Conversation

@myksa
Copy link
Collaborator

@myksa myksa commented Nov 3, 2025

  • examples 01,02,03 and 05 no real changes only used a different venv and python version
  • example 04: 1. used 10 copyes of the old data to have a time dependent example.
    2. added time constant
    3. added data preprocessing steps
    4. added time constant for plotting
    5. changed the epochs from 150 to 100
    For the mrfRec file:
  1. Line 25 to 70: added time data and changed the Intensity data to 4d input
  2. Line 86 to 93: changed Initialize band structure form 2D (kx,ky) to 3d (kx,ky,t)
  3. Line 121 and 131: added time data to fromFile
  4. Line 223: in initializeBand the theoretical data is given, the data is given as a 2D array, for the reconstruction the data is expendet into the time domain
  5. Line 238 to 240: smooting of the intensity is done for all times seperatly
  6. Line 273 to 281: normalization is done for all times seperatly
  7. Line 314 to 338: symmetrize for each time seperatly
  8. Line 364 to 395: for the seq reconstruction i removed the curv. functions and added the time domain. The seq is still work in procress.
  9. Line 405 to 430: the squarediff is calculated for the 3D MRF not the 2D case. LogP is in this case a cube which get initilised with a new function called _initCube(2) which can be found at the end of the code. LogP is then calculated for the time dependent case.
  10. Line 437 to 445: the total LogP is calculated for the cube (3D case) instead of the square (2D) case.
  11. Line 450 and 457: the black and white nodes are calculated for the 3D case.
  12. Line 492 to 513: added the time data and changed the calculations for the time dependent case. I gets transposed to have the needed format of (kx,ky,t,E)
  13. Line 517 to 537: added the time data and changed to calculation of the nodes to the 3D case.
  14. Line 539 to 545: added time data for the results.
  15. Line 764 to 783: calculate logP for timedepentend data
  16. Line 791 to 985: changed the plot functions to time dependent data
  17. 1069 to 1082: _initCube(2) funtion for the 3D MRF model
Copy link
Member

@rettigl rettigl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally, most changes make sense to me, but carefully check the order of your indices. I think the bug could be there.

Delay: 1D array | None
Delay along time axis as numpy array.
I: 4D array | None
Measured intensity wrt momentum, time and energy, generated if None.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you consider the data as I(kx, ky, t, E) or I(kx, ky, E, t)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right now i only consider I(kx, ky, E, t), i will change the Description. The format I(kx, ky, E, t) comes from the nexus data set.

ind1d = np.argmin(np.abs(EE - EE0), 1)
self.indEb = ind1d.reshape(self.E0.shape)
self.indEb = np.repeat(self.indEb[ :, :, np.newaxis], self.lengthdelay, axis=2)
# depends on the shape of E0, i assume E0 is the same for all times
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Describe what you assume in the docstring, and possibly test for the shape


self.I = ndimage.gaussian_filter(self.I, sigma=sigma)
for t in range(len(self.delay)):
self.I[:,:,:,t] = ndimage.gaussian_filter(self.I[:,:,:,t], sigma=sigma)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this also assumes I(kx, ky, E, t)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Comment on lines +273 to +280
for t in range(self.lengthdelay):
self.I[:,:,:,t] = mclahe(
self.I[:,:,:,t] ,
kernel_size=kernel_size,
n_bins=n_bins,
clip_limit=clip_limit,
use_gpu=use_gpu,
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should discuss if this makes sense. Maybe generate one set of parameters, and apply everywhere. Not sure if mclahe can do this rn.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think i already tried to do this for the 4d intensity. If i remenber correctly i got an error, but i can try again.

logP -= (ECurv[self.indEb[indx, indy - 2]] - 2 * ECurv[self.indEb[indx, indy - 1]] + ECurv) ** 2
if indy < (self.lengthKy - 1):
logP -= (ECurv[self.indEb[indx, indy - 1]] - 2 * ECurv + ECurv[self.indEb[indx, indy + 1]]) ** 2
logP -= (ENN - ENN[self.indEb[indx, indy - 1, indt]]) ** 2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way this is defined here, it will take the same eta along all directions. This should be extended after testing to provide a len(3) eta array for the three dimensions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did the extention and i am testing the results right now. If everything looks correct i will update this with the testing of len(3).

Comment on lines +773 to +775
logP -= np.sum(
(Eb[ 0 : (self.lengthKx - 1), :,:] - Eb[1 : self.lengthKx, :,:]) ** 2
) / (2 * self.eta**2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

different etas

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will update this when i find out were this bug with the "ripples" comes from.

**Parameters**\n
kx, ky: 1D array, 1D array | None, None
kx, ky, time: 1D array, 1D array | None, None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are indices and not 1d arrays, no?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, i will change this.

Name of the colormap.
figsize: list/tuple | [9, 9]
Size of the figure produced.
equal_axes: bool | False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add parameter

Comment on lines +937 to +940
if time is None:
t = 0
if time is not None:
t = time
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this should be a time rather than an index like for the function above.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use one variable

Comment on lines -872 to +965
ax.plot_surface(x, y, np.transpose(self.getEb()))
ax.plot_surface(x, y, np.transpose(Eb[:,:,t]))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it matter if you use getEb or just Eb?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did matter in the beginning while i updatet the code for time dependens. I can check again if this is still needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants