NSLS2 / NSLS2/pyCHX

[v2][_commonspeckle][Two_Time_Correlation_Function] has 2 functions that calculate 1time from 2time.

Open
#37 1 comment 0 reactions 1 assignee View on GitHub

@afluerasu is already working on this.

Since Oct 22, 2020.

_commonspeckle discussion V2
Dominant language
Jupyter Notebook
Stars
8
Forks
12
Avg merge
2h 53m
Merged PRs (30d)
6

Description

Need to decide if old version of this function can be eliminated.

In case of norms = None, the output of each are equal, as confirmed by assert.

In the case of norms!=None, the code is slightly re-written.

< def get_one_time_from_two_time_old(g12, norms=None, nopr=None):
---
> def get_one_time_from_two_time(g12, norms=None, nopr=None):
21,35c21,33
<     g2f12 = np.zeros([m, noqs])
<     for q in range(noqs):
<         y = g12[:, :, q]
<         for tau in range(m):
< 
<             if norms is None:
<                 g2f12[tau, q] = np.nanmean(np.diag(y, k=int(tau)))
<             else:
<                 yn = norms[:, q]
<                 yn1 = np.average(yn[tau:])
<                 yn2 = np.average(yn[: m - tau])
<                 g2f12[tau, q] = np.nanmean(np.diag(y, k=int(tau))) / (
<                     yn1 * yn2 * nopr[q]
<                 )
< 
---
>     if norms is None:
>         g2f12 = np.array([np.nanmean(g12.diagonal(i), axis=1) for i in range(m)])
>     else:
>         g2f12 = np.zeros([m, noqs])
>         for q in range(noqs):
>             yn = norms[:, q]
>             g2f12[i, q] = np.array(
>                 [
>                     np.nanmean(g12[:, :, q].diagonal(i))
>                     / (np.average(yn[i:]) * np.average(yn[: m - i]) * nopr[q])
>                     for i in range(m)
>                 ]
>             )

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.