[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orekit Users] Passing 2D arrays to orekit functions in python
- To: orekit-users@orekit.org
- Subject: Re: [Orekit Users] Passing 2D arrays to orekit functions in python
- From: "Petrus Hyvönen" <petrus.hyvonen@gmail.com>
- Date: Wed, 26 Dec 2012 09:47:38 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; bh=q9S5h/1FQYYvugaLkbI2Nx6jsXIhJQY4ga4CpKBtp1Q=; b=RLvc+sczX+hFo6fQDAfcH185P3v8OecMqHHgr1JKukv9J9yomremhrMIdZNGo/7Yam dcSWvAys08QPTb4HbvVV69JckO9QGlmMALidS0O5fgT6IY1a+XVXyvwJg+K2IptOe6PQ 8H8BlwhH6KIJu9dQCPTCMyPKPxuOp8QiH33qz30EUpkaxEnTy4VsIaVeYsko1tilvDYl kG86UYQ/jckdzDXPGeKm28Tz7LfbHCweF1/NufIfExdEi1Ux09z3YVjRBSyuMPr9+5BE dHq/heNneGDclqXPucrpkaCxskZ9mYMjfBDrxDU9jKsh6cytOn57zTR04R1nF7sZtLQP 1A+w==
- In-reply-to: <sympa.1356494475.7171.267@orekit.org>
- References: <sympa.1356494475.7171.267@orekit.org>
Hi Piyush,
Not sure about the 2D arrays, I don't think I have tried it. I think it should be done with the JArray interface. I guess you already seen the JCC page http://lucene.apache.org/pylucene/jcc/features.html which has some info about arrays.
Note that a python generator will create a python list of java objects, you somehow need to make a java list of the objects also. For example, for a 1-D List I use
...
state = [eck_prop.propagate(tt) for tt in t]
...
fitter.toTLE(Arrays.asList(state), positionTolerance, positionOnly, withBStar)
But I think the JArray should be usable directly somehow.
Best Regards
/petrus
On 26 dec 2012, at 05:06, <piyush@gps.caltech.edu> wrote:
> ###Code
>
> PotlProvider = orekit.GravityFieldFactory.getProvider()
> Cnm = PotlProvider.getC()
> Snm = PotlProvider.getS()
> orb_prop.addForceModel(orekit.DSSTCentralBody(w, ae, mu, Cnm, Snm)
>
>
> Orekit doesn't seem to like the format of Cnm and Snm which are of type
> JArray_object. Assuming it was looking for a list of lists, I converted the
> JArray_object to a 2D list as
>
> Cnm_l = [[orekit.JArray_double.cast_(kkk)[0]] for kk in Cnm]
> Snm_l = [[orekit.JArray_double.cast_(kkk)[0]] for kk in Snm]
>
>
> It still doesn't seem to like the inputs. How do I pass 2D arrays to orekit
> functions in python?
>
> Thanks
> Piyush