A panic attack is a sudden, intense fear that lasts for several minutes when there is no real danger. With it comes terror, physical symptoms, and a strong need to escape from wherever you are. If you have these attacks often, you have panic disorder. The attacks can be very frightening. You may be scared of having another one. You may even stay away from a place where you've had an attack. Some people become so afraid of having panic attacks, it's very hard for them to leave home (agoraphobia).
Remind yourself that your body is having a false alarm. Nothing bad will happen to you. You've survived attacks before, and you will this time, too.
Try not to think frightening thoughts about what might happen. You won't die or go crazy.
Don't fight your feelings. Let them come. Ride them out. Focus on a task like counting backward from 100. Think about someplace relaxing, such as a tropical island or quiet meadow. Ask your doctor or therapist to suggest other relaxation techniques.
Keep in mind that places and activities don't cause attacks. Separate the attack from the situation. Make an effort not to avoid the situation in the future.
Don't give in to the temptation to use alcohol or unprescribed drugs as an escape. In the long run, they will only add to your problems.


Peter Hovanes lives and works in Huntsville, Alabama, dividing his time between photography and computer software development. Largely self taught, his photographic career started in Huntsville where he learned his craft by studying the work of Edward Steichen, Edward Weston, Ansel Adams and Man Ray, as well as working with studio, newspaper and industrial photographers in the area. It was at this time he began developing his nature photography and fascination with light, shape, shadows and patterns.
Peter traveled extensively and settled in Northern California where he studied at The College of The Redwoods and worked with aerial and photogrammetric photography. In the mid 1980's he moved back to Huntsville where he opened the Commercial Images studio. Throughout this time his love of nature photography only grew.
Peter continues to develop his personal photographic style, focusing on the light, shape, shadows and patterns of nature. He uses digital/film photography and images scanned directly from nature to produce his photographs, creating images of ethereal landscapes, delicate flowers and the play of light in the complex, yet simple, beauty of nature. His archival prints use Epson archival inks and acid free printing and mounting material.


text:
Lollipop Chainsaw Review
Xbox 360 | PS3
System: PS3*, Xbox 360
Dev: Grasshopper Manufacture
Pub: Warner Bros.
Screen Resolution: 480p-1080p Blood and Gore, Drug Reference, Intense Violence, Partial Nudity, Sexual Themes, Strong Language
Romero And Juliet
by Josh Wirtanen
You want to scribble another tick mark on the scorecard of "games as art?" Well, you might want to pass Lollipop Chainsaw by. However, if you want to turn off your brain and mindlessly slaughter zombies with a chainsaw while punk rock blares in the background, boy have I got a game for you.
Lollipop Chainsaw is the newest title by Suda51, the man you can blame for No More Heroes and Shadows of the Damned. It follows in a similar tradition to those titles, with a quirky, always overstated sense of humor. Suda tends to push his creations so far over the top that they become ridiculous, then keeps on pushing them even further. Lollipop is no exception; it's completely absurd.
The game tells the story of Juliet Starling, a cheerleader who happens to be the middle sister in a family of zombie slayers. Juliet's weapon of choice is a chainsaw, of course, which she uses to dismember any undead unfortunate enough to shamble across her cute little path. She also wields a lollipop, because apparently it makes her sexy or something. Or else she just likes the taste…
It's Juliet's eighteenth birthday, and her high school, San Romero High, is being overrun by zombies. To make matters worse, her boyfriend was bitten, and the only way to save him was to remove his entire body. Now she wears his still-living, still-talking severed head around like he's the latest fashion accessory. Kind of a crappy birthday, no?
The combat in Lollipop Chainsaw begins deceptively simple. In fact, when you first begin the game, you'll most likely just mash buttons and pray for the best. And this works for a while. But soon you start to learn the intricacies of the combat system—one button for low chainsaw attack, one for high chainsaw attack, and one for a pom pom attack. Obviously the chainsaw attacks are far more powerful than pom pom attacks, but pom pom attacks are much quicker and able to make zombies "groggy," which is basically a stun. Whenever a zombie is groggy, Juliet can use a chainsaw attack for a brutal insta-kill. Yes, this even works on the named zombies who are essentially mini-bosses.
Eventually you'll find a rhythm to the whole thing, and that's when you realize just how much fun Lollipop Chainsaw's combat is. Of course, you can also purchase combos with the zombie tokens you collect, further increasing Juliet's deadliness on the battlefield. (And yes, any cheerleader worth her salt is going to find an excuse to go shopping during the middle of a zombie plague.) Oh, and because it's her birthday, Juliet keeps getting presents from her family to upgrade her chainsaw.
Each stage has you slaughtering zombies to your heart's content, though most of them are broken up by minigames. Generally, these are just quick time events (the penalties for failing these can be downright brutal in some instances), but there are a few incredibly bizarre minigames thrown into the mix. Zombie Baseball in particular completely redefines the phrase "frustrating escort mission."
Now, this wouldn't be a Suda game without insane boss fights, and this is definitely a Suda game. The first boss, for example, is a punk rock zombie named Zed who plays electric guitar and hurls gigantic letters at you. Yes, letters. Don't ask. If there were any underlying sense of logic behind all this, Suda fans would be asking for a refund. You see, this is a world filled with magical flying Viking ships, zombie chickens, and mind-altering mushrooms. None of it has to make any sense.
All of this craziness comes with a cel-shaded visual appeal that wouldn't be anything special if it weren't for the fact that everything is so damn stylized. Lollipop Chainsaw has this comic book vibe that carries over into its UI, menus, and even loading screens. It all works in conjunction to make a game that's not pushing the boundaries of what your console can do but is just plain fun to look at. And we can't really complain about that, now can we?
To compliment the game's insanity is the soundtrack, a brilliantly schizophrenic mix of punk rock and 50's rock 'n' roll (among other things). Not only does it work extremely well in the context, but it's super fun to listen to.

redpajama_set_name: RedPajamaCommonCrawl


In a competitive situation, Paramount Television and Anonymous Content have acquired rights to Stupid Idiots, a comedy web series written, directed by and starring Stephanie Koenig, to develop as a TV series. Koenig (PopTV's Swedish Dicks) is set to write the adaptation and star in the potential TV series, described as a (trying-to-get-out-of-the-) workplace comedy about two underachievers who consistently fail upwards. Koenig and Brian Jordan Alvarez star in the web version, which launched earlier this year.
Michael Sugar and Ashley Zalta will executive produce for Anonymous Content along with Zoe Worth, who has a first-look writing/producing deal at Paramount TV.
Koenig moved to Los Angeles in 2012 from Michigan and created Stupid Idiots, which she made independently (you can check out the first episode below). She also stars alongside Alvarez in his web series The Gay And Wondrous Life Of Caleb Gallo.
This is the latest collaboration between Paramount TV and Anonymous Content via their first-look deal. They have several on-air series together, including Epix's Berlin Station, Netflix's 13 Reasons Why and the upcoming Cary Fukunaga-directed Maniac with Emma Stone And Jonah Hill, and TNT's upcoming The Alienist.
Koenig is repped by Paradigm, Luber Roklin Entertainment and Ziffren Brittenham.


text:
BEGINNING COMPONENTS FOR ASP PART 4 – DIFFERENT KINDS OF COMPONENTS (Page 2)
How Components Are Made Available
OK, we've had an example of using a component from ASP, and we've talked about some of the ways we can think about categorizing the components we're going to build. Despite that, what we've yet to do is establish exactly how components are made available to our client code. You know that components are stored in DLL and EXE files, but there have been no references to those in the code you've seen so far. There must be another mechanism in operation.
The first questions to ask are: How do we know how to reference the component that we want? Where do applications get the information about components? The answer to both these questions lies in the system registry (often known simply as "the registry"). The registry currently plays a lead role in the world of COM. It's a hierarchical data store that's used to hold COM-related information and lots more.
The role of the registry with COM+ in Windows 2000 has changed slightly; the general concept of having a 'central repository' for component information is the same, but the registry is no longer that repository, except for legacy components.
Generally, applications don't access the registry directly for the COM information they need. Instead, they use some Application Programming Interface (API) functions provided by COM that encapsulate its usage. To take a closer look at the registry, run the registry editor program Regedit.exe (just choose Run… from the Start menu and type Regedit). When it starts, you'll see a number of keys:
COM information is stored under the HKEY_CLASSES_ROOT key. We won't discuss the registry editor or the various keys in detail here, but feel free to have a look around it when you have a spare moment.
Looking around is fine, but never change anything in the registry unless you know exactly what you're doing. The registry holds a lot of information that's used by the Windows operating system. If you accidentally change something important, it's possible to render your computer unusable.
If you expand the HKEY_CLASSES_ROOT key, you'll find a number of interesting sub-keys. Those of interest are shown here:
Most of the COM components installed on your machine will be listed under the key HKEY_CLASSES_ROOTCLSID, where you'll find a large number of sub-keys whose names are all CLSIDs of the form you saw earlier. There will a sub-key for every component registered on your machine. As we've explained, these identifiers are the actual names of your components, and each sub-key stores information about the component whose name it bears. One of these pieces of information is the location of the server that contains the component, and it's by this means that components are found and subsequently instantiated on request.
When your client is compiled (if, for example, it's a Visual Basic or a Visual C++ application), the CLSIDs of the components it uses are generally "hard-wired" into the code. This means that if the CLSID of the component it uses should change, the client will no longer work.
However, in our Brick Calculator example, when we created the component instance within the ASP page, we did not use the CLSID to reference the component. Instead, we used the programmatic identifier, or ProgID.
Programmatic Identifiers
In our first example of using a component in an ASP page, we created an instance of the component like this:
Dim objBrickCalc
Set objBrickCalc = Server.CreateObject("BrickCalc.wsc")
When you create a class module in Visual Basic, it generates a ProgID for you, in the form:
[ProjectName].[ClassModuleName]
At the end of this chapter, we'll build the Windows Script Component using the Wizard provided by Microsoft. There, you'll see that WSCs store the ProgID in the same file as the rest of the component's implementation:
<registration
description="BrickCalc"
progid="BrickCalc.WSC"
version="1.00"
classid="{f954a720-67c1-11d3-99b1-00104b4c84a4}"
</registration>
As the next screenshot shows, ProgIDs are also sub-keys under HKEY_CLASSES_ROOT. They provide a way of looking up a CLSID at runtime from a "friendly" string identifier. Using the Brick Calculator component as an example, we can see that the ProgID key has a sub-key called CLSID. This has a Default string value that contains the GUID in string format:
Whether you use ProgIDs or CLSIDs to call your component from ASP is up to you. While CLSIDs are less easy to write and less logical to read than ProgIDs, they do ensure that (in the unlikely event that there is a component with the same name and method as the one you are calling) you get the correct method of the correct component.
The COM Runtime
An important part of the COM is the COM runtime, which provides the API functions that enable applications use to create and manipulate COM objects. As ASP programmers, we don't really see the COM runtime, but functions like the Server object's CreateObject() method are layers upon it. If you asked ten C++ programmers to name a COM runtime API, you'd probably find 99% of them would say CoCreateInstance() or CoCreateInstanceEx(). These APIs are responsible for the creation of COM objects – they are the equivalent of CreateObject() in ASP. The COM runtime is a large topic, and we will not be covering it in depth here.
There is a lot more to learn about COM in general, but both ASP and Visual Basic make COM very easy to work with. While we could introduce all manner of topics to help you understand what is going on under the hood, the ASP and Visual Basic environments are designed to hide much of the complexity from you until you're at a stage when you really need to dig into the inner workings. We will be looking into COM more deeply in the section on C++, starting in Chapter 10, but what you have seen so far is enough to get you used to building components and using them in your ASP pages.
Will Microsoft Replace COM?
Unlike a lot of Microsoft technologies, COM has a fairly stable history that can be tracked back long before the official release in 1993. Since its release, COM has slowly evolved, but this has largely involved additional features such as security and the ability to call up components on different computers. There have been no major architecture changes.
COM has a solid future. These days, almost every new technology that Microsoft introduces is based to some extent – and in some cases entirely – on COM. This is true for all the technologies we will be examining in this book – ADO, MTS, MSMQ ADSI, and OLE DB. All the Microsoft Office components expose COM interfaces, as does Internet Explorer. The next version of COM, known as COM+, already has a pivotal role in Windows 2000, so you can rest assured it is here to stay. There are some big changes between COM and COM+, but nothing that invalidates or outdates the code that we will be writing in this book.
BEGINNING COMPONENTS FOR ASP PART 1 – STARTING OUT WITH COMPONENTS
The continual growth in the adoption and expansion of computer-based systems leads to more sophisticated (or complicated) applications – some of which take years to develop, or evolve without direction into unmanageable systems that no single developer fully understands. When the system requires maintenance or an upgrade, where's the developer who built the thing in …
BEGINNING ACTIVE SERVER PAGES 3.0 PART 5 – WHAT IS THE ACTIVE SERVER PAGES OBJECT MODEL? (Page 1)
In the Active Server Pages programming model, there is a wide range of functionality that is accessible to the programmer. ASP helps us to track the state of a user, dynamically generate HTML output, and take data from forms to be inserted into a database. All of this functionality makes ASP a rather complex beast. …
BEGINNING ACTIVE SERVER PAGES 3.0 PART 5 – WHAT IS THE ACTIVE SERVER PAGES OBJECT MODEL?
BEGINNING ACTIVE SERVER PAGES 3.0 PART 3 – ALTERING THE PROPERTIES OF AN OBJECT (Page 2)
Retrieving a Property The last section showed how to set the values of properties of an object. Now that information is stored there, we can retrieve this information at a later time. In essence, we have an instance of an object that has some data stored in its properties. All we need to refer to …
Memory Leak on Windows Mobile 6.1 (Shim_verifer,…
Get $1000 Free – No Deposit Required And 1…
CoCreateInstance Under Stress on Multiple Threads at…


text:
Три (, также Коглуктуалук, ) — река в провинции Нунавут, Канада. Берёт начало в водах озера Кигликавик (), впадает в залив Коронейшен.

В районе этой реки встречаются водно-ледниковые формы рельефа в виде приледниковых дельт и камовых террас.

В водах реки Три обитает арктический голец.

Из поколения в поколение в окрестностях этой реки проживали племена так называемых «Медных инуитов» (), в частности, племя Коглуктуалугмиут (также называемое Уткусиксалигмиут, ), обитавшее на её берегах; племя Пингангнактогмиут (), представители которого селились на западе от реки, и племя Нагиуктогмиут (также известное как Киллинермиут, ), которое жило на востоке по отношению к ней.

Примечания

Реки, впадающие в Северный Ледовитый океан (Северная Америка)
Бассейн Коронейшена
Реки Нунавута
Район Китикмеот

redpajama_set_name: RedPajamaWikipedia


Thermostatic Expansion Valve Danfoss TES2 Z RA | Thermostatic expansion valve regulates injection of refrigerant into the evaporator. Injection is . MAKING Danfoss A/S (AG-SMC / bpv), 07 – .. Z Z Z Z Z TES 2. Ext. 3/8. 1/2. Angleway valve body, inlet size 3/8 inch, outlet size 1/2 inch, capillary tube length m, max. working pressure bar. TE 2, flare/flare, versions with external.
Pyskowicka 24, Zabrze is the administrator of the personal data provided by you in the above form. Thermostatic expansion valve regulates injection of refrigerant into the evaporator. The abovementioned does not influence compliance with the right to process data, which was performed on the basis of the consent expressed by you, before you withdrew it.
Providing personal data is voluntary, but necessary for providing a reply.
Ask for this product: If this description is not sufficient, please send us a question to this product. You are entitled to withdraw the consent at any time by sending an email from address to which the consent relates. To rate this product or to add a new review, you need to log in. No stress and worry Thanks to the integration with cheap returns you can purchase without stress and be sure that the return process will be hassle free.
Remove products Compare products. When you sign up to be notified, you hereby agree to receive only a one-time notification of a product re-availability.
Capillary tube length [mm]. You can determine conditions of storing or access to cookie files in your web browser. Sign me up to an availability notification. Pyskowicka 24, Zabrze in the scope necessary for drawing up and sending a reply to my message, which tex2 sent to the administrator by the above contact form.
Enter contact details and we will notify you, when the product is available. You can return the product without providing a reason within 14 days. Injection is controlled by overheating. This page uses cookie files to provide its services in accordance to Cookies Usage Policy.
Enter your e-mail address, to which we will send a one-time notification when this product is available again. Easy product returns Buy a product and check it in your own time, at home.
We also inform you that: Ready to ship in 4 days 20 h Check delivery time and costs. Contact details entered above are not used to send newsletters or tws2 advertisements.
If you agree to the above, the data will also be used for sending marketing contents.
We will reply as soon as possible. Notify me about a product availability.


text:
Roland Martin kan syfta på bland andra:

 Roland Martin (medicinare) (1726-1788), svensk medicinare
 Roland Martin (politiker) (1838-1925), svensk politiker
 Roland Martin (tandläkare) (1841–1894), svensk tandläkare
 Roland Martin (arkeolog) (1912-1997), fransk arkeolog

Se även

 Carl Roland Martin (1843–1925), svensk teolog och präst


text:
Posted on May 9, 2021 August 3, 2021 by Christopher Smith
CHARTS: UK Top 40 Singles Chart 12th May 1991
Thirty years ago: UK Top 40 Singles Chart for Sunday 12th May 1991
So this was the chart that Radio 1 DJ Mark Goodier broadcast from 4:30-7pm with data from the GALLUP computer based on record sales from Monday 6th to Saturday 11th May 1991.
This is how the charts USED to look with new entries, climbers and non-movers, all based solely on record purchases.
This week, thirty years ago, there were ten new entrys, eight climbers and three non-movers! And it was announced like this…
40. EMF – "Children"
EMF's latest single has spent just four weeks on the chart and it looks like its last as they fall seventeen places.
39. The Wedding Present – "Dalliance"
Also going down, having been new on last week, are The Wedding Present, as they drop ten places with their newest release.
38. Gary Clail – "Human Nature"
Gary Clail's first top 40 single has been around for two months now and made the top ten. Like EMF, he too falls seventeen places but we hope to see him again…
37. The Wonder Stuff – "The Size Of A Cow"
The Wonder Stuff's highest charted single takes the same tumble in places as they leave the top twenty, six weeks after they joined us.
36. Paul Weller Movement – "Into Tomorrow"
Former Jam and Style Council member Paul Weller is going solo now and he launches that new phase of his career with this new line up titled 'The Paul Weller Movement'. This is their first single and it puts Paul back in the top 40 for the first time since early 1988.
35. REM – "Shiny Happy People"
REM are back with the follow up to their 'consistent' top twenty hit, "Losing My Religion". This time they rope in Kate of the B52's on guest vocals for the second single off their current album, "Out Of Time".
34. Flowered Up – "Take It"
There's a new entry and a chart debut next for British band Flowered Up who formed in 1989 and have released two previous singles. This is their third and it makes the top 40 for them at last.
33. Lonnie Gordon – "Gonna Catch You"
It looks like to won't happen all over again for Lonnie Gordon as her second top 40 charting single drops back one place this week.
32. Madonna – "Rescue Me"
Madonna's latest new track from "The Immaculate Collection" is down thirteen places, which takes her out of the upper half of the chart this week.
31. T'Pau – "Whenever You Need Me"
We welcome back T'Pau to the top 40 with a brand new album on the way and a new entry to kick that off today! We last saw the Shrewsbury quintet in April 1989 with "Only The Lonely".
30. Samantha Janus – "A Message To Your Heart"
It's not looking good for this year's Eurovision entry from newcomer Samanatha Janus as her new entry last week does absolutely nothing in week two as she is a non-mover.
29. Wilson Phillips – "You're In Love"
Three sisters who are doing something in week two are Wilson Phillips with their latest single, which moves up ten places and into the top thirty.
28. Roachford – "Get Ready"
Hopes of a top twenty hit are sadly over for Roachford this time as they go back six places, after five weeks of steady climbing.
27. Color Me Badd – "I Wanna Sex You Up"
Here's another chart debut for this US trio of young men with their debut single, which is currently top ten Stateside and hoping now to do the same here. Only time will tell…
26. Amy Grant – "Baby Baby"
Fellow American Amy Grant made her UK chart debut finally last week, with this track from her ninth studio album. She goes up eight places this week with a song that's already topped the chart over there.
25. Jason Donovan – "RSVP"
Jason Donovan is back for 1991 with new music and gains a chart entry with a noticeable change in sound for him since last year's "Between The Lines" album and the five top thirty charting singles from it.
24. The Waterboys – "The Whole Of The Moon"
The Waterboys re-issued 1985 single has performed far better second time around, having reached the top three to give the band their biggest chart hit to date. This week they fall eleven places.
23. Michael Bolton – "Love Is A Wonderful Thing"
Michael Bolton is still on the up although it's just one more place this week with his newest single which comes from his new album, "Time, Love And Tenderness", which is out now.
22. Quadrophonia – "Quadrophonia"
Former highest climber Quadrophonia have been stuck in the same place for the past two weeks. Not any longer as they go down eight places and out of the top twenty.
21. Dannii Minogue – "Success"
We loose Dannii Minogue's debut single this week but gain its follow up in place of! She hurtles back with single number two and, as the title suggests, she's hoping for more top ten 'success' with this one as well!
20. New Kids On The Block – "Call It What You Want"
In a bumper week of new entry's, we continue with the return of New Kids On The Block and the second single to come from their remix album, "No More Games", which gives them an eleventh UK top twenty hit!
19. James – "Sit Down"
James leave the top ten with a fall of ten places with their biggest hit yet, now with a full two months on the chart.
18. Frances Nero – "Footsteps Following Me"
And Frances Nero slips back one place with her new recording, but wins a second week inside the top twenty.
17. Nomad – "Just A Groove"
Following her, also down one place, are Nomad with their second chart hit, which doesn't look as if it will go quite as far as "Devotion" did.
16. De La Soul – "Ring Ring Ring"
Down five places this week for De La Soul with their latest new track, which will feature on their new album, "De La Soul Is Dead", out in two weeks time.
15. Vic Reeves and The Roman Numerals – "Born Free"
Vic Reeves is free of the chart position he's been holding on to for the past two weeks as he leaves the top ten, down nine places.
14. T99 – "Anasthasia"
Producers T99 made their chart debut last week and enjoy an impressive climb of thirteen places a week later to move into the top twenty.
13. Seal – "Future Love" EP
No top ten hit this time for Seal as his extended play drops back one place, with his debut album due out at the end of this month.
12. Roxette – "Fading Like A Flower"
Good news, however, for Per and Marie, they were last week's highest new entry with the second single from "Joyride" and with a climb of fourteen places, it makes them this week's highest!
11. Chesney Hawkes – "The One And Only"
The former number one from Chesney Hawkes leaves the top ten for the first time in more than two months as he goes down six places this week.
10. Soft Cell – "Tainted Love '91"
We're not finished with the new entry's just yet as Soft Cell bring a new version of their 1981 chart topper back to the top 40, which follows on from their earlier reboot of "Say hello, Wave Goodbye".
9. Electronic – "Get The Message"
The new duo line up of Electronic are going back one place this week, back to where they were two weeks ago with their debut album coming in three weeks time.
8. Blur – "There's No Other Way"
UK band Blur continue to make progress with their very first top 40 single, which climbs two places this week, continuing to do much better than their debut release last year.
7. Zucchero and Paul Young – "Senza Una Donna"
Sadly, it's all over for Zucchero and Paul Young, after six weeks of climbing upwards, they go downwards and they drop out of the top five by three places.
6. Beverely Craven – "Promise Me"
One of last week's joint highest climbers came from chart newbie Beverely Craven with her very first single. This week she moves into the top ten, up nine places.
5. Cathy Dennis – "Touch Me (All Night Long)"
While the other one, from Cathy Dennis, stays top ten for a second week as she moves her version of Fonda Rae's former recording into the top five, up two places.
4. OMD – "Sailing On The Seven Seas"
The wind is blowing the sails on OMD's boat back to port this week as they slip back one place with their brand new single.
3. Crystal Waters – "Gypsy Woman"
Making way for this week's highest new entry and an impressive debut from US singer Crystal Waters, who is currently number one on the dance chart over there with this, her debut single, which now crashes straight into the top three of the UK sales chart!
2. The KLF – "Last Train To Transcentral"
The KLF were hoping to take their train to the top this week, just as they did back in January, but alas, it's still in transcentral station, as they remain in second place for a second week.
1. Cher – "The Shoop Shoop Song"
Which means for a third week running, Cher stays top of the pile with her song from the movie 'Mermaids' as she remains Britain's biggest seller. But can she make it a fourth, or will Crystal Waters, Cathy Dennis or Beverely Craven stop her? There's only one way to find out…
Make sure you come back in seven days time for next weeks chart!
Follow the latest 'rewind' chart below, click here to read about previous weeks or go old school and get the book.
This entry was posted in:1991, Charts, Powered By The Past
Tagged with:chart rewind, UK singles chart 12th May 1991, UK top 40 12th May 1991, UK top 40 singles 12th May 1991
Previous PostWHERE ARE THEY NOW? Sabrina Johnston
Next PostFRESH: 'Hold On' – Serena Sophia


text:
"""
plot_radar.py

Class instance used to make Display.
"""
from __future__ import print_function
# Load the needed packages
import numpy as np
import os
import pyart

from matplotlib.backends.qt_compat import is_pyqt5
if is_pyqt5():
    from matplotlib.backends.backend_qt5agg import (
        FigureCanvas, NavigationToolbar2QT as NavigationToolbar, FigureCanvasQTAgg)
else:
    from matplotlib.backends.backend_qt4agg import (
        FigureCanvas, NavigationToolbar2QT as NavigationToolbar)

from matplotlib.figure import Figure
from matplotlib.colors import Normalize as mlabNormalize
from matplotlib.colorbar import ColorbarBase as mlabColorbarBase
from matplotlib.pyplot import cm

from ..core import (Variable, Component, common, VariableChoose, QtCore,
                    QtGui, QtWidgets, log)
from ..core.points import Points

# Save image file type and DPI (resolution)
IMAGE_EXT = 'png'
DPI = 200
# ========================================================================

class RadarDisplay(Component):
    '''
    Class to create a display plot, using a returned Radar structure
    from the PyArt pyart.graph package.
    '''

    Vradar = None  #: see :ref:`shared_variable`
    Vfield = None  #: see :ref:`shared_variable`
    Vtilt = None  #: see :ref:`shared_variable`
    Vlimits = None  #: see :ref:`shared_variable`
    Vcolormap = None  #: see :ref:`shared_variable`
    Vgatefilter = None  #: see :ref:`shared_variable`
    VplotAxes = None  #: see :ref:`shared_variable` (no internal use)
    VpathInteriorFunc = None  #: see :ref:`shared_variable` (no internal use)
    VpyartDisplay = None  #: see :ref:`shared_variable`

    @classmethod
    def guiStart(self, parent=None):
        '''Graphical interface for starting this class'''
        args = _DisplayStart().startDisplay()
        args['parent'] = parent
        return self(**args), True

    def __init__(self, Vradar=None, Vfield=None, Vtilt=None, Vlimits=None,
                 Vcolormap=None, Vgatefilter=None,
                 name="RadarDisplay", parent=None):
        '''
        Initialize the class to create display.

        Parameters
        ----------
        [Optional]
        Vradar : :py:class:`~artview.core.core.Variable` instance
            Radar signal variable. If None start new one with None.
        Vfield : :py:class:`~artview.core.core.Variable` instance
            Field signal variable. If None start new one with empty string.
        Vtilt : :py:class:`~artview.core.core.Variable` instance
            Tilt signal variable. If None start new one with 0.
        Vlimits : :py:class:`~artview.core.core.Variable` instance
            Limits signal variable.
            A value of None will instantiate a limits variable.
        Vcolormap : :py:class:`~artview.core.core.Variable` instance
            Colormap signal variable.
            A value of None will instantiate a colormap variable.
        Vgatefilter : :py:class:`~artview.core.core.Variable` instance
            Gatefilter signal variable.
            A value of None will instantiate a empty variable.
        name : string
            Display window name.
        parent : PyQt instance
            Parent instance to associate to Display window.
            If None, then Qt owns, otherwise associated with parent PyQt
            instance.

        '''
        super(RadarDisplay, self).__init__(name=name, parent=parent)
        self.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.setMinimumSize(20,20)
        #self.setSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
        # Set up signal, so that DISPLAY can react to
        # external (or internal) changes in radar, field,
        # lims and tilt (expected to be Core.Variable instances)
        # The capital V so people remember using ".value"
        if Vradar is None:
            self.Vradar = Variable(None)
        else:
            self.Vradar = Vradar
        if Vfield is None:
            self.Vfield = Variable('')
        else:
            self.Vfield = Vfield
        if Vtilt is None:
            self.Vtilt = Variable(0)
        else:
            self.Vtilt = Vtilt
        if Vlimits is None:
            self.Vlimits = Variable(None)
        else:
            self.Vlimits = Vlimits

        if Vcolormap is None:
            self.Vcolormap = Variable(None)
        else:
            self.Vcolormap = Vcolormap

        if Vgatefilter is None:
            self.Vgatefilter = Variable(None)
        else:
            self.Vgatefilter = Vgatefilter

        self.VpathInteriorFunc = Variable(self.getPathInteriorValues)
        self.VplotAxes = Variable(None)
        self.VpyartDisplay = Variable(None)

        self.sharedVariables = {"Vradar": self.NewRadar,
                                "Vfield": self.NewField,
                                "Vtilt": self.NewTilt,
                                "Vlimits": self.NewLims,
                                "Vcolormap": self.NewCmap,
                                "Vgatefilter": self.NewGatefilter,
                                "VpathInteriorFunc": None,
                                "VplotAxes": None,
                                "VpyartDisplay": self.NewDisplay}

        # Connect the components
        self.connectAllVariables()

        self.plot_type = None

        # Set plot title and colorbar units to defaults
        self.title = self._get_default_title()
        self.units = self._get_default_units()

        # Set the default range rings
        self.RngRingList = ["None", "10 km", "20 km", "30 km",
                            "50 km", "100 km"]
        self.RngRing = False

        # Find the PyArt colormap names
#        self.cm_names = [m for m in cm.datad if not m.endswith("_r")]
        self.cm_names = ["pyart_" + m for m in pyart.graph.cm.datad
                         if not m.endswith("_r")]
        self.cm_names.sort()

        # Create tool dictionary
        self.tools = {}

        # Create display image text dictionary
        self.disp_text = {}

        # Set up Default limits and cmap
        if Vlimits is None:
            self._set_default_limits(strong=False)
        if Vcolormap is None:
            self._set_default_cmap(strong=False)

        # Create a figure for output
        self._set_fig_ax()

        # Launch the GUI interface
        self.LaunchGUI()

        # Initialize radar variable
        self.NewRadar(None, True)

        self.show()

    def keyPressEvent(self, event):
        '''Allow tilt adjustment via the Up-Down arrow keys.'''
        if event.key() == QtCore.Qt.Key_Up:
            self.TiltSelectCmd(self.Vtilt.value + 1)
        elif event.key() == QtCore.Qt.Key_Down:
            self.TiltSelectCmd(self.Vtilt.value - 1)
        else:
            super(RadarDisplay, self).keyPressEvent(event)

    ####################
    # GUI methods #
    ####################

    def LaunchGUI(self):
        '''Launches a GUI interface.'''
        # Create layout
        self.layout = QtWidgets.QGridLayout()
        self.layout.setSpacing(8)

        # Create the widget
        self.central_widget = QtWidgets.QWidget()
        self.setCentralWidget(self.central_widget)
        self._set_figure_canvas()

        self.central_widget.setLayout(self.layout)

        # Add buttons along display for user control
        self.addButtons()
        self.setUILayout()

        # Set the status bar to display messages
        self.statusbar = self.statusBar()

    ##################################
    # User display interface methods #
    ##################################

    def addButtons(self):
        '''Add a series of buttons for user control over display.'''
        # Create the Display controls
        self._add_displayBoxUI()
        # Create the Tilt controls
        self._add_tiltBoxUI()
        # Create the Field controls
        self._add_fieldBoxUI()
        # Create the Tools controls
        self._add_toolsBoxUI()
        # Create the Informational label at top
        self._add_infolabel()

    def setUILayout(self):
        '''Setup the button/display UI layout.'''
        self.layout.addWidget(self.tiltBox, 0, 0)
        self.layout.addWidget(self.fieldBox, 0, 1)
        self.layout.addWidget(self.dispButton, 0, 2)
        self.layout.addWidget(self.toolsButton, 0, 3)
        self.layout.addWidget(self.infolabel, 0, 4)

    #############################
    # Functionality methods #
    #############################

    def _open_LimsDialog(self):
        '''Open a dialog box to change display limits.'''
        from .limits import limits_dialog
        limits, cmap, aspect, change = limits_dialog(
            self.Vlimits.value, self.Vcolormap.value, self.ax.get_aspect(),
            self.name)
        if aspect != self.ax.get_aspect():
            self.ax.set_aspect(aspect)
        if change == 1:
            self.Vcolormap.change(cmap)
            self.Vlimits.change(limits)

    def _fillTiltBox(self):
        '''Fill in the Tilt Window Box with current elevation angles.'''
        self.tiltBox.clear()
        self.tiltBox.addItem("Tilt Window")
        # Loop through and create each tilt button
        elevs = self.Vradar.value.fixed_angle['data'][:]
        for i, ntilt in enumerate(self.rTilts):
            btntxt = "%2.1f deg (Tilt %d)" % (elevs[i], i+1)
            self.tiltBox.addItem(btntxt)

    def _fillFieldBox(self):
        '''Fill in the Field Window Box with current variable names.'''
        self.fieldBox.clear()
        self.fieldBox.addItem("Field Window")
        # Loop through and create each field button
        for field in self.fieldnames:
            self.fieldBox.addItem(field)

    def _tiltAction(self, text):
        '''Define action for Tilt Button selection.'''
        if text == "Tilt Window":
            self._open_tiltbuttonwindow()
        else:
            ntilt = int(text.split("(Tilt ")[1][:-1])-1
            self.TiltSelectCmd(ntilt)

    def _fieldAction(self, text):
        '''Define action for Field Button selection.'''
        if text == "Field Window":
            self._open_fieldbuttonwindow()
        else:
            self.FieldSelectCmd(str(text))

    def _GateFilterToggleAction(self):
        '''Define action for GateFilterToggle menu selection.'''
        if self.gatefilterToggle.isChecked():
            self.gatefilterToggle.setText("GateFilter On")
        else:
            self.gatefilterToggle.setText("GateFilter Off")
        self._update_plot()

    def _IgnoreEdgesToggleAction(self):
        '''Define action for IgnoreEdgesToggle menu selection.'''
        if self.ignoreEdgesToggle.isChecked():
            self.ignoreEdges = False
        else:
            self.ignoreEdges = True
        self._update_plot()

    def _UseMapToggleAction(self):
        '''Define action for IgnoreEdgesToggle menu selection.'''
        self._check_file_type()
        self._update_display()

    def _title_input(self):
        '''Retrieve new plot title.'''
        val, entry = common.string_dialog_with_reset(
            self.title, "Plot Title", "Title:", self._get_default_title())
        if entry is True:
            self.title = val
            self._update_plot()

    def _units_input(self):
        '''Retrieve new plot units.'''
        val, entry = common.string_dialog_with_reset(
            self.units, "Plot Units", "Units:", self._get_default_units())
        if entry is True:
            self.units = val
            self._update_plot()

    def _add_ImageText(self):
        '''Add a text box to display.'''
        from .image_text import ImageTextBox
        itext = ImageTextBox(self, parent=self.parent)
        return itext

    def _open_tiltbuttonwindow(self):
        '''Open a TiltButtonWindow instance.'''
        from .level import LevelButtonWindow
        self.tiltbuttonwindow = LevelButtonWindow(
            self.Vtilt, plot_type=self.plot_type, Vcontainer=self.Vradar,
            name=self.name+" Tilt Selection", parent=self.parent)

    def _open_fieldbuttonwindow(self):
        '''Open a FieldButtonWindow instance.'''
        from .field import FieldButtonWindow
        self.fieldbuttonwindow = FieldButtonWindow(
            self.Vradar, self.Vfield,
            name=self.name+" Field Selection", parent=self.parent)

    def _add_RngRing_to_button(self):
        '''Add a menu to display range rings on plot.'''
        for RngRing in self.RngRingList:
            RingAction = self.dispRngRingmenu.addAction(RngRing)
            RingAction.setStatusTip("Apply Range Rings every %s" % RngRing)
            RingAction.triggered.connect(
                lambda check, RngRing=RngRing: self.RngRingSelectCmd(RngRing))
            self.dispRngRing.setMenu(self.dispRngRingmenu)

    def _add_cmaps_to_button(self):
        '''Add a menu to change colormap used for plot.'''
        for cm_name in self.cm_names:
            cmapAction = self.dispCmapmenu.addAction(cm_name)
            cmapAction.setStatusTip("Use the %s colormap" % cm_name)
            cmapAction.triggered.connect(
                lambda check, cm_name=cm_name: self.cmapSelectCmd(cm_name))
            self.dispCmap.setMenu(self.dispCmapmenu)

    def _add_displayBoxUI(self):
        '''Create the Display Options Button menu.'''
        self.dispButton = QtWidgets.QPushButton("Display Options")
        self.dispButton.setToolTip("Adjust display properties")
        self.dispButton.setFocusPolicy(QtCore.Qt.NoFocus)
        dispmenu = QtWidgets.QMenu(self)
        dispLimits = dispmenu.addAction("Adjust Display Limits")
        dispLimits.setToolTip("Set data, X, and Y range limits")
        self.colormapToggle = QtWidgets.QAction(
            'Colormap', dispmenu, checkable=True,
            triggered=self._update_plot)
        dispmenu.addAction(self.colormapToggle)
        self.colormapToggle.setChecked(True)
        self.gatefilterToggle = QtWidgets.QAction(
            'GateFilter On', dispmenu, checkable=True,
            triggered=self._GateFilterToggleAction)
        dispmenu.addAction(self.gatefilterToggle)
        self.gatefilterToggle.setChecked(True)
        self.ignoreEdgesToggle = QtWidgets.QAction(
            'Ignore Edges', dispmenu, checkable=True,
            triggered=self._IgnoreEdgesToggleAction)
        dispmenu.addAction(self.ignoreEdgesToggle)
        self.ignoreEdgesToggle.setChecked(False)
        self.useMapToggle = QtWidgets.QAction(
            'Use MapDisplay', dispmenu, checkable=True,
            triggered=self._UseMapToggleAction)
        dispmenu.addAction(self.useMapToggle)
        self.useMapToggle.setChecked(False)
        dispTitle = dispmenu.addAction("Change Title")
        dispTitle.setToolTip("Change plot title")
        dispUnit = dispmenu.addAction("Change Units")
        dispUnit.setToolTip("Change units string")
        self.dispRngRing = dispmenu.addAction("Add Range Rings")
        self.dispRngRingmenu = QtWidgets.QMenu("Add Range Rings")
        self.dispRngRingmenu.setFocusPolicy(QtCore.Qt.NoFocus)
        self.dispCmap = dispmenu.addAction("Change Colormap")
        self.dispCmapmenu = QtWidgets.QMenu("Change Cmap")
        self.dispCmapmenu.setFocusPolicy(QtCore.Qt.NoFocus)
        changeAxesPosition = dispmenu.addAction("Change Axes Position")
        self.dispImageText = dispmenu.addAction("Add Text to Image")
        self.dispImageText.setToolTip("Add Text Box to Image")
        dispQuickSave = dispmenu.addAction("Quick Save Image")
        dispQuickSave.setShortcut("Ctrl+D")
        dispQuickSave.setToolTip(
            "Save Image to local directory with default name")
        dispSaveFile = dispmenu.addAction("Save Image")
        dispSaveFile.setShortcut("Ctrl+S")
        dispSaveFile.setStatusTip("Save Image using dialog")

        dispLimits.triggered.connect(self._open_LimsDialog)
        dispTitle.triggered.connect(self._title_input)
        dispUnit.triggered.connect(self._units_input)
        changeAxesPosition.triggered.connect(self._change_axes_position)
        self.dispImageText.triggered.connect(self._add_ImageText)
        dispQuickSave.triggered.connect(self._quick_savefile)
        dispSaveFile.triggered.connect(self._savefile)

        self._add_RngRing_to_button()
        self._add_cmaps_to_button()
        self.dispButton.setMenu(dispmenu)

    def _add_tiltBoxUI(self):
        '''Create the Tilt Selection ComboBox.'''
        self.tiltBox = QtWidgets.QComboBox()
        self.tiltBox.setFocusPolicy(QtCore.Qt.NoFocus)
        self.tiltBox.setToolTip("Select tilt elevation angle to display.\n"
                                "'Tilt Window' will launch popup.\n"
                                "Up/Down arrow keys Increase/Decrease tilt.")
        self.tiltBox.activated[str].connect(self._tiltAction)

    def _add_fieldBoxUI(self):
        '''Create the Field Selection ComboBox.'''
        self.fieldBox = QtWidgets.QComboBox()
        self.fieldBox.setFocusPolicy(QtCore.Qt.NoFocus)
        self.fieldBox.setToolTip("Select variable/field in data file.\n"
                                 "'Field Window' will launch popup.\n")
        self.fieldBox.activated[str].connect(self._fieldAction)

    def _add_toolsBoxUI(self):
        '''Create the Tools Button menu.'''
        self.toolsButton = QtWidgets.QPushButton("Toolbox")
        self.toolsButton.setFocusPolicy(QtCore.Qt.NoFocus)
        self.toolsButton.setToolTip("Choose a tool to apply")
        toolmenu = QtWidgets.QMenu(self)
        toolZoomPan = toolmenu.addAction("Zoom/Pan")
        toolValueClick = toolmenu.addAction("Click for Value")
        toolReset = toolmenu.addAction("Reset Tools")
        toolDefault = toolmenu.addAction("Reset File Defaults")
        toolZoomPan.triggered.connect(self.toolZoomPanCmd)
        toolValueClick.triggered.connect(self.toolValueClickCmd)
        toolReset.triggered.connect(self.toolResetCmd)
        toolDefault.triggered.connect(self.toolDefaultCmd)
        self.toolmenu = toolmenu
        self.toolsButton.setMenu(toolmenu)

    def add_mode(self, mode, label):
        """ Add a tool entry with given label. Selecting that tool, execute
        mode passing this component shared variables."""
        def call_mode():
            mode(self.get_sharedVariables())
        action = self.toolmenu.addAction(label)
        action.triggered.connect(call_mode)

    def _add_infolabel(self):
        '''Create an information label about the display'''
        self.infolabel = QtWidgets.QLabel("Radar: \n"
                                      "Field: \n"
                                      "Tilt: ", self)
        self.infolabel.setStyleSheet('color: red; font: italic 10px')
        self.infolabel.setToolTip("Filename not loaded")

    def _update_infolabel(self):
        if self.Vradar.value is None:
            return
        self.infolabel.setText("Radar: %s\n"
                               "Field: %s\n"
                               "Tilt: %d" % (
                                   self.Vradar.value.metadata[
                                       'instrument_name'],
                                   self.Vfield.value,
                                   self.Vtilt.value+1))
        if hasattr(self.Vradar.value, 'filename'):
            self.infolabel.setToolTip(self.Vradar.value.filename)

    ########################
    # Selectionion methods #
    ########################

    def NewRadar(self, variable, strong):
        '''
        Slot for 'ValueChanged' signal of
        :py:class:`Vradar <artview.core.core.Variable>`.

        This will:

        * Update fields and tilts lists and MenuBoxes
        * Check radar scan type and reset limits if needed
        * Reset units and title
        * If strong update: update plot
        '''
        # test for None
        if self.Vradar.value is None:
            self.fieldBox.clear()
            self.tiltBox.clear()
            return

        # Get the tilt angles
        self.rTilts = self.Vradar.value.sweep_number['data'][:]
        # Get field names
        self.fieldnames = self.Vradar.value.fields.keys()

        # Check the file type and initialize limts
        self._check_file_type()

        # Update field and tilt MenuBox
        self._fillTiltBox()
        self._fillFieldBox()

        self.units = self._get_default_units()
        self.title = self._get_default_title()
        if strong:
            self._update_display()
            self._update_infolabel()
            self.VpathInteriorFunc.update(True)

    def NewField(self, variable, strong):
        '''
        Slot for 'ValueChanged' signal of
        :py:class:`Vfield <artview.core.core.Variable>`.

        This will:

        * Reset colormap
        * Reset units
        * Update fields MenuBox
        * If strong update: update plot
        '''
        if self.Vcolormap.value['lock'] is False:
            self._set_default_cmap(strong=False)
        self.units = self._get_default_units()
        self.title = self._get_default_title()
        idx = self.fieldBox.findText(self.Vfield.value)
        self.fieldBox.setCurrentIndex(idx)
        if strong:
            self._update_plot()
            self._update_infolabel()
            self.VpathInteriorFunc.update(True)

    def NewLims(self, variable, strong):
        '''
        Slot for 'ValueChanged' signal of
        :py:class:`Vlimits <artview.core.core.Variable>`.

        This will:

        * If strong update: update axes
        '''
        if strong:
            self._update_axes()

    def NewCmap(self, variable, strong):
        '''
        Slot for 'ValueChanged' signal of
        :py:class:`Vcolormap <artview.core.core.Variable>`.

        This will:

        * If strong update: update plot
        '''
        if strong:
            self._update_plot()

    def NewGatefilter(self, variable, strong):
        '''
        Slot for 'ValueChanged' signal of
        :py:class:`Vgatefilter <artview.core.core.Variable>`.

        This will:

        * If strong update: update plot
        '''
        if strong:
            self._update_plot()

    def NewTilt(self, variable, strong):
        '''
        Slot for 'ValueChanged' signal of
        :py:class:`Vtilt <artview.core.core.Variable>`.

        This will:

        * Update tilt MenuBox
        * If strong update: update plot
        '''
        # +1 since the first one is "Tilt Window"
        self.tiltBox.setCurrentIndex(self.Vtilt.value+1)
        if strong:
            self.title = self._get_default_title()
            self._update_plot()
            self._update_infolabel()
            self.VpathInteriorFunc.update(True)

    def NewDisplay(self, variable, strong):
        '''
        Slot for 'ValueChanged' signal of
        :py:class:`VpyartDisplay <artview.core.core.Variable>`.

        This will:

        * If strong update: update plot (redraws)
        * else redraw canvas
        '''
        if strong:
            self._update_plot()
        else:
            self.canvas.draw()

    def TiltSelectCmd(self, ntilt):
        '''
        Captures tilt selection and update tilt
        :py:class:`~artview.core.core.Variable`.
        '''
        if ntilt < 0:
            ntilt = len(self.rTilts)-1
        elif ntilt >= len(self.rTilts):
            ntilt = 0
        self.Vtilt.change(ntilt)

    def FieldSelectCmd(self, name):
        '''
        Captures field selection and update field
        :py:class:`~artview.core.core.Variable`.
        '''
        self.Vfield.change(name)

    def RngRingSelectCmd(self, ringSel):
        '''
        Captures Range Ring selection and
        redraws the field with range rings.
        '''
        if ringSel is "None":
            self.RngRing = False
        else:
            self.RngRing = True
            # Find the unambigous range of the radar
            try:
                unrng = int(self.Vradar.value.instrument_parameters[
                    'unambiguous_range']['data'][0]/1000)
            except:
                unrng = int(self.Vlimits.value['xmax'])

            # Set the step
            if ringSel == '10 km':
                ringdel = 10
            if ringSel == '20 km':
                ringdel = 20
            if ringSel == '30 km':
                ringdel = 30
            if ringSel == '50 km':
                ringdel = 50
            if ringSel == '100 km':
                ringdel = 100

            # Calculate an array of range rings
            self.RNG_RINGS = range(ringdel, unrng, ringdel)

        self._update_plot()

    def cmapSelectCmd(self, cm_name):
        '''Captures colormap selection and redraws.'''
        CMAP = cm_name
        self.Vcolormap.value['cmap'] = cm_name
        self.Vcolormap.update()

    def toolZoomPanCmd(self):
        '''Creates and connects to a Zoom/Pan instance.'''
        from .toolbox import ZoomPan
        scale = 1.1
        self.tools['zoompan'] = ZoomPan(
            self.Vlimits, self.ax,
            base_scale=scale, parent=self.parent)
        self.tools['zoompan'].connect()

    def toolValueClickCmd(self):
        '''Creates and connects to Point-and-click value retrieval'''
        from .toolbox import ValueClick
        self.tools['valueclick'] = ValueClick(
            self, name=self.name + "ValueClick", parent=self.parent)
        self.tools['valueclick'].connect()

    def toolResetCmd(self):
        '''Reset tools via disconnect.'''
        from . import toolbox
        self.tools = toolbox.reset_tools(self.tools)

    def toolDefaultCmd(self):
        '''Restore the Display defaults.'''
        for key in self.tools.keys():
            if self.tools[key] is not None:
                self.tools[key].disconnect()
                self.tools[key] = None
        if self.Vcolormap.value['lock'] is False:
            self._set_default_cmap()
        self._set_default_limits()

    def getPathInteriorValues(self, paths):
        '''
        Return the bins values path.

        Parameters
        ----------
        paths : list of :py:class:`matplotlib.path.Path` instances

        Returns
        -------
        points : :py:class`artview.core.points.Points`
            Points object containing all bins of the current radar
            and tilt inside path. Axes : 'x_disp', 'y_disp', 'ray_index',
            'range_index', 'azimuth', 'range'. Fields: just current field

        Notes
        -----
            If Vradar.value is None, returns None
        '''
        from .toolbox import interior_radar
        radar = self.Vradar.value
        tilt = self.Vtilt.value
        if radar is None or not self.VpyartDisplay.value:
            return None

        try:
            iter(paths)
        except:
            paths = [paths]

        xy = np.empty((0, 2))
        idx = np.empty((0, 2), dtype=np.int)

        for path in paths:
            try:
                x, y, z = self.VpyartDisplay.value._get_x_y_z(
                    tilt, False, True)
            except:
                x, y, z = self.VpyartDisplay.value._get_x_y_z(
                    self.Vfield.value, tilt, False, True)
            if self.plot_type == "radarAirborne":
                _xy = np.empty(shape=(x.size, 2))
                _xy[:, 0] = x.flatten()
                _xy[:, 1] = z.flatten()
                ind = np.nonzero([path.contains_point(p) for p in _xy])[0]

                _xy = _xy[ind]
                ngates = radar.range['data'].size
                rayIndex = (radar.sweep_start_ray_index['data'][tilt] +
                            ind / ngates)
                gateIndex = ind % ngates
                _idx = np.concatenate((rayIndex[np.newaxis],
                                       gateIndex[np.newaxis]), axis=0)
                _idx = _idx.transpose().astype(np.int)
            elif self.plot_type == "radarPpi":
                _xy = np.empty(shape=(x.size, 2))
                _xy[:, 0] = x.flatten()
                _xy[:, 1] = y.flatten()
                ind = np.nonzero([path.contains_point(p) for p in _xy])[0]

                _xy = _xy[ind]
                ngates = radar.range['data'].size
                rayIndex = (radar.sweep_start_ray_index['data'][tilt] +
                            ind / ngates)
                gateIndex = ind % ngates
                _idx = np.concatenate((rayIndex[np.newaxis],
                                       gateIndex[np.newaxis]), axis=0)
                _idx = _idx.transpose().astype(np.int)
            elif self.plot_type == "radarRhi":
                _xy = np.empty(shape=(x.size, 2))
                r = np.sqrt(x ** 2 + y ** 2) * np.sign(y)
                if np.all(r < 1.):
                    r = -r
                _xy[:, 0] = r.flatten()
                _xy[:, 1] = z.flatten()
                ind = np.nonzero([path.contains_point(p) for p in _xy])[0]

                _xy = _xy[ind]
                ngates = radar.range['data'].size
                rayIndex = (radar.sweep_start_ray_index['data'][tilt] +
                            ind / ngates)
                gateIndex = ind % ngates
                _idx = np.concatenate((rayIndex[np.newaxis],
                                       gateIndex[np.newaxis]), axis=0)
                _idx = _idx.transpose().astype(np.int)

            xy = np.concatenate((xy, _xy))
            idx = np.concatenate((idx, _idx))

        xaxis = {'data':  xy[:, 0] * 1000.,
                 'long_name': 'X-coordinate in Cartesian system',
                 'axis': 'X',
                 'units': 'm'}

        yaxis = {'data':  xy[:, 1] * 1000.,
                 'long_name': 'Y-coordinate in Cartesian system',
                 'axis': 'Y',
                 'units': 'm'}

        azi = radar.azimuth.copy()
        azi['data'] = radar.azimuth['data'][idx[:, 0]]

        rng = radar.range.copy()
        rng['data'] = radar.range['data'][idx[:, 1]]

        field = radar.fields[self.Vfield.value].copy()
        field['data'] = radar.fields[self.Vfield.value]['data'][
            idx[:, 0], idx[:, 1]]

        ray_idx = {'data': idx[:, 0],
                   'long_name': 'index in ray dimension'}
        rng_idx = {'data': idx[:, 1],
                   'long_name': 'index in range dimension'}

        axes = {'x_disp': xaxis,
                'y_disp': yaxis,
                'ray_index': ray_idx,
                'range_index': rng_idx,
                'azimuth': azi,
                'range': rng}

        fields = {self.Vfield.value: field}

        points = Points(fields, axes, radar.metadata.copy(), xy.shape[0])

        return points

    ####################
    # Plotting methods #
    ####################

    def _set_fig_ax(self):
        '''Set the figure and axis to plot.'''
        self.XSIZE = 8
        self.YSIZE = 8
        self.fig = Figure(figsize=(self.XSIZE, self.YSIZE))
        self.ax = self.fig.add_axes([0.2, 0.2, 0.7, 0.7])
        self.cax = self.fig.add_axes([0.2, 0.10, 0.7, 0.02])
        self.VplotAxes.change(self.ax)
        # self._update_axes()

    def _update_fig_ax(self):
        '''Set the figure and axis to plot.'''
        if self.plot_type in ("radarAirborne", "radarRhi"):
            self.YSIZE = 5
        else:
            self.YSIZE = 8
        xwidth = 0.7
        yheight = 0.7  # * float(self.YSIZE) / float(self.XSIZE)
        self.ax.set_position([0.2, 0.55-0.5*yheight, xwidth, yheight])
        self.cax.set_position([0.2, 0.10, xwidth, 0.02])
        self._update_axes()

    def _change_axes_position(self):
        '''GUI change axes Position.'''
        options_type = [
            ("Plot area top",  float),
            ("Plot area left", float),
            ("Plot area bottom", float),
            ("Plot area right", float),
            ("Colormap  top",  float),
            ("Colormap  left", float),
            ("Colormap  bottom", float),
            ("Colormap  right", float),
            ]
        ax_pos = self.ax.get_position()
        cax_pos = self.cax.get_position()
        value = {
            "Plot area bottom":  ax_pos.y0,
            "Plot area left": ax_pos.x0,
            "Plot area top": ax_pos.y0+ax_pos.height,
            "Plot area right": ax_pos.x0+ax_pos.width,
            "Colormap  bottom":  cax_pos.y0,
            "Colormap  left": cax_pos.x0,
            "Colormap  top": cax_pos.y0+cax_pos.height,
            "Colormap  right": cax_pos.x0+cax_pos.width,
            }
        parm = common.get_options(options_type, value)
        self.ax.set_position([parm["Plot area left"],
                              parm["Plot area bottom"],
                              parm["Plot area right"] -
                                               parm["Plot area left"],
                              parm["Plot area top"] -
                                               parm["Plot area bottom"],
                              ])
        self.cax.set_position([parm["Colormap  left"],
                               parm["Colormap  bottom"],
                               parm["Colormap  right"] -
                                               parm["Colormap  left"],
                                parm["Colormap  top"] -
                                               parm["Colormap  bottom"],
                              ])
        self._update_axes()

    def _set_figure_canvas(self):
        '''Set the figure canvas to draw in window area.'''
        self.canvas = FigureCanvasQTAgg(self.fig)
        # Add the widget to the canvas
        self.layout.addWidget(self.canvas, 1, 0, 7, 6)

    def _update_display(self):
        if self.plot_type == "radarAirborne":
            from pkg_resources import parse_version
            if parse_version(pyart.__version__) >= parse_version('1.6.0'):
                display = pyart.graph.AirborneRadarDisplay(
                    self.Vradar.value)
        elif self.plot_type == "radarPpiMap":
            display = pyart.graph.RadarMapDisplay(self.Vradar.value)
        elif self.plot_type == "radarPpi":
            display = pyart.graph.RadarDisplay(self.Vradar.value)
        elif self.plot_type == "radarRhi":
            display = pyart.graph.RadarDisplay(self.Vradar.value)
        self.VpyartDisplay.change(display)

    def _update_plot(self):
        '''Draw/Redraw the plot.'''

        if self.Vradar.value is None:
            return

        # Create the plot with PyArt RadarDisplay
        self.ax.cla()  # Clear the plot axes
        self.cax.cla()  # Clear the colorbar axes

        self.VplotAxes.update()

        if self.Vfield.value not in self.Vradar.value.fields.keys():
            self.canvas.draw()
            self.statusbar.setStyleSheet("QStatusBar{padding-left:8px;" +
                                         "background:rgba(255,0,0,255);" +
                                         "color:black;font-weight:bold;}")
            self.statusbar.showMessage("Field not Found in Radar", msecs=5000)
            return
        else:
            self.statusbar.setStyleSheet("QStatusBar{padding-left:8px;" +
                                         "background:rgba(0,0,0,0);" +
                                         "color:black;font-weight:bold;}")
            self.statusbar.clearMessage()

        title = self.title
        limits = self.Vlimits.value
        cmap = self.Vcolormap.value
        display = self.VpyartDisplay.value
        if self.gatefilterToggle.isChecked():
            gatefilter = self.Vgatefilter.value
        else:
            gatefilter = None
        if self.ignoreEdgesToggle.isChecked():
            ignoreEdges = False
        else:
            ignoreEdges = True

        if 'norm' in cmap:
            norm = cmap['norm']
            mask_outside = False
        else:
            norm = None
            mask_outside = True

        if self.plot_type == "radarAirborne":
            self.plot = display.plot_sweep_grid(
                self.Vfield.value, vmin=cmap['vmin'],
                vmax=cmap['vmax'], colorbar_flag=False, cmap=cmap['cmap'],
                norm=norm, mask_outside=mask_outside,
                edges=ignoreEdges, gatefilter=gatefilter,
                ax=self.ax, fig=self.fig, title=title)
            display.plot_grid_lines()

        elif self.plot_type == "radarPpi" or self.plot_type == "radarPpiMap":
            # Create Plot
            if self.useMapToggle.isChecked():
                plot_ppi = display.plot_ppi_map
            else:
                plot_ppi = display.plot_ppi

            self.plot = plot_ppi(
                self.Vfield.value, self.Vtilt.value,
                vmin=cmap['vmin'], vmax=cmap['vmax'], norm=norm,
                colorbar_flag=False, cmap=cmap['cmap'], mask_outside=mask_outside,
                edges=ignoreEdges, gatefilter=gatefilter,
                ax=self.ax, fig=self.fig, title=title)
            # Add range rings
            if self.RngRing:
                display.plot_range_rings(self.RNG_RINGS, ax=self.ax)
            # Add radar location
            display.plot_cross_hair(5., ax=self.ax)

        elif self.plot_type == "radarRhi":
            # Create Plot
            self.plot = display.plot_rhi(
                self.Vfield.value, self.Vtilt.value,
                vmin=cmap['vmin'], vmax=cmap['vmax'], norm=norm,
                colorbar_flag=False, cmap=cmap['cmap'], mask_outside=mask_outside,
                edges=ignoreEdges, gatefilter=gatefilter,
                ax=self.ax, fig=self.fig, title=title)
            # Add range rings
            if self.RngRing:
                display.plot_range_rings(self.RNG_RINGS, ax=self.ax)

        self._update_axes()
        if norm is None:
            norm = mlabNormalize(vmin=cmap['vmin'],
                                 vmax=cmap['vmax'])
        if self.colormapToggle.isChecked():
            self.cbar = mlabColorbarBase(self.cax, cmap=cmap['cmap'],
                                        norm=norm, orientation='horizontal')
            self.cbar.set_label(self.units)
            self.cax.set_visible(True)
        else:
            self.cax.set_visible(False)

#        print "Plotting %s field, Tilt %d in %s" % (
#            self.Vfield.value, self.Vtilt.value+1, self.name)
        self.canvas.draw()

    def _update_axes(self):
        '''Change the Plot Axes.'''
        limits = self.Vlimits.value
        self.ax.set_xlim(limits['xmin'], limits['xmax'])
        self.ax.set_ylim(limits['ymin'], limits['ymax'])
        self.ax.figure.canvas.draw()

    #########################
    # Check methods #
    #########################

    def _check_file_type(self):
        '''Check file to see if the file is airborne or rhi.'''
        radar = self.Vradar.value
        old_plot_type = self.plot_type
        if radar.scan_type != 'rhi':
            if self.useMapToggle.isChecked():
                self.plot_type = "radarPpiMap"
            else:
                self.plot_type = "radarPpi"
        else:
            if 'platform_type' in radar.metadata:
                if ('aircraft' in radar.metadata['platform_type'] or
                    'aircraft_tail' in radar.metadata['platform_type']):
                    self.plot_type = "radarAirborne"
                else:
                    self.plot_type = "radarRhi"
            else:
                self.plot_type = "radarRhi"

        if self.plot_type != old_plot_type:
            print("Changed Scan types, reinitializing", file=log.debug)
            self.toolResetCmd()
            self._set_default_limits()
            self._update_fig_ax()

    def _set_default_limits(self, strong=True):
        ''' Set limits to pre-defined default.'''
        from .limits import _default_limits
        limits, cmap = _default_limits(
            self.Vfield.value, self.plot_type)
        self.Vlimits.change(limits, strong)

    def _set_default_cmap(self, strong=True):
        ''' Set colormap to pre-defined default.'''
        cmap = pyart.config.get_field_colormap(self.Vfield.value)
        d = {}
        d['cmap'] = cmap
        d['lock'] = False
        lims = pyart.config.get_field_limits(self.Vfield.value,
                                             self.Vradar.value,
                                             self.Vtilt.value)
        if lims != (None, None):
            d['vmin'] = lims[0]
            d['vmax'] = lims[1]
        else:
            d['vmin'] = -10
            d['vmax'] = 65

        # HACK while pyart don't implemt it self
        if (self.Vradar.value is not None and
            self.Vfield.value in self.Vradar.value.fields):
            if 'valid_min' in self.Vradar.value.fields[self.Vfield.value]:
                d['vmin'] = self.Vradar.value.fields[self.Vfield.value][
                    'valid_min']
            if 'valid_max' in self.Vradar.value.fields[self.Vfield.value]:
                d['vmax'] = self.Vradar.value.fields[self.Vfield.value][
                    'valid_max']

        self.Vcolormap.change(d, strong)

    def _get_default_title(self):
        '''Get default title from pyart.'''
        if (self.Vradar.value is None or
            self.Vfield.value not in self.Vradar.value.fields):
            return ''
        return pyart.graph.common.generate_title(self.Vradar.value,
                                                 self.Vfield.value,
                                                 self.Vtilt.value)

    def _get_default_units(self):
        '''Get default units for current radar and field.'''
        if self.Vradar.value is not None:
            try:
                return self.Vradar.value.fields[self.Vfield.value]['units']
            except:
                return ''
        else:
            return ''

    ########################
    # Image save methods #
    ########################
    def _quick_savefile(self, PTYPE=IMAGE_EXT):
        '''Save the current display via PyArt interface.'''
        imagename = self.VpyartDisplay.value.generate_filename(
            self.Vfield.value, self.Vtilt.value, ext=IMAGE_EXT)
        self.canvas.print_figure(os.path.join(os.getcwd(), imagename), dpi=DPI)
        self.statusbar.showMessage(
            'Saved to %s' % os.path.join(os.getcwd(), imagename))

    def _savefile(self, PTYPE=IMAGE_EXT):
        '''Save the current display using PyQt dialog interface.'''
        PBNAME = self.VpyartDisplay.value.generate_filename(
            self.Vfield.value, self.Vtilt.value, ext=IMAGE_EXT)
        file_choices = "PNG (*.png)|*.png"
        path = unicode(QtWidgets.QFileDialog.getSaveFileName(
            self, 'Save file', PBNAME, file_choices))
        if path:
            self.canvas.print_figure(path, dpi=DPI)
            self.statusbar.showMessage('Saved to %s' % path)

    def minimumSizeHint(self):
        return QtCore.QSize(20, 20)

    ########################
    #      get methods     #
    ########################

    def getPlotAxis(self):
        '''Get :py:class:`matplotlib.axes.Axes` instance of main plot.'''
        return self.ax

    def getStatusBar(self):
        '''Get :py:class:`PyQt4.QtWidgets.QStatusBar` instance.'''
        return self.statusbar

    def getField(self):
        '''Get current field.'''
        return self.Vfield.value

    def getUnits(self):
        '''Get current units.'''
        return self.units

    def getRadar(self):
        ''' get current radar '''
        return self.Vradar.value

    def getTilt(self):
        ''' get current tilt '''
        return self.Vtilt.value

class _DisplayStart(QtWidgets.QDialog):
    '''
    Dialog Class for graphical start of display, to be used in guiStart.
    '''

    def __init__(self):
        '''Initialize the class to create the interface.'''
        super(_DisplayStart, self).__init__()
        self.result = {}
        self.layout = QtWidgets.QGridLayout(self)
        # set window as modal
        self.setWindowModality(QtCore.Qt.ApplicationModal)

        self.setupUi()

    def chooseRadar(self):
        item = VariableChoose().chooseVariable()
        if item is None:
            return
        else:
            self.result["Vradar"] = getattr(item[1], item[2])

    def chooseField(self):
        item = VariableChoose().chooseVariable()
        if item is None:
            return
        else:
            self.result["Vfield"] = getattr(item[1], item[2])

    def chooseTilt(self):
        item = VariableChoose().chooseVariable()
        if item is None:
            return
        else:
            self.result["Vtilt"] = getattr(item[1], item[2])

    def chooseLims(self):
        item = VariableChoose().chooseVariable()
        if item is None:
            return
        else:
            self.result["Vlimits"] = getattr(item[1], item[2])

    def setupUi(self):

        self.radarButton = QtWidgets.QPushButton("Find Variable")
        self.radarButton.clicked.connect(self.chooseRadar)
        self.layout.addWidget(QtWidgets.QLabel("VRadar"), 0, 0)
        self.layout.addWidget(self.radarButton, 0, 1, 1, 3)

        self.fieldButton = QtWidgets.QPushButton("Find Variable")
        self.fieldButton.clicked.connect(self.chooseField)
        self.layout.addWidget(QtWidgets.QLabel("Vfield"), 1, 0)
        self.field = QtWidgets.QLineEdit("")
        self.layout.addWidget(self.field, 1, 1)
        self.layout.addWidget(QtWidgets.QLabel("or"), 1, 2)
        self.layout.addWidget(self.fieldButton, 1, 3)

        self.tiltButton = QtWidgets.QPushButton("Find Variable")
        self.tiltButton.clicked.connect(self.chooseTilt)
        self.layout.addWidget(QtWidgets.QLabel("Vtilt"), 2, 0)
        self.tilt = QtWidgets.QSpinBox()
        self.layout.addWidget(self.tilt, 2, 1)
        self.layout.addWidget(QtWidgets.QLabel("or"), 2, 2)
        self.layout.addWidget(self.tiltButton, 2, 3)

        self.limsButton = QtWidgets.QPushButton("Find Variable")
        self.limsButton.clicked.connect(self.chooseLims)
        self.layout.addWidget(QtWidgets.QLabel("Vlimits"), 3, 0)
        self.layout.addWidget(self.limsButton, 3, 1, 1, 3)

        self.name = QtWidgets.QLineEdit("RadarDisplay")
        self.layout.addWidget(QtWidgets.QLabel("name"), 4, 0)
        self.layout.addWidget(self.name, 4, 1, 1, 3)

        self.closeButton = QtWidgets.QPushButton("Start")
        self.closeButton.clicked.connect(self.closeDialog)
        self.layout.addWidget(self.closeButton, 5, 0, 1, 5)

    def closeDialog(self):
        self.done(QtWidgets.QDialog.Accepted)

    def startDisplay(self):
        self.exec_()

        # if no Vradar abort
        if 'Vradar' not in self.result:
            self.result['Vradar'] = Variable(None)
            # common.ShowWarning("Must select a variable for Vradar")
            # I'm allowing this to continue, but this will result in error

        # if Vfield, Vtilt, Vlimits were not select create new
        field = str(self.field.text())
        tilt = self.tilt.value()
        if 'Vfield' not in self.result:
            self.result['Vfield'] = Variable(field)
        if 'Vtilt' not in self.result:
            self.result['Vtilt'] = Variable(tilt)

        self.result['name'] = str(self.name.text())

        return self.result

redpajama_set_name: RedPajamaGithub


Your Trusted IT Service Provider!
An effective online sample management module, supporting bio-repository freezers that stores clinical samples and maintains electronic records with adequate audit trails for the Store, Remove, Move operations. The innovative User Interface gives you a snapshot of the freezer occupancy.
Modern User Interface that captures the complex paper-based workflow and enables performing everyday tasks with ease.
Tailor fitted application workflow that matches your paper-based procedures, helping your employees feel at home, while increasing productivity.
Search the Orders using multiple filtering criteria like Patient MRN, Order Statuses and Date Range.
Integration with Storage/Inventory Management system & Scheduler Management System.
Email notifications to configured lists.
Providing Art & Science for Businesses.