-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #192 from h2020charisma/oranchada-related-fix
multiple updates , use position instead of center, nexusformat notebook
- Loading branch information
Showing
14 changed files
with
1,152 additions
and
497 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,7 @@ dependencies: | |
- pip | ||
- pip: | ||
- jupyter | ||
- ploomber | ||
- pytest | ||
- -e . | ||
|
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Run with | ||
|
||
> ploomber build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
file: "../../../src/ramanchada2/auxiliary/spectra/datasets2/ICV_BW532/PST02_iRPlus532_Z050_100_2500msx5.txt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import ramanchada2 as rc2 | ||
import pyambit.datamodel as mx | ||
from pyambit.nexus_spectra import spe2ambit | ||
import nexusformat.nexus.tree as nx | ||
import uuid | ||
import os.path | ||
|
||
# + tags=["parameters"] | ||
upstream = ["read_preprocess"] | ||
product = None | ||
sample = None | ||
laser_wl = None | ||
instrument_make = None | ||
instrument_model = None | ||
data_provider = None | ||
# - | ||
|
||
spe_raw = rc2.spectrum.from_chada(upstream["read_preprocess"]["cha"], dataset="/raw") | ||
spe_raw.plot() | ||
|
||
prefix = "DEMO" | ||
|
||
substances = [] | ||
substance = mx.SubstanceRecord(name=sample, publicname=sample, ownerName="TEST") | ||
substance.i5uuid = "{}-{}".format(prefix, uuid.uuid5(uuid.NAMESPACE_OID, sample)) | ||
protocol_application = spe2ambit( | ||
x=spe_raw.x, | ||
y=spe_raw.y, | ||
meta=spe_raw.meta, | ||
instrument=(instrument_make, instrument_model), | ||
wavelength=laser_wl, | ||
provider=data_provider, | ||
investigation="My experiment", | ||
sample=sample, | ||
sample_provider="CHARISMA", | ||
prefix=prefix, | ||
endpointtype="RAW_DATA", | ||
unit="cm-1", | ||
) | ||
substance.study = [protocol_application] | ||
substances.append(substance) | ||
|
||
output_file = product["nxs"] | ||
|
||
substances = mx.Substances(substance=substances) | ||
nxroot = nx.NXroot() | ||
nxroot.attrs["pyambit"] = "0.0.1" | ||
nxroot.attrs["file_name"] = os.path.basename(output_file) | ||
substances.to_nexus(nxroot) | ||
|
||
print(nxroot.tree) | ||
nxroot.save(output_file, mode="w") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
tasks: | ||
|
||
- source: read_preprocess.py | ||
product: | ||
nb: "products/read_preprocess.ipynb" | ||
cha: "products/spectrum.cha" | ||
params: | ||
input_file: "{{file}}" | ||
|
||
- source: nexusformat.py | ||
product: | ||
nb: "products/nexusformat.ipynb" | ||
nxs: "products/spectrum.nxs" | ||
params: | ||
sample: "PST" | ||
laser_wl: 532 | ||
instrument_make: "BWTek" | ||
instrument_model: "iRamanPlus" | ||
data_provider: "ICV" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import os.path | ||
import ramanchada2 as rc2 | ||
|
||
# + tags=["parameters"] | ||
upstream = [] | ||
product = None | ||
input_file = None | ||
# - | ||
|
||
file = os.path.abspath(input_file) | ||
|
||
# load spectrum from file system | ||
spe = rc2.spectrum.from_local_file(file) | ||
spe.plot() | ||
|
||
if os.path.isfile(product["cha"]): | ||
os.remove(product["cha"]) | ||
|
||
spe.write_cha(product["cha"], dataset="/raw") | ||
|
||
spe.subtract_baseline_rc1_snip(niter=40) | ||
spe.write_cha(product["cha"], dataset="/baseline") |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.