diff --git a/.gitignore b/.gitignore index 7ee73c07..03dfce03 100644 --- a/.gitignore +++ b/.gitignore @@ -83,3 +83,6 @@ target/ #Ipython Notebook .ipynb_checkpoints + +# Testing artifacts +TES-Shadow-timing.png diff --git a/sirepo_bluesky/tests/SIREPO_SRDB_ROOT/user/testuser/shadow/00000002/sirepo-data.json b/sirepo_bluesky/tests/SIREPO_SRDB_ROOT/user/testuser/shadow/00000002/sirepo-data.json index 21c52717..92e6a25d 100644 --- a/sirepo_bluesky/tests/SIREPO_SRDB_ROOT/user/testuser/shadow/00000002/sirepo-data.json +++ b/sirepo_bluesky/tests/SIREPO_SRDB_ROOT/user/testuser/shadow/00000002/sirepo-data.json @@ -371,7 +371,7 @@ }, { "_super": "_MISALIGNED_ELEMENT", - "alpha": 90, + "alpha": 0, "axmaj": 0, "axmin": 0, "cil_ang": 0, @@ -432,14 +432,7 @@ "z_rot": 0 }, { - "alpha": "270", "id": 12, - "position": 56.972, - "title": "Reset Orientation", - "type": "emptyElement" - }, - { - "id": 13, "position": 57.142, "title": "W9", "type": "watch" @@ -536,16 +529,14 @@ }, "simulation": { "documentationUrl": "", - "folder": "/", - "isExample": false, + "folder": "/TES", "istar1": 567656, - "lastModified": 1631629560300, + "lastModified": 1639159814414, "name": "TES (from SRW)", "notes": "", "npoint": 100000, - "outOfSessionSimulationId": "", "simulationId": "00000002", - "simulationSerial": 1631629560313007, + "simulationSerial": 1639159814410583, "sourceType": "bendingMagnet" }, "sourceDivergence": { @@ -588,7 +579,7 @@ "etap_y": 0, "number_of_bunches": 1 }, - "watchpointReport13": { + "watchpointReport12": { "_super": "_INTENSITY_REPORT", "aspectRatio": "1", "colorMap": "grayscale", @@ -634,15 +625,16 @@ }, "rsmanifest": { "image": { - "git_commit": "8e71e61c04795a52dc6ff309158d58eab263d943", + "git_commit": "a8b1ef5210b2f2595e3182f8676d321148d04004", "git_remote_origin_url": "https://github.com/radiasoft/sirepo", "name": "radiasoft/sirepo", "type": "docker", - "uri": "https://registry.hub.docker.com/radiasoft/sirepo:20210831.151744", - "version": "20210831.151744" + "uri": "https://registry.hub.docker.com/radiasoft/sirepo:20211123.203943", + "version": "20211123.203943" }, "version": "20190612.150000" }, "simulationType": "shadow", - "version": "20210831.151122" + "state": "completed", + "version": "20211123.165730" } diff --git a/sirepo_bluesky/tests/SIREPO_SRDB_ROOT/user/testuser/srw/00000002/sirepo-data.json b/sirepo_bluesky/tests/SIREPO_SRDB_ROOT/user/testuser/srw/00000002/sirepo-data.json index 87898c81..750d5f1e 100644 --- a/sirepo_bluesky/tests/SIREPO_SRDB_ROOT/user/testuser/srw/00000002/sirepo-data.json +++ b/sirepo_bluesky/tests/SIREPO_SRDB_ROOT/user/testuser/srw/00000002/sirepo-data.json @@ -68,9 +68,9 @@ "nvy": 0.6119182833983884, "nvz": -0.7909209912771121, "orientation": "y", - "outframevx": 1, - "outframevy": 0, - "outoptvx": 0, + "outframevx": 1.0, + "outframevy": 0.0, + "outoptvx": 0.0, "outoptvy": 0.9679580305720843, "outoptvz": -0.25111202888553913, "position": 25, @@ -105,7 +105,7 @@ "nvy": -0.6119182833983884, "nvz": -0.7909209912771121, "orientation": "y", - "outframevx": 1, + "outframevx": 1.0, "outframevy": -4.491233240844306e-09, "outoptvx": -3.4747689913268823e-09, "outoptvy": -0.9679580305720843, @@ -187,7 +187,7 @@ "verticalOffset": 0 }, { - "autocomputeVectors": "horizontal", + "autocomputeVectors": "vertical", "firstFocusLength": 3.83, "focalLength": 0.17, "grazingAngle": 3.6, @@ -195,15 +195,15 @@ "heightProfileFile": "", "horizontalOffset": 0, "id": 9, - "normalVectorX": 0.9999935200069984, - "normalVectorY": 0, + "normalVectorX": 0, + "normalVectorY": 0.9999935200069984, "normalVectorZ": -0.0035999922240050387, "orientation": "x", "position": 56.972, "sagittalSize": 0.02, "tangentialSize": 0.18, - "tangentialVectorX": -0.0035999922240050387, - "tangentialVectorY": 0, + "tangentialVectorX": 0, + "tangentialVectorY": 0.0035999922240050387, "title": "KBV", "type": "ellipsoidMirror", "verticalOffset": 0 @@ -230,7 +230,7 @@ "copyCharacteristic": "0", "horizontalOffset": 0, "horizontalSize": 20, - "intensityPlotsWidth": "0", + "intensityPlotsWidth": "1000", "maxIntensityLimit": 866043559936, "minIntensityLimit": 335347712000, "notes": "", @@ -251,12 +251,12 @@ "colorMap": "grayscale", "copyCharacteristic": "0", "fieldUnits": 1, - "horizontalOffset": -0.010686666351726604, - "horizontalSize": 27.49833330696589, + "horizontalOffset": 0, + "horizontalSize": 0.01, "intensityPlotsScale": "linear", - "intensityPlotsWidth": "0", - "maxIntensityLimit": 101973504294912, - "minIntensityLimit": 1.4486932542467912e-08, + "intensityPlotsWidth": "1000", + "maxIntensityLimit": 613765463846944800, + "minIntensityLimit": 141136176, "notes": "", "plotScale": "linear", "polarization": 6, @@ -264,9 +264,9 @@ "rotateAngle": 0, "rotateReshape": "1", "useIntensityLimits": "0", - "usePlotRange": "0", - "verticalOffset": 0.0024544383403240404, - "verticalSize": 1.6150204279331715 + "usePlotRange": "1", + "verticalOffset": 0, + "verticalSize": 0.01 }, "beamlineAnimation16": { "_super": "_INTENSITY_REPORT", @@ -275,11 +275,11 @@ "colorMap": "grayscale", "copyCharacteristic": "0", "fieldUnits": 1, - "horizontalOffset": 0.012420863680959453, - "horizontalSize": 0.4814138757223422, + "horizontalOffset": 0, + "horizontalSize": 0.1, "intensityPlotsScale": "linear", - "intensityPlotsWidth": "0", - "maxIntensityLimit": 3861947619475456, + "intensityPlotsWidth": "1000", + "maxIntensityLimit": 3261762983952384, "minIntensityLimit": 0, "notes": "", "plotScale": "linear", @@ -288,9 +288,9 @@ "rotateAngle": 0, "rotateReshape": "1", "useIntensityLimits": "0", - "usePlotRange": "0", - "verticalOffset": -0.0008803255525862233, - "verticalSize": 0.5792542136017271 + "usePlotRange": "1", + "verticalOffset": 0, + "verticalSize": 0.3 }, "brillianceReport": { "brightnessComponent": "k-tuning", @@ -317,6 +317,49 @@ "intensityPlotsWidth": "0", "plotScale": "linear" }, + "coherentModesAnimation": { + "_super": "_INTENSITY_REPORT", + "aspectRatio": "1", + "characteristic": "0", + "colorMap": "grayscale", + "distanceFromSource": 10.5, + "finalPosition": 0, + "horizontalOffset": 0, + "horizontalPointCount": 100, + "horizontalPosition": 0, + "horizontalRange": 20, + "horizontalSize": 1, + "initialPosition": 0, + "intensityPlotsWidth": "0", + "jobRunMode": "parallel", + "maxIntensityLimit": 1e+30, + "method": "1", + "minIntensityLimit": 0, + "notes": "", + "numberOfCoherentModes": 100, + "numberOfMacroElectrons": 1000, + "photonEnergy": 2000, + "plotModesEnd": 100, + "plotModesStart": 1, + "plotScale": "linear", + "polarization": "6", + "precision": 0.01, + "rotateAngle": 0, + "rotateReshape": "1", + "sampleFactor": 0.1, + "samplingMethod": 1, + "sbatchCores": 128, + "sbatchHours": 0.4, + "sbatchProject": "", + "sbatchQueue": "debug", + "useIntensityLimits": "0", + "usePlotRange": "0", + "verticalOffset": 0, + "verticalPointCount": 100, + "verticalPosition": 0, + "verticalRange": 10, + "verticalSize": 1 + }, "electronBeam": { "beamDefinition": "t", "beamSelector": "NSLS-II BM Final", @@ -427,7 +470,7 @@ "copyCharacteristic": "0", "horizontalOffset": 0, "horizontalSize": 20, - "intensityPlotsWidth": "0", + "intensityPlotsWidth": "1000", "maxIntensityLimit": 866043559936, "minIntensityLimit": 335347712000, "notes": "", @@ -475,6 +518,7 @@ "_super": "_INTENSITY_REPORT", "aspectRatio": "1", "calcCoherence": "0", + "coherentModesFile": "", "colorMap": "grayscale", "horizontalOffset": 0, "horizontalPosition": 0, @@ -503,7 +547,8 @@ "verticalPosition": 0, "verticalRange": "0.6", "verticalSize": 1, - "watchpointId": 15 + "watchpointId": 15, + "wavefrontSource": "source" }, "multipole": { "bx": 0, @@ -526,9 +571,9 @@ 1, 0, 0, + 0.3, 1, - 1, - 1, + 0.5, 1, 0, 0, @@ -575,7 +620,7 @@ 0, 0, 1.3, - 20, + 5, 1.5, 5, 0, @@ -654,11 +699,11 @@ 1, 0, 0, + 0.5, 1, + 0.5, 1, - 1, - 1, - 0, + "0", 0, 0, 0, @@ -895,9 +940,9 @@ 0, 0, 1, + 0.5, 1, - 1, - 1, + 0.5, 0, 0, 0, @@ -1018,15 +1063,15 @@ "horizontalPosition": 0, "horizontalRange": 20, "isExample": false, - "lastModified": 1631629938939, + "lastModified": 1639153171802, "name": "TES", "notes": "", - "outOfSessionSimulationId": "", + "outOfSessionSimulationId": "asJGbyAL", "photonEnergy": 2500, "sampleFactor": 0.02, "samplingMethod": "1", "simulationId": "00000002", - "simulationSerial": 1631629938941056, + "simulationSerial": 1639153171798991, "sourceType": "m", "verticalPointCount": 20, "verticalPosition": 0, @@ -1110,12 +1155,12 @@ "colorMap": "grayscale", "copyCharacteristic": "0", "fieldUnits": 1, - "horizontalOffset": -0.010671515692462982, - "horizontalSize": 27.41384476451465, + "horizontalOffset": 0, + "horizontalSize": 0.01, "intensityPlotsScale": "linear", - "intensityPlotsWidth": "0", - "maxIntensityLimit": 1216790134784, - "minIntensityLimit": 2.9112432950451073e-13, + "intensityPlotsWidth": "1000", + "maxIntensityLimit": 613765463846944800, + "minIntensityLimit": 141136176, "notes": "", "plotScale": "linear", "polarization": 6, @@ -1123,9 +1168,9 @@ "rotateAngle": 0, "rotateReshape": "1", "useIntensityLimits": "0", - "usePlotRange": "0", - "verticalOffset": 0.0402537414821956, - "verticalSize": 26.486961895285866 + "usePlotRange": "1", + "verticalOffset": 0, + "verticalSize": 0.01 }, "watchpointReport16": { "_super": "_INTENSITY_REPORT", @@ -1134,11 +1179,11 @@ "colorMap": "grayscale", "copyCharacteristic": "0", "fieldUnits": 1, - "horizontalOffset": 0.012420863680959453, - "horizontalSize": 0.4814138757223422, + "horizontalOffset": 0, + "horizontalSize": 0.1, "intensityPlotsScale": "linear", - "intensityPlotsWidth": "0", - "maxIntensityLimit": 93559738859520, + "intensityPlotsWidth": "1000", + "maxIntensityLimit": 3261762983952384, "minIntensityLimit": 0, "notes": "", "plotScale": "linear", @@ -1147,22 +1192,22 @@ "rotateAngle": 0, "rotateReshape": "1", "useIntensityLimits": "0", - "usePlotRange": "0", - "verticalOffset": 0.0396008964854179, - "verticalSize": 26.057389887404913 + "usePlotRange": "1", + "verticalOffset": 0, + "verticalSize": 0.3 } }, "rsmanifest": { "image": { - "git_commit": "8e71e61c04795a52dc6ff309158d58eab263d943", + "git_commit": "a8b1ef5210b2f2595e3182f8676d321148d04004", "git_remote_origin_url": "https://github.com/radiasoft/sirepo", "name": "radiasoft/sirepo", "type": "docker", - "uri": "https://registry.hub.docker.com/radiasoft/sirepo:20210831.151744", - "version": "20210831.151744" + "uri": "https://registry.hub.docker.com/radiasoft/sirepo:20211123.203943", + "version": "20211123.203943" }, "version": "20190612.150000" }, "simulationType": "srw", - "version": "20210831.151122" + "version": "20211123.165730" } diff --git a/sirepo_bluesky/tests/test_bl_elements_as_ophyd_objs.py b/sirepo_bluesky/tests/test_bl_elements_as_ophyd_objs.py index b58b7f08..c2c0738e 100644 --- a/sirepo_bluesky/tests/test_bl_elements_as_ophyd_objs.py +++ b/sirepo_bluesky/tests/test_bl_elements_as_ophyd_objs.py @@ -92,7 +92,7 @@ def test_shadow_with_run_engine(RE, db, shadow_tes_simulation, num_steps=5): # Check that an average values of the first and last images are right: assert np.allclose(w9_image[0].mean(), 0.0) - assert np.allclose(w9_image[-1].mean(), 0.254417) + assert np.allclose(w9_image[-1].mean(), 0.255665516042795) # Check that the values from the table and averages from the image data are # the same: @@ -185,5 +185,5 @@ def test_beam_statistics_report_and_watchpoint(RE, db, shadow_tes_simulation): w9_bsr_diffs = list(dictdiffer.diff(w9_data_1, bsr_data_5)) assert w9_bsr_diffs == [ ("change", ["models", "beamline", 5, "r_maj"], (10000.0, 50000.0)), - ("change", "report", ("watchpointReport13", "beamStatisticsReport")), + ("change", "report", ("watchpointReport12", "beamStatisticsReport")), ] diff --git a/sirepo_bluesky/tests/test_shadow_det.py b/sirepo_bluesky/tests/test_shadow_det.py index 0043fab6..d257fdf4 100644 --- a/sirepo_bluesky/tests/test_shadow_det.py +++ b/sirepo_bluesky/tests/test_shadow_det.py @@ -95,27 +95,27 @@ def test_shadow_detector_docker_beam_stats_report(RE, db, tmpdir): assert set(beam_statistics_report.keys()) == set(available_fields) - length = 807 + length = 806 for field in available_fields: assert np.array(beam_statistics_report[field]).shape == (length,) assert np.allclose( - np.mean(beam_statistics_report["angxpzp"]), 2.211199214690907e-09 + np.mean(beam_statistics_report["angxpzp"]), -4.045918161185424e-07 ) - assert np.allclose(np.mean(beam_statistics_report["angxz"]), 5.808713898817275e-07) - assert np.allclose(np.mean(beam_statistics_report["s"]), 33.58038661710039) - assert np.allclose(np.mean(beam_statistics_report["sigdix"]), 0.0011698015394024878) - assert np.allclose(np.mean(beam_statistics_report["sigdiz"]), 4.214191655245657e-05) - assert np.allclose(np.mean(beam_statistics_report["sigmax"]), 0.0028331705566906917) + assert np.allclose(np.mean(beam_statistics_report["angxz"]), -3.5334861183335793e-07) + assert np.allclose(np.mean(beam_statistics_report["s"]), 33.55136476426801) + assert np.allclose(np.mean(beam_statistics_report["sigdix"]), 0.000842173185311512) + assert np.allclose(np.mean(beam_statistics_report["sigdiz"]), 0.00012148976606081912) + assert np.allclose(np.mean(beam_statistics_report["sigmax"]), 0.0028351785597699897) assert np.allclose( - np.mean(beam_statistics_report["sigmaxpzp"]), -6.429420083567669e-16 + np.mean(beam_statistics_report["sigmaxpzp"]), -2.317882293458049e-12 ) assert np.allclose( - np.mean(beam_statistics_report["sigmaxz"]), 6.606042728342832e-09 + np.mean(beam_statistics_report["sigmaxz"]), 6.3950298662456295e-09 ) - assert np.allclose(np.mean(beam_statistics_report["sigmaz"]), 0.0004813342804196106) - assert np.allclose(np.mean(beam_statistics_report["x"]), -4.613524631932644e-18) - assert np.allclose(np.mean(beam_statistics_report["xp"]), -5.373988556032905e-19) - assert np.allclose(np.mean(beam_statistics_report["z"]), -1.4755304204693282e-06) - assert np.allclose(np.mean(beam_statistics_report["zp"]), 1.0113398478476434e-10) + assert np.allclose(np.mean(beam_statistics_report["sigmaz"]), 0.0004745737749984571) + assert np.allclose(np.mean(beam_statistics_report["x"]), -1.742303638933747e-17) + assert np.allclose(np.mean(beam_statistics_report["xp"]), -9.277770695212126e-27) + assert np.allclose(np.mean(beam_statistics_report["z"]), -9.476726285805737e-07) + assert np.allclose(np.mean(beam_statistics_report["zp"]), -2.1840296685632408e-08) diff --git a/versioneer.py b/versioneer.py index 64fea1c8..f84667eb 100644 --- a/versioneer.py +++ b/versioneer.py @@ -339,9 +339,8 @@ def get_config_from_root(root): # configparser.NoOptionError (if it lacks "VCS="). See the docstring at # the top of versioneer.py for instructions on writing your setup.cfg . setup_cfg = os.path.join(root, "setup.cfg") - parser = configparser.SafeConfigParser() - with open(setup_cfg, "r") as f: - parser.readfp(f) + parser = configparser.ConfigParser() + parser.read(setup_cfg) VCS = parser.get("versioneer", "VCS") # mandatory def get(parser, name):