Code Monkey home page Code Monkey logo

igorwriter's People

Contributors

t-onoz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

jbuencuerpo

igorwriter's Issues

Support for Unicode

It may be good to add Unicode support for wave names, data units, text wave elements, etc.
It seems newer (Igor7 or later) waves contain info on encoding which we can modify with SetWaveTextEncoding, but I need to find out where in the .ibw files it is stored (that is not documented in Igor TN#003).

No Issue just wanted to contribute Pandas saving function

Function for saving Pandas Dataframe

I have found your package very useful as I work mostly in Python but my boss wants everything plotted in Igor Pro. I have much of my data in pandas dataframes and so I have written a function that saves the dataframe as either .itx or .ibw files.

Function

When save_pd() is passed a Pandas DataFrame df ( if as_ibw = False ) it saves the DataFrame as .itx file with the name name that is passed as a string and each column being a different Igor wave. or it save each column as individual .ibw file ( if as_ibw = True).

def save_pd(df, name=None, as_ibw = False):
    #If no name specified then take the name of the DataFrame
    if not name:
        name =[x for x in globals() if globals()[x] is df][0]
    with open("./{0}.itx".format(name),'w') as fp:
        for column in df.columns:
            #Igor does not accept waves named 'time
            igor_wave_name = 'times' if 'time' in column else column
            #The conversion to np.array then IgorWave5 and then saving is all done here as either .ibw or .itx
            if as_ibw:
                exec("IgorWave5(np.asarray(df.{0}),'{1}_{2}').save('./{1}_{2}.ibw')".format(column,name,igor_wave_name))
            else:
                exec("IgorWave5(np.asarray(df.{0}),'{1}_{2}').save_itx(fp)".format(column,name,igor_wave_name))

The dependancy is of course pandas (for df.columns).
It would be great to see a function like this added to the IgorWave5 class.

Please email me if there is anything that you want to discuss: [email protected]

Setting dimension labels

Hi,
I'm trying to write a script for internal use that takes numpy arrays and creates some .ibw files that can be loaded in Igor Pro and used for analysis. However, the pre-existing Igor pipeline requires a parameter table from which values are grabbed using DimensionLabels. It would be great to be able to set these labels to the IgorWave in Python similar to how .set_dimscale already works.

Q's are: Is this already possible? And if not, would this be possible to implement? If you have some pointer's I'm happy to give it a go myself.

Numpy arrays containing strings

Sometimes you might need to create a numpy array containing strings (here using dtype=object, but other dtypes such as dtype('<U16') could also work), but this fails on line 287-288 in __init__.py with the following line:

if a.dtype.type not in TYPES:
     raise TypeError('Unsupported dtype: %r' % a.dtype.type)

A simple work is to include np.object_: '/T', in TYPES and ITX_TYPES

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.