[Matplotlib-users] cartesian/polar problem

2011-06-04 Thread Nick Veitch
I have a small problem which I suspect can be solved in an easy and
elegant way, and it is simply lack of sleep/stupidity preventing me
from finding it.

I have a number of line drawings comprised of cartesian points. I need
to project them onto a sphere (they are drawings of constellations, so
I need to project them onto an imaginary celestial sphere) and convert
the points into sphercal co-ordinates.
I *can* map the points to a sphere, that's no problem. But obviously,
when I do this they become distorted. What I want to do is find out
what the points should be to get an undistorted view - i.e the mapping
that will produce a projection so the points match the cartesian
version. Obviously, I realise this depends on the projection used etc,
but basically, a small amount of distortion is fine. I am sure there
must be a simple way to achieve this, but I can't seem to manage it.


---
Nick Veitch

--
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Discover what all the cheering's about.
Get your free trial download today. 
http://p.sf.net/sfu/quest-dev2dev2 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Not able to access CSV file:

2011-06-04 Thread Daniel Mader
Hi,

have you tried the examples that I have provided a couple days ago,
see below? I cannot see why it should not work. These are the absolute
basics that you need to understand.

Btw, there is no need to use csv2rec unless you want/need column or row headers.

Here's a full script that does what you want. Now, please take the
time and work through the example that I have provided. In case you
need further help, please don't start a new thread but reply to this
one.

Best regards,
Daniel

# -*- coding: utf-8 -*-

import matplotlib.pyplot as plt
import pylab
import scipy

datafile1 = 'ch1_s1_lrr.csv'
datafile2 = 'ch1_s1_baf.csv'

## create dummy data
data = pylab.rand(1,12)
pylab.savetxt(datafile1, data, delimiter=';')
pylab.savetxt(datafile2, data, delimiter=';')

## load data and transpose
a1 = pylab.loadtxt(datafile1, comments='#', delimiter=';').T
print 'loading', datafile1
b1 = pylab.loadtxt(datafile2, comments='#', delimiter=';').T
print 'loading', datafile2

## axis limits
#v1 = [0,98760,0,1]
#v2 = [0,98760,-2,2]
v1 = [0,1]
v2 = [-2,2]

plt.close('all')
plt.figure()

plt.subplot(2,1,1)
#plt.axis(v2)
plt.ylim(v2)
#plt.plot(a1, 'r.')
for i in range(6):
plt.plot(a1[i])

plt.subplot(2,1,2)
#plt.axis(v1)
plt.ylim(v1)
#plt.plot(b1, 'b.')

## need masked arrays here
## http://physics.nmt.edu/~raymond/software/python_notes/paper003.html
m = b1 >= 0.05
b1masked = scipy.ma.array(b1,mask=m)
## print first two cols
print b1masked[0:2]

for i in range(6,12):
plt.plot(b1masked[i])

plt.show()


2011/6/3 Karthikraja Velmurugan :
> import matplotlib.pyplot as plt
> import pylab
> datafile1 = 'ch1_s1_lrr.csv'
> datafile2 = 'ch1_s1_baf.csv'
>
> a1 = pylab.loadtxt(datafile1, comments='#', delimiter=';')
> b1 = pylab.loadtxt(datafile2, comments='#', delimiter=';')
>
> v1 = [0,98760,0,1]
> v2 = [0,98760,-2,2]
>
> plt.figure(1)
>
> plt.subplot(2,1,1)
> print 'loading', datafile1
> plt.axis(v2)
> plt.plot(a1, 'r.')
>
> plt.subplot(2,1,2)
> print 'loading', datafile2
> plt.axis(v1)
> plt.plot(b1, 'b.')
>
> plt.show()



