IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 30147


Ignore:
Timestamp:
Dec 23, 2010, 2:50:34 PM (15 years ago)
Author:
rhenders
Message:

Some major refactoring

Location:
trunk/ippToPsps
Files:
17 added
15 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/perl/ippToPsps/Batch.pm

    r29646 r30147  
    126126    $self->{_surveyType} = $self->getSurveyTypeFromDistGroup();
    127127
    128     # can we run ippToPsps?
    129     $self->{_ippToPsps} = can_run('ippToPsps') or
    130         (warn "Can't find 'ippToPsps' program" and exit($PS_EXIT_CONFIG_ERROR));
    131 
    132128    # set up batch output paths
    133129    $self->init();
     
    139135
    140136    return $self;
     137}
     138
     139########################################################################################
     140#
     141# Sets to program and checks we can run it
     142#
     143########################################################################################
     144sub setProgram {
     145    my ($self, $program) = @_;
     146
     147    # can we run ippToPsps?
     148    $self->{program} = can_run($program) or
     149        (warn "Can't find '$program' program" and exit($PS_EXIT_CONFIG_ERROR));
    141150}
    142151
     
    197206    my ($self, $input, $resultsFilePath) = @_;
    198207
    199     # build command
    200     my $command = "$self->{_ippToPsps}";
    201     $command .= " -input $input";
    202     $command .= " -output $self->{_batchDir}";
    203     if (defined $self->{_dvoPath} ) {$command .= " -D CATDIR $self->{_dvoPath}";}
    204     $command .= " -config ../config"; # TODO
    205         $command .= " -id $self->{_expId}";
    206     $command .= " -expname $self->{_expName}";
    207     $command .= " -survey $self->{_surveyType}";
    208     $command .= " -batch $self->{_type}";
    209     $command .= " -results $resultsFilePath";
    210 
    211     # run command
    212     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf )
    213         = run(command => $command, verbose => $self->{_verbose});
    214 
    215     return $success;
     208    my $thisFunction = (caller(0))[3];
     209    print "* ERROR: '$thisFunction' not implemented\n";
    216210}
    217211
  • trunk/ippToPsps/perl/ippToPsps/DetectionBatch.pm

    r29997 r30147  
    88use File::Temp qw(tempfile);
    99use XML::LibXML;
     10use IPC::Cmd 0.36 qw( can_run run );
    1011
    1112use ippToPsps::Batch;
     
    6364            );
    6465
     66    $self->setProgram("detectionbatch");
     67
    6568    bless $self, $class;
    6669    $self->process();
     
    105108#######################################################################################
    106109#
     110# runs the ippToPsps program
     111#
     112#######################################################################################
     113sub runProgram {
     114    my ($self, $input, $resultsFilePath) = @_;
     115
     116    # build command
     117    my $command = "$self->{program}";
     118    $command .= " -input $input";
     119    $command .= " -output $self->{_batchDir}";
     120    if (defined $self->{_dvoPath} ) {$command .= " -D CATDIR $self->{_dvoPath}";}
     121    $command .= " -config ../config"; # TODO
     122    $command .= " -survey $self->{_surveyType}";
     123    $command .= " -results $resultsFilePath";
     124    $command .= " -expid $self->{_expId}";
     125    $command .= " -expname $self->{_expName}";
     126
     127    # run command
     128    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf )
     129        = run(command => $command, verbose => $self->{_verbose});
     130
     131    return $success;
     132}
     133
     134
     135#######################################################################################
     136#
    107137# - Reads results from processing (min/max obj ID etc)
    108138# - writes to Db
  • trunk/ippToPsps/perl/ippToPsps/InitBatch.pm

    r29212 r30147  
    88use File::Temp qw(tempfile);
    99use XML::LibXML;
     10use IPC::Cmd 0.36 qw( can_run run );
    1011
    1112use ippToPsps::Batch;
     
    3738            $_[7]);    # save_temps
    3839
     40    $self->setProgram("initbatch");
     41
    3942    bless $self, $class;
    4043    $self->process();
     
    5255    return "NULL";
    5356}
     57
     58#######################################################################################
     59#
     60# runs the ippToPsps program
     61#
     62#######################################################################################
     63sub runProgram {
     64    my ($self, $input, $resultsFilePath) = @_;
     65
     66    # build command
     67    my $command = "$self->{program}";
     68    $command .= " -output $self->{_batchDir}";
     69    $command .= " -config ../config"; # TODO
     70    $command .= " -results $resultsFilePath";
     71
     72    # run command
     73    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf )
     74        = run(command => $command, verbose => $self->{_verbose});
     75
     76    return $success;
     77}
     78
    5479
    5580#######################################################################################
  • trunk/ippToPsps/perl/ippToPsps/StackBatch.pm

    r29236 r30147  
    88use File::Temp qw(tempfile);
    99use XML::LibXML;
     10use IPC::Cmd 0.36 qw( can_run run );
    1011
    1112use ippToPsps::Batch;
     
    6263            $_[11]  # save_temps
    6364            );
    64 
     65   
     66    $self->setProgram("stackbatch");
    6567
    6668    $self->{_skyId} = $_[1];
     
    7880sub createInputFileList {
    7981    my ($self, $inputFile) = @_;
     82
     83  # TODO hardcode demo file for now
     84        print $inputFile "/data/ippc18.0/home/rhenders/psphotstack.v3.001.cmf\n";
     85            return 1;
     86
    8087
    8188    my ($nebPath, $numInputs);
     
    98105    return 1;
    99106}
     107
     108#######################################################################################
     109#
     110# runs the ippToPsps program
     111#
     112#######################################################################################
     113sub runProgram {
     114    my ($self, $input, $resultsFilePath) = @_;
     115
     116    # build command
     117    my $command = "$self->{program}";
     118    $command .= " -input $input";
     119    $command .= " -output $self->{_batchDir}";
     120    if (defined $self->{_dvoPath} ) {$command .= " -D CATDIR $self->{_dvoPath}";}
     121    $command .= " -config ../config"; # TODO
     122    $command .= " -survey $self->{_surveyType}";
     123    $command .= " -results $resultsFilePath";
     124    $command .= " -skycellid $self->{_expId}";
     125
     126    # run command
     127    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf )
     128        = run(command => $command, verbose => $self->{_verbose});
     129
     130    return $success;
     131}
     132
    100133
    101134#######################################################################################
  • trunk/ippToPsps/perl/pspsSchema2xml.pl

    r29304 r30147  
    3030pod2usage(
    3131        -msg => "\n   Required options:\n\n".
    32         "--schema <path to PSPS schema>\n".
    33         "--type <init|det|diff|stack|object>\n".
     32        "- <path to PSPS schema>\n".
     33        "-t   <init|detection|diff|stack|object>\n".
    3434        -exitval => 3
    3535        ) unless
     
    3737defined $type;
    3838
    39 if ($type ne "init" && $type ne "det" && $type ne "diff" && $type ne "stack" && $type ne "object" ) {
     39if (
     40        $type ne "init" &&
     41        $type ne "detection" &&
     42        $type ne "diff" &&
     43        $type ne "stack" &&
     44        $type ne "object" ) {
    4045
    4146    print "Don't understand type '$type'\n";
     
    4348}
    4449
    45 my $enumsHeader = "ippToPsps".ucfirst($type)."Enums";
     50my $enumsHeader = ucfirst($type)."BatchEnums";
    4651open(OUT, ">".$enumsHeader.".h") or die("Error");
    4752
     
    6166
    6267if ($type eq "init") {createInit();}
    63 elsif ($type eq "det") {createDetections();}
     68elsif ($type eq "detection") {createDetections();}
    6469elsif ($type eq "diff") {createDiffs();}
    6570elsif ($type eq "stack") {createStacks();}
  • trunk/ippToPsps/src/Makefile.am

    r27809 r30147  
    1414
    1515# Force recompilation of ippToPspsVersion.c, since it gets the version information
    16 ippToPspsVersion.c: ippToPspsVersionDefinitions.h
    17 ippToPspsVersionDefinitions.h: ippToPspsVersionDefinitions.h.in FORCE
    18         -$(RM) ippToPspsVersionDefinitions.h
    19         $(SED) -e "s|@IPPTOPSPS_VERSION@|\"$(IPPTOPSPS_VERSION)\"|" -e "s|@IPPTOPSPS_BRANCH@|\"$(IPPTOPSPS_BRANCH)\"|" -e "s|@IPPTOPSPS_SOURCE@|\"$(IPPTOPSPS_SOURCE)\"|" ippToPspsVersionDefinitions.h.in > ippToPspsVersionDefinitions.h
     16Version.c: VersionDefinitions.h
     17VersionDefinitions.h: VersionDefinitions.h.in FORCE
     18        -$(RM) VersionDefinitions.h
     19        $(SED) -e "s|@IPPTOPSPS_VERSION@|\"$(IPPTOPSPS_VERSION)\"|" -e "s|@IPPTOPSPS_BRANCH@|\"$(IPPTOPSPS_BRANCH)\"|" -e "s|@IPPTOPSPS_SOURCE@|\"$(IPPTOPSPS_SOURCE)\"|" VersionDefinitions.h.in > VersionDefinitions.h
    2020FORCE: ;
    2121
    22 bin_PROGRAMS = ippToPsps
     22# all the programs we create
     23bin_PROGRAMS = initbatch detectionbatch stackbatch
    2324
    24 ippToPsps_CFLAGS = $(IPPTOPSPS_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS) -I/usr/include/libxml2
    25 ippToPsps_LDFLAGS = $(IPPTOPSPS_LIBS) $(PSMODULE_LIBS) $(PSLIB_LIBS) -lxml2
    2625
    27 ippToPsps_SOURCES = \
    28         main.c \
    29         ippToPsps.c \
    30         ippToPspsVersion.c \
    31         ippToPspsConfig.c \
    32         ippToPspsBatchTest.c \
    33         ippToPspsBatchInit.c \
    34         ippToPspsBatchDetection.c \
    35         ippToPspsBatchStack.c \
    36         ippToPspsBatchDifference.c   
     26# initbatch
     27initbatch_CFLAGS = $(IPPTOPSPS_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS) -I/usr/include/libxml2
     28initbatch_LDFLAGS = $(IPPTOPSPS_LIBS) $(PSMODULE_LIBS) $(PSLIB_LIBS) -lxml2
     29initbatch_SOURCES = \
     30        InitBatch.c \
     31        Batch.c \
     32        Version.c \
     33        Config.c
    3734
    38 include_HEADERS = \
    39         ippToPsps.h \
    40         ippToPspsConfig.h \
    41         ippToPspsDetEnums.h \
    42         ippToPspsDiffEnums.h \
    43         ippToPspsStackEnums.h
     35# detectionbatch
     36detectionbatch_CFLAGS = $(IPPTOPSPS_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS) -I/usr/include/libxml2
     37detectionbatch_LDFLAGS = $(IPPTOPSPS_LIBS) $(PSMODULE_LIBS) $(PSLIB_LIBS) -lxml2
     38detectionbatch_SOURCES = \
     39        DetectionBatch.c \
     40        Batch.c \
     41        Version.c \
     42        Config.c
     43
     44# stackbatch
     45stackbatch_CFLAGS = $(IPPTOPSPS_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS) -I/usr/include/libxml2
     46stackbatch_LDFLAGS = $(IPPTOPSPS_LIBS) $(PSMODULE_LIBS) $(PSLIB_LIBS) -lxml2
     47stackbatch_SOURCES = \
     48        StackBatch.c \
     49        Batch.c \
     50        Version.c \
     51        Config.c
    4452
    4553clean-local:
Note: See TracChangeset for help on using the changeset viewer.