-
Couldn't load subscription status.
- Fork 3
Offspec data reduction #194
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
Conversation
|
That final fix might break the Amor notebook (to fix it is only necessary to have a |
| "id": "7636a6b0-6d9e-40e6-9169-a29fa18e4b21", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "## Comparison with Mantid\n", |
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 don't think this should be part of the docs. We want to show how to do things with Scipp and not with Mantid. That being said, the comparison is valuable.
You can leave it here for now. We'll hopefully move this to a better place.
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.
The aim was to show that the reduction is as good as the mantid version.
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 don't see this as the purpose of the documentation. We want to show people how to use it. Investigations about how well it works are separate.
| "outputs": [], | ||
| "source": [ | ||
| "reduced_mantid_remote = client.get_dataset(reduced_mantid_up.pid)\n", | ||
| "reduced_mantid_local = client.download_files(reduced_mantid_remote, target=\".\")\n", |
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.
Is this really necessary? For one, it pollutes the file system with the mantid file. And also, we can use the file directly and don't have to make a roundtrip through SciCat.
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.
What part do you mean here? Specifically the downloading it?
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.
Specifically the downloading it?
Yes, in particular the file. But there is also no reason, IMHO, to download the dataset.
Co-authored-by: Jan-Lukas Wynen <[email protected]>
Co-authored-by: Jan-Lukas Wynen <[email protected]>
Co-authored-by: Jan-Lukas Wynen <[email protected]>
| principal_investigator="Joshanial F. K. Cooper", | ||
| contact_email="[email protected]", | ||
| end_time=datetime.now(), | ||
| end_time='2020-11-26T18:19:24', |
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.
Mainly for future reference, scitacean parses this as UTC unless you specify a timezone. If this is the time at ISIS, then this is coincidentally (colonialism?) correct.
| "reduced.input_datasets.append(direct_beam_local.pid)\n", | ||
| "reduced.name = 'Reduced reflectometry data from QCS sample'\n", | ||
| "reduced.used_software = [f'scipp-{sc.__version__}']\n", | ||
| "reduced.used_software = ['scipp-23.01.1']\n", |
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.
Why did you revert this again?
Co-authored-by: Jan-Lukas Wynen <[email protected]>
|
I removed the SciCat stuff and comparison with Mantid. We will handle SciCat through Sciline when migrating the workflow. And the Mantid comparison is useful but shouldn't be part of the workflow example. We have a it in the history now and can recreate it later when we have a Sciline pipeline. |
environment.yml
Outdated
| - pip: | ||
| - orsopy==1.0.1 | ||
| - sphinx-autodoc-typehints==1.18.3 | ||
| - scitacean==23.7.0 |
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.
remove?
| "\n", | ||
| "In this example, we load some test data provided by the `offspec` package.\n", | ||
| "We need a sample measurement (the sample is `Air | Si(790 A) | Cu(300 A) | SiO2`) and a direct beam measurement.\n", | ||
| "The latter was obtained by positioning the detector directly in the beam of incident neutrons and moving the sample out of the way and gives an estimate for the ISIS pulse structure as a function of time-of-flight. " |
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.
| "The latter was obtained by positioning the detector directly in the beam of incident neutrons and moving the sample out of the way and gives an estimate for the ISIS pulse structure as a function of time-of-flight. " | |
| "The latter was obtained by positioning the detector directly in the beam of incident neutrons and moving the sample out of the way.\n", | |
| "It gives an estimate for the ISIS pulse structure as a function of time-of-flight. " |
| }, | ||
| "outputs": [], | ||
| "source": [ | ||
| "sample_full = scn.load_with_mantid(offspec.data.sample(), mantid_args={\"LoadMonitors\": True})\n", |
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.
We should move away from loading with Mantid (cf #208)
| " name=\"Joshanial F. K. Cooper\",\n", | ||
| " affiliation=\"ISIS Neutron and Muon Source\",\n", | ||
| " contact=\"[email protected]\",\n", |
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.
Maybe we should have a fake name and email for our online docs?
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 probably right for data protection reasons. But on the other hand, we need to somehow acknowledge the owner of the data. I'm not sure how to do both.
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 can add a line in the notebooks (at the start or the end) saying something like "The data used in this notebook was kindly provided by Joshanial F. K. Cooper (ISIS, STFC)."?
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.
Then we can keep the name here as well. Are you concerned about the email address? I can try removing it if ORSO lets me or use a dummy otherwise.
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.
Yeah, it was mostly the email.
| "### Correcting the position of detector pixels\n", | ||
| "\n", | ||
| "The pixel positions in the sample data must be modified to account for the transformation on the detector by rotating it around the sample. \n", | ||
| "We can achieve this by understanding that the sample has been rotated by some amount (as discussed above) and that sample measurement has the specular peak at the same pixel as the direct beam measurement has the direct beam. \n", |
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.
as discussed above
Not sure which discussion you are refering to?
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.
Seems to have been removed. Do we need a discussion of is this comment (minus the ref to a discussion) enough?
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.
Not sure, I would say removing "(as discussed above)" would be ok?
| }, | ||
| "outputs": [], | ||
| "source": [ | ||
| "sample_mon_wav -= sc.values(sample_mon_wav['wavelength', 15 * sc.units.angstrom].mean())\n", |
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.
| "sample_mon_wav -= sc.values(sample_mon_wav['wavelength', 15 * sc.units.angstrom].mean())\n", | |
| "sample_mon_wav -= sc.values(sample_mon_wav['wavelength', 15 * sc.units.angstrom:].mean())\n", |
| "outputs": [], | ||
| "source": [ | ||
| "sample_mon_wav -= sc.values(sample_mon_wav['wavelength', 15 * sc.units.angstrom].mean())\n", | ||
| "direct_beam_mon_wav -= sc.values(direct_beam_mon_wav['wavelength', 15 * sc.units.angstrom].mean())\n", |
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.
| "direct_beam_mon_wav -= sc.values(direct_beam_mon_wav['wavelength', 15 * sc.units.angstrom].mean())\n", | |
| "direct_beam_mon_wav -= sc.values(direct_beam_mon_wav['wavelength', 15 * sc.units.angstrom:].mean())\n", |
| }, | ||
| "outputs": [], | ||
| "source": [ | ||
| "sample_mon_wav_sum = sample_mon_wav['wavelength', 2 * sc.units.angstrom:15 * sc.units.angstrom].sum()\n", |
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.
Can we define some wav_min and wav_max to avoid repeating 15 * sc.units.angstrom many times?
| "source": [ | ||
| "sample_mon_wav_sum = sample_mon_wav['wavelength', 2 * sc.units.angstrom:15 * sc.units.angstrom].sum()\n", | ||
| "direct_beam_mon_wav_sum = direct_beam_mon_wav['wavelength', 2 * sc.units.angstrom:15 * sc.units.angstrom].sum()\n", | ||
| "sample_norm = sample_wav / sc.values(sample_mon_wav_sum)\n", |
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.
Are we using sc.values because of the variance broadcast issue? If so, we should add a note here, so that we don't forget to update it to something better in the future (e.g. Simon's "upper bound" method)
| "sample_norm_hist.coords.set_aligned('theta', False)\n", | ||
| "direct_beam_norm_hist = direct_beam_norm.hist(\n", | ||
| " wavelength=sc.geomspace(\n", | ||
| " dim=\"wavelength\", start=2, stop=14, num=100, unit=sc.units.angstrom\n", |
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.
Define edges once and store in a variable?
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.
We could also consider putting sample and direct beam in a DataGroup?
Here is the OFFSPEC data reduction example.