-
Notifications
You must be signed in to change notification settings - Fork 5
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
Feature/kt3 #23
base: development
Are you sure you want to change the base?
Feature/kt3 #23
Conversation
Based on FibreOpticGroup. Allows user to generate a KT3A or KT3B models with sightline information or by using the Simple Access Layer to get sightline information from PPF data.
Shows how a KT3 model can be obtained using SAL. Shows the sigthlin trajectories in a poloidal plane. Shows impact of spot position corrections and differences between KT3A and KT3B sightlines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @Mateasek, this PR is superb. I especially liked the feature that allows to adjust the LoS alignment when the view is obstructed by the structure. I have only a few comments and the main one is related to the rarely available PPFs used to read diagnostic parameters.
import numpy as np | ||
from math import sqrt, tan, radians | ||
|
||
from jet.data import sal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replacing this with
from sal.client import SALClient
...
sal = SALClient('https://sal.jet.uk')
will make the code more portable.
We should probably define the DEFAULT_SAL_SERVER
. At the moment it is https://sal.jet.uk, but in the near future it will probably change to https://sal.jetdata.eu.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the version of sal from jet package is slightly different isn't it? At least according to what they say here. It seems like this is the SAL version to use for JET. Also, when the default server changes, it should automatically be changed in the jet package, shouldn't it? This way we wouldn't have to care. The same style is used also in the equilibrium loading. Am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct. My point is that with from jet.data import sal
this code will run only at JET clusters. With from sal.client import SALClient
you can run it from anywhere.
Edit
Of course, we need to replace other usages of jet.data
if we want this module to be portable, but that is a separate issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look like sal = SALClient('https://sal.jet.uk')
requires authorization on JET Data Center nodes, while from jet.data import sal
works without authorization because it's configured for https://sal.jetdata.eu, which is currently unavailable outside of the JDC.
Something like:
try:
from jet.data import sal
except ModuleNotFoundError:
# use general SAL client outside of the JET computing infrastructure
from sal.client import SALClient
sal = SALClient('https://sal.jet.uk')
will be a better solution.
However, this problem is general for all JET diagnostics implemented in Cherab, and should probably be solved with
from cherab.jet import sal
So, please ignore my comments about this issue, I think it's OK to use from jet.data import sal
for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Mateasek pointed out that the JET version of the SAL client can be installed on local machines by following the instructions from https://data.jet.uk/guides/sal/downloads.html#sal-downloads-label. Thus, replacing jet.data.sal
with a generic sal
does not make cherab.jet
more portable as I mistakenly thought.
cherab/jet/spectroscopy/kt3/kt3.py
Outdated
# empirically determined point limiting the inner sightlines | ||
KT3_INNER_THRESHOLD = Point2D(3.0510967354232994, 2.0072688526617264) | ||
|
||
def kt3_from_data(spectrometer, origin_rz, spots_rz, min_wavelength, max_wavelength, spectral_bins, pixel_samples=1e3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rename it to load_kt3_from_data()
to match the naming of other load_some_diagnostic()
functions in cherab.jet
.
if spectrometer.lower() in ("a", "kt3a"): | ||
leaf_origin = "/pulse/{0:d}/ppf/signal/jetppf/t3af/rzor".format(int(pulse_number)) | ||
leaf_spot_tile5 = "/pulse/{0:d}/ppf/signal/jetppf/t3af/rzdv".format(int(pulse_number)) | ||
leaf_wave = "/pulse/{0:d}/ppf/signal/jetppf/t3af/wave".format(int(pulse_number)) | ||
spectrometer = "KT3A" | ||
elif spectrometer.lower() in ("b", "kt3b"): | ||
leaf_origin = "/pulse/{0:d}/ppf/signal/jetppf/t3bf/rzor".format(int(pulse_number)) | ||
leaf_spot_tile5 = "/pulse/{0:d}/ppf/signal/jetppf/t3bf/rzdv".format(int(pulse_number)) | ||
leaf_wave = "/pulse/{0:d}/ppf/signal/jetppf/t3bf/wave".format(int(pulse_number)) | ||
spectrometer = "KT3B" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, these PPFs are produced on-demand. Among the 19500 pulses between 80124 and 99624, the T3AF and T3BF PPFs are available only in 33 and 290 pulses, respectively. Therefore, it would be nice to have some fallback values for origin_rz
, spots_rz
and wave
.
Looks like the origin_rz
(the first mirror position) is fixed at (3.28422, 3.56166) for all the ILW pulses. So, the problem is to obtain spots_rz
and wave
. I think that the wave
can be obtained from the settings specified in the JPF using the equation for the dispersion of the Czerny-Turner spectrometer.
I see three possible solutions for spots_rz
:
- Calling
kt3a(b)_los_siw_new()
fromhome/cxs/instrument_data/kt3_common/alignment
throughidlbridge
. - Implementing the parts of the
kt3a(b)_los_siw_new()
,agm_image_to_divertor()
andagm_divertor_mark2()
in python. - Hardcoding the
{pulse1: spots_rz1, pulse2: spots_rz2, ...}
dictionaries, in which thespots_rz1
is valid between the pulsespulse1
andpulse2
.
The first solution is not portable. The second one requires some efforts and can only be implemented with the permission of Andy Meigs. My guess is that the rz_spots
rarely changes, so the third solution might work. I'll check it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing this out @vsnever . I didn't notice because the shot ensemble I'm working with. I will contact Andy Meigs to discus with him what could be the best way forward, but for myself:
- Would cause a lot of problems to a lot of people and as you said it would not work remotely. I think this is not an option.
- This would be the best solution in my opinion. Or getting the data from other files, we will see.
- Having a default data would be a last resort solution.
I will inform here when I get some information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm currently working on the 3rd solution by obtaining the values of spots_rz
using kt3a(b)_los_siw_new()
for the entire set of ILW pulses. So far I have found that spots_rz
depends on the grating, which varies from pulse to pulse, but can only take on 3 values: 300, 1200 and 2400, while for the same grating, the spots_rz
changes very rarely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets wait for Andy Meigs before we jump to reverse engineering.
cherab/jet/spectroscopy/kt3/kt3.py
Outdated
|
||
return group | ||
|
||
def kt3_from_sal(spectrometer, pulse_number,min_wavelength=None, max_wavelength=None, spectral_bins=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this is a default way of loading the diagnostic, so the name load_kt3()
would do better I think.
cherab/jet/spectroscopy/kt3/kt3.py
Outdated
return group | ||
|
||
def kt3_from_sal(spectrometer, pulse_number,min_wavelength=None, max_wavelength=None, spectral_bins=None, | ||
spot_position_correction=True, pulse_time=None, time_selection="nearest", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would change the default value for spot_position_correction
to False
. The private PPF required for the spot correction may not be available.
Changed names to match package convention, changed default value of spot_position_correction to False
This PR add model of KT3 diagnostic based on FibreOpticGroup. related to issue #18