Re: E-field plots

"Steven G. Johnson" <[email protected]>
Newsgroups gmane.comp.science.photonic-bands
Message-ID <[email protected]>
On Thu, 24 May 2007, Jim Andrews wrote:
> I am trying to work through the defect1dsol.ctl example that is posted
> on the nanophotonics course website in order to recreate the figure 4
> that appears there and I am finding that I don't know how to get a
> line plot of Ez from the h5 files.

You can make line plots (or any other kind of plots) from h5 files just by 
reading it into a plotting program.  In Matlab, you can use the hd5read 
command to read an hdf5 file directly; see the examples in:
 	http://www-math.mit.edu/~stevenj/18.369/mpb-demo.pdf
For other programs, you can use h5totxt (part of h5utils) to convert an 
hdf5 file into comma-delimited text.

> I'm having trouble even getting the condition satisfied that the 
> frequency of one of the bands is within the range of the minimum and 
> maximum frequencies of the structure without the defect.  Also, I'm not 
> sure why the minimum and maximum frequencies are defined by use of the 
> following because I don't know what car and cadr mean here (though I can 
> see that this gives the frequencies previously found for the two band 
> case:
> (define gap-min (car freqs))
> (define gap-max (cadr freqs))

car and cadr are two basic Scheme/Lisp primitives, that are documented in 
any Scheme manual.

Given a list L, (car L) returns the first element of the list, and (cdr L) 
returns a list of the elements after the first.  (cadr L) is a standard
abbreviation for (car (cdr L)), i.e. it returns the second element of the 
list. Therefore in the commands above, gap-min and gap-max are set to the 
first and second elements of the freqs list, respectively, because the gap 
in this case is between the first and second bands.

Steven
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.