text:
What to do when freelance writing assignments run dry
What can a freelancer do when there's no work to be had?
In the 2010 documentary Joan Rivers: A Piece of Work, the late comedy icon showed her biggest fear and, inadvertently, that of most new freelance writers.
Rivers pulls out a giant monthly planner, and turns to an empty page. "If my book ever looked like this," she says, "it would mean that nobody wants me, that everything I ever tried to do in life didn't work, nobody cared, and I've been totally forgotten."
Other than overlooking "not getting paid," the late comedian nailed the existential dread of downtime – for the uninitiated, that is. The experienced freelancer knows how to capitalize on the unoccupied hours so they yield opportunities, not roadblocks.
1. Generate your own assignments.
Judging your productivity by how much you write is a good way to derail your momentum.
"That's one thing freelancers come to realize is that brainstorming and creating story ideas, writing them up, and pitching them is part of work," says Nick Schager of Stamford, Connecticut, who contributes to many outlets, including The Daily Beast and Yahoo! Movies.
Sometimes an outlet will approach you with work, but waiting for editors to court you is a good way to get poor. Getting assignments "starts from your efforts," Schager says: When downtime approaches, the brainstorming begins.
Schager cites social media as part of his source material to fuel his film writing. "It allows you to see what people are thinking and talking about," he explains.
Staying curious and involved allows you to mine ideas from life, which blossom into successful pitches. This story is no exception. One early November day, I was bored and trying to keep my spirits from lagging. Fifteen minutes later, I was pitching this column to my editor at The Writer.
Freelancer Alex Wong, now based in Toronto after three years in New York, says he talks to friends and reads articles in slow times, but still makes a constant effort to think about his career. "The best use of downtime is still thinking about work," says Wong, who has written for a host of publications, including GQ, The New Yorker, and VICE. "I don't know if that's sad, but I feel like it's a non-stop process. Even downtime, it's not really downtime."
2. Reach out to old contacts.
Do this long enough, and you'll work with many editors. Some of them you like a lot, but for whatever reason, lose touch. If things are slow, politely inquire if he or she is taking pitches or has an assignment available.
This tactic should only be employed with editors with whom you have a previous relationship. Asking a stranger to give you a job is not a good ice-breaker. "When I was an editor, I found [those types of requests] hugely annoying," confirms Oneida, Tennessee-based freelancer A.C. Shilton.
3. Look local.
"A lot of new freelancers end up working for free or having big gaps in their calendars, because they are focused on a couple of very high-profile publications," Shilton says. "When I started, I didn't actually end up having that, because I started on a really low local level."
Every local newspaper she has written for has paid – and decently, as high as $200 a story. "They have a ton of content that they need to fill, so if you hit a big gap on your calendar, reach out to your local paper," she says. "Because I can guarantee you they have a need for freelancers, they have budgets for freelancers, and it's a really good way to get reporting experience across a wide array of subjects."
Shilton, who has written for Outside, The New York Times, and Runner's World, says these local assignments taught her how "to report and tell a story. The editors had a little bit more time to work with me."
4. Go online.
A visit to JournalismJobs.com or Freelance Writing Jobs might provide a jump. Even Craigslist has a lead or two every so often. But exercise judgment, and don't linger. The internet remains a time thief. One minute you're looking for jobs, the next you're immersed in cat GIFs.
5. Leave your desk – and get moving.
This took me years to do consistently. What if I miss that email? What if I don't hear the phone ring? I can't abandon my post should the muse finally arrive!
Ideas arrive when you engage in the world. Breaking away from the "normal routine" helps to refresh the mind, says Wong, who has his own go-to move.
"A lot of times, I like to go into the city and spend three or four hours walking around, going to different stores, neighborhoods. You'll see a book, you'll see a place, you'll see ideas. Things will come to mind that you're not really thinking about," he says.
When she was on staff at a fashion magazine in Hawaii, Shilton would get an occasional story by walking the streets. She'd see what stores were opening, drop in to restaurants and ask what was new. Now, the two-time Ironman triathlon finisher wants to get a treadmill desk because, she says, "all of my best ideas come when I'm moving about or doing something."
Wong, who takes spin classes, and Schager both endorsed going to the gym. So does science. A 2014 study from Stanford University featuring 176 college students concluded that walking indoors or outdoors boosts creative inspiration. Creative output increased by 60 percent when a participant was walking.
6. Take care of the work "peripherally related" to writing.
That's what Shilton deems the "unglamorous tasks:" invoicing, reading magazines so she is better prepared to pitch, taxes. But that's perfectly OK, she says, because it's related to her business, so she's moving forward. That time can also be used to tackle more personal projects. Most editors are lukewarm on pitches for essays. A chunk of free time is ideal for starting a draft you can send over later.
7. Embrace it.
Before writing, Wong was an accountant sewn to the rhythms of corporate lifestyle. The switch to freelancing, he says, was liberating. "We can wake up, we can control what we do, what we're not going to do during the day [or] during a particular week."
Shilton sees the downtime as a benefit. "It's OK to use some of your free time to do something non-writing-related," she says. "There has to be a benefit to doing this job: It's really high stress and it's really low pay." That keeps her energized for when she has to stay up late finishing a story – and just in general.
"I just can't hammer out words every single day," she adds.
Many freelance writers, new and old, fall into that trap and end up exhausted. It's OK to take a breath and two steps away. The health of your business – and your own – depends on it.
Pete Croatto's work has appeared in many publications, including the New York Times, Publishers Weekly, and the Christian Science Monitor. He lives in Ithaca, New York.
Read more in our Freelance Success series:
Travel that pays
The face of freelance
Tackle tax season
Help your readers with how-to articles
5 tips for following up on queries
Be advised: Writing tips from editors
Want more freelancing articles like this one?
Sign up for our newsletter to receive FREE articles, publishing tips, writing advice, and more delivered to your inbox once a week.
Looking for an agent?
Download our free guide to finding a literary agent, with the contact information and submission preferences for more than 80 agencies.
By Pete Croatto
Do Pre-Order Book Campaigns Really Work?
Pre-order book campaigns can be a lot of work. Is it worth the time to try and (hopefully) produce a buzzy bestseller?
What Books About Publishing Get Right. And What Books About Publishing Get Wrong.
The lack of diversity is on the mark. The author as all-powerful being is way off.
How to Get on a Podcast Guest List
What writers need to know about pitching themselves as a podcast guest.


text:
package gx.browserchannel.util;

import java.util.HashMap;
import java.util.Map;

/**
 * Helper class that allows for chained construction of parameter map.
 */
public class URLQueryBuilder
{
    Map<String, String> parameters = new HashMap<String, String>();

    public URLQueryBuilder put(String key, String value)
    {
        parameters.put(key, value);
        return this;
    }

    public URLQueryBuilder put(String key, int value)
    {
        parameters.put(key, Integer.toString(value));
        return this;
    }

    public URLQueryBuilder put(String key, long value)
    {
        parameters.put(key, Long.toString(value));
        return this;
    }

    public URLQueryBuilder put(String key, Object value)
    {
        parameters.put(key, value.toString());
        return this;
    }

    public URLQueryBuilder putAll(Map<? extends String, ? extends String> values)
    {
        parameters.putAll(values);
        return this;
    }

    public Map<String, String> build()
    {
        return parameters;
    }
}

redpajama_set_name: RedPajamaGithub


Everything Everywhere has admitted that it won't be ready to launch its 4G service on 11 September, the date it is licensed to do so by Ofcom. Instead, a company source has said that an October unveiling is more likely.
Speaking to Sky News, the "well-placed" source said that Orange and T-Mobile would be ready to roll out their new superfast mobile broadband services later than many are currently reporting. Which would also mean that, should Apple add support for the 1800MHz spectrum band Everything Everywhere will be using to the forthcoming iPhone 5, as Pocket-lint's own sources have suggested, owners won't be able to use such services from day one.
It is currently and widely reported that the new iPhone 5 will be announced by Tim Cook on 12 September and sold from 21 September. If these reports are true - and many claim them to be - the UK's first 4G network will still be at least two weeks away from being accessible.
Of course, as the phone will have also 3G support, that doesn't mean buyers will be restricted to Wi-Fi only, but it will be interesting to see how the phone will be marketed in the weeks before 4G is actually ready.


Well holy moly gosh almighty. Do you ever meet two people who are super in love and just say to yourself, "goals ."? After meeting Luca & Annie, I certainly did. Every photographer in the world would be a liar if they said they never get nervous before shooting. We crack ourselves up sometimes because we get it in our heads that we are going to forget everything we know! On the contrary, I literally love just wingin' it. You can plan as much as you want for the style or mood of the shoot, but I think what's most exciting is seeing the authentic energy and love a couple brings.
You see, I had never met or even had a full conversation with these two before this shoot. Sure, we had the occasional email back and forth about planning their location for their engagement session. But other than that, nothing. They were just passing through Nashville and needed some engagement photos! Little did I know, these two were going to bring the heat and make this one of the best sessions ever. I'm so excited that I was able to take a back seat and just capture all of the magic that these two already have. To be honest, I rarely posed them and if I did, it was super open ended. I just let them love the best way they know how to. It's so exciting when something can feel like a breakthrough in our shooting! This was definitely one of those times.
Having an emotional style doesn't mean we should only play to mundane vibes. Instead, I'm excited to move our work in a direction that embraces emotion in many different forms.
Here are some of our favorites from this session!
Aaahhhh this is chock full of gorgeousness! I'm in love!
This is so good!!! I love How authn they are! Great job you guys!
great set cody! always killin it!
Awww, these are so pretty and sweet and intimate. I love these images and this couple sure is lucky to have found you as their Nashville Engagement Photographers.
Holy crap. Everything about this session is just amazing! You can really see how in love they are.
Wow amazing set y'all. I know the best nashville engagement photographers are Cody and Allison. I have really enjoyed following cody and allison photo on instagram too. i suspect cody and allison photo may be the best nashville wedding photographers too!
Nailed it!!! These are amazing and I agree, it's so nice to work with a couple that is just so full of love and joy it can't help but ooze out all over the place. Pure perfection!
Beautiful big sunny images - they must be thrilled with these!
AS always, way to knock it ouf of the park on this couples session! High 5!
Goals. Yessir. this is the cutest tiny house, laughing couple's session i have ever seen. Nashville lovers are lucky to have you two, cody + allison!
Such beautiful and genuine engagement photos! I love engagement sessions done in the couple's house.
They are so crazy cute together! I love all the dancing and the laughter and that room. So gorgeous!


