Code Monkey home page Code Monkey logo

python-meep-utils's People

Contributors

filipdominec avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-meep-utils's Issues

port to new Python API?

Hi @FilipDominec, now that we have a Python API integrated into the main Meep repo, it would be great if you could port some of the examples to the new high-level API.

(The high-level API is built on top of a SWIG-generated low-level API that mirrors the C++ API. For example, it allows the geometry to be specified in terms of geometric objects — and, recently, GDSII CAD files — with fast subpixel averaging. There are also other new features like mode decomposition.)

Let us know if there is anything we can do to help integrate your efforts. cc @ChristopherHogan, who wrote much of the new Python API.

MPI synchronisation freezes in ca 1% of simulations

There is some deadlock in the python-meep HDF export or sync() function; I am suspicious it is the multiprocessing communication. The simulation silently hangs after the FDTD timestepping is finished and has to be terminated manually.

Observed on Ubuntu 16.04 with openmpi 1.10.2. This never happened to me on previous versions of Ubuntu, although I used a very similar installation procedure for python meep (https://github.com/FilipDominec/python-meep-install).

Currently, I have no clue how to resolve this except for debugging openmpi, which is beyond my capabilities.

passing params on command line

Hello,

Congrats for your work on this!

I'm trying to use cylindrical_cavity.py as a starting point for a simulation.
I ran the corresponding example "ringdown_cylindrical_cavity" with the batch.sh script, and it seems to do fine.
There is however this error message:

File "../cylindrical_cavity.py", line 14, in <module>
    sim_param, model_param = meep_utils.process_param(sys.argv[1:])
ValueError: need more than 0 values to unpack

due to the fact that the python script is called without argument I presume. Anyway, I get some results.

Now when I take the cylindrical_cavity.py script, and try to run it on the command line without argument, I have the same error message, and no output data at all.
If I try to pass some argument on the command line, like ./cylindrical_cavity X=1c Y=1G (X and Y being some string, one of my question is actually very basic: where do I find a parameter list?):

  • if I pass one argument, I get:
Traceback (most recent call last):
  File "./cylindrical_cavity.py", line 14, in <module>
    sim_param, model_param = meep_utils.process_param(sys.argv[1:])
ValueError: need more than 1 value to unpack
  • if I pass 2 arguments, I get:
Traceback (most recent call last):
  File "./cylindrical_cavity.py", line 51, in <module>
    model = HollowCyl_model(**model_param)
TypeError: type object argument after ** must be a mapping, not str

I don't understand those errors, neither am I sure of understanding what the parameters can be and which one are necessary.

also, the incriminated line in cylindrical_cavity.py is:

sim_param, model_param = meep_utils.process_param(sys.argv[1:])

and in meep_utils.py I see:

def process_param(args):#{{{                  %% TODO include this code into Abstr..Model.init()
    """ Parse command-line parameters and store them as attributes of the model """
    model_param = {}
    for namevalue in args:
        name, value = namevalue.split("=")
        model_param[name] = phys_to_float(value)
    return model_param

Isn't it odd that process_param returns only one dic, while its call in cylindrical_cavity.py requests two dics as outputs ? (sim_param and model_param)

'No module named 'meep_mpi'

hi, thanks for your kindness
I run this code and get 'No module named 'meep_mpi' '
but I can't install it correct
how can I deal with it?

Incompatibility with HDF5 lib in Fedora23+

Running example_metamaterial_s_parameters/yslit_xcomparison_d20/batch.sh results in:

Info    Adding material: Gold with 1 oscillator(s); (eps @ 1.00e+12 Hz = -20443.0+281018.263j)
    Simulation time: 3.500000e-10 [s] = 1.049274e-01 time units
Traceback (most recent call last):
  File "../../scatter.py", line 92, in <module>
    for slice_ in slices: slice_.poll(f.time()/c)
  File "/home/dominecf/python-meep-utils/meep_utils.py", line 818, in poll
Traceback (most recent call last):
  File "../../scatter.py", line 92, in <module>
    self.field.output_hdf5(component, self.volume, self.openfile, 1) 
  File "/usr/lib64/python2.7/site-packages/meep_mpi.py", line 4350, in output_hdf5
    for slice_ in slices: slice_.poll(f.time()/c)
  File "/home/dominecf/python-meep-utils/meep_utils.py", line 818, in poll
    self.field.output_hdf5(component, self.volume, self.openfile, 1) 
  File "/usr/lib64/python2.7/site-packages/meep_mpi.py", line 4350, in output_hdf5
    return _meep_mpi.fields_output_hdf5(self, *args)
NotImplementedError: Wrong number or type of arguments for overloaded function 'fields_output_hdf5'.
  Possible C/C++ prototypes are:
    meep::fields::output_hdf5(meep::h5file *,char const *,int,meep::component const *,meep::field_function,void *,int,meep::volume const &,bool,bool)
    meep::fields::output_hdf5(meep::h5file *,char const *,int,meep::component const *,meep::field_function,void *,int,meep::volume const &,bool)
    meep::fields::output_hdf5(meep::h5file *,char const *,int,meep::component const *,meep::field_function,void *,int,meep::volume const &)
    meep::fields::output_hdf5(char const *,int,meep::component const *,meep::field_function,void *,meep::volume const &,meep::h5file *,bool,bool,char const *,bool)
    meep::fields::output_hdf5(char const *,int,meep::component const *,meep::field_function,void *,meep::volume const &,meep::h5file *,bool,bool,char const *)
    meep::fields::output_hdf5(char const *,int,meep::component const *,meep::field_function,void *,meep::volume const &,meep::h5file *,bool,bool)
    meep::fields::output_hdf5(char const *,int,meep::component const *,meep::field_function,void *,meep::volume const &,meep::h5file *,bool)
    meep::fields::output_hdf5(char const *,int,meep::component const *,meep::field_function,void *,meep::volume const &,meep::h5file *)
    meep::fields::output_hdf5(char const *,int,meep::component const *,meep::field_function,void *,meep::volume const &)
    meep::fields::output_hdf5(char const *,int,meep::component const *,meep::field_rfunction,void *,meep::volume const &,meep::h5file *,bool,bool,char const *)
    meep::fields::output_hdf5(char const *,int,meep::component const *,meep::field_rfunction,void *,meep::volume const &,meep::h5file *,bool,bool)
    meep::fields::output_hdf5(char const *,int,meep::component const *,meep::field_rfunction,void *,meep::volume const &,meep::h5file *,bool)
    meep::fields::output_hdf5(char const *,int,meep::component const *,meep::field_rfunction,void *,meep::volume const &,meep::h5file *)
    meep::fields::output_hdf5(char const *,int,meep::component const *,meep::field_rfunction,void *,meep::volume const &)
    meep::fields::output_hdf5(meep::component,meep::volume const &,meep::h5file *,bool,bool,char const *)
    meep::fields::output_hdf5(meep::component,meep::volume const &,meep::h5file *,bool,bool)
    meep::fields::output_hdf5(meep::component,meep::volume const &,meep::h5file *,bool)
    meep::fields::output_hdf5(meep::component,meep::volume const &,meep::h5file *)
    meep::fields::output_hdf5(meep::component,meep::volume const &)
    meep::fields::output_hdf5(meep::derived_component,meep::volume const &,meep::h5file *,bool,bool,char const *)
    meep::fields::output_hdf5(meep::derived_component,meep::volume const &,meep::h5file *,bool,bool)
    meep::fields::output_hdf5(meep::derived_component,meep::volume const &,meep::h5file *,bool)
    meep::fields::output_hdf5(meep::derived_component,meep::volume const &,meep::h5file *)
    meep::fields::output_hdf5(meep::derived_component,meep::volume const &)

numpy.float64 object cannot be interpreted as an index

Simulations in the example_metamaterial_s_parameters/SphereWire_principles terminate with error

Traceback (most recent call last):
  File "../../scatter.py", line 113, in <module>
    eps1=getattr(model, 'mon1eps', 1), eps2=getattr(model, 'mon2eps', 1))               ## enable monitors inside dielectrics
  File "/home/dominecf/python-meep-utils/meep_utils.py", line 902, in get_s_parameters
    Ex1, Hy1, Ex2, Hy2  =  map(lambda x: np.append(x, np.zeros(target_len - len(Ex1))), (Ex1, Hy1, Ex2, Hy2))
  File "/home/dominecf/python-meep-utils/meep_utils.py", line 902, in <lambda>
    Ex1, Hy1, Ex2, Hy2  =  map(lambda x: np.append(x, np.zeros(target_len - len(Ex1))), (Ex1, Hy1, Ex2, Hy2))
