Skip to content

Commit 84cd5d3

Browse files
committed
Revert "rebase main, add everything"
This reverts commit e093399, reversing changes made to 2e1d2a3.
1 parent af13762 commit 84cd5d3

63 files changed

Lines changed: 16205 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# SCM syntax highlighting & preventing 3-way merges
2+
pixi.lock merge=binary linguist-language=YAML linguist-generated=true -diff

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*.pyc
2+
*~
3+
*.pkl
4+
# pixi environments
5+
.pixi/*
6+
!.pixi/config.toml

.pre-commit-config.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
ci:
2+
autofix_prs: true
3+
skip: [pixi-lock-check]
4+
5+
repos:
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: v6.0.0
8+
hooks:
9+
- id: check-added-large-files
10+
args: [--maxkb=8192]
11+
- id: check-merge-conflict
12+
- id: check-yaml
13+
args: [--allow-multiple-documents]
14+
- id: end-of-file-fixer
15+
exclude: "tests/cis_tests/.*"
16+
- id: trailing-whitespace
17+
exclude: "tests/cis_tests/.*"
18+
- repo: https://github.com/astral-sh/ruff-pre-commit
19+
rev: v0.15.0
20+
hooks:
21+
- id: ruff-check
22+
args: [--fix, --exit-non-zero-on-fix]
23+
exclude: "tests/cis_tests/.*"
24+
- id: ruff-format
25+
exclude: "tests/cis_tests/.*"
26+
- repo: local
27+
hooks:
28+
- id: pixi-lock-check
29+
name: pixi-lock-check
30+
entry: bash -c "PATH=$HOME/.pixi/bin:$PATH pixi lock --check"
31+
stage: pre-push
32+
language: system

src/dgs_resolution/Developer.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Root web app
2+
`app.py`
3+
* Loads apps of each instrument
4+
5+
# ARCS web app
6+
* `arcs/__init__.py`: skeleton
7+
* `arcs/inelastic.py`: inelastic tab
8+
- method `get_data`: get a tuple of (energy transfer, resolution)
9+
* `arcs/elastic.py`: elastic tab
10+
* `arcs/model.py`: functions to obtain resolution from pychop model
11+
12+
Web apps for other intruments have similar structure.
13+
14+
# Common utils
15+
`phonon/__init__.py`
16+
* `SQE_from_ForceConstants`: function to calculate S(Q,E) from POSCAR, SPOSCAR, FORCE_CONSTANTS
17+
* `SQE_from_FCzip`: function to calculate S(Q,E) from a zip file of POSCAR, SPOSCAR, FORCE_CONSTANTS files

src/dgs_resolution/README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Setup
2+
3+
Need Jiao's pychop
4+
5+
```
6+
$ rsync -av analysis.sns.gov:~lj7/dv/PyChop PyChop
7+
```
8+
and make sure it is in PYTHONPATH
9+
10+
conda env
11+
12+
```
13+
$ conda create -n dash python=2
14+
$ conda activate dash
15+
$ conda config --add channels conda-forge
16+
$ conda config --add channels mcvine
17+
$ conda config --add channels mantid
18+
$ conda install dash dash-daq scipy matplotlib plotly=3.10 pyyaml waitress pandas mcvine tqdm multiphonon
19+
```
20+
21+
Activate conda environment
22+
23+
```
24+
$ conda activate dash
25+
```
26+
27+
Install dgsres
28+
29+
```
30+
$ git clone git@github.com:mcvine/dgsres.git
31+
$ cd dgsres
32+
$ python setup.py install
33+
```
34+
35+
And need this repo
36+
37+
```
38+
$ cd ~/dv/
39+
$ git clone git@github.com:sns-chops/resolution
40+
```

src/dgs_resolution/__init__.py

Whitespace-only changes.

src/dgs_resolution/arcs/V_Cali_Int_Res_FC1_2018_v2.dat

Lines changed: 299 additions & 0 deletions
Large diffs are not rendered by default.

src/dgs_resolution/arcs/V_Cali_Int_Res_FC1_HighRes_2018_v2.dat

Lines changed: 129 additions & 0 deletions
Large diffs are not rendered by default.

src/dgs_resolution/arcs/V_Cali_Int_Res_FC2_2018_v2.dat

Lines changed: 185 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: ARCS
2+
# Input file for PyChop2 for the ARCS spectrometer at SNS.
3+
4+
chopper_system:
5+
name: ARCS chopper system
6+
chop_sam: 2.0 # Distance (x1) from final chopper to sample (m)
7+
sam_det: 3.0 # Distance (x2) from sample to detector (m)
8+
aperture_width: 0.1751 # Width of aperture at moderator face (m)
9+
aperture_height: 0.1955 # Height of aperture at moderator face (m)
10+
choppers:
11+
- # Each entry must have a dash on an otherwise empty line!
12+
name: ARCS Fermi
13+
distance: 11.61 # Distance from moderator to this chopper in metres
14+
aperture_distance: 9.342 # Distance from aperture (moderator face) to this chopper (only for Fermi)
15+
packages: # A hash of chopper packages
16+
ARCS-100-1.5-AST:
17+
name: ARCS 100 meV Sloppy
18+
pslit: 1.52 # Neutron transparent slit width (mm)
19+
pslat: 0.35 # Neutron absorbing slat width (mm)
20+
radius: 50.0 # Chopper package radius (mm)
21+
rho: 580.0 # Chopper package curvature (mm)
22+
tjit: 0.0 # Jitter time (us)
23+
fluxcorr: 3.0 # (Empirical/Fudge) factor to scale calculated flux by
24+
isPi: False # Should the PI pulse (at 180 deg rotation) be transmitted by this package?
25+
ARCS-700-1.5-AST:
26+
name: ARCS 700 meV Sloppy
27+
pslit: 1.52 # Neutron transparent slit width (mm)
28+
pslat: 0.35 # Neutron absorbing slat width (mm)
29+
radius: 50.0 # Chopper package radius (mm)
30+
rho: 1535.0 # Chopper package curvature (mm)
31+
tjit: 0.0 # Jitter time (us)
32+
fluxcorr: 3.0 # (Empirical/Fudge) factor to scale calculated flux by
33+
isPi: False # Should the PI pulse (at 180 deg rotation) be transmitted by this package?
34+
ARCS-700-0.5-AST:
35+
name: ARCS 700 meV Fine
36+
pslit: 0.51 # Neutron transparent slit width (mm)
37+
pslat: 0.35 # Neutron absorbing slat width (mm)
38+
radius: 50.0 # Chopper package radius (mm)
39+
rho: 1535.0 # Chopper package curvature (mm)
40+
tjit: 0.0 # Jitter time (us)
41+
fluxcorr: 3.0 # (Empirical/Fudge) factor to scale calculated flux by
42+
isPi: False # Should the PI pulse (at 180 deg rotation) be transmitted by this package?
43+
ARCS-100-1.5-SMI:
44+
name: ARCS 100 meV Sloppy
45+
pslit: 1.5 # Neutron transparent slit width (mm)
46+
pslat: 0.41 # Neutron absorbing slat width (mm)
47+
radius: 50.0 # Chopper package radius (mm)
48+
rho: 640.0 # Chopper package curvature (mm)
49+
tjit: 0.0 # Jitter time (us)
50+
fluxcorr: 3.0 # (Empirical/Fudge) factor to scale calculated flux by
51+
isPi: False # Should the PI pulse (at 180 deg rotation) be transmitted by this package?
52+
ARCS-700-1.5-SMI:
53+
name: ARCS 700 meV Sloppy
54+
pslit: 1. # Neutron transparent slit width (mm)
55+
pslat: 0.41 # Neutron absorbing slat width (mm)
56+
radius: 50.0 # Chopper package radius (mm)
57+
rho: 1535.0 # Chopper package curvature (mm)
58+
tjit: 0.0 # Jitter time (us)
59+
fluxcorr: 3.0 # (Empirical/Fudge) factor to scale calculated flux by
60+
isPi: False # Should the PI pulse (at 180 deg rotation) be transmitted by this package?
61+
SEQ-100-2.0-AST:
62+
name: ARCS 100 meV Sloppy
63+
pslit: 2.03 # Neutron transparent slit width (mm)
64+
pslat: 0.35 # Neutron absorbing slat width (mm)
65+
radius: 50.0 # Chopper package radius (mm)
66+
rho: 580.0 # Chopper package curvature (mm)
67+
tjit: 0.0 # Jitter time (us)
68+
fluxcorr: 3.0 # (Empirical/Fudge) factor to scale calculated flux by
69+
isPi: False # Should the PI pulse (at 180 deg rotation) be transmitted by this package?
70+
SEQ-700-3.5-AST:
71+
name: ARCS 700 meV Sloppy
72+
pslit: 3.56 # Neutron transparent slit width (mm)
73+
pslat: 0.35 # Neutron absorbing slat width (mm)
74+
radius: 50.0 # Chopper package radius (mm)
75+
rho: 1535.0 # Chopper package curvature (mm)
76+
tjit: 0.0 # Jitter time (us)
77+
fluxcorr: 3.0 # (Empirical/Fudge) factor to scale calculated flux by
78+
isPi: False # Should the PI pulse (at 180 deg rotation) be transmitted by this package?
79+
# Now define how the frequencies of the choppers should be related
80+
# This is an NxM matrix A where N is the number of choppers and M is the number of indepdent frequencies
81+
# Such that A.F will give the N required frequencies for each chopper from the M input frequencies
82+
frequency_matrix:
83+
[[1]] # f1 is the Fermi frequency
84+
max_frequencies:
85+
[600] # Maximum frequencies (Hz)
86+
default_frequencies:
87+
[300]
88+
89+
sample:
90+
name: ARCS Sample Can
91+
isam: 0 # Sample type: 0==flat plate, 1==ellipse, 2==annulus, 3==sphere, 4==solid cylinder
92+
sx: 2.0 # Thickness (mm)
93+
sy: 48.0 # Width (mm)
94+
sz: 48.0 # Height (mm)
95+
gamma: 0.0 # Angle of x-axis to ki (degrees)
96+
97+
detector:
98+
name: He3 PSD tubes
99+
idet: 2 # Detector type: 1==He tube binned together, 2==He tube
100+
dd: 0.025 # Detector depth (diameter for tube) in metres
101+
tbin: 0.0 # Detector time bins (microseconds)
102+
phi: 0.0 # Detector scattering angle (degrees)
103+
tthlims: [2.373, 135.955] # Min and max 2-theta angles of detectors (for Q-E plot)
104+
105+
moderator:
106+
name: Ambient Water # A==water, AP==poisoned water, CH4==methane, H2==hydrogen. This is only used for analytical calculations
107+
# of the flux distribution for ISIS TS1 moderators. If measured_flux is defined below, name can be anything
108+
imod: 1 # Moderator time profile type: 0==chi^2, 1==Old_Ikeda-Carpenter, 2==modified chi^2, 3==polynomial, 4==Tobyfit Ikeda-Carpenter
109+
mod_pars: [281., 79.0, # Parameters for time profile (for I-K is: [S1, S2, B1, B2, Emod]
110+
.087, .4, 172.] # where tau_f=1/(sqrt(Ei)*E2V*sqrt(S1^2+(S2*lam)^2), tau_s=1/B1 for E<=130meV, 1/B2 otherwise, R=exp(-Ei/Emod)
111+
# and the overall variance (not FWHM) is: tau^2 = 3/tau_f^2 + R/(2-R)/tau_s^2
112+
theta: -13.75 # Angle beamline makes with moderator face (degrees)
113+
source_rep: 60 # Frequency of source (Hz)
114+
measured_flux: # Table of measured flux vs wavelength. Wavelength in Angstrom. Flux in n/cm^2/s/uA/Angstrom
115+
scale_factor: 1. # A factor to scale the flux values below by
116+
wavelength: [0.28601414576833351, 0.29616861080662232, 0.30668359353866664, 0.31757189355627352, 0.32884676487984915, 0.34052193209214343, 0.35261160704479783, 0.36513050615803061, 0.37809386833452097, 0.39151747350929472, 0.40541766185819367, 0.41981135368831168, 0.43471607003460611, 0.45014995398775937, 0.46613179277925221, 0.48268104065052947, 0.49981784253410028, 0.5175630585753952, 0.53593828952523304, 0.55496590303380511, 0.57466906087818581, 0.59507174715650868, 0.61619879748313355, 0.63807592922033896, 0.66072977278334122, 0.68418790405674834, 0.70847887796190545, 0.73363226321599551, 0.75967867832520353, 0.78664982885576173, 0.81457854602823976, 0.84349882668206377, 0.87344587465890866, 0.90445614365534355, 0.93656738159688513, 0.969818676587485, 1.0042505044903745, 1.0399047781981905, 1.0768248986523594, 1.1150558076738351, 1.1546440426695133, 1.1956377932809006, 1.2380869600440081, 1.2820432151318641, 1.3275600652535944, 1.3746929167866273, 1.4234991432213153, 1.4740381550000654, 1.5263714718359951, 1.5805627975991423, 1.6366780978613906, 1.6947856801944969, 1.7549562773189731, 1.8172631332050293, 1.8817820922303938, 1.9485916915035324, 2.0177732564646584, 2.0894109998808901, 2.1635921243560827, 2.2404069284800938, 2.3199489167467102, 2.4023149133740307, 2.4876051801658536, 2.5759235385575425, 2.6673774959949301, 2.762078376800098, 2.8601414576833353, 2.9616861080662242, 3.0668359353866661, 3.1757189355627351, 3.2884676487984921, 3.4052193209214345, 3.5261160704479786, 3.6513050615803064, 3.780938683345211, 3.9151747350929473, 4.0541766185819386, 4.1981135368831177, 4.3471607003460608, 4.5014995398775941, 4.6613179277925214, 4.8268104065052952, 4.9981784253410035, 5.175630585753952, 5.3593828952523292, 5.5496590303380522, 5.7466906087818588, 5.9507174715650875, 6.1619879748313364, 6.3807592922033907, 6.6072977278334157, 6.8418790405674859, 7.0847887796190561, 7.3363226321599546, 7.5967867832520346, 7.866498288557616, 8.1457854602823971, 8.4349882668206373, 8.7344587465890875, 9.0445614365534368]
117+
flux: [25276.821244674764, 28722.723407923262, 30360.473049322729, 33984.736292474241, 35854.454907360159, 37721.888451513369, 41792.101597201276, 45450.508563093113, 48323.974753436923, 52677.150482905265, 53810.476756526761, 58355.292747301173, 60130.332759471909, 65066.09090594935, 69045.858337315658, 72437.898974947966, 80728.676179699396, 87002.521650256065, 91084.890656927688, 98323.28542422819, 105006.17676779242, 114322.08986347441, 126171.54613173187, 139218.61294605921, 151521.41609409908, 161409.6958591649, 189259.48264800446, 210587.69758960878, 242242.73125719716, 268099.91882613447, 301397.72323530738, 340189.43392865575, 386431.19630181114, 439606.75079753564, 490872.55069392739, 559056.15358305548, 598054.68010369327, 642867.30642169702, 682214.88617398019, 735770.18390646728, 789062.37807587918, 843435.70552473445, 892067.84175600309, 932069.58753616642, 960829.52260059584, 977838.59389104007, 991797.75904680265, 1000337.9175057374, 982396.29545647511, 966139.49995927035, 951371.50707512058, 957975.67004690482, 970869.50658444816, 979478.07901000162, 986052.74143295304, 967911.34861546499, 896279.74583482195, 829475.87333898549, 779461.92206302506, 748939.9422760657, 720475.04177324544, 693928.58029561746, 673063.46634146478, 654417.17264869832, 637027.57674385677, 620809.98140205501, 605685.3977078927, 559996.66818095162, 517387.20610928442, 477649.47917235375, 440589.94203344069, 406028.09366374754, 373795.59819970129, 343735.46505153348, 320318.31796563335, 300587.22403512523, 282185.93979786616, 265024.84053124895, 249020.34191900652, 234094.49294804141, 220174.5962426459, 207192.8539869253, 195086.037710865, 183795.1803317109, 173265.28895073067, 163445.07700651177, 154286.71448023061, 145745.59493625097, 137780.11826340586, 130351.48805879033, 129879.12053379402, 129879.12053379402, 129879.12053379402, 129879.12053379402, 129879.12053379402, 129879.12053379402, 129879.12053379402, 129879.12053379402, 129879.12053379402, 129879.12053379402]
118+

0 commit comments

Comments
 (0)