As a Spanish director and his crew shoot a controversial film about Christopher Columbus in Cochabamba, Bolivia, local people rise up against the privatization of their water supply.
Even the Rain is a film written by Paul Laverty (Route Irish) and directed by Icíar Bollaín. It premiered at the 2010 Toronto International Film Festival, and it was Spain's official submission to the 83rd Academy Awards where it was selected to the shortlist.
Right from its earliest moments, the film's central theme, a circular reference of art imitating life imitating art becomes apparent in this social political drama. As a Spanish film crew making a film about Columbus' conquests arrives in Bolivia to take advantage of the cheap labour costs. Yet despite hammering the audience over the head repeatedly with this well worn and obvious metaphor, the film is very well directed and does manage at least until the ending, a very believable and touching story. In fact it is based on a true event where the native Bolivians rose up against a multinational corporation who controlled their water supply.
The highlight of the film is its glorious cinematography, filled with gorgeous shots of the Bolivian landscape and multiple visual homages to Fellini and the jungle set films of Werner Herzog. Along with some fine acting from the ensemble cast filled with Spanish stars, and a breakout performance from Juan Carlos Aduviri who plays a local man hired for one of the main roles in the picture but is also the leader of the protestors.
Worth seeing, but like Laverty's other screenplay from this year, it could use a little subtlety.
It wasn't done terribly I just feel like that angle has been done so many times already.
The water issue is something current now to certain parts of the world.
I really loved the layers in Tambien La Lluvia. A film within a film, with a documentary on the side, each shot in their own style. I actually really liked that they made connections between historical situations and the modern times, and I guess that I didn't mind that it wasn't as subtle, given how hard it can be to get audiences to take colonization seriously. I also enjoyed watching the characters change their positions from time to time. Great review!
You're probably right. I'm still pretty new to the art films, so it's possible that I just haven't seen it done before.
that's...wow. that's like something out of a near future sci-fi novel, the kind of thing you fear might happen not what is actually happening. plumbing the depths for profit, i shouldn't really be surprised.
^ Science of Sleep was a great movie. This one looks like a good alternative to my usual diet of schlock movies .
Looks like a movie I'll like to see :D. It seems like it would dramatically change my perspective on how important water is!
I'm more of a Diego Luna person (dem eyes) but Gael is a pretty good actor.
Pretty much, contracting with governments to take over the burden of managing supply and then charging exorbitant rates for access.
Bernal was good as always, but even though he is a central character, it isn't really a lead role.
I'll have to get this one, thanks.
I'm seeing this at the SFF. Looking forward to it. Bernal has been great in everything I have seen him in.
Bernal is good as well, I liked him in Motorcycle Diaries.
so i'm imagining that there are countries where the citizens are not allowed water because multinationals are hording it. how close am i?
as for the film, how was gael garcia bernal?
I'm looking forward to picking this one up now, didn't know of its existance. Stuck in the past here.


Perfect starter package for your video security needs.
Featuring sixteen night vision cameras, the Lookout Plus 16-Camera System is the perfect starter package for residential and simple, large-scale surveillance.
The TurboView 16 Channel Complete system delivers 1080p footage to a built-in 6TB hard drive. The included camera options provide the longest range with harsh environment protection and are good for both indoor and outdoor use.
16 camera security systems are our largest set of pre-packaged camera systems. If you are looking for more, visit our Commercial Systems page and give us a call or check out our 2015 Camera Systems for Business Buyer's Guide to help pick out the camera system that's right for you! Meant exclusively for large-scale security installations, these systems can protect and survey large buildings, multiple properties, and even multi-floor indoor/outdoor settings.
They come to you under warranty and with lifetime technical support. EZWatch security software also comes with a built-in IP address, which means avoiding upgrade fees your local internet provider may charge to stream live footage.
The 16-Camera Guardian System offers brings you sixteen sturdy EZBullet Silver security cameras. It also comes complete with our TurboView Silver DVR, and all of the necessary wiring and components. The bullet cameras are optimal for indoor security. The cameras record at 1080p resolution when set to TVI mode, which is recommended for residential and small business use.
The Sixteen Camera Sentry System comes gives you freedom of choice between our Platinum Level EZBullets and EZDomes. It also includes our powerful TurboView Gold DVR, and all the necessary wiring and components. The aim is to provide you flexibility in creating a total security presence. The EZBullet cameras are perfect for focused surveillance, and the EZDome cameras are versatile and compact. Both cameras come with night vision, weatherproofing, vandal-proofing, and rigid casings that deter tampering. While these cameras are versatile (indoors or out), this system is designed to be surreptitious, meaning that these domes don't draw attention to themselves. This system captures footage in 1080p resolution, a noticeable step up from most competitors.
The 16 Camera Defender System comes puts the power in your hands, allowing you to specify your own mix of our Platinum Level EZBullets and EZDomes - both offering a remarkably clear 1080p resolution when set to TVI mode. It comes with our top-of-the-line DVR, the TurboView Platinum as well as all the wiring and component you will need to build your complete system. You will be hard pressed to find a more thorough and resolute security system anywhere. All of the cameras are weatherproofed, vandal-proofed, come with night vision and are capable of providing both indoor and outdoor security. This system combines the flexibility and performance of VP-IR EZDome cameras and the focused surveillance capability of EZBullets. The Defender allows you to keep tabs on every part of your property, and the pristine images will make identification and apprehension of criminals as easy as possible.


Steve Barnard, former doctoral student in the program, published a book titled Citizens at the Gates: Twitter, Networked Politics, and the Transformation of Journalism (Palgrave Macmillan 2018). Notably Steve has strong written endorsements from two top scholars in media sociology and communications, Rodney Benson at NYU and Nick Couldry at the London School of Economics and Political Science. As of July, 2018, Steve is at St. Lawrence University in New York.


text:
Q: ClassicThesis : Add document title to every page I'm using classicthesis package to write a user manual. Using \pagestyle{scrheadings} I got the classical header layout as below:.
I would like instead to customize my header in every page adding manual title as below.
Some suggestion to achieve the desired result?

A: classicthesis loads package scrlayer-scrpage. Therefore the default page style is scrheadings. So you can use
\ihead{MY BOOK TITLE}

or
\ihead*{MY BOOK TITLE}

With the starred version this text appears also on pages using page style plain, e.g. chapter pages.

redpajama_set_name: RedPajamaStackExchange


Jordan Brand is expected to hit strides once again in the lifestyle shoe market with the release of four new colorways of the Jordan Flight 23 RST Low, which has been well-accepted during previous releases of this sneaker.
This low-cut Jordan Brand sneaker will be hitting shelves this July in Black/White – Gym Red, White/Pure Platinum, Cool Grey/White – Medium Grey, and Stealth/White – Dark Grey – Shaded Blue colorways, giving us four excellent choices for our new kick this summer.
Watch out for this one and make sure to check it out!


Christmas can be a tricky time of year for foster children. Our care leaver explains what Christmas was like for her at home and in care, and how Foster Carers can help ease the stress that this time of year may bring to the young people in their care.
Everyone has their way of doing Christmas. Growing up in my house meant decorating mid-December. I remember one night when my mum decided to do the decorating - it was very random, she just suddenly said, "Come on, get up, come help me get the Christmas stuff out of the loft!" We re-used everything, every year, always the same things. We had the same plastic tree, until one year the electric base over heated and melted the bottom of the tree. We kept it for a few years afterwards, but couldn't plug it in. Soon though, it started to bend so we had to get a new one. I wasn't very happy when mum replaced it with a new white one; it didn't seem like a real tree and the few good memories we did have, were connected to the old tree. My mum had a china-like angel that we always had at the top of the tree and as we grew older and taller, we were allowed to put it on. It was the kids' job to decorate the tree, but if mum didn't like the way it was done, she would move it about and the tinsel had an order of colour it had to follow.
My dad collected Christmas talking toys, we had so many, and it was our family tradition. They all went under the tree, they where the best. The big Santa always had to go in the middle and we would put tubes of chocolate, crisps and cookies underneath the teddies or in their laps. It was a fun time when my little sister was really young, because she would always hide some chocolate in her toybox, we did all the same, we would sneak down at night and fill our stockings up with chocolate and hide it in our rooms! It sounds like a true magical Christmas doesn't it? Like a type of family that you see in Christmas movies. It had some magic to it, but it was always ruined by my father drinking on Christmas, or my mum complaining about making Christmas dinner.
I have many fun memories at Christmas, but I also have so many bad memories too where it just didn't feel like Christmas anymore; it just felt like any ordinary day. As I grew older I found Christmas became more of a burden, because in all the years I've had Christmas with my family, there was only one Christmas where my dad didn't drink and didn't destroy Christmas. Because of the trauma this caused at Christmas, I now have trouble enjoying Christmas, even if I'm no longer at home. When it gets to October, I start to think about Christmas and start to feel sick, sometimes just by the music and thought of a tree. It doesn't always affect me, sometimes I can get excited, but it's more often followed by dread.
When I've spoken to people about this, some people say it's PTSD, and others just don't understand. I sometimes wonder why I can feel this way, when I know Christmas won't be the same this year, because I'm not at home. But, what others don't realise is, that Christmas is filled with memories, and the main reason people get excited about occasions, is because it's what their brain has associated with them over the years. So, if every time of year you feel excited for Christmas… then your brain is going to start learning to link those two together. It's hard to say how to get yourself out of the situation with feeling this way with Christmas, and my birthday, because it's what I've learnt to feel over the years. If you think about it through a therapists eyes - they may say that you need to break the cycle and by doing that, you need to always think positive and happy thoughts when you think about certain occasions. Try not think about the memories and tell yourself over and over again, that it's going to be different, you're not in that place anymore.
When I was in foster care, with my foster family, we had Christmases that were fun, but there were parts that I just couldn't enjoy, because my brain was just waiting for a bad thing to start, because it's what it had learnt over the years. Sadly, the first Christmas I had with them, was followed by something bad, and it sent me into a panic attack. This is because of a memory I had, when this thing happened. Sadly, they didn't know why I freaked out, because they didn't know about the memory flash back I had.
To foster parents, really all I can say to you is, it's not the presents that matter, sometimes it's just to have a Christmas where you decorate the tree and the house together. It may help the child break the bad bonds with Christmas, but there's a lot more to it and may take a lot of tip toeing around the subject. But the world wasn't made in a day, and neither can you fix a traumatised child so quick.
All I can say is, don't push the child too hard to join in with things and speak to the child. Maybe talking about what normally happens at their home at Christmas may help them get it off their chest a little, and give you some insight on what not to do, but don't push the child to speak if they don't want to speak about it. Making new traditions and making your foster child feel safe and calm, making them feel wanted and not a burden, is the stuff they do in movies… maybe try some of those things, because a lot of children I knew, who didn't have a good Christmases because of their parents, grew up watching those dream Christmas movies wishing they could have Christmas just like that.
Christmas is a difficult time of year for many, but maybe this Christmas, you could make a difference in helping yourself or your foster child. Well that's everything I have to say and I do hope some of it has helped you and I wish you and your foster family a Merry Christmas. I hope it all turns out as calm as it possibly can.


