Skip to content
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

DiffractometerMixin: needs wh() report #397

Closed
prjemian opened this issue Aug 7, 2020 · 3 comments · Fixed by #398
Closed

DiffractometerMixin: needs wh() report #397

prjemian opened this issue Aug 7, 2020 · 3 comments · Fixed by #398
Assignees
Milestone

Comments

@prjemian
Copy link
Contributor

prjemian commented Aug 7, 2020

Need a report like SPEC provides:

1117.KAPPA29ID_sim> wh
H K L =  0  0  1.7345
Alpha = 20  Beta = 20  Azimuth = 90
Omega = 32.952  Lambda = 1.54
  Two Theta       Theta         Chi         Phi     K_Theta       Kappa       K_Phi
  40.000000   20.000000   90.000000   57.048500   77.044988  134.755995  114.093455

also report the sample name

Thanks, @rodolakis, for the suggestion.

@prjemian prjemian added this to the 1.3.4 milestone Aug 7, 2020
@prjemian prjemian self-assigned this Aug 7, 2020
@prjemian
Copy link
Contributor Author

prjemian commented Aug 7, 2020

maybe sample does not fit into this context, could be an option

@prjemian
Copy link
Contributor Author

prjemian commented Aug 7, 2020

prototype:


def wh(diffractometer):
    """
    1117.KAPPA29ID_sim> wh
    H K L =  0  0  1.7345
    Alpha = 20  Beta = 20  Azimuth = 90
    Omega = 32.952  Lambda = 1.54
    Two Theta       Theta         Chi         Phi     K_Theta       Kappa       K_Phi
    40.000000   20.000000   90.000000   57.048500   77.044988  134.755995  114.093455

    https://certif.com/downloads/css_docs/spec_manA4.pdf
    """
    self = diffractometer
    table = pyRestTable.Table()
    table.labels = "term value".split()
    table.addRow(("diffractometer", self.name))
    table.addRow(("wavelength (angstrom)", self.calc.wavelength))
    # TODO: Alpha   angle of incidence with sample surface
    # TODO: Beta    angle of reflection with sample surface
    # TODO: Azimuth ??
    # TODO: Omega   ??

    # table.addRow(("sample name", self.calc.sample.name))
    # for item in "a b c".split():
    #     table.addRow((f"{item} (angstrom)", getattr(self.calc.sample.lattice, item)))
    # for item in "alpha beta gamma".split():
    #     table.addRow((f"{item} (degrees)", getattr(self.calc.sample.lattice, item)))

    for item in "h k l".split():
        table.addRow((item, getattr(self, item).position))

    for item in self.real_positioners:
        table.addRow((item.attr_name, item.position))
    print(table)

example:

In [89]: wh(sixc)                                                                                                                                        
===================== =====
term                  value
===================== =====
diffractometer        sixc 
wavelength (angstrom) 1.54 
h                     0.0  
k                     0.0  
l                     0.0  
mu                    0.0  
omega                 0    
chi                   0    
phi                   0    
gamma                 0    
delta                 0    
===================== =====

prjemian added a commit that referenced this issue Aug 7, 2020
@prjemian
Copy link
Contributor Author

prjemian commented Aug 7, 2020

Make it easier to subclass. Add printing=True kwarg and return the table object. A subclass that overrides could call table = super().wh(printing=False), then call table.addRow() as desired.

prjemian added a commit that referenced this issue Aug 7, 2020
prjemian added a commit that referenced this issue Aug 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant