Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@arm61
Copy link
Collaborator

@arm61 arm61 commented Aug 11, 2023

Here is the OFFSPEC data reduction example.

@arm61
Copy link
Collaborator Author

arm61 commented Aug 11, 2023

That final fix might break the Amor notebook (to fix it is only necessary to have a dimension='dectector_id' in the save_ort call).

"id": "7636a6b0-6d9e-40e6-9169-a29fa18e4b21",
"metadata": {},
"source": [
"## Comparison with Mantid\n",
Copy link
Member

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.

Copy link
Collaborator Author

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.

Copy link
Member

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",
Copy link
Member

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.

Copy link
Collaborator Author

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?

Copy link
Member

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.

principal_investigator="Joshanial F. K. Cooper",
contact_email="[email protected]",
end_time=datetime.now(),
end_time='2020-11-26T18:19:24',
Copy link
Member

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",
Copy link
Member

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?

@jl-wynen
Copy link
Member

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.

@jl-wynen jl-wynen requested a review from nvaytet September 14, 2023 14:08
environment.yml Outdated
- pip:
- orsopy==1.0.1
- sphinx-autodoc-typehints==1.18.3
- scitacean==23.7.0
Copy link
Member

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. "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"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",
Copy link
Member

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)

Comment on lines 123 to 125
" name=\"Joshanial F. K. Cooper\",\n",
" affiliation=\"ISIS Neutron and Muon Source\",\n",
" contact=\"[email protected]\",\n",
Copy link
Member

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?

Copy link
Member

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.

Copy link
Member

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)."?

Copy link
Member

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.

Copy link
Member

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",
Copy link
Member

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?

Copy link
Member

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?

Copy link
Member

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",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"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",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"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",
Copy link
Member

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",
Copy link
Member

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",
Copy link
Member

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?

Copy link
Member

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?

@jl-wynen jl-wynen merged commit 1925c0a into main Sep 27, 2023
@jl-wynen jl-wynen deleted the offspec-collimated-arm branch September 27, 2023 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants