Monday, August 21, 2023

 Fourier Transformations for wave propagation: 

Introduction:  A Fast Fourier Transform converts wave form data in the time domain into the frequency domain. It achieves this by breaking down the original time-based waveform into a series of sinusoidal terms, each with a unique magnitude, frequency and phase. This process converts a waveform in the time domain into a series of sinusoidal functions which when added together reconstruct the original waveform. Plotting the amplitude of each sinusoidal term versus its frequency creates a power spectrum, which is the response of the original waveform in the frequency domain. 

 

When Fourier transforms are applicable, it means the “earth response” now is the same as the “earth response” later. Switching our point of view from time to space, the applicability of the Fourier transformation means that the “impulse response” here is the same as the “impulse response” there. An impulse is a column vector full of zeros with somewhere a one. An impulse response is a column from the matrix q = Bp The collection of impulse responses in q=Bp defines the convolution operation. 

 

Sample FFT application: 
import numpy as nm 

import scipy 

import scipy.fftpack 

import pylab 

 

def lowpass_cosine( y, tau, f_3db, width, padd_data=True): 

    # padd_data = True means we are going to symmetric copies of the data to the start and stop 

    # to reduce/eliminate the discontinuities at the start and stop of a dataset due to filtering 

    # 

    # False means we're going to have transients at the start and stop of the data 

 

    # kill the last data point if y has an odd length 

    if nm.mod(len(y),2): 

        y = y[0:-1] 

 

    # add the weird padd 

    # so, make a backwards copy of the data, then the data, then another backwards copy of the data 

    if padd_data: 

        y = nm.append( nm.append(nm.flipud(y),y) , nm.flipud(y) ) 

 

    # take the FFT 

    ffty=scipy.fftpack.fft(y) 

    ffty=scipy.fftpack.fftshift(ffty) 

 

    # make the companion frequency array 

    delta = 1.0/(len(y)*tau) 

    nyquist = 1.0/(2.0*tau) 

    freq = nm.arange(-nyquist,nyquist,delta) 

    # turn this into a positive frequency array 

    pos_freq = freq[(len(ffty)/2):] 

 

    # make the transfer function for the first half of the data 

    i_f_3db = min( nm.where(pos_freq >= f_3db)[0] ) 

    f_min = f_3db - (width/2.0) 

    i_f_min = min( nm.where(pos_freq >= f_min)[0] ) 

    f_max = f_3db + (width/2); 

    i_f_max = min( nm.where(pos_freq >= f_max)[0] ) 

 

    transfer_function = nm.zeros(len(y)/2) 

    transfer_function[0:i_f_min] = 1 

    transfer_function[i_f_min:i_f_max] = (1 + nm.sin(-nm.pi * ((freq[i_f_min:i_f_max] - freq[i_f_3db])/width)))/2.0 

    transfer_function[i_f_max:(len(freq)/2)] = 0 

 

    # symmetrize this to be [0 0 0 ... .8 .9 1 1 1 1 1 1 1 1 .9 .8 ... 0 0 0] to match the FFT 

    transfer_function = nm.append(nm.flipud(transfer_function),transfer_function) 

 

    # plot up the transfer function 

    # since "freq" is only the positive frequencies, select out 

    pylab.figure(1) 

    pylab.clf() 

    pylab.plot(freq,transfer_function) 

    pylab.xlabel('Frequency [Hz]') 

    pylab.ylabel('Filter Transfer Function') 

    pylab.xlim([-10.0,10.0]) 

    pylab.ylim([-0.05,1.05]) 

 

    # apply the filter, undo the fft shift, and invert the fft 

    filtered=nm.real(scipy.fftpack.ifft(scipy.fftpack.ifftshift(ffty*transfer_function))) 

 

    # remove the padd, if we applied it 

    if padd_data: 

        filtered = filtered[(len(y)/3):(2*(len(y)/3))] 

 

    # return the filtered data 

    return filtered 

 

 

# do an example of lowpass filtering 

# first make some fake data 

# a sine wave fluctuating once every pi seconds 

# samples 1000 times per second 

