"Meet Joe Black" offers definitive proof that there is indeed such a thing as too much of a good thing. Updating the venerable old chestnut "Death Takes A Holiday" may have seemed like an inspired idea and casting Brad Pitt as Death and Anthony Hopkins as his intended victim undoubtedly enhanced the project's profile at Universal Pictures, badly in need of a marketable movie after a disasterous year at the box office. Turning the movie over to director Martin Brest, however, was -- pardon the pun -- the kiss of death. As he proved with his 1992 epic "Scent of a Woman," Brest is a guy who doesn't know the meaning of the word "cut," and while "Scent" at least offered an Oscar-winning Al Pacino performance to hold the interest, "Joe" is so low-key it can't help but feel like a slender little story stretched far beyond its limits. Brest lets scene after scene ramble on and on, giving the picture a languid air that makes its three-hour running time feel more like three weeks. For everyone except the most fervent Pitt fans, this is Sominex Cinema. "Joe" gets off to a solid start, introducing Pitt as an effervescent young lawyer who wows medical student Susan Parrish (Claire Forlani) in a coffeeshop encounter. But when Susan meets what she thinks is the same man later on, he seems to have had his personality stolen. Now he's reserved, stiff and, in many ways, downright weird. That's because Death, curious about life, is using the lawyer's body as a kind of luxurious vacation home. Speaking of luxury, Death has moved in with ultra-rich communications magnate Bill Parrish (Anthony Hopkins) -- get it? Death and Parrish? -- whose upcoming 65th birthday is destined to be his last. A deal is struck that as long as Parrish keeps Death amused and keeps his identity a secret, Parrish can enjoy a little extra time on Earth; Death, in turn, can learn what peanut butter tastes like and discover what love feels like. Most of "Joe" involves Death behaving like a child, slurping food, spinning around in an office chair and weaving from side to side as he toddles around. Seeing Pitt play infantilism is good for a few laughs at first, but it's hard to believe someone as seemingly worldly as Susan finds these traits sexy; when she begins to undress him during the big poolside love scene you're uncertain if she's going to seduce him or check his diaper. Since no Pitt movie these days is complete without him doing a misguided accent, he's allowed to tackle Jamaican patois this time out in a subplot that could easily have been dropped. But then almost everything in "Joe" is done to excess, including Thomas Newman's grandoise score, which vainly tries to make this muddled drama seem important and exciting. If nothing else, the movie is extremely well-produced and easy to look at, shot in a rich color scheme of ebony, amber and peach. And certainly there are worse ways to waste 179 minutes than looking at Pitt and the sloe-eyed Forlani, who makes Susan easily the most fascinating character in the film. But as otherworldly romances go, "Joe" pales next to the far more compelling "City of Angels," which actually had some points to make about the human condition. "Joe," in contrast, has little to say and takes far too long to say it. James Sanford
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


--- layout: post esbma_id: 1200 title: Law #18: The Law of Success date: 2004-06-24 14:53:09 keywords: law ---
(This entry is part of a series I am writing on The 22 Immutable Laws of Marketing.)
The Law of Success says that "success often leads to arrogance, and arrogance to failure".
The basic point of this chapter is a warning to not let yourself get too far from your customers. Truly small ISVs may not need to worry too much about this, but the admonition is valuable nonetheless.
As companies grow, the CEO tends to get busy with other stuff. She doesn't spend much time "in the trenches" anymore. He goes to a lot of meetings and spends a lot of time working on the big picture. In the process, she loses touch with the customer.
Despite what the chapter says, I think this effect may or may not be rooted in arrogance. The root problem might be simpler and more innocent. Maybe the CEO simply let himself get too busy. It seems quite possible to become detached from the basic activities of the company without growing a big ego.
But either way, forgetting the customer is a fatal disease. Fortunately, this disease is also preventable and treatable. Don't let it happen to you.  When you do, you'll start to make bad marketing decisions.


