Skip to content
Snippets Groups Projects
Commit 4ce72c21 authored by Francois POLACK's avatar Francois POLACK
Browse files

Testing: Added NXfmt_test.py, a short script to generate an example of NeXus

         file from a HeightMap object
parent a75e6dd4
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
'''
This file is part of the Superflat project
Test program of Metrology NeXus format
'''
__author__ = "François Polack"
__copyright__ = "2023, Superflat-PCP project"
__email__ = "superflat-pcp@synchrotron-soleil.fr"
__version__ = "0.1.0"
import sys
sys.path.append('D:\projets\ProjetsPython\Superflat')
#import numpy as np
import heightmap
from pathlib import Path
def fiducial_list(fname):
if fname=='Stitching_SESO_ALBA_ZOOMx1_7':
flist=dict()
flist['C1']=dict(unit='pixel', mark='cross', coordinates=(253,605))
flist['C2']=dict(unit='pixel', mark='cross', coordinates=(1514.5,606))
flist['C3']=dict(unit='pixel', mark='cross', coordinates=(1515.5,22.5))
flist['C4']=dict(unit='pixel', mark='cross', coordinates=(884,21))
flist['C5']=dict(unit='pixel', mark='cross', coordinates=(254,21.5))
flist['P1']=dict(unit='pixel', mark='pit', coordinates=(83,310))
flist['P2']=dict(unit='pixel', mark='pit', coordinates=(1637,312))
flist['Pc1']=dict(unit='pixel', mark='circle', coordinates=(108,312))
flist['Pc2']=dict(unit='pixel', mark='circle', coordinates=(1662,314))
return flist
else :
return None
if __name__ == "__main__":
hmp = heightmap.load('') # create a new HeightMap object
if hmp== None :
print("No file loaded")
exit(-1)
fname=Path(hmp.filepath).stem
outfile='nexus/NXmetro_format_example2'
hmp.fiducial_list=fiducial_list(fname)
hmp.reference_point=dict(name='C1', coordinates=(0.005, -0.015 ), unit='meter')
hmp.sample_drawing="fiducials.svg"
hmp.nexus_save(outfile)
......@@ -101,7 +101,7 @@ class ROItool(ToolBase):
class Viewer2D(fig.Figure):
"""" A Figure with a special button in the toolbar and methods for drawing a rectangular ROI area"""
"""" A Figure with ability of showing values at pointer position in the display area"""
def __init__(self,*args, **kwargs):
super().__init__(*args,**kwargs)
self.selectaxes=None
......
......@@ -83,6 +83,7 @@ class Crms_fig(fig.Figure):
self.mvcid=0 #mouse move connection
self.brcid=0 # button release connection
self.epsilon= 5
self.alphcoeff=2
def set_linemode(self, state) :
self.linemode=state
......@@ -101,7 +102,7 @@ class Crms_fig(fig.Figure):
for p in self.vertices:
print(p)
for ind in range(len(self.vertices)-1):
print("2alpha", 2 *(np.log(self.vertices[ind+1][1])-np.log(self.vertices[ind][1]))/
print(self.alphcoeff, "X alpha=", self.alphcoeff *(np.log(self.vertices[ind+1][1])-np.log(self.vertices[ind][1]))/
(np.log(self.vertices[ind+1][0])-np.log(self.vertices[ind][0])))
self.lineedit=False
self.canvas.set_cursor(1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment