1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
|
package Demeter::Plot::Style;
use Moose;
extends 'Demeter';
use Demeter::StrTypes qw( MERIP );
has '+name' => (default => q{style});
has 'emin' => (is => 'rw', isa => 'LaxNum', default => sub{ shift->co->default("plot", "emin") || -200});
has 'emax' => (is => 'rw', isa => 'LaxNum', default => sub{ shift->co->default("plot", "emax") || 800});
# has 'e_mu' => (is => 'rw', isa => 'Bool', default => sub{ shift->co->default("plot", "e_mu") || 1});
# has 'e_bkg' => (is => 'rw', isa => 'Bool', default => sub{ shift->co->default("plot", "e_bkg") || 0});
# has 'e_pre' => (is => 'rw', isa => 'Bool', default => sub{ shift->co->default("plot", "e_pre") || 0});
# has 'e_post' => (is => 'rw', isa => 'Bool', default => sub{ shift->co->default("plot", "e_post") || 0});
# has 'e_norm' => (is => 'rw', isa => 'Bool', alias => 'e_nor', default => sub{ shift->co->default("plot", "e_norm") || 0});
# has 'e_der' => (is => 'rw', isa => 'Bool', default => sub{ shift->co->default("plot", "e_der") || 0});
# has 'e_sec' => (is => 'rw', isa => 'Bool', default => sub{ shift->co->default("plot", "e_sec") || 0});
# has 'e_i0' => (is => 'rw', isa => 'Bool', default => sub{ shift->co->default("plot", "e_i0") || 0});
# has 'e_signal' => (is => 'rw', isa => 'Bool', default => sub{ shift->co->default("plot", "e_signal") || 0});
# has 'e_markers' => (is => 'rw', isa => 'Bool', alias => 'e_marker', default => sub{ shift->co->default("plot", "e_markers") || 0});
# has 'e_smooth' => (is => 'rw', isa => 'Int', default => sub{ shift->co->default("plot", "e_smooth") || 0});
# has 'e_zero' => (is => 'rw', isa => 'Bool', default => 0);
has 'kmin' => (is => 'rw', isa => 'LaxNum', default => sub{ shift->co->default("plot", "kmin") || 0});
has 'kmax' => (is => 'rw', isa => 'LaxNum', default => sub{ shift->co->default("plot", "kmax") || 15});
has 'rmin' => (is => 'rw', isa => 'LaxNum', default => sub{ shift->co->default("plot", "rmin") || 0});
has 'rmax' => (is => 'rw', isa => 'LaxNum', default => sub{ shift->co->default("plot", "rmax") || 6});
#has 'r_pl' => (is => 'rw', isa => MERIP, default => sub{ shift->co->default("plot", "r_pl") || "m"});
has 'qmin' => (is => 'rw', isa => 'LaxNum', default => sub{ shift->co->default("plot", "qmin") || 0});
has 'qmax' => (is => 'rw', isa => 'LaxNum', default => sub{ shift->co->default("plot", "qmax") || 15});
#has 'q_pl' => (is => 'rw', isa => MERIP, default => sub{ shift->co->default("plot", "q_pl") || "r"});
my @limits = qw(emin emax kmin kmax rmin rmax qmin qmax);
my @parts = qw(r_pl q_pl e_mu e_bkg e_pre e_post e_norm e_der e_sec);
sub BUILD {
my ($self, @params) = @_;
$self->mo->push_Style($self);
};
sub pull {
my ($self) = @_;
foreach my $att (@limits) {
$self->$att($self->po->$att);
};
return $self;
};
sub apply {
my ($self) = @_;
foreach my $att (@limits) {
$self->po->$att($self->$att);
};
return $self;
};
__PACKAGE__->meta->make_immutable;
1;
=head1 NAME
Demeter::Plot::Style - Simple management of plotting parameters
=head1 VERSION
This documentation refers to Demeter version 0.9.26.
=head1 SYNOPSIS
my $xanes_style = Demeter::Plot::Style->new(name=>xanes,
emin=>-30,
emax=>50);
my $exafs_style = Demeter::Plot::Style->new(name=>xanes,
emin=>-200,
emax=>900);
$data -> po -> start_plot;
$xanes_style->apply;
$data -> plot('E'); # makes a XANES plot
$data -> po -> start_plot;
$exafs_style->apply;
$data -> plot('E'); # makes a plot of the full spectrum
=head1 DESCRIPTION
This is an object for holding a subset of the attributes of the Plot
object. The purpose is to maintain sets of xmin and xmax parameters
in the different plotting spaces suitable for plotting different
representations of data. For example, you might keep a plotting style
for XANES plots and another for EXAFS plots, using this object's
C<apply> method to quickly and conveniently switch between the two.
This is implemented in Athena in one o fthe plot tabs at the bottom of
the plotting sidebar.
=head1 ATTRIBUTES
=over 4
=item C<emin>
=back
=head1 SERIALIZATION AND DESERIALIZATION
Good question ...
=head1 CONFIGURATION AND ENVIRONMENT
See L<Demeter::Config> for a description of the configuration system.
There is an indicator group that can be adjusted to modify the default
behavior of this object. It is in the F<ornaments.demeter_conf>
file.
=head1 DEPENDENCIES
Demeter's dependencies are in the F<Build.PL> file.
=head1 BUGS AND LIMITATIONS
Please report problems to the Ifeffit Mailing List
(L<http://cars9.uchicago.edu/mailman/listinfo/ifeffit/>)
Patches are welcome.
=head1 AUTHOR
Bruce Ravel (http://bruceravel.github.io/home)
L<http://bruceravel.github.io/demeter/>
=head1 LICENCE AND COPYRIGHT
Copyright (c) 2006-2019 Bruce Ravel (L<http://bruceravel.github.io/home>). All rights reserved.
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself. See L<perlgpl>.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
=cut
|