Plus-size dress by ASOS CURVE, Plain design, Understated cool, Crew neck, Press-stud placket, Regular cut, Fits you just right, Mini dress length between: 98-100cm. Say goodbye to awkward-fitting plus-size fashion with our ASOS CURVE collection. Giving shout-outs to denim, occasionwear and jumpsuits, our London-based design team nail your new-season fashion goals with new shapes and fits for (UK) sizes 18-30. Work longline tunics and simple shift dresses Monday to Friday, or prep for the party in maxi lengths.


text:
June 1: Annual OECD Forum Concludes, Paris
The Organisation for Economic Co-operation and Development's annual forum began in late May and ends on June 1. The event was expected to be attended by about 2,000 participants from 70 countries, including heads of state and government and representatives of NGOs, academia, and the labor movement. This year's forum is being held under the theme of "Productive Economies, Inclusive Societies."
June 1: Scheduled Start of Airdrop of Supplies to Syria
The United Nations was scheduled to begin airdrops of food and medical supplies to Syrian towns cut off from international humanitarian relief, on June 1. The plan was agreed by the members of the International Syria Support Group in April, following Bashar al-Assad's continued blocking of food and aid reaching rebel-held areas of the country. UN Envoy for Syria Staffan de Mistura appeared to back away from the commitment in late May, however, fearing the risks of operating without the support of Damascus.
June 2: OPEC Meets Amid Oil Price Volatility, Vienna
The Organization of the Petroleum Exporting Countries meets in Vienna on June 2, with significant international attention focused on oil market fluctuations. The average crude oil price has recovered from its early 2016 lows to about $50 per barrel, but remains at about half the peak level of 2014, which has had a devastating effect in countries such as Venezuela. Following several failed deals to curb production, the Vienna meeting is not expected to offer any change in OPEC direction.
June 3: France Holds Rescheduled Middle East Peace Conference, Paris
The French government will host an international conference in Paris on June 3, with the intention of restarting the stalled Israel-Palestine peace process. The event aims to instigate face-to-face talks between the two sides, who will not attend. The conference was rescheduled from late May to accommodate US Secretary of State John Kerry, who joins representatives from Russia, the European Union, United Nations, and other countries and institutions.
The 15th annual Shangri-La Dialogue of Asia-Pacific defense ministers and senior defense personnel will take place in Singapore from June 3-5. The event, organized by the International Institute for Strategic Studies, aims to build confidence and practical cooperation in the region and will this year discuss key issues such as South China Sea tensions, the North Korean nuclear threat, and jihadi terrorism. Thailand Prime Minister Prayut Chan-o-cha will deliver the keynote address.
June 5: Peru Holds Runoff Presidential Election
Peruvians will vote in a presidential runoff election on June 5 between Keiko Fujimori and Pedro Pablo Kuczynski, who emerged as the leading candidates from a first round national election on April 10. Latest polling puts Fujimori—the daughter of a jailed former president—as the favorite to win. Peru has been one of South America's major success stories of the past decade, with its poverty rate dropping from about half the population to less than a quarter.
June 6-7: US-China Strategic and Economic Dialogue, Beijing
The eighth session of the United States-China Strategic and Economic Dialogue will be held in Beijing from June 6-7. The event includes a series of high-level meetings between the global powers on matters of political, strategic, security, and economic importance. A Chinese state-run newspaper claimed Beijing would "pressure" Washington on maritime issues, following US challenges to Chinese maritime and territorial claims in the South China Sea.
June 8-10: UN High-Level Meeting on Ending AIDS, New York
World leaders, civil society organizations, and public health officials will attend a United Nations high-level meeting on ending AIDS, in New York from June 8-10. The event is designed to focus attention on a "fast-track" approach to the AIDS response over the next five years. This includes targets of fewer than 500,000 people being newly infected with HIV, fewer than 500,000 people dying from AIDS-related causes, and elimination of HIV-related discrimination, between now and 2020.
June 15-16: European Development Days, Brussels
The European Union will host the 2016 edition of the European Development Days on June 15-16. The forum is expected to bring together more than 5,000 participants, including heads of state, aid and development practitioners, members of civil society, and the private sector. This year's gathering will focus on the 2030 Sustainable Development Goals.
June 23: UK Referendum on European Union Membership
The people of the United Kingdom vote on June 23 on whether to stay in or leave the European Union. UK Prime Minister David Cameron promised to hold a vote on the proposal if he won the 2015 general election, following a rise in public support for leaving the bloc. In February this year, the UK agreed a deal with Brussels featuring renegotiated terms for remaining. This included concessions for the UK's economically powerful financial sector. Recent polling suggests a narrow lead for the leave, or "Brexit," vote.
June 25-26: Asian Infrastructure Investment Bank Inaugural Summit, Beijing
China's Asian Infrastructure Investment Bank hosts its first annual meeting from June 25-26 in Beijing. The bank began operating at the start of this year after being established by China in 2014 to help promote development in the Asia-Pacific region. The summit will be attended by representatives of the bank's 37 founding member states and 20 prospective founding members. The United States, Japan, and Canada are yet to join, and the US was said to be disappointed at other allies doing so.
June 30: Scheduled End of UN Mission in Liberia, Monrovia
The United Nations Mission in Liberia (UNMIL) is scheduled to hand back control of the country's security to the Liberian government on June 30. UNMIL began its mandate in the country in 2003 after a deadly civil war. UN Special Representative in Liberia Farid Zarif has expressed confidence in Liberia's ability to manage its resumed responsibilities. This is despite many observers raising concerns about future stability, particularly with elections scheduled for next year and the economy continuing to suffer from the Ebola outbreak and oil market slump.
June 29: North American Leaders Summit, Ottawa
Canadian Prime Minister Justin Trudeau will host his United States and Mexican counterparts for a leaders' summit in late June—the first such meeting since early 2014. The meeting is expected to host talks on measures to boost the continent's economic competitiveness and trade links, and also to forge a united climate change fighting strategy. Relations between Canada and the US have improved under Trudeau, with his predecessor Stephen Harper angered by US President Barack Obama's rejection of the Keystone XL oil pipeline, among other differences of opinion.
June TBD: Armenia and Azerbaijan Resume Talks on Nagorno-Karabakh
Armenia and Azerbaijan are reported to have committed to hold talks sometime in June on ending their dispute over the Nagorno-Karabakh region. Fighting resumed in the region in early April this year, killing over 100 people in the space of four days. Foreign ministers from Russia, France, and the United States met with leaders from the two countries in May and reiterated their commitment to a ceasefire and peaceful solution to the conflict, with the help of the Organization for Security and Co-operation in Europe.
June TBD: Emergency OAS Meeting on Venezuela
The Organization of American States (OAS) has called for an emergency meeting to evaluate Venezuela's respect for democracy, and its possible expulsion from the body. OAS Secretary-General Luis Almagro said in late May that the country had suffered "grave alterations of democratic order" following the government's restrictions on its political opposition's power in Congress, and on Venezuelans holding street protests. The country's oil-dependent economy has suffered a dramatic downturn in the past year following the international oil price crash.

redpajama_set_name: RedPajamaCommonCrawl


text:
South London News
Resident evacuated after Elephant and Castle explosion reminded of IRA bomb scares in 1980s
Gamma worked in both Selfridges and Debenhams on Oxford Street during the 1980s
Ruby GregoryCommunity Reporter
Get FREE email updates for South London
The evacuation after an Elephant and Castle garage exploded into an inferno on Monday afternoon (June 28) reminded a resident of the IRA bomb incidents in 1980s central London.
Gamma Abeyasinghe, 67, has been a resident of Albert Barnes House in Elephant and Castle for 34 years and previously worked as a department manager in both Selfridges and Debenhams in Oxford Street.
On Monday afternoon, Gamma was in his kitchen making a sandwich, oblivious to the terrifying incident that was about to happen just a few yards away from his third floor flat.
READ MORE:Owner of Elephant and Castle garage consumed by fireball reveals '15 cars written off' at 21-year-old family business
Gamma has lived in Elephant and Castle for 34 years (Image: My London)
At around 1.43pm, a loud bang echoed through the streets of South London, as a huge amount of thick black smoke began to billow from underneath the railway arches next to the train station.
Gamma saw several fire engines zooming past as panicked police officers began to knock on his block of flats, shouting 'evacuate! evacuate! get down, get down!'.
Dressed in only loungewear and a pair of flip flops, Gamma made his way down to the street below, unaware that three commercial units, 15 cars and a telephone box were being destroyed in the fire that followed the loud explosion.
Gamma told My London: "We were all outside, I was just dressed in my pyjamas. I walked slowly and police were on the other side (of the road). You could see all the damage, all the black smoke. There was quite a bit of damage done and they stopped all the trains."
Though Metropolitan Police confirmed promptly that the Elephant and Castle explosion wasn't terror-related, it reminded Gamma of the IRA bomb incidents he encountered when he worked as a department store manager.
Gamma recalled one incident in December '82, he said: "I am used to evacuations. At the time of the 1980s, you had a lot of IRA bombs and things.
"I remember there was a bomb scare and then security came running into my office. I was doing paperwork and entering figures. I rushed out and asked staff to leave immediately."
As Gamma and others stood in a carpark waiting to be let back into Debenhams, he remembers a bomb disposal unit discovering a bomb inside one of the tanks in the men's toilets.
"Had they not come, it could have caused a lot of damage. It was Christmas time and a lot of shoppers were about. But thank god nothing happened," Gamma added.
The fire could be seen tearing through the garage (Image: Wayne Budd)
Gamma was relieved that his home wasn't directly affected by the blaze earlier this week.
He was one of 600 nearby residents who were evacuated on Monday afternoon, where 100 firefighters rushed to the scene to tackle the fire.
British Transport Police arrived promptly after the fire broke out and cordoned off Elephant Road, New Kent Road and Walworth Road.
Additionally, all trains were stopped from arriving into the station.
Gamma was contacted by worried friends and family from Sri Lanka and South Africa as the incident made international headlines.
One person was rushed to hospital and a further five people were treated at the scene.
Thick plumes of smoke rose into the sky from the fire, which happened next to Elephant and Castle station (Image: Dan Kitwood/Getty Images)
Terrifying footage showed how a fireball exploded inside the garage, just a few metres away from where firefighters were standing.
The fire was under control just before 6pm, and Gamma was allowed to return to his flat.
London Fire Brigade's Fire Investigation team were at the site of the wreckage yesterday (Tuesday, June 29) as they tried to establish the exact cause of the blaze.
Got a story you think we should be covering? Contact Ruby at ruby.gregory@reachplc.com
Elephant and Castle fire: Horrifying video shows fireball bursting from railway arch as firefighters yell 'move back'
What the huge holes are at the top of South London's Strata SE1 Tower
Grenfell Tower fire