fakedata = nm.sin(nm.arange(0,11,0.001)) + nm.random.randn(len(nm.arange(0,11,0.001)))/4.0 

 

# run the filter 

# lowpass at 5 Hz, with a 1 Hz width of its roll-off 

filtered = lowpass_cosine(fakedata,0.001,5.0,1.0,padd_data=True) 

 

# plot the noisy data, with the filtered data on top 

pylab.figure(2) 

pylab.clf() 

pylab.plot(nm.arange(0,11,0.001),fakedata,label='Noisy Data') 

pylab.plot(nm.arange(0,11,0.001),filtered,label='Lowpass Filtered Data') 

pylab.xlabel('Time [s]') 

pylab.ylabel('Voltage') 

pylab.legend() 

 

pylab.ion() 

pylab.show() 

Sunday, August 20, 2023

 

This is a summary of the book “How the other half eats? The untold story of food and inequality in America” written by Priya Fielding Singh PhD who is a sociologist at Stanford University. She studies the societal factors that influence people’s health.

There are prevalent assumptions about eating that grossly misunderstand the dietary choices in America. There is societal pressure to be a “good mom” which dictates family dietary choices. The food industry pushes junk food to ease mothers' guilt.  Gendered expectations create further frustrations for mothers trying to uphold healthy eating habits. Lack of time and resources often leads to unhealthy dietary compromises. Emotional stress and misguided blame affect diets across the income spectrum.

The author makes recommendations for both mothers without resources who must be prudent to buy the right foods and those who can buy healthful food but who think the choices are not good enough. Her research targets diverse families and shows that Americans’ dietary choices have little to do with personal discipline and, instead, mainly involve family budgets and societal pressures. Personal desires – whether to be a perfect mom or to alleviate the weight of poverty – shape how Americans eat.

The American diet is overwhelmingly unhealthy. The US Department of Agriculture agrees with most nutritionists that a healthy diet is made up of fresh fruits, vegetables, low fat dairy, whole grains, and lean proteins. Most Americans don’t eat this way. The Americans who suffer the most from diets lacking in nutritional value are low-income families of color. They often eat too much sugar and too many processed foods and fatty meats, leading to higher rates of diabetes and heart problems, as well as earlier deaths than more affluent people.

As the disparity between rich and the poor widens, some political figures, such as Michelle Obama, have sought to mitigate some of the causes behind this issue. However, those efforts operate on two assumptions about why some Americans eat unhealthily. First, low-income families can’t afford healthier foods and second, low-income families don’t have physical access to grocery stores that sell healthy foods.

The second assumption is false. For example, The Healthy Food Financing Initiative invested more than $650 million dollars in building supermarkets in communities that lacked nearby grocery stores. Yet, making healthful food more available brought about little or no dietary changes within low-income communities. The author asserts that geographical access was not a contributing factor to dietary choices. Most people have cars and don’t mind traveling to get the food they want.

A mother who makes ends meet lacks the resources to take her kids out for fun activities, such as visiting a water park. Her lack of financial security impedes her ability to provide for her children. She constantly denies her daughters’ requests for new clothes, electronics, or toys. This makes her feel guilty and leaves her wondering if she’s a terrible mother. However, she can say yes to junk food because it’s cheap. Buying her daughters powdered donuts or a bag of Doritos puts smiles on their faces and is often the only thing she can do to ease the hardship of poverty.

On the opposite end of the economic spectrum, an affluent mother often says no to her kid’s junk food requests. However, she can say yes to most of their other requests. She can provide her children with private school, concert tickets, summer camp and consistent, healthy dietary choices.

Intensive mothering dooms moms to feelings of inadequacy and the sense that they never do enough — that they never are enough. This behavior creates a racial and economic inequality gap concerning who gets to be a good mother. Gold standard mothering now means giving your kids every opportunity to grow and learn, buying them whatever they need to thrive and providing them with nutritious food. By those unfair criteria, only the financially secure can afford to be good moms.

The food industry pushes junk food to ease mothers’ guilt. Because many low-income Americans are people of color, food choices may also reflect racial inequalities. Americans often associate childhood obesity with being Black or Hispanic – and often blame mothers instead of scrutinizing the food industry’s practices. The author states that the dads she met did not need to devote themselves to feeding their kids to feel like they were good dads.

