beamlines

package
v0.3.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2024 License: MIT Imports: 12 Imported by: 0

README

Beamlines FOXDEN/CHESS module

This repository contains codebase related to CHESS beamlines. It defines all structures of beamlines and provide necessary functions to deal with them.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SchemaRenewInterval time.Duration

SchemaRenewInterval setup interal to update schema cache

View Source
var SkipKeys = []string{"User", "Date", "Description", "SchemaName", "SchemaFile", "Schema"}

SkipKeys

Functions

func SchemaFileName added in v0.0.1

func SchemaFileName(sname string) string

SchemaFileName obtains schema file name from schema name

func SchemaName added in v0.0.1

func SchemaName(fname string) string

SchemaName extracts schema name from schema file name

Types

type Common

type Common struct {
	Facility                  string   `json:"Facility"`
	Cycle                     string   `json:"Cycle"`
	PI                        string   `json:"PI"`
	BTR                       string   `json:"BTR"`
	Experiments               string   `json:"Experiments"`
	Beamline                  []string `json:"Beamline"`
	StaffScientist            []string `json:"StaffScientist"`
	BeamlineFundingPartner    []string `json:"BeamlineFundingPartner"`
	Alignment                 bool     `json:"Alignment"`
	DataLocationRaw           string   `json:"DataLocationRaw"`
	Detectors                 []string `json:"Detectors"`
	CESRConditions            []string `json:"CESRConditions"`
	ExperimentType            []string `json:"ExperimentType"`
	Technique                 []string `json:"Technique"`
	SampleType                []string `json:"SampleType"`
	SampleName                string   `json:"SampleName"`
	Calibration               bool     `json:"Calibration"`
	DataLocationMeta          string   `json:"DataLocationMeta"`
	DataLocationReduced       string   `json:"DataLocationReduced"`
	DataLocationScratch       string   `json:"DataLocationScratch"`
	DataLocationBeamtimeNotes string   `json:"DataLocationBeamtimeNotes"`
}

Common schema definition

type ID1A3

type ID1A3 struct {
	Facility                       string   `json:"Facility"`
	Cycle                          string   `json:"Cycle"`
	PI                             string   `json:"PI"`
	BTR                            string   `json:"BTR"`
	Experiments                    string   `json:"Experiments"`
	Beamline                       []string `json:"Beamline"`
	StaffScientist                 []string `json:"StaffScientist"`
	BeamlineFundingPartner         []string `json:"BeamlineFundingPartner"`
	Affiliation                    []string `json:"Affiliation"`
	Alignment                      bool     `json:"Alignment"`
	EnergyScan                     bool     `json:"EnergyScan"`
	EnergyScanDocument             string   `json:"EnergyScanDocument"`
	DataLocationRaw                string   `json:"DataLocationRaw"`
	DataLocationMeta               string   `json:"DataLocationMeta"`
	DataLocationReduced            string   `json:"DataLocationReduced"`
	DataLocationBeamtimeNotes      string   `json:"DataLocationBeamtimeNotes"`
	CESRConditions                 []string `json:"CESRConditions"`
	InsertionDevice                []string `json:"InsertionDevice"`
	Monochromator                  []string `json:"Monochromator"`
	Focusing                       []string `json:"Focusing"`
	BeamMode                       []string `json:"BeamMode"`
	BeamEnergy                     float64  `json:"BeamEnergy"`
	BeamlineSetupDocument          string   `json:"BeamlineSetupDocument"`
	Detectors                      []string `json:"Detectors"`
	ExperimentType                 []string `json:"ExperimentType"`
	Technique                      []string `json:"Technique"`
	InSitu                         bool     `json:"InSitu"`
	MechanicalTest                 bool     `json:"MechanicalTest"`
	MechanicalTestType             []string `json:"MechanicalTestType"`
	MechanicalLoadFrame            []string `json:"MechanicalLoadFrame"`
	MechanicalGrips                []string `json:"MechanicalGrips"`
	SupplementaryTechnique         []string `json:"SupplementaryTechnique"`
	Furnace                        []string `json:"Furnace"`
	SampleName                     string   `json:"SampleName"`
	Calibration                    bool     `json:"Calibration"`
	SampleSpaceGroup               string   `json:"SampleSpaceGroup"`
	SampleGeometry                 string   `json:"SampleGeometry"`
	SampleMatPedHeatTreatment      string   `json:"SampleMatPedHeatTreatment"`
	SampleMatPedProcessingRoute    string   `json:"SampleMatPedProcessingRoute"`
	MaterialSafetyHazardousSamples bool     `json:"MaterialSafetyHazardousSamples"`
	SampleState                    []string `json:"SampleState"`
}

ID1A3 schema definition

type ID3A

type ID3A struct {
	Facility                       string    `json:"Facility"`
	Cycle                          string    `json:"Cycle"`
	PI                             string    `json:"PI"`
	BTR                            string    `json:"BTR"`
	Experiments                    string    `json:"Experiments"`
	Beamline                       []string  `json:"Beamline"`
	StaffScientist                 []string  `json:"StaffScientist"`
	BeamlineFundingPartner         []string  `json:"BeamlineFundingPartner"`
	Affiliation                    []string  `json:"Affiliation"`
	Alignment                      bool      `json:"Alignment"`
	EnergyScan                     bool      `json:"EnergyScan"`
	UndulatorScan                  bool      `json:"UndulatorScan"`
	BeamSlitHorizontalSize         float64   `json:"BeamSlitHorizontalSize"`
	BeamSlitVerticalSize           float64   `json:"BeamSlitVerticalSize"`
	BeamSlitHorizontalPosition     float64   `json:"BeamSlitHorizontalPosition"`
	BeamSlitVerticalPosition       float64   `json:"BeamSlitVerticalPosition"`
	PreSlitHorizontalSize          float64   `json:"PreSlitHorizontalSize"`
	PreSlitVerticalSize            float64   `json:"PreSlitVerticalSize"`
	PreSlitHorizontalPosition      float64   `json:"PreSlitHorizontalPosition"`
	PreSlitVerticalPosition        float64   `json:"PreSlitVerticalPosition"`
	GuardSlitHorizontalSize        float64   `json:"GuardSlitHorizontalSize"`
	GuardSlitVerticalSize          float64   `json:"GuardSlitVerticalSize"`
	GuardSlitHorizontalPosition    float64   `json:"GuardSlitHorizontalPosition"`
	GuardSlitVerticalPosition      float64   `json:"GuardSlitVerticalPosition"`
	DataLocationRaw                string    `json:"DataLocationRaw"`
	DataLocationMeta               string    `json:"DataLocationMeta"`
	DataLocationReduced            string    `json:"DataLocationReduced"`
	DataLocationScratch            string    `json:"DataLocationScratch"`
	DataLocationBeamtimeNotes      string    `json:"DataLocationBeamtimeNotes"`
	CESRConditions                 []string  `json:"CESRConditions"`
	BeamEnergy                     float64   `json:"BeamEnergy"`
	Monochromator                  []string  `json:"Monochromator"`
	Focusing                       []string  `json:"Focusing"`
	AttenMaterial                  []string  `json:"AttenMaterial"`
	AttenThickness                 float64   `json:"AttenThickness"`
	EnergyFoil                     []string  `json:"EnergyFoil"`
	Detectors                      []string  `json:"Detectors"`
	ExperimentType                 []string  `json:"ExperimentType"`
	Technique                      []string  `json:"Technique"`
	InSitu                         bool      `json:"InSitu"`
	MechanicalTest                 bool      `json:"MechanicalTest"`
	MechanicalTestType             []string  `json:"MechanicalTestType"`
	MechanicalLoadFrame            []string  `json:"MechanicalLoadFrame"`
	MechanicalGrips                []string  `json:"MechanicalGrips"`
	SupplementaryTechnique         []string  `json:"SupplementaryTechnique"`
	Furnace                        []string  `json:"Furnace"`
	Processing                     []string  `json:"Processing"`
	Calibration                    bool      `json:"Calibration"`
	ReferenceCalibrantSampleName   string    `json:"ReferenceCalibrantSampleName"`
	ReferenceCalibrantScanNumber   int32     `json:"ReferenceCalibrantScanNumber"`
	ReferenceEnergyScanSampleName  string    `json:"ReferenceEnergyScanSampleName"`
	ReferenceEnergyScanNumber      int32     `json:"ReferenceEnergyScanNumber"`
	SampleName                     string    `json:"SampleName"`
	SampleCommonName               string    `json:"SampleCommonName"`
	SampleChemicalFormula          string    `json:"SampleChemicalFormula"`
	SampleUnitCell                 []float64 `json:"SampleUnitCell"`
	SampleSpaceGroup               int64     `json:"SampleSpaceGroup"`
	SampleGeometry                 string    `json:"SampleGeometry"`
	SampleMatPedHeatTreatment      string    `json:"SampleMatPedHeatTreatment"`
	SampleMatPedProcessingRoute    string    `json:"SampleMatPedProcessingRoute"`
	MaterialSafetyHazardousSamples bool      `json:"MaterialSafetyHazardousSamples"`
}

ID3A schema

type ID4B

type ID4B struct {
	Facility                       string   `json:"Facility"`
	Cycle                          string   `json:"Cycle"`
	PI                             string   `json:"PI"`
	BTR                            string   `json:"BTR"`
	Experiments                    string   `json:"Experiments"`
	Beamline                       []string `json:"Beamline"`
	StaffScientist                 []string `json:"StaffScientist"`
	BeamlineFundingPartner         []string `json:"BeamlineFundingPartner"`
	Alignment                      bool     `json:"Alignment"`
	EnergyScan                     bool     `json:"EnergyScan"`
	UndulatorScan                  bool     `json:"UndulatorScan"`
	SpotSize                       string   `json:"SpotSize"`
	DataLocationRaw                string   `json:"DataLocationRaw"`
	DataLocationMeta               string   `json:"DataLocationMeta"`
	DataLocationReduced            string   `json:"DataLocationReduced"`
	DataLocationBeamtimeNotes      string   `json:"DataLocationBeamtimeNotes"`
	DataLocationScientificData     string   `json:"DataLocationScientificData"`
	CESRConditions                 []string `json:"CESRConditions"`
	BeamEnergy                     string   `json:"BeamEnergy"`
	InsertionDevice                []string `json:"InsertionDevice"`
	Monochromator                  []string `json:"Monochromator"`
	EnergyFoil                     []string `json:"EnergyFoil"`
	Detectors                      []string `json:"Detectors"`
	ExperimentType                 []string `json:"ExperimentType"`
	InSitu                         bool     `json:"InSitu"`
	Technique                      []string `json:"Technique"`
	CryoCooler                     []string `json:"CryoCooler"`
	Cryostream11Kto500K            string   `json:"Cryostream11Kto500K"`
	Cryostat3Kto300K               string   `json:"Cryostat3Kto300K"`
	ScanEdgeK                      string   `json:"ScanEdgeK"`
	ScanEdgeL                      string   `json:"ScanEdgeL"`
	Calibration                    []string `json:"Calibration"`
	ReferenceCalibrantSampleName   string   `json:"ReferenceCalibrantSampleName"`
	SampleType                     []string `json:"SampleType"`
	SampleName                     string   `json:"SampleName"`
	SampleChemicalFormula          string   `json:"SampleChemicalFormula"`
	SampleThermalGradient          bool     `json:"SampleThermalGradient"`
	SampleUnitCell                 string   `json:"SampleUnitCell"`
	SampleDSpacing                 float64  `json:"SampleDSpacing"`
	SampleMass                     string   `json:"SampleMass"`
	SampleSpaceGroup               string   `json:"SampleSpaceGroup"`
	SampleMatPedHeatTreatment      string   `json:"SampleMatPedHeatTreatment"`
	SampleMatPedProcessingRoute    string   `json:"SampleMatPedProcessingRoute"`
	SampleState                    []string `json:"SampleState"`
	SamplePreparationDate          string   `json:"SamplePreparationDate"`
	MaterialSafetyHazardousSamples bool     `json:"MaterialSafetyHazardousSamples"`
	HolderLabel                    string   `json:"HolderLabel"`
}

