Пример #1
0
 def add_log(self):
     # Temporarily (for the duration of the 'with' block) set the
     # log level and context.
     # these are done by the IMP_OBJECT_LOG macro in C++
     with IMP.SetLogState(self.get_log_level()):
         with IMP.CreateLogContext(self.get_name() + "::add_log"):
             self.set_was_used(True)
             IMP.add_to_log(IMP.VERBOSE,
                            "A verbose message in the object\n")
Пример #2
0
class DummyObject(IMP.Object):

    def __init__(self):
        IMP.Object.__init__(self, "DummyObject%1%")

    def add_log(self):
        # Temporarily (for the duration of the 'with' block) set the
        # log level and context.
        # these are done by the IMP_OBJECT_LOG macro in C++
        with IMP.SetLogState(self.get_log_level()):
            with IMP.CreateLogContext(self.get_name() + "::add_log"):
                self.set_was_used(True)
                IMP.add_to_log(IMP.VERBOSE,
                               "A verbose message in the object\n")

# we can set the log level for all of IMP
IMP.set_log_level(IMP.TERSE)

# we can tell it to print the time each event occurs
IMP.set_log_timer(True)

# we can create a log context (valid for the duration of the 'with' block)
with IMP.CreateLogContext("my context"):

    # we can print a message
    IMP.add_to_log(IMP.TERSE, "This is my log message\n")

    o = DummyObject()
    o.set_log_level(IMP.VERBOSE)
    o.add_log()
Пример #3
0
IMP.set_log_level(IMP.PROGRESS)
sd = IMP.npctransport.SimulationData(
    flags.output,
    flags.quick,
    flags.rmf_file)
print "RMF file: ", sd.get_rmf_file_name()
print get_fgs_of_type(IMP.npctransport.get_type_of_fg(0), sd.get_root())
if(flags.cylinder_anchoring):
#    set_fgs_in_cylinder(sd, 4)
    set_fgs_three_types(sd)
color_fgs( sd )
ntrials = sd.get_number_of_trials()
print "Number of trials: ", ntrials
for i in range(ntrials):
    clc = IMP.CreateLogContext("iteration")
    if(not flags.quick): # TODO: why is that?
        sd.reset_rmf()
    print "Initializing..."
    if(flags.initialization_rmf_file):
        sd.initialize_positions_from_rmf(
            flags.initialization_rmf_file )
    else:
        init_restraints = []
        if(sd.get_has_slab()): # if has slab, exclude from channel initially
            init_restraints.append( get_exclude_from_channel_restraint( sd ) )
        IMP.npctransport.initialize_positions( sd, init_restraints )
    nframes_running = math.ceil(sd.get_statistics_fraction()
                                * sd.get_number_of_frames())
    nframes_equilib = sd.get_number_of_frames() - nframes_running
    print "Equilibrating for frames...", nframes_equilib