Single mothers who work labor-intensive jobs have greater difficulty making healthy choices. Lack of time is an issue for most working parents across economic brackets. They often face long hours and long commutes, leaving them with less time to shop for food, cook or clean. Mothers often feel they must choose between spending quality time with their kids or cooking a healthy meal. This is also true for moms who are somewhat better off, though some wealthier moms can afford to hire household help to compensate for their lack of parenting time.

The author says that as moms, we deserve to live in a society built of infinitely more empathy, appreciation, and support.” The narrative of blaming mothers will never fix these issues. The government should hold employers and corporations responsible.

 

Reference:

Previous Book Summaries: BookSummary3.docx

Application to summarize text: https://booksonsoftware.com/text/

 

Saturday, August 19, 2023

 

This completes a set of three book summaries. This one is about the book “Viral Justice: How we grow the world we want?” by Ruha Benjamin. She is a professor of African American studies at Princeton University and is also the author of “Race After Technology” and “People’s Science”.

The author uses the term “Viral justice” in the context of promoting collective healing and unlearning dominant narratives. Systemic oppression such as sexism, classism, racism, ableism, and colonialism, operate like viruses. When the “privilege” of the status quo is maintained, this kills people and robs them of the material and social conditions they need to survive. It’s time to treat these societal “viruses” as signals that the status quo is no longer acceptable. When opportunities to dismantle these oppressive systems are actively sought and a more inclusive caring world is built, “viral justice” comes into play.

Systems might indeed be retractable, and the wronged person might be the only victim whose heart is broken, and the shattering might be both emotional and physiological but “viral justice” can be the rallying cry inviting others who desire change to join the individual. The first step in this direction requires us to unlearn patterns of behavior and thought that reinforce dominant narratives. The act of dreaming must be reclaimed and the promotion of collective good must be imagined.

Support networks must be built to weather the stress and physical damage caused by oppressive systems. The term “weathering” here is a public health concept that embodies the stress of living with oppressive systems. If the struggle to make ends meet is one of the principal causes of weathering, then viral justice is about creating social relations that are resuscitating instead of exhausting. Some examples illustrate weathering. Black teenage boys are more likely to die before the age of 65 than teenage boys in Bangladesh. The health of Latinx immigrants deteriorates each generation after their families arrive in the United States. Experiencing traumatic events, ages a person prematurely. There is protection needed from the negative impacts of weathering and this could include cultivating supportive relationships, committing to practices of healing and accountability, and building networks of solidarity.

One of the classic examples is punitive policing which must be replaced with community centered harm reduction policies. Police surveillance affects health of entire communities. Some feel “hunted”, and witnesses report acts of “licensed terror” such as pepper spraying homeless people’s sleeping bags to shooting unarmed civilians. “Viral justice” can be enacted by growing communities of care which does not mean police reform but rather everyday people relating to one another in life-affirming ways. Technology also plays a role. Some apps like GhettoTracker and NextDoor perpetuate systems of oppression, and this manifests as 240 million calls reported annually to 911 for suspicious activity viewing but this can be undone with a more empathetic approach.

Such examples are clearer with racism. For instance, teachers may fail to recognize Black students as gifted and talented, because their image of successful students is white. Researchers found that schools punish Black girls more often and severely for minor infractions – such as having “too much attitude” – than they punish their white female counterparts. A neutral example can be seen with “zero-tolerance” disciplinary approaches which damage students’ self-esteem and rob them of education and life opportunities. “Viral justice” in the educational system can be embraced by advocating reforms such as:

1.       Replacing punitive actions with “restorative practices” where authorities display calm and loving presence.

2.       Prioritizing recruiting and fostering diversity among teachers which can inspire students.

3.       Updating the curriculum to include ethnic studies and Black history.

4.       Hiring counselors to ensure the well-being of students and inviting police to walk the hallways.