ID4B schema definition

type Lite

type Lite struct {
	Facility                  string   `json:"Facility"`
	Cycle                     string   `json:"Cycle"`
	PI                        string   `json:"PI"`
	BTR                       string   `json:"BTR"`
	Experiments               string   `json:"Experiments"`
	Beamline                  []string `json:"Beamline"`
	StaffScientist            []string `json:"StaffScientist"`
	BeamlineFundingPartner    []string `json:"BeamlineFundingPartner"`
	Affiliation               []string `json:"Affiliation"`
	Alignment                 bool     `json:"Alignment"`
	DataLocationRaw           string   `json:"DataLocationRaw"`
	Detectors                 []string `json:"Detectors"`
	CESRConditions            []string `json:"CESRConditions"`
	ExperimentType            []string `json:"ExperimentType"`
	Technique                 []string `json:"Technique"`
	SampleType                []string `json:"SampleType"`
	SampleName                string   `json:"SampleName"`
	Calibration               bool     `json:"Calibration"`
	DataLocationMeta          string   `json:"DataLocationMeta"`
	DataLocationReduced       string   `json:"DataLocationReduced"`
	DataLocationScratch       string   `json:"DataLocationScratch"`
	DataLocationBeamtimeNotes string   `json:"DataLocationBeamtimeNotes"`
}

Lite schema definition

type Schema added in v0.0.1

type Schema struct {
	FileName       string                  `json:"fileName`
	Map            map[string]SchemaRecord `json:"map"`
	WebSectionKeys map[string][]string     `json:"webSectionKeys"`
	Verbose        int                     `json:"verbose"`
}

Schema provides structure of schema file

func (*Schema) Keys added in v0.0.1

func (s *Schema) Keys() ([]string, error)

Keys provides list of keys of the schema

func (*Schema) Load added in v0.0.1

func (s *Schema) Load() error

Load loads given schema file

func (*Schema) MandatoryKeys added in v0.0.1

func (s *Schema) MandatoryKeys() ([]string, error)

MandatoryKeys provides list of madatory keys of the schema

func (*Schema) OptionalKeys added in v0.0.1

func (s *Schema) OptionalKeys() ([]string, error)

OptionalKeys provides list of optional keys of the schema

func (*Schema) SectionKeys added in v0.0.1

func (s *Schema) SectionKeys() (map[string][]string, error)

SectionKeys provides map of section keys

func (*Schema) Sections added in v0.0.1

func (s *Schema) Sections() ([]string, error)

Sections provides list of schema sections

func (*Schema) String added in v0.0.1

func (s *Schema) String() string

Load loads given schema file

func (*Schema) Validate added in v0.0.1

func (s *Schema) Validate(rec map[string]any) error

Validate validates given record against schema

type SchemaKeys added in v0.0.1

type SchemaKeys map[string]string

SchemaKeys represents full collection of schema keys across all schemas

type SchemaManager added in v0.0.1

type SchemaManager struct {
	Map     map[string]*SchemaObject
	Verbose int
}

SchemaManager holds current map of MetaData schema objects

func (*SchemaManager) Load added in v0.0.1

func (m *SchemaManager) Load(fname string) (*Schema, error)

Schema returns either cached schema map or load it from provided file

func (*SchemaManager) String added in v0.0.1

func (m *SchemaManager) String() string

Schema returns either cached schema map or load it from provided file

type SchemaObject added in v0.0.1

type SchemaObject struct {
	Schema   *Schema
	LoadTime time.Time
}

SchemaObject holds current MetaData schema

type SchemaRecord added in v0.0.1

type SchemaRecord struct {
	Key         string `json:"key"`
	Type        string `json:"type"`
	Optional    bool   `json:"optional"`
	Multiple    bool   `json:"multiple"`
	Section     string `json:"section"`
	Value       any    `json:"value"`
	Placeholder string `json:"placeholder"`
	Description string `json:"description"`
}

SchemaRecord provide schema record structure

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL