Announcing Physics::RayTransfer

While I am still working out the bugs from Alien::Base I have released a little scientific side project named Physics::RayTransfer.

Calling all laser physicists! Does modeling your cavity using Ray Transfer (ABCD) matrices bore you? Do you regularly forget to include one of the matrices on the reversed arm on the round trip? Do you hate using that symbolic mathematical language? Try Physics::RayTranser!

It slices, dices, makes julienne fries and of course is a totally object oriented way to model your laser cavities (or other optical systems). No round trip matrices needed!

use Physics::RayTransfer;

# build the system using helper constructors
my $sys = Physics::RayTransfer->new();

# parameter for for cavity length
# from 0 to 10 in 0.1 (cm) increments
my $d = [ map { $_ / 10 } (0..100) ];

# spot size at right mirror (OC) at 1063 nm 
# for each cavity length!
my @data = 
  map { $_->[1]->w(1063e-7) }

Finally, some of you might complain that the whole thing is written in MooseX::Declare and so you have to install that whole monstrosity just to use it. Oh well, its really fast to write, and I find writing OO scientific code very intuitive using it, so get over it. :-)


I couldn’t get it to install due to all the dependencies.

I’ve sent the output of cpanm and “.cpanm/build.log” by email. But I suspect the cause of the problems is that I broke the Perl library installation somehow when I was testing App::pmuninstall:

I also could not install “Dist::Zilla”. So there may be nothing wrong with your module. At some point I will have to reinstall Perl I think.

After the email exchange we had, I tried installing it on another computer, Ubuntu Linux. This is a Perl I virtually never use except for testing the installation of modules which I made, so almost everything including Moose was installed from scratch, I even had to install App::cpanminus on this machine, and it took about half an hour or so to install all the dependencies. Again the problem seems to occur in the same place (this is the output for the second attempt, after most of the other stuff had installed):

--> Working on Physics::RayTransfer
Fetching ... OK
Configuring Physics-RayTransfer-0.003 ... OK
==> Found dependencies: MooseX::Declare
--> Working on MooseX::Declare
Fetching ... OK
Configuring MooseX-Declare-0.35 ... OK
==> Found dependencies: MooseX::Method::Signatures, MooseX::Method::Signatures::Types, MooseX::Method::Signatures::Meta::Method
--> Working on MooseX::Method::Signatures
Fetching ... OK
Configuring MooseX-Method-Signatures-0.41 ... OK
Building and testing MooseX-Method-Signatures-0.41 ... FAIL
! Installing MooseX::Method::Signatures failed. See /home/ben/.cpanm/build.log for details.
! Bailing out the installation for MooseX-Declare-0.35. Retry with --prompt or --force.
! Bailing out the installation for Physics-RayTransfer-0.003. Retry with --prompt or --force.

This is a completely different computer.

I thought I had most of CPAN installed already… ;) anyway, it did install and seems to work (i don’t work with lasers). I used cpanminus and a perlbrewed perl5-14.1 on Open Suse 11 (at least that’s what the admins tell me).

Building and testing Physics-RayTransfer-0.003 … OK Successfully installed Physics-RayTransfer-0.003 28 distributions installed

If the only thing that’s failing is MooseX::Method::Signatures, you can probably just ignore that. Since Joel is using Method::Signatures::Modifiers, MXMS will never be used anyway.

I really need to work on a version of MooseX::Declare that won’t even depend on MSMX, but I just haven’t had time lately. On my TODO list though.

Leave a comment

About Joel Berger

user-pic As I delve into the deeper Perl magic I like to share what I can.