Package org.apache.commons.text
Basic classes for text handling.
- Since:
- 1.0
-
Interface Summary Interface Description Builder<T> The Builder interface is designed to designate a class as a builder object in the Builder design pattern.CharacterPredicate A predicate for selecting code points.FormatFactory Format factory.TextRandomProvider TextRandomProvider implementations are used byRandomStringGenerator
as a source of randomness. -
Class Summary Class Description AlphabetConverter Convert from one alphabet to another, with the possibility of leaving certain characters unencoded.CaseUtils Case manipulation operations on Strings that contain words.CompositeFormat Formats using one formatter and parses using a different formatter.ExtendedMessageFormat Extendsjava.text.MessageFormat
to allow pluggable/additional formatting options for embedded format elements.FormattableUtils Provides utilities for working with theFormattable
interface.RandomStringGenerator Generates random Unicode strings containing the specified number of code points.RandomStringGenerator.Builder A builder for generatingRandomStringGenerator
instances.StrBuilder Deprecated. Deprecated as of 1.3, useTextStringBuilder
instead.StringEscapeUtils Escapes and unescapesString
s for Java, Java Script, HTML and XML.StringEscapeUtils.Builder Convenience wrapper forStringBuilder
providing escape methods.StringSubstitutor Substitutes variables within a string by values.StringTokenizer Tokenizes a string based on delimiters (separators) and supporting quoting and ignored character concepts.StrLookup<V> Deprecated. Deprecated as of 1.3, useStringLookupFactory
instead.StrMatcher Deprecated. Deprecated as of 1.3, useStringMatcherFactory
instead.StrSubstitutor Deprecated. Deprecated as of 1.3, useStringSubstitutor
instead.StrTokenizer Deprecated. Deprecated as of 1.3, useStringTokenizer
instead.TextStringBuilder Builds a string from constituent parts providing a more flexible and powerful API than StringBuffer.WordUtils Operations on Strings that contain words. -
Enum Summary Enum Description CharacterPredicates Commonly used implementations ofCharacterPredicate
.


Enter info about broker to add a new broker
Id broker:
Company payments:
Broker's name:
Broker's income:


JavaScript vs. Ruby
Objects and Hashes
May 3, 2015
Although there are many similarities and differences between JavaScript and Ruby, I'm going to focus on
one such comparison today: JavaScript objects versus Ruby hashes. Let's first examine how they are
both created:
Hmmm, that's not very helpful. They look the same. The only reason we can really tell what they are is
because JavaScript has the var keyword while Ruby doesn't. There are also variable naming
conventions in both languages that help to distinguish them. To continue our analysis, let's add some
data. We could have just created both with data to begin with, or we could add some later:
Now we can at least see a couple differences. The pairs within JavaScript objects are called properties and values. The pairs within Ruby hashes are called keys and values. They may have slightly different syntaxes with regard to how they store data, but for our purposes as beginners, they are used for very similar reasons. They can group data together in a very efficient and organized manner. Instead of creating a list or individual objects with all this information, I can create one object (or hash) and store the values. I can then use the properties or keys to look up the data and/or change it later.


Have you imagined creating kickass GUI desktop applications in HTML?
Close this window Open a window Test custom C binding Exit


