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

update pyWinspec #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions winspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ def _read(self):
self._data = np.rollaxis(self._data, 2, 1)

# flip data
if all([self.reversed == True, self.adc == '100 KHz']):
if all([self.reversed == True, self.adc_rate == '100 KHz']):
pass
elif any([self.reversed == True, self.adc == '100 KHz']):
elif any([self.reversed == True, self.adc_rate == '100 KHz']):
self._data = self._data[:, ::-1, :]
log.debug('flipped data because of nonstandard ADC setting ' +\
'or reversed setting')
Expand Down Expand Up @@ -193,11 +193,20 @@ def _make_axes(self):
xcalib_valid = struct.unpack('?', xcalib.calib_valid)

if xcalib_valid:
xcalib_order, = struct.unpack('>B', xcalib.polynom_order) # polynomial order
px = xcalib.polynom_coeff[:xcalib_order+1]
px = np.array(px[::-1]) # reverse coefficients to use numpy polyval
pixels = np.arange(1, self.header.xdim + 1)
px = np.polyval(px, pixels)
if self.xaxis_label=='Raman shift [cm -1]': # for Raman spectra
xcalib_order, = struct.unpack('>B', xcalib.polynom_order) # polynomial order
px = xcalib.polynom_coeff[:xcalib_order+1]
px = np.array(px[::-1]) # reverse coefficients to use numpy polyval
pixels = np.arange(1, self.header.xdim + 1)
px = np.polyval(px, pixels)
px = (1/xcalib.laser_position-1/px)*(10**7) # calibrate to wavenumber

else:
xcalib_order, = struct.unpack('>B', xcalib.polynom_order) # polynomial order
px = xcalib.polynom_coeff[:xcalib_order+1]
px = np.array(px[::-1]) # reverse coefficients to use numpy polyval
pixels = np.arange(1, self.header.xdim + 1)
px = np.polyval(px, pixels)
else:
px = np.arange(1, self.header.xdim + 1)

Expand Down