本文整理汇总了Python中pts.core.basics.log.log.info函数的典型用法代码示例。如果您正苦于以下问题:Python info函数的具体用法?Python info怎么用?Python info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_ionizing
def set_ionizing(self):
"""
This function ...
:return:
"""
# Inform the user
log.info("Setting the ionizing stellar disk component ...")
# Get the title
title = titles["ionizing"]
# Create the new component
self.ski.create_new_stellar_component(title)
# Set the geometry
self.ski.set_stellar_component_geometry(title, self.deprojections["ionizing"])
# Set the SED
# metallicity, compactness, pressure, covering_factor
self.ski.set_stellar_component_mappingssed(title, ionizing_metallicity, ionizing_compactness, ionizing_pressure, ionizing_covering_factor)
# Set the normalization
self.ski.set_stellar_component_luminosity(title, fuv_ionizing, self.fuv_filter.pivot)
示例2: test_dust_mass
def test_dust_mass(self):
"""
This function ...
:return:
"""
# Inform the user
log.info("Testing the dust mass ...")
ndigits = 4
nbits = numbers.binary_digits_for_significant_figures(ndigits)
print(str(nbits) + " bits for " + str(ndigits) + " digits")
mass_range = parsing.quantity_range("1500000.0 Msun > 300000000.0 Msun")
unit = "Msun"
minimum = mass_range.min
maximum = mass_range.max
low = minimum.to(unit).value
high = maximum.to(unit).value
value = parse_quantity("1.5e7 Msun").to(unit).value
# Test : ROUNDING IN TEST BUT NOT IN BETWEEN CONVERSION!!
if light_test_from_number_rounding(value, low, high, ndigits): log.success("Test succeeded")
else: log.error("Test failed")
示例3: find
def find(self):
"""
This function ...
:return:
"""
# Inform the user
log.info("Finding the sources ...")
# Settings
settings = dict()
# settings["input"] =
settings["output"] = self.find_path
settings["nprocesses"] = self.config.nprocesses
# Input
input_dict = dict()
input_dict["dataset"] = self.dataset
#input_dict["extended_source_catalog"] = self.extended_source_catalog
input_dict["point_source_catalog"] = self.point_source_catalog
input_dict["output_paths"] = self.find_paths
# Construct the command
command = Command("find_sources", "find sources", settings, input_dict)
# Run the command
self.finder = self.run_command(command)
示例4: set_old
def set_old(self):
"""
This function ...
:return:
"""
# Inform the user
log.info("Setting the old stellar disk component ...")
# Get the title
title = titles["old"]
# Create the new component
self.ski.create_new_stellar_component(title)
# Set the geometry
self.ski.set_stellar_component_geometry(title, self.deprojections["old"])
# Set the SED
self.ski.set_stellar_component_sed(title, disk_template, disk_age, disk_metallicity)
# Convert the flux density into a spectral luminosity
luminosity = old_fluxdensity.to("W/micron", fltr=self.i1_filter, distance=self.galaxy_distance)
# Set the normalization
self.ski.set_stellar_component_luminosity(title, luminosity, self.i1_filter.pivot)
示例5: create_wcs
def create_wcs(self):
"""
This function ...
:return:
"""
# Inform the user
log.info("Creating the WCS ...")
min_pixelscale = None
# Determine the path to the headers directory
headers_path = fs.join(m81_data_path, "headers")
# Loop over the header files
for path, name in fs.files_in_path(headers_path, extension="txt", returns=["path", "name"]):
# Get the filter
fltr = parse_filter(name)
filter_name = str(fltr)
# Set the path of the file for the filter name
self.wcs_paths[filter_name] = path
# Get WCS
wcs = CoordinateSystem.from_header_file(path)
# Adjust the pixelscale
if min_pixelscale is None:
min_pixelscale = wcs.pixelscale
self.wcs = wcs
elif min_pixelscale > wcs.pixelscale:
min_pixelscale = wcs.pixelscale
self.wcs = wcs
示例6: make_animation
def make_animation(self):
"""
This function ...
:return:
"""
# Inform the user
log.info("Making animation ...")
# Get the best
best = self.optimizer.best
# Determine path
temp_path = self.optimizer.config.path
filepath = fs.join(temp_path, "best.png")
# Make plot of best
# Create animated gif
animation = Animation()
# Open the images present in the directory
for path in fs.files_in_path(temp_path, extension="png", exact_not_name="best"):
# Add frame to the animation
animation.add_frame_from_file(path)
# Save the animation
animation_path = fs.join(temp_path, "animation.gif")
animation.saveto(animation_path)
示例7: restore_chi_squared
def restore_chi_squared(self):
"""
This function ...
:return:
"""
# Inform the user
log.info("Restoring the chi squared tables ...")
# Loop over the generations
for generation_name in self.generation_names:
# Has generation?
if not self.has_generation(generation_name): continue
# Debugging
log.debug("Creating backup of chi squared table for generation '" + generation_name + "' ...")
# Get the generation
generation = self.generations[generation_name]
# Get the generation path
generation_path = self.get_generation_restore_path(generation_name)
# Determine the filepath
filepath = fs.join(generation_path, "chi_squared.dat")
# Copy the file
fs.copy_file(filepath, generation.chi_squared_table_path)
示例8: show_luminosities
def show_luminosities(sed):
"""
This function ...
:param sed:
:return:
"""
# Get spectral luminosity density
lum = sed.photometry_at(fltr_wavelength, unit="W/micron")
lum2 = sed.photometry_at(fltr_wavelength, unit="W/micron", interpolate=False)
#
log.info("Luminosity: " + tostr(lum))
log.info("No interpolation: " + tostr(lum2))
# Convert to solar SPECTRAL luminosity DENSITY at wavelength
lum_spectral_solar = lum.to("W/micron").value / solar_wavelength_density.to("W/micron").value
# Convert to neutral
lum_neutral = lum.to("W", density=True, wavelength=fltr_wavelength)
lum_solar = lum.to("Lsun", density=True, wavelength=fltr_wavelength)
# Neutral and solar
log.info("Luminosity in spectral solar units: " + tostr(lum_spectral_solar) + " Lsun_" + fltr.band)
log.info("Luminosity in neutral units: " + tostr(lum_neutral))
log.info("Luminosity in solar units: " + tostr(lum_solar))
示例9: make_sky
def make_sky(self):
"""
This function ...
:return:
"""
# Inform the user
log.info("Adding sky ...")
# Loop over the frames
for fltr in self.frames:
# Get the frame
frame = self.frames[fltr]
# Determine random sky level
sky_level = np.random.uniform(0.0, 10.)
# Create sky gradient
y, x = np.mgrid[:frame.ysize, :frame.xsize]
sky_gradient = x * y
# Normalize so that the maximal sky is 20%
sky_gradient = sky_gradient / np.max(sky_gradient) * 20
# Add the sky
frame += sky_level + sky_gradient
# Mask
frame[self.rotation_masks[fltr]] = 0.0
示例10: setup_modelling
def setup_modelling(self):
"""
This fucntion ...
:return:
"""
# Inform the user
log.info("Setting up the modelling ...")
# Settings
settings_setup = dict()
settings_setup["type"] = "sed"
settings_setup["name"] = self.modeling_name
settings_setup["fitting_host_ids"] = self.moderator.host_ids_for_ensemble("fitting", none_if_none=True)
# Create input dict for setup
input_setup = dict()
input_setup["sed"] = self.observed_sed
input_setup["ski"] = self.ski_template
#input_setup["ski_input"] = self.required_input_files
input_setup["ski_input"] = self.all_input_files # Important so that the fittinginitializer can choose the number
# of wavelengths for the fitting based on what the user used as a wavelength grid file for the ski file
# Create object config
object_config = dict()
# object_config["ski"] = ski_path
input_setup["object_config"] = object_config
# Construct the command
stp = Command("setup", "setup the modeling", settings_setup, input_setup, cwd=".")
# Call the command
tool = self.run_command(stp)
示例11: write_frame
def write_frame(self):
"""
This function ...
:return:
"""
# Inform the user
log.info("Saving the result ...")
# Determine the path
path = self.output_path_file(self.image_name)
# Check if already existing
if fs.is_file(path):
if self.config.replace:
if self.config.backup: fs.backup_file(path, suffix=self.config.backup_suffix)
fs.remove_file(path)
else:
#raise ValueError("The image already exists")
path = self.output_path_file("result.fits")
# Save
self.frame.saveto(path, header=self.header)
示例12: _init_psf_phot_process
def _init_psf_phot_process(data, all_positions, all_amplitudes,
idx, nidx, psf, amplitudes, positions):
"""
Global variables for psf photometry processes
"""
import multiprocessing
global gbl_data
global gbl_all_positions
global gbl_all_amplitudes
global gbl_idx
global gbl_nidx
global gbl_psf
global gbl_amplitudes
global gbl_positions
gbl_data = data
gbl_all_positions = all_positions
gbl_all_amplitudes = all_amplitudes
gbl_idx = idx
gbl_nidx = nidx
gbl_psf = psf
gbl_amplitudes = amplitudes
gbl_positions = positions
log.info("Initializing process {0}".format(
multiprocessing.current_process().name))
示例13: combine_second
def combine_second(self):
"""
This function ...
:return:
"""
# Inform the user
log.info("Doing second combination ...")
fltr_a, fltr_b = self.lowest_resolution_filters
frames = self.frames[fltr_a, fltr_b]
frames.convolve_to_highest_fwhm()
frames.rebin_to_highest_pixelscale()
frames.convert_to_same_unit(unit="MJy/sr") # here conversion to surface brightness, related to the pixelscale is necessary
# Set the frames
#self.second = frames
frames.convert_to_same_unit(unit="Lsun", density=True, distance=self.distance) # convert to solar luminosity
# Now do something
self.second = np.random.random() * frames[fltr_a] + np.random.random() * frames[fltr_b]
# Set unit
self.second.unit = "Lsun"
示例14: combine_first
def combine_first(self):
"""
This function ...
:return:
"""
# Inform the user
log.info("Doing first combination ...")
fltr_a, fltr_b = self.highest_resolution_filters
frames = self.frames[fltr_a, fltr_b]
frames.convolve_to_highest_fwhm()
frames.rebin_to_highest_pixelscale()
frames.convert_to_same_unit(unit="W/micron/m2") # here conversion related to frequency/wavelength is necessary
frames.convert_to_same_unit(unit="W/m2", density=True) # here conversion from spectral flux density to flux is necessary
# Set the frames
#self.first = frames
# Now do something, like adding them
self.first = np.random.random() * frames[fltr_a].get_log10() + np.random.random() * frames[fltr_b].get_log10()
# Set the unit
self.first.unit = "W/m2"
示例15: test_brightness
def test_brightness(self):
"""
This function ...
:return:
"""
# Inform the user
log.info("Testing surface brightness units ...")
units = [u("Jy"), u("W/micron"), u("Lsun"), u("erg/s/Hz"), u("W/sr"), u("Lsun/pc2", brightness=True), u("W/m2/micron")]
print("")
for unit in units:
print(str(unit))
print("")
print(" - symbol: " + unit.symbol)
print(" - physical type: " + unit.physical_type)
print(" - base physical type: " + unit.base_physical_type)
print(" - base unit: " + str(unit.base_unit))
print(" - density: " + str(unit.density))
print(" - brightness: " + str(unit.brightness))
angular_area_unit = unit.corresponding_angular_area_unit
#print(angular_area_unit)
intrinsic_area_unit = unit.corresponding_intrinsic_area_unit
print(" - corresponding angular area unit: " + str(angular_area_unit))
print(" - corresponding intrinsic area unit: " + str(intrinsic_area_unit))
print("")