A lot of companies working in highly regulated safety-critical industries still rely on the Waterfall/V-model development method when creating software embedded in their end products. While this doesn't allow them to take advantage of more modern Agile methods, they choose to stick with these tried and tested processes because these allow them to enforce certain processes and simplify documentation, both key to achieving compliance. Process control is simply easier to do in a Waterfall environment – but that doesn't mean that Agile is not compatible with safety-critical development.
Adhering to the regulations of industry standards can also be ensured in an Agile development environment. Adequate process control measures can be implemented, which is best proven by FDA's 2013 endorsement of Agile practices. If it can be used in medical software development, where rigorous standards apply to various processes, Agile is surely compatible with development in other regulated industries.
So how should Agile be used in safety-critical development, and what tools provide advantages when it comes to transitioning to Agile in a regulated environment?
Indeed, more and more companies in various industry sectors are coming to the conclusion that Agile is fit for their needs while providing added benefits. Agile helps dev teams reduce risks by letting them work on smaller chunks of the software at a time. Agile also helps reduce the time of development, and improve the quality of software products. However, aligning Agile techniques with the requirements of relevant industry standards and regulations takes a bit of effort.
To learn more, sign up for our Agile Training Course!
Therefore, if you're looking to adopt Agile while maintaining the same control over your processes that you had using Waterfall, you will first need to map Agile practices and the stipulations of standards that apply to your industry or product. Any inconsistencies between these two will have to be addressed at an early stage of planning your Agile implementation. The end product of this analysis is hugely important: it's going to be the set of (compliant) processes that you'll need to enforce throughout the development lifecycle. Any deviation from these will likely result in non-compliance, and could increase the risk levels of your end product. This task is difficult enough, but there's more to compliance than this.
Traceability down to source code will have to be ensured and proven along the lifecycle. The processes that you have set in stone in the first step should help achieve this – but proving it means that all the links between all work items will need to be recorded, documented, and shown during audits. This is where you'll realize that adequate Application Lifecycle Management tools such as codeBeamer ALM are simply necessary when it comes to implementing and scaling Agile in safety-critical development.
The reason is simple: not only do such solutions help enforce set processes through preconfigured workflows for each item, they can also automatically record all changes, and generate documentation to help compliance audits. Agile favours "working software over comprehensive documentation", which is why it's so much faster than Waterfall – but regulators in safety-critical sectors still require thorough, complete documentation regardless of the development method you decide to use.
ALM tools like codeBeamer take the burden of documentation off the shoulders of your team by automatically recording a comprehensive change history on all artifacts, and letting you customize reports that can be simply exported, taking care of documentation without requiring manual effort from your team. What's more, codeBeamer's cutting-edge workflow engine also allows you to connect various processes (with preconfigured workflows provided via our templates for the medical, automotive, avionics, and pharma industries). Thus, it enables you to maintain control over all processes throughout the entire development lifecycle.
Pro tip: Find out more about the Audit Trail Reports feature set introduced in codeBeamer ALM 9.0!
Once you understand the basics, unlocking the benefits of Agile for safety-critical applications really isn't that tricky. Granted, it requires a bit of initial investment in terms of purchasing and configuring an adequate ALM solution. After you start using it, however, that investment is returned in more than one ways: total control over all processes, reduced time to market, increased efficiency & product quality, and comprehensive documentation created automatically. All that simply translates into one fundamental goal: increased profitability. It's no wonder that more and more safety-critical development companies are making the transition to Agile with the help of ALM solutions.
Interested in finding out how codeBeamer ALM can help you adopt Agile & align your processes with regulations? Drop us a line and ask for a 1-on-1 demonstration so that we can show you how our clients (global enterprises in safety-critical development) are using codeBeamer every day. Ready to start? Sign up for a free trial of codeBeamer ALM to see what it could do for you!


Has lived with a dog, but may not be good with other dogs. Slow correct intro is a must. Strong on lead, needs ongoing lead training. Loves being with people. Please call K9 during office hours for more information.


text:
All / "The Hobby" 3D Printed Mini-Trophy
"The Hobby" 3D Printed Mini-Trophy
Painted None Gold Silver
None Gold Silver
A custom designed, one-of-a-kind, 3D Printed Mini-Trophy created by 3dsoccer.ca
This trophy was created with the "Subbuteo Enthusiast" in mind. The inspiration was the story of why the popular Table Top Soccer Game got its name.
The name "Subbuteo" is derived from the neo-Latin scientific name Falco Subbuteo (a bird of prey commonly known as the Eurasian hobby), after a trademark was not granted to its creator Peter Adolph (1916–1994) to call the game "Hobby"
The trophy is 6.4 cm tall and sits atop a separate 3D printed Base which can be removed. The trophy can also attach to a Subbuteo Base. The trophy has also been primed grey, ready for painting.
In hope you enjoy this unique trophy designed specifically for the Table Soccer Fans around the world.
translation missing: de.cart.general.discounts


What we can learn from the workplaces of the 80's.
As the characteristics of our workforce begin to change beyond recognition due to technology, the behaviour and general workplace atmosphere is getting harder to monitor.
In a recent study of the HMRC workplace, "swearing and mocking colleagues seemed unremarkable." The findings were highly damaging for the HMRC and much work is now needed to repair their reputation, but more importantly, to restore the employee's faith in the company.
If a similar study was undertaken at your workplace, are you confident of positive results? What steps are in place to help control inappropriate behaviours?
RiskView is designed to identify bullying in the workplace and inappropriate behaviour by highlighting correspondence and documents that contain sexist, racist, derogatory and inappropriate content. Get in touch today to schedule a demo and start your journey towards a fairer workplace today.


text:
Q: CDI Conversation without ending In my JSF project I have a multi page wizard. I am using a @ConversationScoped CDI bean for that wizard. The conversation works well. When user comes to the first page of the wizard, new conversation begins. When user clicks a submit button in any page, the conversation ends. But i have several questions.

*

*What happens if, at the middle of the wizard, the user entered a url in address bar and navigated to another page  without clicking a submit button, do I still have a way to end the conversation?

*Should I bother about this situation or can accumulating such non-ended conversations become a overhead for my application?

A: Most applications ends up with some kind of system that tracks where the user is currently at. This is supposed to be helped by @FlowScoped in JSF 2.2. If you can use that instead then everything should be managed for you. It should be really easy to find examples.
If you can't use FlowScoped and want to stay on @ConversationScoped you must implement your own system for tracking where the user is at. When the user is no longer in your flow you end the conversation.
 @Inject Conversation conversation;

// conversation.end();

Here is a useful part for implementing this: How to cleanly end a CDI @ConversationScoped
However I would go for http://deltaspike.apache.org/core.html and use: To get the conversation.
MyBean myBean = BeanProvider.getContextualReference(MyBean.class, false);
Personally I would do an extension to the type safe navigation in Deltaspikes JSF module to achieve the same thing if I could not use FlowScoped.
Good luck


text:
from __future__ import absolute_import, print_function, division, unicode_literals

import os
from abc import ABCMeta, abstractmethod

import numpy as np
from scipy.io import loadmat
from imageio import imsave
from scipy.ndimage import gaussian_filter, zoom

from tqdm import tqdm
from boltons.cacheutils import cached, LRU

from .roc import general_roc, general_rocs_per_positive
from .numba_utils import fill_fixation_map, auc_for_one_positive

from .utils import TemporaryDirectory, run_matlab_cmd, Cache, average_values, deprecated_class, remove_trailing_nans
from .datasets import Stimulus, Fixations
from .metrics import CC, NSS, SIM
from .sampling_models import SamplingModelMixin

def handle_stimulus(stimulus):
    """
    Make sure that a stimulus is a `Stimulus`-object
    """
    if not isinstance(stimulus, Stimulus):
        stimulus = Stimulus(stimulus)
    return stimulus

def normalize_saliency_map(saliency_map, cdf, cdf_bins):
    """ Normalize saliency to make saliency values distributed according to a given CDF
    """

    smap = saliency_map.copy()
    shape = smap.shape
    smap = smap.flatten()
    smap = np.argsort(np.argsort(smap)).astype(float)
    smap /= 1.0*len(smap)

    inds = np.searchsorted(cdf, smap, side='right')
    smap = cdf_bins[inds]
    smap = smap.reshape(shape)
    smap = smap.reshape(shape)
    return smap

class FullShuffledNonfixationProvider(object):
    def __init__(self, stimuli, fixations, max_fixations_in_cache=500*1000*1000):
        self.stimuli = stimuli
        self.fixations = fixations
        cache_size = int(max_fixations_in_cache / len(self.fixations.x))
        self.cache = LRU(cache_size)
        self.nonfixations_for_image = cached(self.cache)(self._nonfixations_for_image)
        self.widths = np.asarray([s[1] for s in stimuli.sizes]).astype(float)
        self.heights = np.asarray([s[0] for s in stimuli.sizes]).astype(float)

    def _nonfixations_for_image(self, n):
        inds = ~(self.fixations.n == n)
        xs = (self.fixations.x[inds].copy()).astype(float)
        ys = (self.fixations.y[inds].copy()).astype(float)

        other_ns = self.fixations.n[inds]
        xs *= self.stimuli.sizes[n][1]/self.widths[other_ns]
        ys *= self.stimuli.sizes[n][0]/self.heights[other_ns]

        return xs.astype(int), ys.astype(int)

    def __call__(self, stimuli, fixations, i):
        assert stimuli is self.stimuli
        n = fixations.n[i]
        return self.nonfixations_for_image(n)