2011/5/30 Daniel Mader :
> Hi,
>
> the content of the CSV is stored as an array after reading. You can
> simply access rows and columns like in Matlab:
>
> firstrow = a1[0]
> firstcol = a1.T[0]
>
> The .T transposes the array.
>
> The second element of the third row would be
>
> elem32 = a1[2][1]
> which is equivalent to
> elem32 = a1[2,1]
>
> A range of e.g. rows 3 to 6 is
> range36 = a1[2:6]
>
> Please have a look here for getting started with scipy/numpy:
> http://pages.physics.cornell.edu/~myers/teaching/ComputationalMethods/python/arrays.html
> and
> http://www.scipy.org/NumPy_for_Matlab_Users
>
> Hope this helps,
> Daniel
>
> 2011/5/27 Karthikraja Velmurugan :
>> Hello Daniel,
>>
>> The code you have given is simple and works fab. Thank you very much. But I
>> wasn't able to find an example which accesses the columns of a CSV files
>> when I import data through "datafile="filename.csv"" option. It will be
>> great if you could help with accessing individual columns. What excatly I am
>> looking for is to access individual coulmns (of the same CSV file), do
>> calculations using the two coumnsĀ and plot them into seperate subplots of
>> the same graph.
>> I modified the script a lil bit. Please find it below:
>>
>> import matplotlib.pyplot as plt
>> import pylab
>> datafile1 = 'ch1_s1_lrr.csv'
>> datafile2 = 'ch1_s1_baf.csv'
>> a1 = pylab.loadtxt(datafile1, comments='#', delimiter=';')
>> b1 = pylab.loadtxt(datafile2, comments='#', delimiter=';')
>> v1 = [0,98760,0,1]
>> v2 = [0,98760,-2,2]
>> plt.figure(1)
>> plt.subplot(4,1,1)
>> print 'loading', datafile1
>> plt.axis(v2)
>> plt.plot(a1, 'r.')
>> plt.subplot(4,1,2)
>> print 'loading', datafile2
>> plt.axis(v1)
>> plt.plot(b1, 'b.')
>> plt.show()
>>
>> Thank you very much in advance for your time and suggestions.
>>
>> Karthik

--
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Discover what all the cheering's about.
Get your free trial download today. 
http://p.sf.net/sfu/quest-dev2dev2 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Plotting in loop problem, not refreshing

2011-06-04 Thread Armin G

Hi everyone ,

I know this has been posted several times now, But I could not understand
qietly why my simple code does not work. 
here is the code:
http://old.nabble.com/file/p31775254/LinearConvection.py LinearConvection.py  

The problem in detail: In the solver loop ( the outer loop) , The plot
should be updated after every time step, but it stays the same.

I'm a complete noob in python, so excuse my simple communicating language.

thanks alot,
Armin
-- 
View this message in context: 
http://old.nabble.com/Plotting-in-loop-problem%2C-not-refreshing-tp31775254p31775254.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Discover what all the cheering's about.
Get your free trial download today. 
http://p.sf.net/sfu/quest-dev2dev2 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Plotting in loop problem, not refreshing

2011-06-04 Thread Joe Kington
Your code should work (and does on my system)...

What backend, version of matplotlib, OS, etc are you running?

On Sat, Jun 4, 2011 at 4:54 PM, Armin G  wrote:

>
> Hi everyone ,
>
> I know this has been posted several times now, But I could not understand
> qietly why my simple code does not work.
> here is the code:
> http://old.nabble.com/file/p31775254/LinearConvection.pyLinearConvection.py
>
> The problem in detail: In the solver loop ( the outer loop) , The plot
> should be updated after every time step, but it stays the same.
>
> I'm a complete noob in python, so excuse my simple communicating language.
>
> thanks alot,
> Armin
> --
> View this message in context:
> http://old.nabble.com/Plotting-in-loop-problem%2C-not-refreshing-tp31775254p31775254.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
>
> --
> Simplify data backup and recovery for your virtual environment with
> vRanger.
> Installation's a snap, and flexible recovery options mean your data is
> safe,
> secure and there when you need it. Discover what all the cheering's about.
> Get your free trial download today.
> http://p.sf.net/sfu/quest-dev2dev2
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Discover what all the cheering's about.
Get your free trial download today. 
http://p.sf.net/sfu/quest-dev2dev2 ___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Exact semantics of ion()??

2011-06-04 Thread Eric Firing


https://github.com/efiring/matplotlib/blob/faq_show_draw/doc/faq/usage_faq.rst

Eric, Ben,

See if the section "What is interactive mode" makes sense to you.  I 
have just added it to a feature branch (which includes some other faq 
madifications, mainly moving the backend section from installation to 
usage), but have not yet generated a pull request.  It doesn't go into 
every detail, or into the underlying machinery.  It is intended to 
provide just enough understanding to clear up user-level confusion about 
interactive mode, show, and draw, and let most relatively new users get 
on with their work.

Eric

--
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Discover what all the cheering's about.
Get your free trial download today. 
http://p.sf.net/sfu/quest-dev2dev2 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users