Draft: fix: CCV markdown tablefmt from pipe to grid for a better rst conversion and pdf display
Description
After we started using textlive/2022, the markdown tables for the retrieved constants are not properly converted in RST and Latex.
This MR fixes the issue by introducing an environment variable NB_CONVERT_RUNNING
and a display_latex_retrieved_constants
function to be able to display_retrieved_constants
in either markdown or latex based on the existence of NB_CONVERT_RUNNING
Changes:
-
NB_CONVERT_RUNNING
environment variable when notebooks are executed usingxfel-calibrate
-
display_retrieved_constants()
method deciding in which format the retrieved constants table should be generated. -
display_latex_retrieved_constants()
method to display a table of retrieved constants in latex. - Update detector notebooks':
-
Jungfrau -
epix100 -
pnCCD -
AGIPD [ ] LPDs-
Gotthard2
How Has This Been Tested?
-
Automated tests.
Relevant Documents (optional)
This is a screenshot for the current issue:
MASTER state
This is how the table looks like in RST files:
+---------+--------------+--------------+--------------+--------------+
| Modules | Noise | Offset | BadPixelsFF | B |
| | | | | adPixelsDark |
+=========+==============+==============+==============+==============+
| AGIPD00 | `2021-07-30 | `2021-07-30 | `2021-07-29 | `2021-07-30 |
| | 21:23 | 21:23 | 17:44 | 21:23 |
| | <https://in. | <https://in. | <https://in. | <https://in. |
| | xfel.eu/cali | xfel.eu/cali | xfel.eu/cali | xfel.eu/cali |
| | bration/cali | bration/cali | bration/cali | bration/cali |
| | bration_cons | bration_cons | bration_cons | bration_cons |
| | tant_version | tant_version | tant_version | tant_version |
| | s//84948>`__ | s//84932>`__ | s//93997>`__ | s//84959>`__ |
+---------+--------------+--------------+--------------+--------------+
| AGIPD01 | `2021-07-30 | `2021-07-30 | `2021-07-29 | `2021-07-30 |
| | 21:23 | 21:23 | 17:44 | 21:23 |
| | <https://in. | <https://in. | <https://in. | <https://in. |
| | xfel.eu/cali | xfel.eu/cali | xfel.eu/cali | xfel.eu/cali |
| | bration/cali | bration/cali | bration/cali | bration/cali |
| | bration_cons | bration_cons | bration_cons | bration_cons |
| | tant_version | tant_version | tant_version | tant_version |
| | s//84942>`__ | s//84930>`__ | s//93977>`__ | s//84954>`__ |
+---------+--------------+--------------+--------------+--------------+
| AGIPD02 | `2021-07-30 | `2021-07-30 | `2021-07-29 | `2021-07-30 |
| | 21:23 < | 21:23 < | 17:44 | 21:23 < |
| | https://in.x | https://in.x | <https://in. | https://in.x |
| | fel.eu/calib | fel.eu/calib | xfel.eu/cali | fel.eu/calib |
| | ration/calib | ration/calib | bration/cali | ration/calib |
| | ration_const | ration_const | bration_cons | ration_const |
| | ant_versions | ant_versions | tant_version | ant_versions |
| | //202755>`__ | //202750>`__ | s//93983>`__ | //202760>`__ |
+---------+--------------+--------------+--------------+--------------+
| AGIPD03 | `2021-07-30 | `2021-07-30 | `2021-07-29 | `2021-07-30 |
| | 21:23 < | 21:23 < | 17:44 | 21:23 < |
| | https://in.x | https://in.x | <https://in. | https://in.x |
| | fel.eu/calib | fel.eu/calib | xfel.eu/cali | fel.eu/calib |
| | ration/calib | ration/calib | bration/cali | ration/calib |
| | ration_const | ration_const | bration_cons | ration_const |
| | ant_versions | ant_versions | tant_version | ant_versions |
| | //202748>`__ | //202747>`__ | s//93979>`__ | //202751>`__ |
+---------+--------------+--------------+--------------+--------------+
| AGIPD04 | `2021-07-30 | `2021-07-30 | `2021-07-29 | `2021-07-30 |
| | 21:23 < | 21:23 < | 17:44 | 21:23 < |
| | https://in.x | https://in.x | <https://in. | https://in.x |
| | fel.eu/calib | fel.eu/calib | xfel.eu/cali | fel.eu/calib |
| | ration/calib | ration/calib | bration/cali | ration/calib |
| | ration_const | ration_const | bration_cons | ration_const |
| | ant_versions | ant_versions | tant_version | ant_versions |
| | //202762>`__ | //202756>`__ | s//93975>`__ | //202764>`__ |
+---------+--------------+--------------+--------------+--------------+
Current Version
Types of changes
- Bug fix (non-breaking change which fixes an issue)
Checklist:
Reviewers
Merge request reports
Activity
assigned to @ahmedk
yes, it looks funny.
This is how it looks in RST.
+---+----------------+----------------+----------------+----------------+ | M | Noise | ThresholdsDark | BadPixelsDark | BadPixelsPC | | o | | | | | | d | | | | | | u | | | | | | l | | | | | | e | | | | | | s | | | | | +===+================+================+================+================+ | A | `2021-08-05 | `2021-08-05 | `2021-08-05 | `2021-08-09 | | G | 16:24 <h | 16:24 <h | 16:24 <h | 14:45 <h | | I | ttps://in.xfel | ttps://in.xfel | ttps://in.xfel | ttps://in.xfel | | P | .eu/calibratio | .eu/calibratio | .eu/calibratio | .eu/calibratio | | D | n/calibration_ | n/calibration_ | n/calibration_ | n/calibration_ | | 0 | constant_versi | constant_versi | constant_versi | constant_versi | | 0 | ons//87560>`__ | ons//87577>`__ | ons//87568>`__ | ons//92116>`__ | +---+----------------+----------------+----------------+----------------+ | A | `2021-08-05 | `2021-08-05 | `2021-08-05 | `2021-08-09 | | G | 16:24 <h | 16:24 <h | 16:24 <h | 14:45 <h | | I | ttps://in.xfel | ttps://in.xfel | ttps://in.xfel | ttps://in.xfel | | P | .eu/calibratio | .eu/calibratio | .eu/calibratio | .eu/calibratio | | D | n/calibration_ | n/calibration_ | n/calibration_ | n/calibration_ | | 0 | constant_versi | constant_versi | constant_versi | constant_versi | | 1 | ons//87567>`__ | ons//87580>`__ | ons//87574>`__ | ons//92102>`__ | +---+----------------+----------------+----------------+----------------+ | A | `2021-08-05 | `2021-08-05 | `2021-08-05 | `2021-08-09 | | G | 16:24 <h | 16:24 <h | 16:24 <h | 14:45 <h | | I | ttps://in.xfel | ttps://in.xfel | ttps://in.xfel | ttps://in.xfel | | P | .eu/calibratio | .eu/calibratio | .eu/calibratio | .eu/calibratio | | D | n/calibration_ | n/calibration_ | n/calibration_ | n/calibration_ | | 0 | constant_versi | constant_versi | constant_versi | constant_versi | | 2 | ons//87563>`__ | ons//87579>`__ | ons//87571>`__ | ons//92042>`__ | +---+----------------+----------------+----------------+----------------+
It is not displayed properly anyway in the notebook itself. So it is still WIP.
Edited by Karim Ahmed+---------+--------------+--------------+--------------+--------------+ | Modules | BadPi | Offset10Hz | Rela | Bad | | | xelsDark10Hz | | tiveGain10Hz | PixelsFF10Hz | +=========+==============+==============+==============+==============+ | JNGFR03 | `2021-09-19 | `2021-09-19 | `2021-04-14 | `2021-04-14 | | | 13:27 < | 13:27 < | 20:05 | 20:05 | | | https://in.x | https://in.x | <https://in. | <https://in. | | | fel.eu/calib | fel.eu/calib | xfel.eu/cali | xfel.eu/cali | | | ration/calib | ration/calib | bration/cali | bration/cali | | | ration_const | ration_const | bration_cons | bration_cons | | | ant_versions | ant_versions | tant_version | tant_version | | | //102593>`__ | //102591>`__ | s//72819>`__ | s//72820>`__ | +---------+--------------+--------------+--------------+--------------+
So I know the problem, but not the solution.
In this example, RelativeGain10Hz and BadPixelsFF10Hz will be displayed fine.
if the table looks like this
+---------+--------------+--------------+--------------+--------------+ | Modules | BadPi | Offset10Hz | Rela | Bad | | | xelsDark10Hz | | tiveGain10Hz | PixelsFF10Hz | +=========+==============+==============+==============+==============+ | JNGFR03 | `2021-09-19 | `2021-09-19 | `2021-04-14 | `2021-04-14 | | | 13:27 | 13:27 | 20:05 | 20:05 | | | <https://in.x| <https://in.x| <https://in. | <https://in. | | | fel.eu/calib | fel.eu/calib | xfel.eu/cali | xfel.eu/cali | | | ration/calib | ration/calib | bration/cali | bration/cali | | | ration_const | ration_const | bration_cons | bration_cons | | | ant_versions | ant_versions | tant_version | tant_version | | | //102593>`__ | //102591>`__ | s//72819>`__ | s//72820>`__ | +---------+--------------+--------------+--------------+--------------+
Then all the tables will look fine. The difference is the the link is enclosed with the
<
>
on the same line row.Edited by Karim Ahmed
223 223 " constant_names += [\"BadPixelsFF10Hz\", \"RelativeGain10Hz\"]\n", 224 224 " jf_metadata = jf_cal.metadata(calibrations=constant_names) \n", 225 225 " # Display retrieved calibration constants timestamps\n", 226 " jf_cal.display_markdown_retrieved_constants(metadata=jf_metadata)\n", 226 " jf_cal.display_latex_retrieved_constants(metadata=jf_metadata)\n", This function is another alternative that shows a proper table in the pdf like expected, however, the Latex table in the notebook will look like this:
I have tested with html as well but it doesnt get rendered into the pdf
Edited by Karim Ahmed
added 1 commit
- bce3f16b - feat: switch between latex and markdown based on environment variable NB_CONVERT_RUNNING
added 29 commits
-
bce3f16b...ffd7d60a - 25 commits from branch
master
- dbb13c9f - fix: CCV markdown tablefmt from pipe to grid for a better rst conversion and pdf display
- 630ecf15 - latex table instead of markdown
- 0235d15d - clean up the latex function
- 2fd52349 - feat: switch between latex and markdown based on environment variable NB_CONVERT_RUNNING
Toggle commit list-
bce3f16b...ffd7d60a - 25 commits from branch
added 1 commit
- 238b0303 - fix: update the rest of correction notebook withe new function