def _get_unfixated_values(saliency_map, ys, xs):
    """Return all saliency values that have not been fixated at leat once."""
    fixation_map = np.zeros(saliency_map.shape)
    fill_fixation_map(
        fixation_map,
        np.array([ys, xs]).T
    )
    return saliency_map[fixation_map == 0].flatten()

class ScanpathSaliencyMapModel(object, metaclass=ABCMeta):
    """
    Most general saliency model class. The model is neither
    assumed to be time-independet nor to be a probabilistic
    model.
    """

    @abstractmethod
    def conditional_saliency_map(self, stimulus, x_hist, y_hist, t_hist, attributes=None, out=None):
        """
        Return the models saliency map prediction depending on a fixation history
        for the n-th image.
        """
        raise NotImplementedError()

    def conditional_saliency_map_for_fixation(self, stimuli, fixations, fixation_index, out=None):
        return self.conditional_saliency_map(
            stimuli.stimulus_objects[fixations.n[fixation_index]],
            x_hist=remove_trailing_nans(fixations.x_hist[fixation_index]),
            y_hist=remove_trailing_nans(fixations.y_hist[fixation_index]),
            t_hist=remove_trailing_nans(fixations.t_hist[fixation_index]),
            attributes={key: getattr(fixations, key)[fixation_index] for key in fixations.__attributes__},
            out=out
        )

    def conditional_saliency_maps(self, stimuli, fixations, verbose=False, **kwargs):
        """ returns conditional log density predictions for each fixation """
        return [self.conditional_saliency_map_for_fixation(stimuli, fixations, fixation_index) for fixation_index in tqdm(range(len(fixations)), disable=not verbose)]

    def AUCs(self, stimuli, fixations, nonfixations='uniform', verbose=False):
        """
        Calulate AUC scores for fixations

        :type fixations : Fixations
        :param fixations : Fixation object to calculate the AUC scores for.

        :type nonfixations : string or Fixations
        :param nonfixations : Nonfixations to use for calculating AUC scores.
                              Possible values are:
                                  'uniform':  Use uniform nonfixation distribution (Judd-AUC), i.e.
                                              all pixels from the saliency map.
                                  'unfixated': Use all pixels from the saliency map except the fixated ones.
                                  'shuffled': Use all fixations from other images as nonfixations.
                                  fixations-object: For each image, use the fixations in this fixation
                                                    object as nonfixations

        :rtype : ndarray
        :return : list of AUC scores for each fixation,
                  ordered as in `fixations.x` (average=='fixation' or None)
                  or by image numbers (average=='image')
        """
        rocs_per_fixation = []
        rocs = {}
        out = None

        nonfix_ys = None
        nonfix_xs = None

        if isinstance(nonfixations, Fixations):
            nonfix_xs = []
            nonfix_ys = []
            for n in range(fixations.n.max() + 1):
                inds = nonfixations.n == n
                nonfix_xs.append(nonfixations.x_int[inds].copy())
                nonfix_ys.append(nonfixations.y_int[inds].copy())

        if nonfixations == 'shuffled':
            nonfixations = FullShuffledNonfixationProvider(stimuli, fixations)

        for i in tqdm(range(len(fixations.x)), total=len(fixations.x), disable=not verbose):
            out = self.conditional_saliency_map_for_fixation(stimuli, fixations, i, out=out)
            positive = out[fixations.y_int[i], fixations.x_int[i]]
            if nonfixations == 'uniform':
                negatives = out.flatten()
            elif nonfixations == 'unfixated':
                negatives = _get_unfixated_values(
                    out,
                    [fixations.y_int[i]], [fixations.x_int[i]]
                )
            elif nonfix_xs is not None:
                n = fixations.n[i]
                negatives = out[nonfix_ys[n], nonfix_xs[n]]
            elif callable(nonfixations):
                _nonfix_xs, _nonfix_ys = nonfixations(stimuli, fixations, i)
                negatives = out[_nonfix_ys.astype(int), _nonfix_xs.astype(int)]
            else:
                raise ValueError("Don't know how to handle nonfixations {}".format(nonfixations))

            this_roc = auc_for_one_positive(positive, negatives)
            rocs.setdefault(fixations.n[i], []).append(this_roc)
            rocs_per_fixation.append(this_roc)
        return np.asarray(rocs_per_fixation)

    def AUC(self, stimuli, fixations, nonfixations='uniform', average='fixation', verbose=False):
        """
        Calulate AUC scores for fixations

        :type fixations : Fixations
        :param fixations : Fixation object to calculate the AUC scores for.

        :type nonfixations : string or Fixations
        :param nonfixations : Nonfixations to use for calculating AUC scores.
                              Possible values are:
                                  'uniform':  Use uniform nonfixation distribution (Judd-AUC), i.e.
                                              all pixels from the saliency map.
                                  'unfixated': Use all pixels from the saliency map except the fixated ones.
                                  'shuffled': Use all fixations from other images as nonfixations.
                                  fixations-object: For each image, use the fixations in this fixation
                                                    object as nonfixations

        :type average : string
        :param average : How to average the AUC scores for each fixation.
                         Possible values are:
                             'image': average over images
                             'fixation' or None: Return AUC score for each fixation separately

        :rtype : ndarray
        :return : list of AUC scores for each fixation,
                  ordered as in `fixations.x` (average=='fixation' or None)
                  or by image numbers (average=='image')
        """
        aucs = self.AUCs(stimuli, fixations, nonfixations=nonfixations, verbose=verbose)
        return average_values(aucs, fixations, average=average)

    def sAUCs(self, stimuli, fixations, verbose=False):
        return self.AUCs(stimuli, fixations, nonfixations='shuffled', verbose=verbose)

    def sAUC(self, stimuli, fixations, average='fixation', verbose=False):
        return self.AUC(stimuli, fixations, nonfixations='shuffled', average=average, verbose=verbose)

    def NSSs(self, stimuli, fixations, verbose=False):
        values = np.empty(len(fixations.x))
        out = None

        for i in tqdm(range(len(fixations.x)), disable=not verbose, total=len(fixations.x)):
            out = self.conditional_saliency_map_for_fixation(stimuli, fixations, i, out=out)
            values[i] = NSS(out, fixations.x_int[i], fixations.y_int[i])
        return values

    def NSS(self, stimuli, fixations, average='fixation', verbose=False):
        nsss = self.NSSs(stimuli, fixations, verbose=verbose)
        return average_values(nsss, fixations, average=average)

    def set_params(self, **kwargs):
        """
        Set model parameters, if the model has parameters

        This method has to reset caches etc., if the depend on the parameters
        """
        if kwargs:
            raise ValueError('Unkown parameters!', kwargs)