Reimagining the place of work in our lives helps workers to thrive. It demands understanding that rest, like healthy foods, clean water, and fresh air, is essential. In a recession or pandemic, the rich could get richer while the poor could become poorer. Imagining a future where rich no longer devalue labor and redistributing wealth to ensure everyone has access to social and economic conditions necessary for living a flourishing life are ways to embrace “Viral justice”.

Similar prospect goes for healthcare institutions. For example, white babies are paying the price for anti-black racism from the time they are born and black babies more so. Institutions must make reparations to victims and their families.

Reimagining a better world as an individual can be broken down into the following steps:

1.       Reflecting on one’s own biases and constantly envisioning a future that embraces all.

2.       Taking micro actions that have a collective bigger impact.

3.       Demonstrating inclusivity by creating spaces where everybody knows they are welcome and safe and influencing others to do the same in gamut such as housing, education, and transportation.

4.       Live poetically to transform oppressive systems and embrace creative ways of thinking.

 

Reference:

Application to summarize text: https://booksonsoftware.com/text/

Friday, August 18, 2023

 

This is a summary of a book titled “Win from Within: Build organizational culture for Competitive Advantage” written by James Heskett who is a professor emeritus of Business Logistics at the Harvard Business School. The book was published by Columbia Business School Publishing in 2022. It provides an applicable overview with concrete examples.

The book details 16 steps to change your culture on the premise that evidence does not support most of the common wisdom about organizational culture. An effective culture boosts the bottom line and fosters flexibility, innovation, and learning. Responsibility rests with the leaders to engage and retain employees and an organization’s policies must reflect its values. High-engagement workplaces share several crucial characteristics and experimentation improves your likelihood of success. There might be some challenges presented by remote work, but they are not insurmountable. The risk associated with good cultures going bad is that change becomes difficult.

A strong culture does not imply marketplace success and is not necessarily a winning asset. It could even be toxic. But leaders can shift the culture in a matter of months. The steps listed here are useful to everyone involved in managing organizations.

Culture and strategy are complementary. For example, Satya Nadella simultaneously healed Microsoft’s dysfunctional culture and led a major strategic shift from Windows to cloud computing. On the contrary, resisting new ideas assuming what worked in the past will continue to work, is one of the most common pitfalls.

An effective culture boosts the bottom line, and fosters flexibility, innovation, and learning. The competitive advantage of an effective culture can outlive that of any strategy. Organizations that put their employees first gained long-term market share and later rewarded their shareholders handsomely. Analysts can predict a company’s relative profitability by studying just the culture. There can even be a virtuous feedback loop between cultural changes and impact on profit. For example, Ritz Carlton vets the hirings thoroughly and empowers almost anyone to spend up to 2000$ to redress a guest’s problem. It emphasizes attitude and empathy.

Leaders must engage and retain employees and culture can be a tiebreaker in engaging talent. Organizations with effective culture can be tiebreakers but they could also be pressure cookers. Discontent stems from a lack of training and a lack of being acknowledged.

Companies known for highly engaged employees train their recruiters in employee engagement as a competitive advantage. They seek people with complementary viewpoints and empower them with the necessary skills.  The US Marine Corps, the Mayo Clinic and Harvard Business School all have sustained high engagement beyond their founding generation and leverage a team-based structure to maintain the culture. Similarly, Southwest Airlines views the late departure as a team failure, not an individual one. This results in a top on-time record.

Experimentation is key to success.Booking.com authorizes any staffer to run a test without advance approval. Testing is taught and test evidence overrides executive judgment. Failed tests provide lessons. The author asserts that measurement without action is a great way to scuttle the success of a lot of effort that precedes it.

Sometimes, a toxic culture has devastating results. After two Boeing 737 MAX planes crashed, a whistleblower said management had rejected an engineer’s request for a safety measure. Employees feared retaliation for bringing problems to management’s attention. Similarly, the O-Ring failure destroyed the Challenger space shuttle, and the case of Volkswagen’s emissions-testing imbroglio is well-known.

Remote work presents cultural challenges and the best that the leaders of increasingly remote workforces can hope for may be hiring advantages and modest increases in productivity.

James Heskett lists the following steps to accomplish culture change:

1.       Leaders acknowledge the need for culture change – Leaders must take note of the metrics and messages emerging from the “shadow culture.”

2.       Use discontent with the status quo as a spur for change – Drastic steps might be needed to crystallize and alleviate the concerns people see with change.

3.       Share the message of change – Communications must be ongoing, clear, and simple. Listen to the reactions. Repeat.

4.       Designate a change team – A team can be tasked with cultural change codifying values, gathering input, meeting deadlines, and maintaining the impetus for change.

5.       Install the best leaders – Bring the right people to the fore; tell the wrong people good-bye. Your goal is alignment around change.

6.       Generate and maintain urgency – Culture change should take six to 12 months. As John Doerr said, “Time is the enemy of transformation.” Build in a sense of drive.

7.       Draft a culture charter – by articulating what must change and how. For example, Microsoft spurred change to empower people “to achieve more.” Compare the current state to the desired future.

8.       Promulgate a change statement that involves the whole organization – Communication is crucial. Gather comments; include or reject them; document the outcome.

9.       Set up a “monitor team” – This team tracks relevant measurements, checks progress, and ensures that communication continues.

10.   Align everything – Changes must align with corporate values. Reward what matters.

11.   Put changes into motion – Leaders must walk the talk. McKinsey found that change is more than five times likelier when leaders act the way they want their employees to act.

12.   Teach people at every level how to implement change – Training must be imparted.

13.   Measure new behaviors – Align your metrics with your new expectations and handle troubles.

14.   Acknowledge progress – Milestones are just as much reason to celebrate as the goal.

15.   Give big changes time to unfold – Long range habits take time to reach the customer.

16.   Keep reminding yourself what culture change requires – This is an ongoing evolution. Frequent check-ins with everyone on the team and recalibrations help.

 

 

 

 

Thursday, August 17, 2023

 

This is a summary of the book: “Work, Pray, Code” written by Carolyn Chen. The book was published in 2022 so it is current. Some of the main takeaways are that work is replacing religion. Finding religion at work is a refuge for those in need of time to pursue a spiritual life. Young tech workers with diversity are treating their colleagues like family. This helps to overcome one of the big challenges in the tech industry which is burnout. Tech companies perks attract and retain top engineers and Techtopia is emerging is a society where people garner ultimate fulfillment from their work.

Long days, free cafeterias and mindfulness workshops have replaced church and community. Within this overview, she offers a particularly strong case of watered-down religion in the trivialization of sacred Buddhist practices.

She takes the example of Silicon Valley workers who are turning away from organized religion and filling the void with work that gives them a sense of “belonging, identity, purpose and transcendence.” Workers who once sought meaning, morality and behavioral guidelines in religion are now finding those values at work.

People who move to the Silicon Valley for tech careers have abandoned more than just their congregations; their communities are suffering also. Participation in all civic organizations has decreased significantly over time. Many tech workers emphasize religious observance is difficult. Many believe that the Silicon Valley ethos runs contrary to their religious beliefs but often those who leave organized religion don’t depart consciously, they just drift away.

Tech engineers are notably young, single, far from home, impressionable and vulnerable to the call of work. The ‘religious’ bonds that employees develop with their coworkers are like those of another institution that forges intimate ties: the family.

Tech companies are sponsoring meditation and yoga just as much as they are promoting free food and on-site gyms, all with the goal of preventing burnouts. Yet 60-hour work weeks lead to burnouts. Tech engineers work hard and generally neglect self-care.

Yet most people don’t connect to their jobs, and many suffer alienation from work. Alienation and burnout are considered corporate culture problems. Journeys of self-discovery might lead employees to discover that they are in the wrong job. Part of being marketable means handling yourself well under pressure and remaining focused, both areas in which meditation and mindfulness are helpful. “On-the-go” Buddhism removes the inconvenience of religious practice and tries to squeeze the practice into one-minute bites like the apps that aim to teach meditation a few minutes a day.

People can escape the theocracy of work by deciding collectively to worship something else such as family, community, civil society, and religion. Society should not abandon work, but it should pour energy into the rest of people’s lives as well.