Seven O’Clock Stories
by Robert Gordon Anderson
“Seventh Night: Mr. Scarecrow”
Additional Information
- Year Published: 1920
- Language: English
- Country of Origin: United States of America
- Source: Anderson, R. G. (1920). Seven O’Clock Stories. New York: G.P. Putnam’s Sons: The Knickerbocker Press.
-
Readability:
- Flesch–Kincaid Level: 3.0
- Word Count: 1,307
- Genre: Adventure
- Keywords: children's stories
- ✎ Cite This
Downloads
Under the big oak by the brook sat the three happy children with Rover, Brownie, and little yellow Wienerwurst. They were watching the Toyman cut the ripe corn.
“Isn’t that funny?” said Jehosophat.
“What’s funny?” asked Marmaduke.
“Wot’s funny?” repeated Hepzebiah.
“Oh! I was just thinking,” said Jehosophat, “how he seems just Frank when he’s ploughing or harrowing or cutting the corn. But when he’s through work and tells us stories or makes us things, why then he is the Toyman.”
“Yes,” his brother agreed. “He looks as if some fairy godmother changed him nights and Sundays.”
But they were rudely interrupted.
“Caw, caw!” said a voice.
It was a rascal’s voice.
“Caw, caw!” said another.
The Toyman jumped. He shook his fist.
“You old thief!” he called.
“Rogue, rogue, rogue!” growled Rover in his deep voice.
“Run, run, run!” barked Brownie.

“There he is,” said the Toyman, “Mr. Jim Crow and all his wicked chums. See there!”
All the children looked in the direction in which his finger pointed. Over in the far corner of the field a flock of crows flew up from the waving corn. A white horse, drawing a buggy, was trotting along the road by the side of the cornfield. The driver had scared Mr. Jim Crow and all his chums. They flapped their big black wings as they flew. And they flew very straight, not like the pretty barn-swallows with their dark-blue wings. The swallow is a happy bird and skims and dances in the air like a fancy skater on the ice. But Mr. Jim Crow flies like an arrow. That is because he is always up to some mischief and forever running away when someone finds him out.
“Caw, caw!” he called.
“Caw, caw!” called all his black mates.
The Toyman ran to the fence and picked up a shotgun. It had two barrels that shone in the sun.
“Bang, bang!” went the gun.

The Toyman ran out in the cornfield. He bent over until his straw hat was hidden by the waving corn.
Soon he came back. From his hand Mr. Jim Crow hung head downward. He was very still.
“Oo, oo! You’ve hurted him!”
Little Hepzebiah began to cry.
“Don’t cry,” said the Toyman, patting her head. “Mr. Jim Crow was a bad fellow. You couldn’t teach him any lessons.”
“What did he do?” Marmaduke asked.
“He stole all the corn and you wouldn’t have any nice muffins if he had had his way.  It tells you when it is time to stop,” explained their friend.
And Jehosophat and Marmaduke looked as if they knew just what he meant. But Hepzebiah was too little yet to understand.
“See, Mr. Jim Crow is long and black. He has a bad eye.”
So he buried Mr. Jim Crow under the oak tree while the children watched.
After that the Toyman said:
“I reckon Mr. Scarecrow has fainted.”
“Who’s Mr. Scarecrow?” asked the three happy children. “Is he Mr. Jim Crow’s cousin?”
“Ha, ha, ha!” laughed the Toyman. “That is a good one. No, Mr. Scarecrow is the policeman of the cornfield. Let’s go over and set him on his pins again.”
So again he walked through the rows between the cornstalks and they came to a little clear place in the middle of the field.
There, flat on his back, lay Mr. Scarecrow.
He too looked as if he were dead. But he was not.
For his body was only two sticks of wood nailed together like a cross. He was dressed in Father Green’s old blue trousers and the Toyman’s old black coat. His arms were outstretched. But he had lost his hat. His wooden head stuck out.
The Toyman picked him up and stood him straight on his one wooden leg. Then he put the old felt hat on his hard head.
“There, old wooden top,” the Toyman spoke to him sternly. “Don’t leave your beat.”
But Marmaduke was puzzled.
“How could he scare Mr. Jim Crow away like a policeman? He can’t run with that wooden leg.”
“Silly,” said Jehosophat, for he was older than Marmaduke and knew Mr. Scarecrow very well.
“Ha, ha, ha, that’s another good one,” said the Toyman. “Of course he can’t run. But when all the Crows see him standing up in the cornfield they think he is a real man. They are afraid Mr. Scarecrow will shoot. For they know that things that wear coats and hats often have guns.  So they do not come very near when Mr. Scarecrow is around.”
“Caw, caw!” sounded the old rascals again. But the crows were far away. The three happy children could see them way up in the old chestnut tree over on the edge of their neighbour’s wood.
In the fork of two high branches was a great round nest—oh ever so much bigger than the thrush’s and the oriole’s. It was a crow’s nest. Sailors often call the little turret built around the mast, where they stand and look out over the sea, a “crow’s nest.” It looks something like that.
But Mr. Jim Crow’s chums didn’t come near the cornfield that day.
At night, when they were ready for bed, Jehosophat said to Marmaduke:
“I wonder if old Mr. Scarecrow is out there now.”
“Course he is,” his brother assured him.
“Let’s see!”
So they jumped out of bed and, in their white nightgowns, tiptoed over the floor to the window. The Old-Man-in-the-Moon was up. He looked as round and fat as a pumpkin in the sky.
He winked at them.
The Old-Man-in-the-Moon made it very bright so that they could see.
Sure enough, way out in the cornfield stood Mr. Scarecrow.
His hat and coat were on and he was standing up like a man, very straight and still. His arms were outstretched to tell Mr. Jim Crow’s chums that he was ready for them.
But though they are thieves, the Black Crows are not night burglars and they were fast asleep in the nests in the wood.
The Man-in-the-Moon winked at them three times, once with his right eye, once with his left eye, then again with the right.
And the three happy children thought they heard him say three times:
“Back to bed, back to bed, back to bed!”
Then they heard the sound of bells. Seven times they sounded. It was from the church over in the town,—the big white church with the long finger pointing at the sky. And the Little-Clock-with-the-Wise-Face-on-the-Mantel, answered back.
So they obeyed the old yellow Man-in-the-Moon and scampered like little white mice back to bed.