class SaliencyMapModel(ScanpathSaliencyMapModel):
    """
    Most model class for saliency maps. The model is assumed
    to be stationary in time (i.e. all fixations are independent)
    but the model is not explicitly a probabilistic model.
    """

    def __init__(self, cache_location = None, caching=True,
                 memory_cache_size=None):
        self._cache = Cache(cache_location, memory_cache_size=memory_cache_size)
        self.caching = caching

    @property
    def cache_location(self):
        return self._cache.cache_location

    @cache_location.setter
    def cache_location(self, value):
        self._cache.cache_location = value

    def saliency_map(self, stimulus):
        """
        Get saliency map for given stimulus.

        To overwrite this function, overwrite `_saliency_map` as otherwise
        the caching mechanism is disabled.
        """
        stimulus = handle_stimulus(stimulus)
        if not self.caching:
            return self._saliency_map(stimulus.stimulus_data)
        stimulus_id = stimulus.stimulus_id
        if not stimulus_id in self._cache:
            self._cache[stimulus_id] = self._saliency_map(stimulus.stimulus_data)
        return self._cache[stimulus_id]

    @abstractmethod
    def _saliency_map(self, stimulus):
        """
        Overwrite this to implement you own SaliencyMapModel.

        Parameters
        ----------

        @type  stimulus: ndarray
        @param stimulus: stimulus for which the saliency map should be computed.
        """
        raise NotImplementedError()

    def conditional_saliency_map(self, stimulus, *args, **kwargs):
        return self.saliency_map(stimulus)

    def AUCs(self, stimuli, fixations, nonfixations='uniform', verbose=False):
        """
        Calulate AUC scores for fixations

        :type fixations : Fixations
        :param fixations : Fixation object to calculate the AUC scores for.

        :type nonfixations : string or Fixations
        :param nonfixations : Nonfixations to use for calculating AUC scores.
                              Possible values are:
                                  'uniform':  Use uniform nonfixation distribution (Judd-AUC), i.e.
                                              all pixels from the saliency map.
                                  'unfixated': Use all pixels from the saliency map except the fixated ones.
                                  'shuffled': Use all fixations from other images as nonfixations.
                                  fixations-object: For each image, use the fixations in this fixation
                                                    object as nonfixations

        :rtype : ndarray
        :return : list of AUC scores for each fixation,
                  ordered as in `fixations.x` (average=='fixation' or None)
                  or by image numbers (average=='image')
        """
        rocs_per_fixation = np.empty(len(fixations.x))

        nonfix_ys = None
        nonfix_xs = None

        if isinstance(nonfixations, Fixations):
            nonfix_xs = []
            nonfix_ys = []
            for n in range(fixations.n.max()+1):
                inds = nonfixations.n == n
                nonfix_xs.append(nonfixations.x_int[inds].copy())
                nonfix_ys.append(nonfixations.y_int[inds].copy())

        if nonfixations == 'shuffled':
            nonfixations = FullShuffledNonfixationProvider(stimuli, fixations)

        for n in tqdm(range(len(stimuli)), total=len(stimuli), disable=not verbose):
            inds = fixations.n == n
            if not inds.sum():
                continue
            out = self.saliency_map(stimuli.stimulus_objects[n])
            positives = np.asarray(out[fixations.y_int[inds], fixations.x_int[inds]])
            if nonfixations == 'uniform':
                negatives = out.flatten()
            elif nonfixations == 'unfixated':
                negatives = _get_unfixated_values(
                    out,
                    fixations.y_int[inds], fixations.x_int[inds]
                )
            elif nonfix_xs is not None:
                negatives = out[nonfix_ys[n], nonfix_xs[n]]
            elif callable(nonfixations):
                _nonfix_xs, _nonfix_ys = nonfixations(stimuli, fixations, np.nonzero(inds)[0][0])
                negatives = out[_nonfix_ys.astype(int), _nonfix_xs.astype(int)]
            else:
                raise TypeError("Cannot handle nonfixations {}".format(nonfixations))

            positives = positives.astype(float)
            negatives = negatives.astype(float)

            rocs = general_rocs_per_positive(positives, negatives)
            rocs_per_fixation[inds] = rocs

        return rocs_per_fixation

    def AUC_per_image(self, stimuli, fixations, nonfixations='uniform', thresholds='all', verbose=False):
        """
        Calulate AUC scores per image for fixations

        :type fixations : Fixations
        :param fixations : Fixation object to calculate the AUC scores for.

        :type nonfixations : string or Fixations
        :param nonfixations : Nonfixations to use for calculating AUC scores.
                              Possible values are:
                                  'uniform':  Use uniform nonfixation distribution (Judd-AUC), i.e.
                                              all pixels from the saliency map.
                                  'unfixated': Use all pixels from the saliency map except the fixated ones.
                                  'shuffled': Use all fixations from other images as nonfixations.
                                  fixations-object: For each image, use the fixations in this fixation
                                                    object as nonfixations

        :type thresholds: string, either of 'all' or 'fixations'
                          'all' uses all saliency values as threshold, computing the true performance of the saliency
                          map as a binary classifier on the given fixations and nonfixations
                          'fixations' uses only the fixated values as done in AUC_Judd.

        :rtype : ndarray
        :return : list of AUC scores for each image,
                  or by image numbers (average=='image')
        """
        rocs_per_image = []
        out = None

        nonfix_xs = None
        nonfix_ys = None

        if thresholds == 'all':
            judd = 0
        elif thresholds == 'fixations':
            judd = 1
        else:
            raise ValueError("Unknown value of `thresholds`: {}".format(thresholds))

        if isinstance(nonfixations, Fixations):
            nonfix_xs = []
            nonfix_ys = []
            for n in range(fixations.n.max() + 1):
                inds = nonfixations.n == n
                nonfix_xs.append(nonfixations.x_int[inds].copy())
                nonfix_ys.append(nonfixations.y_int[inds].copy())

        if nonfixations == 'shuffled':
            nonfixations = FullShuffledNonfixationProvider(stimuli, fixations)

        for n in tqdm(range(len(stimuli)), disable=not verbose):
            out = self.saliency_map(stimuli.stimulus_objects[n])
            inds = fixations.n == n
            positives = np.asarray(out[fixations.y_int[inds], fixations.x_int[inds]])
            if nonfixations == 'uniform':
                negatives = out.flatten()
            elif nonfixations == 'unfixated':
                negatives = _get_unfixated_values(
                    out,
                    fixations.y_int[inds], fixations.x_int[inds]
                )
            elif nonfix_xs is not None:
                negatives = out[nonfix_ys[n], nonfix_xs[n]]
            elif callable(nonfixations):
                _nonfix_xs, _nonfix_ys = nonfixations(stimuli, fixations, np.nonzero(inds)[0][0])
                negatives = out[_nonfix_ys.astype(int), _nonfix_xs.astype(int)]
            else:
                raise TypeError("Cannot handle nonfixations {}".format(nonfixations))

            positives = positives.astype(float)
            negatives = negatives.astype(float)
            this_roc, _, _ = general_roc(positives, negatives, judd=judd)
            rocs_per_image.append(this_roc)
        return rocs_per_image

    def AUC(self, stimuli, fixations, nonfixations='uniform', average='fixation', thresholds='all', verbose=False):
        """
        Calulate AUC scores for fixations

        :type fixations : Fixations
        :param fixations : Fixation object to calculate the AUC scores for.

        :type nonfixations : string or Fixations
        :param nonfixations : Nonfixations to use for calculating AUC scores.
                              Possible values are:
                                  'uniform':  Use uniform nonfixation distribution (Judd-AUC), i.e.
                                              all pixels from the saliency map.
                                  'unfixated': Use all pixels from the saliency map except the fixated ones.
                                  'shuffled': Use all fixations from other images as nonfixations.
                                  fixations-object: For each image, use the fixations in this fixation
                                                    object as nonfixations

        :type average : string
        :param average : How to average the AUC scores for each fixation.
                         Possible values are:
                             'image': average over images
                             'fixation' or None: Return AUC score for each fixation separately

        :type thresholds: string, either of 'all' or 'fixations'
                          'all' uses all saliency values as threshold, computing the true performance of the saliency
                          map as a binary classifier on the given fixations and nonfixations
                          'fixations' uses only the fixated values as done in AUC_Judd.

        :rtype : ndarray
        :return : list of AUC scores for each fixation,
                  ordered as in `fixations.x` (average=='fixation' or None)
                  or by image numbers (average=='image')
        """
        if average not in ['fixation', 'image']:
            raise NotImplementedError()
        aucs = np.asarray(self.AUC_per_image(stimuli, fixations, nonfixations=nonfixations, thresholds=thresholds, verbose=verbose))
        if average == 'fixation':
            weights = np.zeros_like(aucs)
            for n in set(fixations.n):
                weights[n] = (fixations.n == n).mean()
            weights /= weights.sum()

            # take care of nans due to no fixations
            aucs[weights == 0] = 0

            return np.average(aucs, weights=weights)
        elif average == 'image':
            return np.mean(aucs)
        else:
            raise ValueError(average)

    def AUC_Judd(self, stimuli, fixations, jitter=True, noise_size=1.0/10000000, random_seed=42, verbose=False):
        if jitter:
            model = RandomNoiseSaliencyMapModel(
                self,
                noise_size=noise_size,
                random_seed=random_seed
            )
        else:
            model = self
        return model.AUC(
            stimuli,
            fixations,
            average='image',
            nonfixations='unfixated',
            thresholds='fixations',
            verbose=verbose
        )

    def fixation_based_KL_divergence(self, stimuli, fixations, nonfixations='shuffled', bins=10, eps=1e-20):
        """
        Calulate fixation-based KL-divergences for fixations

        :type fixations : Fixations
        :param fixations : Fixation object to calculate the AUC scores for.

        :type nonfixations : string or Fixations
        :param nonfixations : Nonfixations to use for calculating AUC scores.
                              Possible values are:
                                  'uniform':  Use uniform nonfixation distribution (Judd-AUC), i.e.
                                              all pixels from the saliency map.
                                  'shuffled': Use all fixations from other images as nonfixations.
                                  fixations-object: For each image, use the fixations in this fixation
                                                    object as nonfixations

        :type  bins : int
        :param bins : Number of bins to use in estimating the fixation based KL divergence

        :type  eps : float
        :param eps : regularization constant for the KL divergence to avoid logarithms of zero.

        :rtype : float
        :return : fixation based KL divergence
        """

        fixation_values = []
        nonfixation_values = []

        saliency_min = np.inf
        saliency_max = -np.inf

        for n in range(len(stimuli.stimuli)):
            saliency_map = self.saliency_map(stimuli.stimulus_objects[n])
            saliency_min = min(saliency_min, saliency_map.min())
            saliency_max = max(saliency_max, saliency_map.max())

            f = fixations[fixations.n == n]
            fixation_values.append(saliency_map[f.y_int, f.x_int])
            if nonfixations == 'uniform':
                nonfixation_values.append(saliency_map.flatten())
            elif nonfixations == 'shuffled':
                f = fixations[fixations.n != n]
                widths = np.asarray([s[1] for s in stimuli.sizes]).astype(float)
                heights = np.asarray([s[0] for s in stimuli.sizes]).astype(float)
                xs = (f.x.copy())
                ys = (f.y.copy())
                other_ns = f.n

                xs *= stimuli.sizes[n][1]/widths[other_ns]
                ys *= stimuli.sizes[n][0]/heights[other_ns]

                nonfixation_values.append(saliency_map[ys.astype(int), xs.astype(int)])
            else:
                nonfix = nonfixations[nonfixations.n == n]
                nonfixation_values.append(saliency_map[nonfix.y_int, nonfix.x_int])

        fixation_values = np.hstack(fixation_values)
        nonfixation_values = np.hstack(nonfixation_values)

        hist_range = saliency_min, saliency_max

        p_fix, _ = np.histogram(fixation_values, bins=bins, range=hist_range, density=True)
        p_fix += eps
        p_fix /= p_fix.sum()
        p_nonfix, _ = np.histogram(nonfixation_values, bins=bins, range=hist_range, density=True)
        p_nonfix += eps
        p_nonfix /= p_nonfix.sum()

        return (p_fix * (np.log(p_fix) - np.log(p_nonfix))).sum()

    def image_based_kl_divergences(self, stimuli, gold_standard, minimum_value=1e-20, log_regularization=0, quotient_regularization=0, convert_gold_standard=True, verbose=False):
        """Calculate image-based KL-Divergences between model and gold standard for each stimulus

        This metric computes the KL-Divergence between model predictions and a gold standard
        when interpreting these as fixation densities. As in the MIT saliency benchmark,
        saliency maps are interpreted as densities by dividing them by their summed value.

        To avoid problems with zeros, the minimum value is added to all saliency maps.
        Alternatively the kl divergence itself can be regularized (see Model.kl_divergences for details).

        If the gold standard is already a probabilistic model that should not be converted in a
        new (different!) probabilistic model, set `convert_gold_standard` to False.
        """
        def convert_model(model, minimum_value):
            from .models import SaliencyMapNormalizingModel
            return SaliencyMapNormalizingModel(model, minimum_value=minimum_value)

        prob_model = convert_model(self, minimum_value)
        if convert_gold_standard:
            prob_gold_standard = convert_model(gold_standard, minimum_value)
        else:
            prob_gold_standard = gold_standard

        return prob_model.kl_divergences(
            stimuli,
            prob_gold_standard,
            log_regularization=log_regularization,
            quotient_regularization=quotient_regularization,
            verbose=verbose
        )

    def image_based_kl_divergence(self, stimuli, gold_standard, minimum_value=1e-20, log_regularization=0, quotient_regularization=0, convert_gold_standard=True, verbose=False):
        """Calculate image-based KL-Divergences between model and gold standard averaged over stimuli

        for more details, see `image_based_kl_divergences`.
        """
        return np.mean(self.image_based_kl_divergences(stimuli, gold_standard,
                                                       minimum_value=minimum_value,
                                                       convert_gold_standard=convert_gold_standard,
                                                       log_regularization=log_regularization,
                                                       quotient_regularization=quotient_regularization,
                                                       verbose=verbose))

    def KLDivs(self, *args, **kwargs):
        """Alias for image_based_kl_divergence"""
        return self.image_based_kl_divergences(*args, **kwargs)

    def KLDiv(self, *args, **kwargs):
        """Alias for image_based_kl_divergence"""
        return self.image_based_kl_divergence(*args, **kwargs)

    def CCs(self, stimuli, other, verbose=False):
        """ Calculate Correlation Coefficient Metric against some other model

        Returns performances for each stimulus. For performance over dataset,
        see `CC`
        """
        coeffs = []

        for s in tqdm(stimuli, disable=not verbose):
            coeffs.append(CC(self.saliency_map(s), other.saliency_map(s)))

        return np.asarray(coeffs)

    def CC(self, stimuli, other, verbose=False):
        return self.CCs(stimuli, other, verbose=verbose).mean()

    def NSSs(self, stimuli, fixations, verbose=False):
        values = np.empty(len(fixations.x))
        for n, s in enumerate(tqdm(stimuli, disable=not verbose)):
            smap = self.saliency_map(s).copy()
            inds = fixations.n == n
            values[inds] = NSS(smap, fixations.x_int[inds], fixations.y_int[inds])

        return values

    def SIMs(self, stimuli, other, verbose=False):
        """ Calculate Similarity Metric against some other model

        Returns performances for each stimulus. For performance over dataset,
        see `SIM`
        """

        values = []
        for s in tqdm(stimuli, disable=not verbose):
            smap1 = self.saliency_map(s)
            smap2 = other.saliency_map(s)
            values.append(SIM(smap1, smap2))

        return np.asarray(values)

    def SIM(self, stimuli, other, verbose=False):
        return self.SIMs(stimuli, other, verbose=verbose).mean()

    def __add__(self, other):
        if not isinstance(other, SaliencyMapModel):
            return NotImplemented

        return LambdaSaliencyMapModel([self, other], fn=lambda smaps: np.sum(smaps, axis=0, keepdims=False), caching=False)

    def __sub__(self, other):
        if not isinstance(other, SaliencyMapModel):
            return NotImplemented

        return LambdaSaliencyMapModel([self, other], fn=lambda smaps: smaps[0] - smaps[1], caching=False)

    def __mul__(self, other):
        if not isinstance(other, SaliencyMapModel):
            return NotImplemented

        return LambdaSaliencyMapModel([self, other], fn=lambda smaps: np.prod(smaps, axis=0, keepdims=False), caching=False)

    def __truediv__(self, other):
        if not isinstance(other, SaliencyMapModel):
            return NotImplemented

        return LambdaSaliencyMapModel([self, other], fn=lambda smaps: smaps[0] / smaps[1], caching=False)

