Skip to content

Conversation

@rowlesmr
Copy link
Collaborator

@rowlesmr rowlesmr commented Jun 6, 2023

EDIT: Lots of things have changed. Jump to the bottom for the current version.

.

Will close #133. Also applicable to #132.

This PR enhances PD_CALIBRATION by providing a category key based on the diffractogram_id to which the calibration applies, and a dataitem to record the diffractogram_id of the reference diffraction pattern from which the calibration was made.

@rowlesmr
Copy link
Collaborator Author

Question:
Both _pd_calibration.diffractogram_id and _pd_calibration.ref_diffractogram_id are defined as

    _name.linked_item_id          '_pd_diffractogram.id'
    _type.purpose                 Link

Does this mean that if neither of these is given a value, they take on the value of _pd_diffractogram.id if it is given in the same data block?

eg:

data_aDiffractionPattern
	_pd_diffractogram.id de14a39d-0d2b-44d5-b830-522b8c68f441 

	_pd_calibration.conversion_eqn          "E = 50000 + 100 * ch#"
	_pd_calibration.special_details         "Looks like the best fit"
	# _pd_calibration.diffractogram_id      takes the value of _pd_diffractogram.id from above?
	# _pd_calibration.ref_diffractogram_id  takes the value of _pd_diffractogram.id from above?

	loop_
	_pd_data.point_id
	_pd_meas.detector_id
	_pd_proc.energy_detection
	_pd_meas.counts_total
	a   0    50000    1234
	b   1    50100    1434
	c   2    50200    1457
	#...

The intent is that _pd_calibration.diffractogram_id is the diff_id of the diffraction pattern to which the calibration is being applied, and _pd_calibration.ref_diffractogram_id is the diff_id of the diffraction pattern from where the calibration was calibrated.

Would _pd_calibration.ref_diffractogram_id be better defined as

    # _name.linked_item_id          '_pd_diffractogram.id' #not this at all
    _type.purpose                 Encode

?

If the calibration were determined by some other method than a reference diffraction pattern, then I don't want to have a value for ref_diff_id. But, then again, a diffraction pattern to which a calibration is applied, then becomes a secondary reference pattern, so...

@rowlesmr
Copy link
Collaborator Author

rowlesmr commented Jun 28, 2025

What's above is the wrong way of doing it.

It should work much in the way PD_CALIB_XCOORD_OVERALL works.

It needs:

  • _pd_calibration.id - key
  • _pd_calibration.conversion_eqn - the equation to calibrate whatever is going on
  • _pd_calibration.diffractogram_id - the diffractogram used to create the calibration

We can find the instrument and detectors from _pd_diffractogram.instr_id

This is basically formalising what it already was.

.

The next question is to whether the key should be changed.

.id - its human-readable, not machine-readble, so a person needs to figure out how to apply it. This is basically what already exists. It does require that you explicitly add an id value.

.diffractogram_id - this would be in lieu of .id. Its human-readable, not machine-readble, so a person needs to figure out how to apply the equation. Allows a lookup of _pd_diffractogram.instr_id to see in an instrument or detector_id has a calibration quation associated with it.

.detector_id - I think this is straying too far into the machine-readble phase with a thing that is fundamentally human-readable.

.something_else - anything else?

@rowlesmr rowlesmr merged commit e5cbf94 into COMCIFS:master Jul 10, 2025
@rowlesmr rowlesmr deleted the Update-`PD_CALIBRATION` branch July 11, 2025 13:37
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.

Update PD_CALIBRATION

2 participants