Giter VIP home page Giter VIP logo

brixs's People

Contributors

cwgaldino avatar fefelipefe avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

brixs's Issues

implement inspect() and metadata() methods in Spectrum.

The idea is as follow:

def inspect(self):
    """Plots data in a inspection window.

    If the mouse pointer hovers over a datapoint, the index of this datapoint is showed.
    """
    raise NotImplementedError('This is not implemented yet.')


def metadata(self):
    """Opens a windows with all user defined variables for inspection.
    """
    raise NotImplementedError('This is not implemented yet.')

calculate_shifts

Error using calculate_shifts from PhotonEvents.

Code:

%matplotlib widget
# %% ------------------------- Standard Imports --------------------------- %% #
from RIXSMacros import *

# matplotlib
br.set_cycler(n='tab10', ls=2)

# %% ------------------------- Initial definitions ------------------------ %% #
TOP  = Path(r'.')
RIXS = TOP/'RIXS'
XAS  = TOP/'XAS'
# out  = Path(r'S:\')

prefix = 'Cr_'

# %% step-by-step (FELIPE)
if True:
    pe = br.ADRESS.read(RIXS/'Cr_0038_d1.h5', type_='pe')
    pe.binning(nbins=(6000, 20))

    # 
    br.figure()
    pe.plot(color='black')
    pe.reduced.plot()

    # 
    br.figure()
    pe.plot(color='black')
    pe.reduced.vlines(color='red')

    # 
    br.figure()
    _ = pe.reduced.columns.plot()

    # 
    pe.calculate_shifts()
    popt, model, R2 = pe.calculated_shifts.polyfit()

    x = np.linspace(min(pe.x), max(pe.x), 100)
    fit = br.Spectrum(x=x, y=model(x))

    # 
    br.figure()
    pe.calculated_shifts.plot(marker='o')
    fit.plot()


    # 
    br.figure()
    pe.plot(color='black')

    offset = pe.reduced.columns[0].x[np.argmax(pe.reduced.columns[0].y)]
    plt.plot(fit.x, -fit.y+offset, color='red')

    # 
    pe.set_shifts(p=popt)

    # 
    br.figure()
    pe.plot(color='black')

Error:

     _ = pe.reduced.columns.plot()
     # 
---> pe.calculate_shifts()
     popt, model, R2 = pe.calculated_shifts.polyfit()
     x = np.linspace(min(pe.x), max(pe.x), 100)
File brixs/brixs.py:2199, in PhotonEvents.calculate_shifts(self, axis)
   2196 mode = 'cc'
   2197 assert self.reduced is not None, 'Image was not binned yet.\nPlease, use PhotonEvents.binning()'
-> 2199 self.reduced.calculate_shifts(axis=axis, mode=mode)
   2201 if mode in cc:
   2202     if axis == 0:

File brixs/brixs.py:1417, in Image.calculate_shifts(self, axis, mode, limit_size)
   1415 if mode in cc:
   1416     self._calculated_shifts = ss.calculated_shifts
-> 1417     self.calculated_shifts.factor = ss.step
   1418 else:
   1419     self._calculated_shifts = ss.calculated_shifts

File brixs/brixs.py:2768, in Spectrum.factor(self, value)
   2766 @factor.setter
   2767 def factor(self, value):
-> 2768     self.set_factor(value)

File brixs/brixs.py:3345, in Spectrum.set_factor(self, value, type_)
   3342     self._factor = value
   3344 # special
-> 3345 self.peaks.set_factors(value=value, type_=type_)

File brixs/peaks.py:826, in Peaks.set_factors(self, value, type_)
    824     self['area'].value = self['area'].value * self.factor**-1
    825 if value != 1:
--> 826     self['amp'].value  = self['amp'].value * value
    827     self['area'].value = self['area'].value * value
    828 self._factor = value

File brixs/peaks.py:149, in Peaks.__getitem__(self, name)
    147         name = name + f'_{index}'
    148     else:
--> 149         raise ValueError(f'This list has multiple peaks, please, identify the peak number')
    150 if name in self:
    151     return super().__getitem__(name)

ValueError: This list has multiple peaks, please, identify the peak number

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.