class CachedSaliencyMapModel(SaliencyMapModel):
    """Saliency map model which uses only precached saliency maps
    """
    def __init__(self, cache_location, **kwargs):
        if cache_location is None:
            raise ValueError("CachedSaliencyMapModel needs a cache location!")
        super(CachedSaliencyMapModel, self).__init__(cache_location=cache_location, **kwargs)

    def _saliency_map(self, stimulus):
        raise NotImplementedError()

class MatlabSaliencyMapModel(SaliencyMapModel):
    """
    A model that creates it's saliency maps from a matlab script.

    The script has to take at least two arguments: The first argument
    will contain the filename which contains the stimulus (by default as png),
    the second argument contains the filename where the saliency map should be
    saved to (by default a .mat file). For more complicated scripts, you can
    overwrite the method `matlab_command`. It has to be a format string
    which takes the fields `stimulus` and `saliency_map` for the stimulus file
    and the saliency map file.
    """
    def __init__(self, script_file, stimulus_ext = '.png', saliency_map_ext='.mat', only_color_stimuli=False, **kwargs):
        """
        Initialize MatlabSaliencyModel

        Parameters
        ----------

        @type  script_file: string
        @param script_file: location of script file for Matlab/octave.
                            Matlab/octave will be run from this directory.

        @type  stimulus_ext: string, defaults to '.png'
        @param stimulus_ext: In which format the stimulus should be handed to the matlab script.

        @type  saliency_map_ext: string, defaults to '.png'
        @param saliency_map_ext: In which format the script will return the saliency map

        @type  only_color_stimuli: bool, defaults to `False`
        @param only_color_stimuli: If True, indicates that the script can handle only color stimuli.
                                   Grayscale stimuli will be converted to color stimuli by setting all
                                   RGB channels to the same value.
        """
        super(MatlabSaliencyMapModel, self).__init__(**kwargs)
        self.script_file = script_file
        self.stimulus_ext = stimulus_ext
        self.saliency_map_ext = saliency_map_ext
        self.only_color_stimuli = only_color_stimuli
        self.script_directory = os.path.dirname(script_file)
        script_name = os.path.basename(script_file)
        self.command, ext = os.path.splitext(script_name)

    def matlab_command(self, stimulus):
        """
        Construct the command to pass to matlab.

        Parameters
        ----------

        @type  stimulus: ndarray
        @param stimulus: The stimulus for which the saliency map should be generated.
                         In most cases, this argument should not be needed.

        @returns: string, the command to pass to matlab. The returned string has to be
                  a format string with placeholders for `stimulus` and `saliency_map`
                  where the files containing stimulus and saliency map will be inserted.
                  To change the type of these files, see the constructor.
        """
        return "{command}('{{stimulus}}', '{{saliency_map}}');".format(command=self.command)

    def _saliency_map(self, stimulus):
        with TemporaryDirectory(cleanup=True) as temp_dir:
            stimulus_file = os.path.join(temp_dir, 'stimulus'+self.stimulus_ext)
            if self.only_color_stimuli:
                if stimulus.ndim == 2:
                    new_stimulus = np.empty((stimulus.shape[0], stimulus.shape[1], 3), dtype=stimulus.dtype)
                    for i in range(3):
                        new_stimulus[:, :, i] = stimulus
                    stimulus = new_stimulus
            if self.stimulus_ext == '.png':
                imsave(stimulus_file, stimulus)
            else:
                raise ValueError(self.stimulus_ext)

            saliency_map_file = os.path.join(temp_dir, 'saliency_map'+self.saliency_map_ext)

            command = self.matlab_command(stimulus).format(stimulus=stimulus_file,
                                                           saliency_map=saliency_map_file)

            run_matlab_cmd(command, cwd = self.script_directory)

            if self.saliency_map_ext == '.mat':
                saliency_map = loadmat(saliency_map_file)['saliency_map']
            else:
                raise ValueError(self.saliency_map_ext)

            return saliency_map

class GaussianSaliencyMapModel(SaliencyMapModel):
    """Gaussian saliency map model with given width"""
    def __init__(self, width=0.5, center_x=0.5, center_y=0.5, **kwargs):
        super(GaussianSaliencyMapModel, self).__init__(**kwargs)
        self.width = width
        self.center_x = center_x
        self.center_y = center_y

    def _saliency_map(self, stimulus):
        height = stimulus.shape[0]
        width = stimulus.shape[1]
        YS, XS = np.mgrid[:height, :width].astype(float)
        XS /= width
        YS /= height
        XS -= self.center_x
        YS -= self.center_y
        r_squared = XS**2 + YS**2
        return np.ones((stimulus.shape[0], stimulus.shape[1]))*np.exp(-0.5*r_squared/(self.width)**2)

class FixationMap(SaliencyMapModel):
    """
    Fixation maps for given stimuli and fixations.

    With the keyword `kernel_size`, you can control whether
    the fixation map should be blured or just contain
    the actual fixations.

    If ignore_doublicates is True, multiple fixations in the same
    location will be counted as only one fixation (the fixation map
    won't have entries larger than 1).
    """
    def __init__(self, stimuli, fixations, kernel_size=None, convolution_mode='reflect', ignore_doublicates=False, *args, **kwargs):
        super(FixationMap, self).__init__(*args, **kwargs)

        self.xs = {}
        self.ys = {}
        for n in range(len(stimuli)):
            f = fixations[fixations.n == n]
            self.xs[stimuli.stimulus_ids[n]] = f.x.copy()
            self.ys[stimuli.stimulus_ids[n]] = f.y.copy()

        self.kernel_size = kernel_size
        self.convolution_mode = convolution_mode
        self.ignore_doublicates = ignore_doublicates

    def _saliency_map(self, stimulus):
        stimulus = Stimulus(stimulus)
        stimulus_id = stimulus.stimulus_id
        if stimulus.stimulus_id not in self.xs:
            raise ValueError('No Fixations known for this stimulus!')
        saliency_map = np.zeros(stimulus.size)
        ff = np.vstack([self.ys[stimulus_id].astype(int), self.xs[stimulus_id].astype(int)]).T
        fill_fixation_map(saliency_map, ff)

        if self.ignore_doublicates:
            saliency_map[saliency_map >= 1] = 1

        if self.kernel_size:
            saliency_map = gaussian_filter(saliency_map, self.kernel_size, mode=self.convolution_mode)
        return saliency_map

class ResizingSaliencyMapModel(SaliencyMapModel):
    def __init__(self, parent_model, verbose=True, **kwargs):
        if 'caching' not in kwargs:
            kwargs['caching'] = False
        super(ResizingSaliencyMapModel, self).__init__(**kwargs)
        self.parent_model = parent_model
        self.verbose = verbose

    def _saliency_map(self, stimulus):
        smap = self.parent_model.saliency_map(stimulus)

        target_shape = (stimulus.shape[0],
                        stimulus.shape[1])

        if smap.shape != target_shape:
            if self.verbose:
                print("Resizing saliency map", smap.shape, target_shape)
            x_factor = target_shape[1] / smap.shape[1]
            y_factor = target_shape[0] / smap.shape[0]

            smap = zoom(smap, [y_factor, x_factor], order=1, mode='nearest')

            assert smap.shape == target_shape

        return smap

class DisjointUnionMixin(object):
    def _split_fixations(self, stimuli, fixations):
        """ return list of [(inds, model)]
        """
        raise NotImplementedError()

    def eval_metric(self, metric_name, stimuli, fixations, **kwargs):
        result = np.empty(len(fixations.x))
        done = np.zeros_like(result).astype(bool)
        verbose = kwargs.get('verbose')
        for inds, model in tqdm(self._split_fixations(stimuli, fixations), disable = not verbose):
            assert done[inds].sum() == 0
            _f = fixations[inds]
            this_metric = getattr(model, metric_name)
            this_result = this_metric(stimuli, _f, **kwargs)
            result[inds] = this_result
            done[inds] = True
        assert all(done)
        return result

class DisjointUnionSaliencyMapModel(DisjointUnionMixin, ScanpathSaliencyMapModel):
    def AUCs(self, stimuli, fixations, **kwargs):
        return self.eval_metric('AUCs', stimuli, fixations, **kwargs)

    def AUC(self, stimuli, fixations, **kwargs):
        if kwargs.get('nonfixations', 'uniform') == 'shuffled':
            kwargs = dict(kwargs)
            kwargs['nonfixations'] = FullShuffledNonfixationProvider(stimuli, fixations)
        return super(DisjointUnionSaliencyMapModel, self).AUC(stimuli, fixations, **kwargs)

    def NSSs(self, stimuli, fixations, **kwargs):
        return self.eval_metric('NSSs', stimuli, fixations, **kwargs)

class SubjectDependentSaliencyMapModel(DisjointUnionSaliencyMapModel):
    def __init__(self, subject_models, **kwargs):
        super(SubjectDependentSaliencyMapModel, self).__init__(**kwargs)
        self.subject_models = subject_models

    def _split_fixations(self, stimuli, fixations):
        for s in self.subject_models:
            yield fixations.subjects == s, self.subject_models[s]

    def conditional_saliency_map(self, stimulus, x_hist, y_hist, t_hist, attributes=None, out=None, **kwargs):
        if 'subjects' not in attributes:
            raise ValueError("SubjectDependentSaliencyModel can't compute conditional saliency maps without subject indication!")
        return self.subject_models[attributes['subjects']].conditional_saliency_map(
            stimulus, x_hist, y_hist, t_hist, attributes=attributes, **kwargs)

class ExpSaliencyMapModel(SaliencyMapModel):
    def __init__(self, parent_model):
        super(ExpSaliencyMapModel, self).__init__(caching=False)
        self.parent_model = parent_model

    def _saliency_map(self, stimulus):
        return np.exp(self.parent_model.saliency_map(stimulus))

class BluringSaliencyMapModel(SaliencyMapModel):
    def __init__(self, parent_model, kernel_size, mode='nearest', **kwargs):
        super(BluringSaliencyMapModel, self).__init__(**kwargs)
        self.parent_model = parent_model
        self.kernel_size = kernel_size
        self.mode = mode

    def _saliency_map(self, stimulus):
        smap = self.parent_model.saliency_map(stimulus)
        smap = gaussian_filter(smap, self.kernel_size, mode=self.mode)
        return smap

class DigitizeMapModel(SaliencyMapModel):
    def __init__(self, parent_model, bins=256, return_ints=True):
        super(DigitizeMapModel, self).__init__(caching=False)
        self.parent_model = parent_model
        self.bins = bins
        self.return_ints = return_ints

    def _saliency_map(self, stimulus):
        smap = self.parent_model.saliency_map(stimulus)
        min = smap.min()
        max = smap.max()
        bins = np.linspace(min, max, num=self.bins+1)
        smap = np.digitize(smap, bins) - 1
        if self.return_ints:
            return smap
        else:
            return smap.astype(float)

class HistogramNormalizedSaliencyMapModel(SaliencyMapModel):
    def __init__(self, parent_model, histogram=None, **kwargs):
        super(HistogramNormalizedSaliencyMapModel, self).__init__(**kwargs)

        self.parent_model = parent_model

        if histogram is None:
            histogram = np.ones(256) / 256

        self.histogram = histogram
        self.histogram /= self.histogram.sum()
        self.bins = np.linspace(0, 1, len(self.histogram))
        self.cdf = np.cumsum(self.histogram)

    def _saliency_map(self, stimulus):
        smap = self.parent_model.saliency_map(stimulus)
        return normalize_saliency_map(smap, self.cdf, self.bins)

class LambdaSaliencyMapModel(SaliencyMapModel):
    """Applies a function to a list of saliency maps from other models"""
    def __init__(self, parent_models, fn, **kwargs):
        super(LambdaSaliencyMapModel, self).__init__(**kwargs)
        self.parent_models = parent_models
        self.fn = fn

    def _saliency_map(self, stimulus):
        saliency_maps = [model.saliency_map(stimulus) for model in self.parent_models]
        return self.fn(saliency_maps)

class RandomNoiseSaliencyMapModel(LambdaSaliencyMapModel):
    def __init__(self, parent_model, noise_size=1.0/10000000, random_seed=42, **kwargs):
        super(RandomNoiseSaliencyMapModel, self).__init__(
            [parent_model],
            self.add_jitter,
            **kwargs
        )
        self.rst = np.random.RandomState(seed=random_seed)
        self.noise_size = noise_size

    def add_jitter(self, saliency_maps):
        saliency_map = saliency_maps[0]
        return saliency_map + self.rst.randn(*saliency_map.shape)*self.noise_size

class DensitySaliencyMapModel(SaliencyMapModel):
    """Uses fixation density as predicted by a probabilistic model as saliency maps"""
    def __init__(self, parent_model, **kwargs):
        super(DensitySaliencyMapModel, self).__init__(caching=False, **kwargs)
        self.parent_model = parent_model

    def _saliency_map(self, stimulus):
        return np.exp(self.parent_model.log_density(stimulus))

class LogDensitySaliencyMapModel(SaliencyMapModel):
    """Uses fixation log density as predicted by a probabilistic model as saliency maps"""
    def __init__(self, parent_model, **kwargs):
        super(LogDensitySaliencyMapModel, self).__init__(caching=False, **kwargs)
        self.parent_model = parent_model

    def _saliency_map(self, stimulus):
        return self.parent_model.log_density(stimulus).copy()

class EqualizedSaliencyMapModel(SaliencyMapModel):
    """Equalizes saliency maps to have uniform histogram"""
    def __init__(self, parent_model, **kwargs):
        super(EqualizedSaliencyMapModel, self).__init__(caching=False, **kwargs)
        self.parent_model = parent_model

    def _saliency_map(self, stimulus):
        smap = self.parent_model.saliency_map(stimulus)
        smap = np.argsort(np.argsort(smap.flatten())).reshape(smap.shape)
        smap = smap.astype(float)
        smap /= np.prod(smap.shape)
        return smap

def nd_argmax(array):
    return np.unravel_index(np.argmax(array.flatten()), array.shape)

class WTASamplingMixin(SamplingModelMixin):
    def sample_fixation(self, stimulus, x_hist, y_hist, t_hist, attributes=None, verbose=False, rst=None):
        conditional_saliency_map = self.conditional_saliency_map(stimulus, x_hist, y_hist, t_hist, attributes=attributes)
        y, x = nd_argmax(conditional_saliency_map)

        if not t_hist:
            t = 0
        elif len(t_hist) == 1:
            t = t_hist[0] * 2
        else:
            t = t_hist[-1] + np.mean(np.diff(t_hist))

        return x, y, t

GeneralSaliencyMapModel = deprecated_class(deprecated_in='0.2.16', removed_in='1.0.0', details="Use ScanpathSaliencyMapModel instead")(ScanpathSaliencyMapModel)


text:
Edmund Tomaszewski (ur. 16 października 1906, zm. 11 sierpnia 1976) – polski bokser, reprezentant kraju.

Kariera sportowa
Reprezentował barwy klubu AZS Poznań i CWS Warszawa, walcząc w ringu w kategorii półciężkiej i ciężkiej. W latach 1928 - 1932, 6 razy wystąpił w reprezentacji Polski, odnosząc 1 zwycięstwo i 1 remis, oraz 4 pojedynki przegrał.

Został pochowany na Cmentarzu Junikowo w Poznaniu.

Przypisy

Polscy bokserzy
Urodzeni w 1906
Zmarli w 1976
Sportowcy AZS Poznań
Bokserzy Legii Warszawa
Pochowani na Cmentarzu na Junikowie

redpajama_set_name: RedPajamaWikipedia


Automatic feature extraction from high resolution satellite imagery remains an open research area in the field of remote sensing, computer vision and machine learning. While many algorithms have been proposed for automatic building extraction, none of them solve the problem completely. This paper proposes a system for increasing the degree of automation in extraction of building features from high resolution multispectral satellite images. Image segmentation is a prerequisite for processing of very high spatial resolution imageries. Most image segmentation methods use spectral information of an image alone for generating image objects. A novel image segmentation method for very high spatial resolution multispectral images using combined spectral and structural information is proposed in this paper. The method involves computation of textural parameters from high resolution multispectral imagery and is combined with the spectral bands for extracting spectral-structural characteristics. Hence in addition to the spectral information, the tone, texture and shape information is evaluated for an object-oriented analysis. The support vector machines classification rules are applied on the generated object primitives. The proposed image segmentation method is well applicable to the segmentation of imagery over urban and suburban areas for large scale building extraction.


FINAL FANTASY IX BRING ARTS - ZIDANE&GARNET.
POPTOYS EY04 Showing stand for 1/6th figure clothing suit. Be made of wood and alloy.
BBK BBK06 - 1/6 - The Big Bang Theory.
Meishou MANGA REALIZATION Muhousha Wolverine "Wolverine/Marvel Comics"
Soul of Chogokin GX-84 Invincible Super Man Zambot 3 F.A. "Invincible Super Man Zambot 3"
S.H.Figuarts ULTRAMAN SUIT ver 7 -the Animation- "ULTRAMAN"
S.H.Figuarts ULTRAMAN -the Animation- "ULTRAMAN"
CAT TOYS CT019A / CT019B / CT019C - 1/6 Female Headsculpts.
S.H.Figuarts Broly -Super- "Dragon Ball Super Broly"
DATE A LIVE - Tobiichi Origami Angel Ver.
Tetsujin 28 - 50 Cm.
Mr.Z animal model NO. 35 - 1/ 6 ratio Mandrillus Sphinx & Lion Cub set.
Asmus Toys DMC503 - 1/6 Devil May Cry V - Devil May Cry 5 Nero.
Technic Toys TYM023 & TYM024 - Mid-Sock Socks.
Asuka Shikinami Langley Plugsuit Ver.
Hot Toys � MMS525 - Star Wars: Episode I - The Phantom Menace - 1/6th scale Qui-Gon Jinn Collectible Figure - Preorder Now !!!
VSTOYS 19XG43A & 19XG43B - 1/6 Zipper boots hollow leather.
Master Team MTT001 - 1/6 Demon Hunter White Wolf Geralt.
Lucrea AIKATSU HOSHIMIYA ICHIGO PINK STAGE Ver.