TypeError: 'numpy.float64' object cannot be interpreted as an index

However, the FDTD computation finishes correctly, as seen from the plotted E-field curve.

h5utils not compiling with Cygwin

I've been trying to install Meep and Python-Meep on Win7 with Cygwin by following the tutorial linked below:
http://novelresearch.weebly.com/installing-meep-in-windows-8-via-cygwin.html

I've also had a look at two other tutorials:
https://www.mail-archive.com/[email protected]/msg03793.html
http://thread.gmane.org/gmane.comp.science.electromagnetism.meep.general/3428

All three seem to be similar but with small differences. I'm unsure as to which method will best install Meep on a Windows 7 platform. When following the 1st tutorial I didn't get past the first hurdle. When compiling h5utils, the following error was the result:

make[1]: Entering directory '/cygdrive/c/cygwin/usr/local/h5utils-1.12.1'
gcc -DHAVE_CONFIG_H -I. -I/usr/local/include -g -O2 -MT writepng.o -MD -MP -MF .deps/writepng.Tpo -c -o writepng.o writepng.c
writepng.c: In function ‘writepng’:
writepng.c:312:24: error: dereferencing pointer to incomplete type ‘png_struct {aka struct png_struct_def}’
if (setjmp(png_ptr->jmpbuf)) {
^
writepng.c:437:19: error: dereferencing pointer to incomplete type ‘png_info {aka struct png_info_def}’
free(info_ptr->palette);
^
make[1]: *** [Makefile:426: writepng.o] Error 1
make[1]: Leaving directory '/cygdrive/c/cygwin/usr/local/h5utils-1.12.1'
make: *** [Makefile:278: all] Error 2

The author dismisses any errors with h5utils in this tutorial saying that MatLab is more capable for processing. However, it seems that due to this failure h5topng is not found and without having access to MatLab, my outputs are useless.

When trying to run 'ring.ctl' from the Meep/examples folder I also get the following:

creating output file "./ring-eps-000000.00.h5"...
Backtrace:
In /pub/devel/guile/yaakov/guile-2.0.14-1.i686/src/guile-2.0.14/module/ice-9/boot-9.scm:
160: 12 [catch #t #<catch-closure 801d0950> ...]
In unknown file:
?: 11 [apply-smob/1 #<catch-closure 801d0950>]
In /pub/devel/guile/yaakov/guile-2.0.14-1.i686/src/guile-2.0.14/module/ice-9/eval.scm:
432: 10 [eval # #]
432: 9 [eval # #]
In unknown file:
?: 8 [primitive-load "ring.ctl"]
In /pub/devel/guile/yaakov/guile-2.0.14-1.i686/src/guile-2.0.14/module/ice-9/eval.scm:
432: 7 [eval # #]
In /pub/devel/guile/yaakov/guile-2.0.14-1.i686/src/guile-2.0.14/module/ice-9/boot-9.scm:
710: 6 Exception thrown while printing backtrace:
ERROR: In procedure delete-meep-volume: Wrong type argument in position 1: #<finalized smob 80447d00>
ERROR: In procedure %run-finalizers:
ERROR: In procedure delete-meep-volume: Wrong type argument in position 1: #<finalized smob 80447ef0>
Some deprecated features have been used. Set the environment
variable GUILE_WARN_DEPRECATED to "detailed" and rerun the
program to get more information. Set it to "no" to suppress
this message.

Any thoughts on what might be happening with Meep would be very helpful. It's been a number of days trying to get it to install correctly on both Windows and Ubuntu.

Emma

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.