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

4 generate lookup tables #14

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from
Draft

4 generate lookup tables #14

wants to merge 26 commits into from

Conversation

stan-dot
Copy link
Collaborator

No description provided.

@stan-dot stan-dot requested a review from iain-hall July 31, 2024 15:37
@stan-dot stan-dot self-assigned this Jul 31, 2024
@stan-dot stan-dot linked an issue Jul 31, 2024 that may be closed by this pull request
Copy link

codecov bot commented Aug 2, 2024

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@stan-dot stan-dot marked this pull request as ready for review August 5, 2024 13:28
@stan-dot stan-dot enabled auto-merge August 5, 2024 13:28
@stan-dot
Copy link
Collaborator Author

stan-dot commented Aug 5, 2024

for this PR to be approved,all the 'test plans' need to be moved into github comments instead

@stan-dot
Copy link
Collaborator Author

stan-dot commented Aug 5, 2024

need to consolidate the plans and make them make sense, run in sim or on a beamline

Comment on lines 16 to 22
def calculate_derivative_maxima(data: np.ndarray) -> List[float]:
x = sp.Symbol("x")
y = sp.interpolating_spline(3, sp.lambdify(x, data))
derivative = y.diff(x)
critical_points = sp.solve(derivative, x)
return [float(cp) for cp in critical_points if cp.is_real]

Copy link
Collaborator

Choose a reason for hiding this comment

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

x = motor position
y = transmission strength

presumably currently y = data, but we need to be passing also the values of x, so data could be array[tuple(float, float)] or otherwise passing in x?

@stan-dot
Copy link
Collaborator Author

from conversation with @iain-hall I figured that a couple of different kinds of alignment were mixed up in the code here. Will adjust on Monday the 19th

@stan-dot
Copy link
Collaborator Author

adjusted, still need more in-person chat with the scientist to perfect the alignment definition

@stan-dot
Copy link
Collaborator Author

stan-dot commented Aug 27, 2024

will investigate today at 2:30

@stan-dot
Copy link
Collaborator Author

manual steps:

setup steps:

  1. set filter B to be in line diode mode
  2. filter A must be at the right size so that the reading from the current is below 20. it's best if between 2 and 18 ? - or decide for which element which. the smaller the filter, the bigger the current, some kind of exponential. must be discrete. attenuator as a name

XFAS community uses Ev for initial energy and inverse angstorms for final energy

not going through all the elements at each run, it's per user run.

that is at the moment, we could do all the elemnts at the start of the run.

the monochromator Bragg angle corresponds to the element - energies to excite the metallic orbitals of

harmonics are learned empirically, about the relationship

Silicon111 is the monochromator where every element has a dedicated harmonic - the lower Z elements are at lower harmonics
higher Z elements are at a higher harmonics.

Monochromator has both the crystal and the energy

Mo has highest energy, so at the highest harmonic - 19

if we know that someone will use Ga scan, the beamline stuff know to cover the given energy

easier for humans to read this angle start, angle end as energy in eV.
usually 1 element has 1 edge
element AND edge as the scan arguments

for GDA the energy space is discretized into gears - harmonics? maybe the insertion device or optics teams?

so during the alignment we pause the conversion between harmonics and energies.

physical order:
idgap (unudlator) -> Bragg angle ->

scanning proper

  1. scan goes to the first angle/energy - starting position using the exiisting lookup table, to start off.
  2. mm on x and reading is some energy on Y microAmps diode reading. peak fitting
  3. we create pairings of angle /element energy to idgap
  4. we get a 3 d pricture which is reduced into 2d by just getting the peaks, which is a discrete representation of a monotonic relatinoship between Bragg angle and the idgap.

/dls/science/groups/i18/lookuptable/Fe_Co_Ni_Aug24.txt - so three elements next to one another, all 3 under the same harmonic

physcial cleanup stage

  1. moving the d7 filter a and filter b back

calculation stage - in IDL

  1. not quite linear - we get function parameters and then it updates the part of a bigger harmonic file - for a given chunk.

when running the script, generous with the range, so that it's updated generously.

@stan-dot
Copy link
Collaborator Author

stan-dot commented Aug 27, 2024

there is also alignment of perpendicular gap

a number of energies, very similar to the idgap alignment

@stan-dot
Copy link
Collaborator Author

Gaussian fitting vs peak fitting. maybe there was an option to use it, rather than the peak, possible other

@stan-dot
Copy link
Collaborator Author

sources of issues when running manually:

  • saturation
  • if the original idgap is so far out of the scan

@stan-dot
Copy link
Collaborator Author

right now for one element - maybe 10 minutes
saturation is usually quick, if it works right, scanning takes most of the time, IDL is quick, sat

@stan-dot
Copy link
Collaborator Author

if all automatic, twice a week - elements for a specific user

otherwise the whole energy range at the end of the run.
19 harmonics? 10 minutes each - 3 hours? or more maybe, adding more point.

so either at the beginning of the experiment, or at the end of it.

need full beam for the, startup beam is full beam too, it's all good.

@stan-dot
Copy link
Collaborator Author

@iain-hall the narrowed down version of the i18 code is in the plans/align_idgap.py file.

Much of the logic might go into the dodal undulator device, I hope to figure out more in the Friday meeting

@stan-dot stan-dot marked this pull request as draft September 13, 2024 12:58
auto-merge was automatically disabled September 13, 2024 12:58

Pull request was converted to draft

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

Successfully merging this pull request may close these issues.

Generate lookup tables
2 participants