Recently there are a number of newbies entering the Steemit community and many of them may not has English as their own language. As a chance, I totally understand sometimes it’s not rare for us to experience a lack of vocabulary. For instance, when we talk about Bitcoin price, we can only say Bitcoin increases, increases and increases, or Bitcoin falls, falls, and falls. That does not look nice, isn’t it?
So now I am going to introduce some words that we usually use and the words that can replace them.
Increase
- Rise
- Grow
- Mount
- Go up
- Soar
- Ascent
- Rocket
- Heighten
- Escalate
- Surge
Fall
- Drop
- Plunge
- Sink
- Descend
- Decline
- Dwindle
- Diminish
- Flag
Words used to describe the degree of change
- Substantial
- Massive
- Dramatic
- Huge
- Rapid
- Significant
- Slight
- Modest
- Gradual
This page is synchronized from the post: ‘Writing workshop - How to use different vocabulary in your own writings’


Where did all the money go?
Calculating how much money the gahmen takes from you.
NOT AN OFFICIAL SITE. NO GUARANTEES ON CORRECTNESS.
NOT AN OFFICIAL SITE. NO GUARANTEES ON CORRECTNESS.
but if you notice any mistakes, please consider reporting on GitHub or through lingyihuu(at)gmail.com.


WITNESS LIST Business & Commerce Committee March 11, 2003 - 9:00A SB 91 FOR: Birnham, Berny (Self), Austin, TX Chapa, Juan (Self), Corpus Christi, TX Lapham, Sara (Self), Garland, TX Perry, Kathryn Scott (Self), Wimberly, TX Schneider, Rob (Consumers Union), Austin, TX Skelton, Jeffrey (Choice Point), Alpharetta, GA Stinson, Bill (Texas Association of Realtors), Austin, TX ON: Brockett, Dr. Patrick (Bureau of Business Research, University of Texas), Austin, TX Butler, Patrick (National Organization for Women and Texas NOW), Austin, TX Kellison, Dr. Bruce (Bureau of Business Research, University of Texas), Austin, TX Registering, but not testifying: For: Lambe, Dan (Texas Watch), Austin, TX Lensch, Judith (Self), Sachse, TX Zepeda, Johnny (Coalition of Exclusive Insurance Agents), San Antonio, TX SB 99 FOR: Chapa, Juan (Self), Corpus Christi, TX Higgins, Carlos (Texas Silver Haired Legislature), Austin, TX Skelton, Jeffrey (Choice Point), Alpharetta, GA Stinson, Bill (Texas Association of Realtors), Austin, TX AGAINST: Lapham, Sara (Self), Garland, TX ON: Brockett, Dr. Patrick (Bureau of Business Research, University of Texas), Austin, TX Bulter, Patrick (National Organization for Women and Texas NOW), Austin, TX Kellison, Dr. Bruce (Bureau of Business Research, University of Texas), Austin, TX Registering, but not testifying: For: Lambe, Dan (Texas Watch), Austin, TX SB 130 FOR: Harrell, Wayne (Wayne Harrell Insurance Agency), Fredericksburg, TX Skelton, Jeffrey (Choice Point), Alpharetta, GA ON: Brockett, Dr. Patrick (Bureau of Business Research,), Austin, TX Kellison, Dr. Bruce (Bureau of Business Research, University of Texas), Austin, TX


You ask the crab what the meaning of life is and it says:
"the meaning of life is finding the best kombucha that could possibly exist and drink all of it. drink it every day until it's gone."
? ? ?
-
Kombucha???? But it's so GROSS
-
Sounds legit


# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains the classes and utility functions for distance and
cartesian coordinates.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import math
import numpy as np
from .. import units as u
from ..utils import deprecated
__all__ = ['Distance', 'CartesianPoints', 'cartesian_to_spherical',
'spherical_to_cartesian']
__doctest_requires__ = {'*': ['scipy.integrate']}
[docs]class Distance(u.Quantity):
"""
A one-dimensional distance.
This can be initialized in one of four ways:
* A distance ``value`` (array or float) and a ``unit``
* A `~astropy.units.Quantity` object
* A redshift and (optionally) a cosmology.
* Providing a distance modulus
Parameters
----------
value : scalar or `~astropy.units.Quantity`.
The value of this distance.
unit : `~astropy.units.UnitBase`
The units for this distance, *if* ``value`` is not a
`~astropy.units.Quantity`. Must have dimensions of distance.
z : float
A redshift for this distance. It will be converted to a distance
by computing the luminosity distance for this redshift given the
cosmology specified by ``cosmology``. Must be given as a keyword
argument.
cosmology : ``Cosmology`` or `None`
A cosmology that will be used to compute the distance from ``z``.
If `None`, the current cosmology will be used (see
`astropy.cosmology` for details).
distmod : float or `~astropy.units.Quantity`
The distance modulus for this distance. Note that if ``unit`` is not
provided, a guess will be made at the unit between AU, pc, kpc, and Mpc.
dtype : `~numpy.dtype`, optional
See `~astropy.units.Quantity`.
copy : bool, optional
See `~astropy.units.Quantity`.
order : {'C', 'F', 'A'}, optional
See `~astropy.units.Quantity`.
subok : bool, optional
See `~astropy.units.Quantity`.
ndmin : int, optional
See `~astropy.units.Quantity`.
allow_negative : bool, optional
Whether to allow negative distances (which are possible is some
cosmologies). Default: ``False``.
Raises
------
`~astropy.units.UnitsError`
If the ``unit`` is not a distance.
ValueError
If value specified is less than 0 and ``allow_negative=False``.
If ``z`` is provided with a ``unit`` or ``cosmology`` is provided
when ``z`` is *not* given, or ``value`` is given as well as ``z``.
Examples
--------
>>> from astropy import units as u
>>> from astropy import cosmology
>>> from astropy.cosmology import WMAP5, WMAP7
>>> cosmology.set_current(WMAP7)
>>> d1 = Distance(10, u.Mpc)
>>> d2 = Distance(40, unit=u.au)
>>> d3 = Distance(value=5, unit=u.kpc)
>>> d4 = Distance(z=0.23)
>>> d5 = Distance(z=0.23, cosmology=WMAP5)
>>> d6 = Distance(distmod=24.47)
>>> d7 = Distance(Distance(10 * u.Mpc))
"""
_include_easy_conversion_members = True
def __new__(cls, value=None, unit=None, z=None, cosmology=None,
distmod=None, dtype=None, copy=True, order=None,
subok=False, ndmin=0, allow_negative=False):
if z is not None:
if value is not None or distmod is not None:
raise ValueError('Should given only one of `value`, `z` '
'or `distmod` in Distance constructor.')
if cosmology is None:
from ..cosmology import default_cosmology
cosmology = default_cosmology.get()
value = cosmology.luminosity_distance(z)
# Continue on to take account of unit and other arguments
# but a copy is already made, so no longer necessary
copy = False
else:
if cosmology is not None:
raise ValueError('A `cosmology` was given but `z` was not '
'provided in Distance constructor')
if distmod is not None:
if value is not None:
raise ValueError('Should given only one of `value`, `z` '
'or `distmod` in Distance constructor.')
value = cls._distmod_to_pc(distmod)
if unit is None:
# if the unit is not specified, guess based on the mean of
# the log of the distance
meanlogval = np.log10(value.value).mean()
if meanlogval > 6:
unit = u.Mpc
elif meanlogval > 3:
unit = u.kpc
elif meanlogval < -3: #~200 AU
unit = u.AU
else:
unit = u.pc
# Continue on to take account of unit and other arguments
# but a copy is already made, so no longer necessary
copy = False
elif value is None:
raise ValueError('None of `value`, `z`, or `distmod` were '
'given to Distance constructor')
# now we have arguments like for a Quantity, so let it do the work
distance = super(Distance, cls).__new__(
cls, value, unit, dtype=dtype, copy=copy, order=order,
subok=subok, ndmin=ndmin)
if not distance.unit.is_equivalent(u.m):
raise u.UnitsError('Unit "{0}" is not a length type'.format(unit))
if not allow_negative and np.any(distance.value < 0):
raise ValueError("Distance must be >= 0. Use the argument "
"'allow_negative=True' to allow negative values.")
return distance
def __quantity_subclass__(self, unit):
if unit.is_equivalent(u.m):
return Distance, True
else:
return super(Distance, self).__quantity_subclass__(unit)[0], False
@property
def z(self):
"""Short for ``self.compute_z()``"""
return self.compute_z()
[docs] def compute_z(self, cosmology=None):
"""
The redshift for this distance assuming its physical distance is
a luminosity distance.
Parameters
----------
cosmology : ``Cosmology`` or `None`
The cosmology to assume for this calculation, or `None` to use the
current cosmology (see `astropy.cosmology` for details).
Returns
-------
z : float
The redshift of this distance given the provided ``cosmology``.
"""
from ..cosmology import luminosity_distance
from scipy import optimize
# FIXME: array: need to make this calculation more vector-friendly
f = lambda z, d, cos: (luminosity_distance(z, cos).value - d) ** 2
return optimize.brent(f, (self.Mpc, cosmology))
@property
def distmod(self):
"""The distance modulus as a `~astropy.units.Quantity`"""
val = 5. * np.log10(self.to(u.pc).value) - 5.
return u.Quantity(val, u.mag)
@classmethod
def _distmod_to_pc(cls, dm):
dm = u.Quantity(dm, u.mag)
return cls(10 ** ((dm.value + 5) / 5.), u.pc, copy=False)
@deprecated('v0.4', alternative='astropy.coordinates.CartesianRepresentation')
[docs]class CartesianPoints(u.Quantity):
"""
A cartesian representation of a point in three-dimensional space.
Parameters
----------
x : `~astropy.units.Quantity` or array-like
The first cartesian coordinate or a single array or
`~astropy.units.Quantity` where the first dimension is length-3.
y : `~astropy.units.Quantity` or array-like, optional
The second cartesian coordinate.
z : `~astropy.units.Quantity` or array-like, optional
The third cartesian coordinate.
unit : `~astropy.units.UnitBase` object or `None`
The physical unit of the coordinate values. If ``x``, ``y``, or ``z``
are quantities, they will be converted to this unit.
dtype : `~numpy.dtype`, optional
See `~astropy.units.Quantity`. Must be given as a keyword argument.
copy : bool, optional
See `~astropy.units.Quantity`. Must be given as a keyword argument.
Raises
------
UnitsError
If the units on ``x``, ``y``, and ``z`` do not match or an invalid
unit is given.
ValueError
If ``y`` and ``z`` don't match ``x``'s shape or ``x`` is not length-3
TypeError
If incompatible array types are passed into ``x``, ``y``, or ``z``
"""
#this ensures that __array_wrap__ gets called for ufuncs even when
#where a quantity is first, like ``3*u.m + c``
__array_priority__ = 10001
def __new__(cls, x, y=None, z=None, unit=None, dtype=None, copy=True):
if y is None and z is None:
if len(x) != 3:
raise ValueError('Input to CartesianPoints is not length 3')
qarr = x
if unit is None and hasattr(qarr, 'unit'):
unit = qarr.unit # for when a Quantity is given
elif y is not None and z is not None:
if unit is None:
#they must all match units or this fails
for coo in (x, y, z):
if hasattr(coo, 'unit'):
if unit is not None and coo.unit != unit:
raise u.UnitsError('Units for `x`, `y`, and `z` do '
'not match in CartesianPoints ')
unit = coo.unit
#if `unit` is still None at this point, it means none were
#Quantties, which is fine, because it means the user wanted
#the unit to be None
else:
#convert any that are like a Quantity to the given unit
if hasattr(x, 'to'):
x = x.to(unit)
if hasattr(y, 'to'):
y = y.to(unit)
if hasattr(z, 'to'):
z = z.to(unit)
qarr = [np.asarray(coo) for coo in (x, y, z)]
if not (qarr[0].shape == qarr[1].shape == qarr[2].shape):
raise ValueError("Shapes for `x`, `y`, and `z` don't match in "
"CartesianPoints")
#let the unit be whatever it is
else:
raise TypeError('Must give all of `x`, `y`, and `z` or just array in '
'CartesianPoints')
try:
unit = _convert_to_and_validate_length_unit(unit, True)
except TypeError as e:
raise u.UnitsError(str(e))
try:
qarr = np.asarray(qarr)
except ValueError as e:
raise TypeError(str(e))
if qarr.dtype.kind not in 'iuf':
raise TypeError("Unsupported dtype '{0}'".format(qarr.dtype))
return u.Quantity.__new__(cls, qarr, unit, dtype=dtype, copy=copy)
def __quantity_subclass__(self, unit):
if unit.is_equivalent(u.m):
return CartesianPoints, True
else:
return u.Quantity.__quantity_subclass__(unit)[0], False
def __array_wrap__(self, obj, context=None):
#always convert to CartesianPoints because all operations that would
#screw up the units are killed by _convert_to_and_validate_length_unit
obj = u.Quantity.__array_wrap__(obj, context=context)
#always prefer self's unit, if possible
if obj.unit.is_equivalent(self.unit):
return obj.to(self.unit)
else:
return obj
@property
def x(self):
"""
The second cartesian coordinate as a `~astropy.units.Quantity`.
"""
return self.view(u.Quantity)[0]
@property
def y(self):
"""
The second cartesian coordinate as a `~astropy.units.Quantity`.
"""
return self.view(u.Quantity)[1]
@property
def z(self):
"""
The third cartesian coordinate as a `~astropy.units.Quantity`.
"""
return self.view(u.Quantity)[2]
def to_spherical(self):
"""
Converts to the spherical representation of this point.
Returns
-------
r : `~astropy.units.Quantity`
The radial coordinate (in the same units as this `CartesianPoints`).
lat : `~astropy.units.Quantity`
The spherical coordinates latitude.
lon : `~astropy.units.Quantity`
The spherical coordinates longitude.
"""
from .angles import Latitude, Longitude
rarr, latarr, lonarr = cartesian_to_spherical(self.x, self.y, self.z)
r = Distance(rarr, unit=self.unit)
lat = Latitude(latarr, unit=u.radian)
lon = Longitude(lonarr, unit=u.radian)
return r, lat, lon
def _convert_to_and_validate_length_unit(unit, allow_dimensionless=False):
"""
raises UnitsError if not a length unit
"""
try:
unit = u.Unit(unit)
assert (unit.is_equivalent(u.kpc) or
allow_dimensionless and unit == u.dimensionless_unscaled)
except (TypeError, AssertionError):
raise u.UnitsError('Unit "{0}" is not a length type'.format(unit))
return unit
#<------------transformation-related utility functions----------------->
[docs]def cartesian_to_spherical(x, y, z):
"""
Converts 3D rectangular cartesian coordinates to spherical polar
coordinates.
Note that the resulting angles are latitude/longitude or
elevation/azimuthal form. I.e., the origin is along the equator
rather than at the north pole.
.. note::
This is a low-level function used internally in
`astropy.coordinates`. It is provided for users if they really
want to use it, but it is recommended that you use the
`astropy.coordinates` coordinate systems.
Parameters
----------
x : scalar or array-like
The first cartesian coordinate.
y : scalar or array-like
The second cartesian coordinate.
z : scalar or array-like
The third cartesian coordinate.
Returns
-------
r : float or array
The radial coordinate (in the same units as the inputs).
lat : float or array
The latitude in radians
lon : float or array
The longitude in radians
"""
xsq = x ** 2
ysq = y ** 2
zsq = z ** 2
r = (xsq + ysq + zsq) ** 0.5
s = (xsq + ysq) ** 0.5
if np.isscalar(x) and np.isscalar(y) and np.isscalar(z):
lon = math.atan2(y, x)
lat = math.atan2(z, s)
else:
lon = np.arctan2(y, x)
lat = np.arctan2(z, s)
return r, lat, lon
[docs]def spherical_to_cartesian(r, lat, lon):
"""
Converts spherical polar coordinates to rectangular cartesian
coordinates.
Note that the input angles should be in latitude/longitude or
elevation/azimuthal form. I.e., the origin is along the equator
rather than at the north pole.
.. note::
This is a low-level function used internally in
`astropy.coordinates`. It is provided for users if they really
want to use it, but it is recommended that you use the
`astropy.coordinates` coordinate systems.
Parameters
----------
r : scalar or array-like
The radial coordinate (in the same units as the inputs).
lat : scalar or array-like
The latitude in radians
lon : scalar or array-like
The longitude in radians
Returns
-------
x : float or array
The first cartesian coordinate.
y : float or array
The second cartesian coordinate.
z : float or array
The third cartesian coordinate.
"""
if np.isscalar(r) and np.isscalar(lat) and np.isscalar(lon):
x = r * math.cos(lat) * math.cos(lon)
y = r * math.cos(lat) * math.sin(lon)
z = r * math.sin(lat)
else:
x = r * np.cos(lat) * np.cos(lon)
y = r * np.cos(lat) * np.sin(lon)
z = r * np.sin(lat)
return x, y, z


Graduate diploma creative writing. Local time 2:13 PM aedt 1 November 2018 Membership 823,344 registered members 1 visited in past 24 hrs 1,091 members online now 1,024 guests visiting.
Graduate diploma creative writing usyd and primary homework help tutankhamun.