text:
# Arthur Conmy

Karma: 307
• That’s true, I think the pretraining gradients training choice probably has more effect on the end model than the overfitting SFT model they start PPO with.

Huh, but Mysteries of mode collapse (and the update) were published before td-003 was released? How would you have ended up reading a post claiming td-002 was RLHF-trained when td-003 existed?

Meta note: it’s plausibly net positive that all the training details of these models has been obfuscated, but it’s frustrating how much energy has been sunk into speculation on The Way Things Work Inside OpenAI.

• I wasn’t trying to say mode collapse results were wrong! I collected these results before finding crisper examples of mode collapse that I could build a useful interpretability project on. I also agree with the remarks made about the difficulty of measuring this phenomena. I indeed tried to use the OpenAI embeddings model to encode the various completions and then hopefully have the Euclidean distance be informative, but it seemed to predict large distances for similar completions so I gave up. I also made a consistent color scheme and compared code-davinci, thanks for those suggestions.

I don’t get the impression that RLHF needs hacks to prevent mode collapse: the InstructGPT reports overfitting leading to better human-rater feedback, and the Anthropic HH paper mentions in passing that the KL penalty may be wholly irrelevant (!).

I’m not sure how to interpret the evidence from your first paragraph. You suggest that td-003 mode collapses where td-002 is perfectly capable. So you believe that both td-002 and td-003 mode collapse, in disjoint cases (given the examples from the original mode collapse post)?

• Thanks—this doesn’t seem to change observations much, except there doesn’t seem to be a case where this model has starkly the lowest entropy, as we found with davinci

EDIT: I added code-davinci-002 as the main focus of the post, thanks!

# RLHF does not appear to differentially cause mode-collapse

20 Mar 2023 15:39 UTC
90 points
• its top singular vector encodes what we think are the *least* frequent tokens.

I spot “GoldMagikarp” and “Skydragon”—we now know these are indeed very infrequent tokens! This was a good evidence for SolidGoldMagikarp lurking in plain sight : )

• I think this point was really overstated. I get the impression the rejected papers were basically turned into the arXiv format as fast as possible and so it was easy for the mods to tell this. However, I’ve seen submissions to cs.LG like this and this that are clearly from the alignment community. These posts are also not stellar by standards of preprint formatting, and were not rejected, apparently

• I had the identical reaction that the statement of this effect was a bizarre framing. @afspies’s comment was helpful—I don’t think the claim is as bizarre now.

(though overall I don’t think this post is a useful contribution because it is more likely to confuse than to shed light on LMs)

• I meant your first point.

Regarding the claim that finetuning on data with property $P$ will lead models to ‘understand’ (scare-quotes omitted from now on...) both $P$ and not $P$ better, thanks. I see better where the post is coming from.

However, I don’t necessarily think that we get the easier elicitation of not $P$. There are reasons to believe finetuning is simply resteering the base model and not changing its understanding at all. For example, there are far more training steps in pretraining vs. finetuning. Even if finetuning is shaping a model’s understanding of $P$, in an RLHF setup you’re generally seeing two responses, one with less $P$ and one with more $P$, and I’m not sure that I buy that the model’s inclination to output not $P$ responses can increase given there are no gradients from not $P$ cases. There are in red-teaming setups though and I think the author should register predictions in advance and then blind test various base models and finetuned models for the Waluigi Effect.

• It is open sourced here and there is material from REMIX to get used to the codebase here

• The Waluigi Effect: After you train an LLM to satisfy a desirable property , then it’s easier to elicit the chatbot into satisfying the exact opposite of property .

I’ve tried several times to engage with this claim, but it remains dubious to me and I didn’t find the croissant example enlightening.

Firstly, I think there is weak evidence that training on properties makes opposite behavior easier to elicit. I believe this claim is largely based on the bing chat story, which may have these properties due to bad finetuning rather than because these finetuning methods cause the Waluigi effect. I think ChatGPT is an example of finetuning making these models more robust to prompt attacks (example).

Secondly (and relatedly) I don’t think this article does enough to disentangle the effect of capability gains from the Waluigi effect. As models become more capable both in pretraining (understanding subtleties in language better) and in finetuning (lowering the barrier of entry for the prompting required to get useful outputs), they will get better at being jailbroken by stranger prompts.

# OpenAI introduce ChatGPT API at 1/10th the previous \$/token

1 Mar 2023 20:48 UTC
28 points


text:
Find all School-related info fast with the new School-Specific MBA Forum

 It is currently 04 May 2015, 04:26

### GMAT Club Daily Prep

#### Thank you for using the timer - this advanced tool can estimate your performance and suggest more practice questions. We have subscribed you to Daily Prep Questions via email.

Customized
for You

we will pick new questions that match your level based on your Timer History

Track

every week, we’ll send you an estimated GMAT score based on your performance

Practice
Pays

we will pick new questions that match your level based on your Timer History

# Events & Promotions

###### Events & Promotions in June
Open Detailed Calendar

# Huge drop in score 690 -> 600

Author Message
Current Student
Joined: 04 May 2013
Posts: 13
Concentration: General Management
GMAT 1: 600 Q46 V29
GMAT 2: 710 Q46 V42
GPA: 3.3
WE: Corporate Finance (Energy and Utilities)
Followers: 0

Kudos [?]: 0 [0], given: 0

Huge drop in score 690 -> 600 [#permalink]  04 May 2013, 15:15
So, the thing is, Im my last two CAT (both on MGMAT) before the actual test I got a 680 (Q45 V37) and a 690 (Q44 V39) and, as I am aiming at a 700 score, I was quite confident in achieving my goal. But on test day the big surprise my score was 600 (Q47 V27). It is worth noting that I took the two CAT under test conditions (timed, witht AWA and IR sections, and 8 minutes brakes which I used only to drink water). Also I am usually very good under stress conditions, and was actually expecting an increase in my score due to the adrenalin and extra attention on test day.

One thing that might help is that I am sure this had something to do with the timing. On the actual test I finished the verbal section with more than 15 min to spare, while on the MGMAT CAT's I usually ended up with less than 5 min. But the ting is I did not feel like I was rushing through the questions, it just felt like I had the correct answer, and then there was no reason to stick to that question.

So, as I am preparing myself to retake the test, and I really don't know what exactly went wrong, I was hoping that maybe somebody can help me understand what went wrong, for such a drop on my verbal section. And then, knowing what went wrong I can correct my path and have a better test next time.
 Manhattan GMAT Discount Codes Kaplan GMAT Prep Discount Codes Veritas Prep GMAT Discount Codes
Veritas Prep GMAT Instructor
Joined: 16 Oct 2010
Posts: 5453
Location: Pune, India
Followers: 1333

Kudos [?]: 6778 [0], given: 177

Re: Huge drop in score 690 -> 600 [#permalink]  04 May 2013, 20:02
Expert's post
newiceguy wrote:
So, the thing is, Im my last two CAT (both on MGMAT) before the actual test I got a 680 (Q45 V37) and a 690 (Q44 V39) and, as I am aiming at a 700 score, I was quite confident in achieving my goal. But on test day the big surprise my score was 600 (Q47 V27). It is worth noting that I took the two CAT under test conditions (timed, witht AWA and IR sections, and 8 minutes brakes which I used only to drink water). Also I am usually very good under stress conditions, and was actually expecting an increase in my score due to the adrenalin and extra attention on test day.

One thing that might help is that I am sure this had something to do with the timing. On the actual test I finished the verbal section with more than 15 min to spare, while on the MGMAT CAT's I usually ended up with less than 5 min. But the ting is I did not feel like I was rushing through the questions, it just felt like I had the correct answer, and then there was no reason to stick to that question.

So, as I am preparing myself to retake the test, and I really don't know what exactly went wrong, I was hoping that maybe somebody can help me understand what went wrong, for such a drop on my verbal section. And then, knowing what went wrong I can correct my path and have a better test next time.

Sorry to hear that. What was your verbal score on GMAT Prep Tests? Those tests are more accurate indicators (if at all a mock can tell you something about your actual performance). I totally understand expecting higher than practice scores on the test due to better concentration and adrenaline. I myself perform better under pressure as compared with my half hearted performance at home. So it's certainly disappointing to actually get lower scores than the scores in practice tests.

In fact, David has written an article about how he comes across such cases often and the reasons that lead to these cases. Check it out here: http://www.veritasprep.com/blog/2013/03 ... bal-score/

If everything goes well on practice tests, it is very hard to say why things don't work out on test day. Perhaps a detailed analysis of your GMAT prep test could help you figure out your weaknesses. Else, take the free Veritas CAT @http://www.veritasprep.com/gmat/free-gmat-practice-test/ and I can look over your performance and suggest areas of improvement.
_________________

Karishma
Veritas Prep | GMAT Instructor
My Blog

Veritas Prep GMAT course is coming to India. Enroll in our weeklong Immersion Course that starts March 29!

Veritas Prep Reviews

Current Student
Joined: 04 May 2013
Posts: 13
Concentration: General Management
GMAT 1: 600 Q46 V29
GMAT 2: 710 Q46 V42
GPA: 3.3
WE: Corporate Finance (Energy and Utilities)
Followers: 0

Kudos [?]: 0 [0], given: 0

Re: Huge drop in score 690 -> 600 [#permalink]  25 May 2013, 09:39
Hi karishma,

Thanks for your reply, since you posted it here, I have done both the GMAT prep CAT and the Veritas CAT.

In the GMAT prep a week ago I had a 710 (Q49 V39), and today on the Veritas CAT I had a 740 (Q48 V44).

I still don't know what went wrong on test day, but at least it seems that It is unlikely to happen again.
Veritas Prep GMAT Instructor
Joined: 16 Oct 2010
Posts: 5453
Location: Pune, India
Followers: 1333

Kudos [?]: 6778 [0], given: 177

Re: Huge drop in score 690 -> 600 [#permalink]  03 Jun 2013, 20:32
Expert's post
newiceguy wrote:
Hi karishma,

Thanks for your reply, since you posted it here, I have done both the GMAT prep CAT and the Veritas CAT.

In the GMAT prep a week ago I had a 710 (Q49 V39), and today on the Veritas CAT I had a 740 (Q48 V44).

I still don't know what went wrong on test day, but at least it seems that It is unlikely to happen again.

Those are very good scores. I would expect you to get 700 or more on the actual test.
_________________

Karishma
Veritas Prep | GMAT Instructor
My Blog

Veritas Prep GMAT course is coming to India. Enroll in our weeklong Immersion Course that starts March 29!

Veritas Prep Reviews

Manager
Joined: 15 Jan 2014
Posts: 89
Concentration: Healthcare, Strategy
GMAT 1: 710 Q0 V0
Followers: 1

Kudos [?]: 8 [0], given: 10

Re: Huge drop in score 690 -> 600 [#permalink]  14 May 2014, 15:32
I had a similar experience to yours today. I've focused more on gmat prep tests rather than mgmat because I know they are more accurate. My last four practice tests were 690, 710, 650 and 670. The first and third were mgmat. I got a 600 today and have no idea how. Feeling very discouraged. ESP since I felt great during the test today. I've been stuying for 5 months and it feels like a waste...

Posted from my mobile device
Current Student
Joined: 04 May 2013
Posts: 13
Concentration: General Management
GMAT 1: 600 Q46 V29
GMAT 2: 710 Q46 V42
GPA: 3.3
WE: Corporate Finance (Energy and Utilities)
Followers: 0

Kudos [?]: 0 [0], given: 0

Re: Huge drop in score 690 -> 600 [#permalink]  14 May 2014, 16:51
lmariesf wrote:
I had a similar experience to yours today. I've focused more on gmat prep tests rather than mgmat because I know they are more accurate. My last four practice tests were 690, 710, 650 and 670. The first and third were mgmat. I got a 600 today and have no idea how. Feeling very discouraged. ESP since I felt great during the test today. I've been stuying for 5 months and it feels like a waste...

Posted from my mobile device

Hey, I cant give you any solid advice, but I can tell what happened to me after I wrote the original post.

First, I took the class right at the begining of my vacations, because I wanted to relax after I took them. And even though my score was depressing, thats what I did. I took the rest of my vacation (about one week) to rest and relax. Took the GMAT almost entirely from my head. The only thought I gave to it on that week, was a little planning on what I would do after my vacation.

Second, according to my timeline, I didnt have much time to retake the test, so I scheduled my second GMAT for one month after my vacation ended (so one month and one week after my first take). I used this one month to focus my study on verbal, and thats for 2 reasons, its much easier to improve your score with verbal and it was where my score really dropped on the actual test compared to my preparations. I also tried not to loose the edge on quant, doing some work on it at least once a day. Another thing was that I tried to be more practical, and focused my study more on exercises and on flash cards, instead of studying the principles.

So after that month I got a 710, and just last week I was accepted from the waitlist to Darden. Dont lose hope, these things happen, take the test again, and try not to be desperate so you can concentrate on your next take.
Veritas Prep GMAT Instructor
Joined: 16 Oct 2010
Posts: 5453
Location: Pune, India
Followers: 1333

Kudos [?]: 6778 [0], given: 177

Re: Huge drop in score 690 -> 600 [#permalink]  14 May 2014, 19:30
Expert's post
lmariesf wrote:
I had a similar experience to yours today. I've focused more on gmat prep tests rather than mgmat because I know they are more accurate. My last four practice tests were 690, 710, 650 and 670. The first and third were mgmat. I got a 600 today and have no idea how. Feeling very discouraged. ESP since I felt great during the test today. I've been stuying for 5 months and it feels like a waste...

Posted from my mobile device

I am sure it is a little depressing to get a low score but it shouldn't discourage you. In fact, it is way better to get a low score in practice and be cautious in the actual test than hit high scores in practice and topple in the actual. After all, practice tests are not black boxes. You can analyze the test as much as you want to figure out why your score dropped. When you do that, you will have some great leads on where to put in more effort. A low score brings to the fore the avenues in which improvement is required and that is the most useful thing about practice tests.

So find out the reason for the low score and get back to study.
_________________

Karishma
Veritas Prep | GMAT Instructor
My Blog

Veritas Prep GMAT course is coming to India. Enroll in our weeklong Immersion Course that starts March 29!

Veritas Prep Reviews

Manager
Joined: 15 Jan 2014
Posts: 89
Concentration: Healthcare, Strategy
GMAT 1: 710 Q0 V0
Followers: 1

Kudos [?]: 8 [0], given: 10

Re: Huge drop in score 690 -> 600 [#permalink]  15 May 2014, 07:02
newiceguy wrote:
lmariesf wrote:
I had a similar experience to yours today. I've focused more on gmat prep tests rather than mgmat because I know they are more accurate. My last four practice tests were 690, 710, 650 and 670. The first and third were mgmat. I got a 600 today and have no idea how. Feeling very discouraged. ESP since I felt great during the test today. I've been stuying for 5 months and it feels like a waste...

Posted from my mobile device

Hey, I cant give you any solid advice, but I can tell what happened to me after I wrote the original post.

First, I took the class right at the begining of my vacations, because I wanted to relax after I took them. And even though my score was depressing, thats what I did. I took the rest of my vacation (about one week) to rest and relax. Took the GMAT almost entirely from my head. The only thought I gave to it on that week, was a little planning on what I would do after my vacation.

Second, according to my timeline, I didnt have much time to retake the test, so I scheduled my second GMAT for one month after my vacation ended (so one month and one week after my first take). I used this one month to focus my study on verbal, and thats for 2 reasons, its much easier to improve your score with verbal and it was where my score really dropped on the actual test compared to my preparations. I also tried not to loose the edge on quant, doing some work on it at least once a day. Another thing was that I tried to be more practical, and focused my study more on exercises and on flash cards, instead of studying the principles.

So after that month I got a 710, and just last week I was accepted from the waitlist to Darden. Dont lose hope, these things happen, take the test again, and try not to be desperate so you can concentrate on your next take.

Congrats on getting into Darden! That's great! I honestly feel like this has to be a fluke and will probably plan on taking the test again because I know I can do way better than 600. Did you take more practice tests during the month of study for your re-take? I'm in the opposite position as my Quant score dropped but still need to increase my Verbal as well. Also, when you say "I took the class" what class are you referring to? Thanks and congrats again!
Manager
Joined: 15 Jan 2014
Posts: 89
Concentration: Healthcare, Strategy
GMAT 1: 710 Q0 V0
Followers: 1

Kudos [?]: 8 [0], given: 10

Re: Huge drop in score 690 -> 600 [#permalink]  15 May 2014, 07:09
VeritasPrepKarishma wrote:
lmariesf wrote:
I had a similar experience to yours today. I've focused more on gmat prep tests rather than mgmat because I know they are more accurate. My last four practice tests were 690, 710, 650 and 670. The first and third were mgmat. I got a 600 today and have no idea how. Feeling very discouraged. ESP since I felt great during the test today. I've been stuying for 5 months and it feels like a waste...

Posted from my mobile device

I am sure it is a little depressing to get a low score but it shouldn't discourage you. In fact, it is way better to get a low score in practice and be cautious in the actual test than hit high scores in practice and topple in the actual. After all, practice tests are not black boxes. You can analyze the test as much as you want to figure out why your score dropped. When you do that, you will have some great leads on where to put in more effort. A low score brings to the fore the avenues in which improvement is required and that is the most useful thing about practice tests.

So find out the reason for the low score and get back to study.

Hi Karishma. So this actually happened to me ON test day, not on practice tests, so I'm not really sure what went wrong. Obviously I didn't do well on quant but it's so hard to tell where and why I messed up. Do you have any advice on understanding errors on test day? Timing wasn't an issue, I'm guessing I just made way too many careless mistakes?
Veritas Prep GMAT Instructor
Joined: 16 Oct 2010
Posts: 5453
Location: Pune, India
Followers: 1333

Kudos [?]: 6778 [0], given: 177

Re: Huge drop in score 690 -> 600 [#permalink]  16 May 2014, 22:10
Expert's post
lmariesf wrote:

Hi Karishma. So this actually happened to me ON test day, not on practice tests, so I'm not really sure what went wrong. Obviously I didn't do well on quant but it's so hard to tell where and why I messed up. Do you have any advice on understanding errors on test day? Timing wasn't an issue, I'm guessing I just made way too many careless mistakes?

It is hard to say what happened in the actual test since you never get to see it again. Also, soon enough you will forget the questions you got so if you remember some right now, you should write them down (but you cannot share them with anyone including us) for future reference.

Your best bet now would be to take some section tests of Quant and some practice tests. If you perform consistently in them, you should be fine next time. Just keep your cool.
_________________

Karishma
Veritas Prep | GMAT Instructor
My Blog

Veritas Prep GMAT course is coming to India. Enroll in our weeklong Immersion Course that starts March 29!

Veritas Prep Reviews

Manager
Joined: 15 Jan 2014
Posts: 89
Concentration: Healthcare, Strategy
GMAT 1: 710 Q0 V0
Followers: 1

Kudos [?]: 8 [0], given: 10

Re: Huge drop in score 690 -> 600 [#permalink]  01 Jun 2014, 12:29
Hi All,

Just wanted to post a quick update. After a week of depression and anti-GMAT, I decided to pick up my studies again and tried to just be less stressed about everything. After two weeks of studying I took another practice test today from the GMAT Prep Exam Pack 1 and scored a 700 (Q44 V41). I definitely think I just choked on my actual test day.

I hope to keep my verbal score strong and improve my quant. If anyone has suggestions on getting out of the 44 range in a few weeks, please share! My major problems with quant are careless mistakes and taking too long to figure out what the question is asking.

Thanks!
Re: Huge drop in score 690 -> 600   [#permalink] 01 Jun 2014, 12:29
Similar topics Replies Last post
Similar
Topics:
Huge Score Drop - GMAT Attempt Number 2 1 04 Nov 2014, 07:29
Gmat score dropped from 690 to 650 2 08 Apr 2014, 04:59
Embarrassing score of 560 - Drop from 650-690 in mocks 0 12 Aug 2013, 01:29
significant drop 630 -> 600 -> 540 (GMATPrep) 6 04 May 2013, 08:13
1 Minimum Quant and Verbal for Total Score > 600 2 01 Mar 2013, 20:53
Display posts from previous: Sort by

format: plain


text:
# A teacher is trying to pick 7 students to represent his class at an upcoming state competition

###### Question:

A teacher is trying to pick 7 students to represent his class at an upcoming state competition. If there are 18 boys and 10 girls in the class, in how many ways can the teacher pick 4 boys and 3 girls to attend the event?

#### Similar Solved Questions

##### 21. A mass weighing 122.5 g stretches a spring by 7- F(f)-0.2e-2 N. The spring is...
21. A mass weighing 122.5 g stretches a spring by 7- F(f)-0.2e-2 N. The spring is set in motion from its equilibrium position with a downward velocity of I m/s. Find an equation for the position of the spring at any time t. A cm. The damping constant is c 0.4. External vibrations create a force of 3...
##### First two photos helps with answer last photo Instructions The cash account for American Medical Co....
First two photos helps with answer last photo Instructions The cash account for American Medical Co. at April 30 indicated a balance of $334.985. The bank statement indicated a balance of$388,600 on April 3 Comparing the bank statement and the accompanying canceled checks and memos with the re...
##### Determinate the Rsq Determina si la siguiente aseveración es cierta o falsa. Usando los datos de...
determinate the Rsq Determina si la siguiente aseveración es cierta o falsa. Usando los datos de más abajo se calculo el valor del Rsq. El valor de Rsq en la regresión lineal entre costos de mercadeo y ventas generadas resultó ser que la variable costo de mucadeo influenc...
##### In each of the summer months (June, July, August), the number of accidents per months at...
In each of the summer months (June, July, August), the number of accidents per months at a busy intersection is Poisson distributed with mean 1.5 accidents/month. For all other months, the number of accidents is Poisson distributed with mean 0.5 accidents/month. 7. a) (3 pts) First, let Y an, YFeb, ...
##### When an economy is at its natural rate of unemployment, which of the following will be...
When an economy is at its natural rate of unemployment, which of the following will be true? The unemployment rate will be 0% Only frictional unemployment will exist in the economy. Only structural unemployment as a result of technological changes will exist in the economy. The unemployment rate wil...
##### Microprocessors/Microcontrollers
convert the instruction mov.b #0xA2, W3 to machine code....
##### 1. All of the following are considerations in determining a sample size EXCEPT: Number of subgroups...
1. All of the following are considerations in determining a sample size EXCEPT: Number of subgroups to be profiled Diversity of population being studied Margin of error Total size of population Industry standards 2. The research director at LINK determined that guests from Texas had always been the ...
##### Question 5 Saved Getting compounds to react is usually easy, isolating the desired product on the...
Question 5 Saved Getting compounds to react is usually easy, isolating the desired product on the other hand can be more difficult. This is especially true for the synthesis of cholesteryl nonanate, which produces two products. Which of the following statements is/are true? There may be more than on...
##### Acetic acid has the formula CH_3COOH. The molar mass of Acetic acid is 60 0 grams...
Acetic acid has the formula CH_3COOH. The molar mass of Acetic acid is 60 0 grams per mole. A solution of acetic acid is 0.80 M. Convert its molarity to % m/v concentration...


text:
# Electrolytic capacitor ESR, ripple current and frequency

Electrolytic capacitor ESR and ripple current ratings vary with frequency and temperature.  In this post I’ll start looking at the effect of frequency. Often, a datasheet will specify the ripple current at a certain frequency (120Hz is common) but you may want to use the part at a different frequency (e.g. the 120Hz part in an SMPS) so you need to know how the ESR and ripple current scale.  I have a hunch that the frequency the capacitor’s datasheet gives for the ripple current is intended to be a clue as to the frequency the component’s designers expect the part to be used at, but I’d like to confirm this.

Cornell Dubilier (CDE) have some excellent documentation, and their Application Guide, Aluminum Electrolytic Capacitors [2] defines ESR as “The equivalent series resistance (ESR) is a single resistance representing all of the ohmic losses of the capacitor and connected in series with the capacitance.” The ripple current is related to the ESR because the power dissipated within the capacitor is the ripple current squared multiplied by the ESR.  The same document gives a short description of the ESR’s relationship with frequency, where $DF_{lf}$ is the low-frequency dissipation factor in percent, and $ESR_{hf}$ is the high-frequency ESR in Ω:

“Like DF, the ESR varies with frequency. Rewriting the DF equation … ESR can be modeled [sic] as below:

$ESR=\dfrac{10000DF_{lf}}{2\pi fC}+ESR_{hf}$

Expressing the ideas in ESR terms, at low frequencies the ESR declines steadily with increasing frequency and crosses over to constant ESR at a frequency inversely proportional to capacitance. This crossover is typically below 10kHz. The ESR of high-capacitance capacitors changes little with increasing frequency because high-capacitance causes them to have low crossover frequencies. The $ESR_{hf}$ ranges from 0.002 for large, screw-terminal capacitors to 10 for miniature devices.”

This statement reflects what CDE publish in their datasheets.  For the Type 350 high frequency capacitors the ripple current is specified at 20kHz, and the following ripple current frequency multipliers are:

 Ripple multipliers at Rated WVDC 60Hz 120Hz 360Hz 1kHz 5kHz 10kHz+ 6.3-20 0.53 0.65 0.73 0.90 0.95 1.0 25 to 35 0.45 0.55 0.65 0.85 0.92 1.0 50 to 75 0.36 0.50 0.60 0.80 0.90 1.0 100 0.29 0.40 0.52 0.75 0.87 1.0

On the other hand, the CDE Type 400C capacitors have their ripple currents specified at 120Hz, with the following ripple current frequency multipliers:

 Ripple multipliers at Rated WVDC 50Hz 60Hz 120Hz 360Hz 1kHz 5kHz+ 100-160 0.80 0.85 1.00 1.05 1.08 1.08 200-350 0.8 0.83 1.00 1.15 1.20 1.20 400-500 0.78 0.80 1.00 1.30 1.40 1.40

CDE give the following warning [2]:

“Rated ripple current can be adjusted for operation at frequencies other than 120 Hz. Multipliers are shown in the specifications. Generally the multipliers are derived based on expected ESR change with frequency; however, … ESR is a complex function of temperature, capacitance and rated voltage as well as frequency. So it is difficult to create ripple-frequency multiplier tables that accurately model the frequency dependence. For high-ripple current applications verify ESR at frequencies of interest and calculate total power dissipated.”

A few other manufacturer’s datasheets were checked to confirm if the CDE multipliers are similar to those given for other brands.

### Duracap

Duracap publish [1] the following ripple current frequency multipliers for their “Extreme Application” range of capacitors:

 Ripple multipliers at Rated WVDC 60Hz 120Hz 400Hz 1kHz 2.5Hz 3 to 50 0.8 1.0 1.05 1.10 1.14 50 to 150 0.8 1.0 1.08 1.13 1.16 150 and up 0.8 1.0 1.15 1.21 1.25

### Panasonic

Here are a few tables from Panasonic, all of which have their ripple current specified at 120Hz:

 Ripple multipliers at Series 50,60Hz 120Hz 1kHz 10kHz+ M Type A 0.7 1.0 1.30 1.70 S Type V 0.7 1.0 1.30 1.70 KS Type A 0.7 1.0 1.30 1.70

The Series M Type A caps are available in voltages from 6.3V to 450V, the Series S Type V caps are available in 4V to 100V and the Series KS Type A caps range from 4V to 50V, but the same multiplies are given. Panasonic don’t break the multiplies into different voltage ranges the way Duracap and CDE do.

### Nichicon

Nichicon are slightly different again.  Here are the multipliers from the HE series datasheet, which are specified for 100kHz.  Again, the HE series was selected at random.

 Ripple multipliers at Capacitance (uF) 50Hz 120Hz 300Hz 1kHz 10kHz+ 0.47 to 33 0.45 0.55 0.7 0.9 1.0 39 to 330 0.6 0.7 0.85 0.95 1.0 390 to 1000 0.65 0.75 0.90 0.98 1.0 1200 to 18000 0.75 0.80 0.95 1.0 1.0

The consensus is that the ESR falls with increasing frequency, resulting in a corresponding increase in maximum ripple current.  The ripple current multipliers vary between manufacturers and between component series, but interestingly the variation of multipliers with rated voltage isn’t consistent, e.g. the multipliers increase with increasing voltage for the CDE types given, by decrease with increasing voltage for the Nichicon HE series.  This deserves a little more investigation.  I haven’t yet found precisely why it is that the ESR falls with increasing frequency; I’ve sent an email to CDE asking for help.

The dissipation factor will be discussed in a future post.


text:
# MOSFET load switch design review

Is there any problem with the below circuit for controlling power supply (as a load switch)?

Hi, I am using this circuit to switch power supply to a load. I have gone through the datasheets and this looks likes it is okay. But, could someone please confirm if the the circuit used is alright?

The load current does not exceed 10A. The load can be a resistive load or a power supply to another module (not an inductive load).

(I know the MOSFET I used is rated for very high currents). There is no strict requirement on the switching frequency (less than 1Hz) . The supply voltage is 9V-12.6V. The control voltage is 3.3V.

https://www.diodes.com/assets/Datasheets/DMG6602SVTQ.pdf

https://www.mouser.in/datasheet/2/308/FDD8896_F085-D-1806946.pdf

• Whatever you connect to that 2 pin connector (HTR) will always be applied to that R40 resistor, which I assume is your load. In this schematic Q2 would do nothing. I think you meant to connect pin 1 of HTR to your circuit GND. (unless you're using R40 as a shunt?) Aug 3, 2020 at 12:01
• @Stiddily check again. Aug 3, 2020 at 12:19
• The DMG6602 is not recommended for new designs so why use it? Are you not worried about shoot-thru in the DMG? Add PDF data sheet links please. State what the supply voltages are and the control voltage too. Aug 3, 2020 at 12:21
• @Andyaka I could not find any indication on mouser or digikey, regarding the NRND for this part. If it is NRND, is there any alternative for this? Yes, shoot through is definitely a problem, is there anything you recommend to overcome this ? Aug 3, 2020 at 12:42
• Always check with the manufacturer - the mouser data sheet is way out of date. diodes.com/assets/Datasheets/products_inactive_data/… but there is a replacement listed. Aug 3, 2020 at 12:44

The control voltage is 3.3V

## The main problem

The gate activation voltage for Q7 is only 3.3 volts!

It will not turn-off the PMOSFET inside Q7 and the circuit will be permanently energized.

Or, ditch the dual MOSFET device (Q7) and use a BJT in common emitter with a load resistor of circa 1 kohm (aka a level shifter). General idea: -

This can only realistically be overcome with either a control voltage that matches the supply voltage (9 volts to 12.6 volts) or by using an extra input transistor forming a level shifter. This is a show-stopper until fixed. The words below assume it has been fixed.

Given this: -

There is no strict requirement on the switching frequency (less than 1Hz)

Using a level shifter isn't going to be a problem.

## The secondary problem

Always check with the manufacturer's website to see if the a device is not recommended for future designs and if so, is an alternative available: -

However, given that this device is probably best replaced with the common emitter level shifter shown earlier, this is moot.

## Shoot-through problem

This can be overcome by using a 100 Ω resistor in series with the drains on Q7. The shoot-through current will be limited to a maximum of 12.6 volts ÷ 100 Ω = 126 mA. If that is too much choose a 1 kΩ resistor etc.. The added resistance will slightly slow down turn on or off but, given that you are only switching at 1 Hz and the gate capacitance of Q2 is only circa 3 nF, a response time of less than 5 μs isn't going to be a worry.

But if you fix the main problem using a BJT level shifter, this problem goes away.

If you can live with Q2's volt-drop of 40 mV when the load takes 10 amps then you're basically good to go. That's a typical value and may be twice this amount across a batch of devices.

## MOSFET leakage ($$\I_{DSS}\$$) into load

When Q2 is off, it might produce typically 1 μA into the load but, again, this is a typical value and it might be as high as 100 μA. If this isn't going to cause activation of some low power circuits in the load then fine.

• Thank you. Considering the above points and given the cost and space, I decided to go with TI's integrated smart high side switch for my use case. Aug 3, 2020 at 20:47
• @viru_s OK but it might be a good idea to mention which product you chose for future reference for anyone coming along later - they might be interested in your particular solution. Aug 3, 2020 at 22:03
• I decided to go with TPS2HB16-Q1. :) Aug 13, 2020 at 14:37

Drawing the proper symbols for your dual FET makes it easier to understand:

simulate this circuit – Schematic created using CircuitLab

When VIN is 3.3V the top PFET (M2) will still have -5..-9V Vgs which means it will be always ON. Also 3.3V is not enough to turn M1 ON. Thus it will not work.

Solution:

If you want fast switching, use an integrated low-side MOSFET driver, like this one. Make sure you double check everything: input logic levels must match your 3V3 signal, min/max supply voltage, etc.

If you don't want fast switching, then any simple schematic with BJTs will do, like this one.

• Thanks @bobflux. I have decided to go with integrated high side switch from TI. Aug 3, 2020 at 20:52


text:
# Factory classmethods in Python

I haven’t seen a great deal of practical documentation about using classmethods as factories in Python (which is arguably the most important use of a classmethod, IMO). This post hopes to fill in that gap.

## Simple Example of classmethod Factory

This is not to hard to find a good example of, but here is a simple example of a class method being used for a generator. Let’s say you have the following vector class, and you want to be able to make a new vector using Vector(x,y,z) or Vector.from_cyl(ρ,θ,z) (as usual, I’m exploiting Python 3’s unicode variable names, change these to plain text if you are using Python 2). Here is how we would do that, with a repr added to make the display easier to see:

from math import sin, cos, pi as π

class Vector(object):
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z

@classmethod
def from_cyl(cls, ρ, θ, z):
return cls(ρ*cos(θ), ρ*sin(θ), z)

def __repr__(self):
return "<{0.__class__.__name__}({0.x}, {0.y}, {0.z})>".format(self)
Vector(1,2,3)
Vector.from_cyl(1,π/4,1)

A few take away points:

• Class methods take the class as the first argument, traditionally cls.
• Class methods that are factories call cls(), and return the new instance they created.
• Both __new__ and __init__ ran when cls() was called.

## Avoiding __init__

This is fine, but there are two more features that we often need. First, we might not want to call the __init__ function at all; this is fine in the above example, but we might not happen to be able to make the transformation to the original parameters. If we can’t do that, it is actually possible in Python to create a new instance of a class without calling __init__ using:

cls.__new__(cls, ...)

where the ellipsis are the parameters for the new function (often this is simply cls.__new__(cls)).

Take the following example, where we’ve reversed the class, so that cylindrical is now default:

from math import sin, cos, pi as π

class Vector(object):
def __init__(self, ρ, θ, z):
self.x = ρ*cos(θ)
self.y = ρ*sin(θ)
self.z = z

@classmethod
def from_xyz(cls, x, y, z):
ob = cls.__new__(cls)
ob.x = x
ob.y = y
ob.z = z
return ob

def __repr__(self):
return "<{0.__class__.__name__}({0.x}, {0.y}, {0.z})>".format(self)
Vector(1,π/4,1)
Vector.from_xyz(1,2,3)

Though it should be obvious now, I’ll point out that each class method using this technique is responible for doing anything that the __init__ function normally does. In this case, self.x, .y, and .z all must be manually set. If we forgot to set self.z, for example, bad things might happen when we call other methods.

# Auto generator

## __init__ Method

This is something I do a lot that is still is difficult with above trick. Let’s say you want to have an auto-selecting factory function. For example, if you have .from_csv(filename) and .from_excel(filename) functions, you might want to make a .from_any function that bases it’s choise of loading function on the extenstion of filename. This is easy to do with normal factory functions unless you decide that you’d like your __init__ function to act like .from_any. Then, you’ll need to write two functions for each factory function (this only uses one from_ method pair for clarity):

class FromFile(object):
def __init__(self, filename):
if filename[-3:] == 'csv':
self._from_csv(filename)
else:
self.file = 'Not a valid format'

@classmethod
def from_csv(cls, filename):
self = cls.__new__(cls)
self._from_csv(filename)
return self

def _from_csv(self, filename):
self.file = 'I got {0} from csv!'.format(filename)

def __repr__(self):
return "<{0.__class__.__name__}({0.file})>".format(self)
FromFile('this.file')
FromFile("this.csv")
FromFile.from_csv("this.is")

## __new__ Method

One other way we could do this would be to change __new__ itself. This is technically what we want anyway; __new__ is where new instances of a class get created.

The downside to this method is that we are limited in our use of __init__ with arguments (if you have an __init__, you need to accept everything that __new__ accepts). __init__ will run only when we call the class normally, so it may or may not run when a factory function is called, forcing you to put any common init code in a seperate function, and then manually calling it from each factory function, and __new__ too, if necessary.

class FromFile(object):
def __new__(cls, filename):
if filename is None:
return super(FromFile,cls).__new__(cls)
elif filename[-3:] == 'csv':
return cls.from_csv(filename)
else:
self = super(FromFile,cls).__new__(cls)
self.file = 'Not a valid format'
self._common_init_code()
return self

def __init__(self, *args, **kargs):
print("This was called directly with", *args)

def _common_init_code(self):
print("All correct creations of this class will print this line!")

@classmethod
def from_csv(cls, filename):
self = super(FromFile,cls).__new__(cls)
self.file = 'I got {0} from csv!'.format(filename)
self._common_init_code()
return self

def __repr__(self):
return "<{0.__class__.__name__}({0.file})>".format(self)
FromFile('this.file')
All correct creations of this class will print this line! This was called directly with this.file
FromFile("this.csv")
All correct creations of this class will print this line! This was called directly with this.csv
FromFile.from_csv("this.is")
All correct creations of this class will print this line!

There are other ways to generate objects of certain classes; subclassing is a valid method, or using a factory function, or even metaclasses. (For metaclasses, this article is hard to beat.) Several of these methods cause the type of the object not match the object used to create it (like numpy.array() is a numpy.ndarray), but still is commonly used.


text:
Some new results on one-dimensional outflow dynamics.

# Some new results on one-dimensional outflow dynamics.

## Abstract

In this paper we introduce modified version of one-dimensional outflow dynamics (known as a Sznajd model) which simplifies the analytical treatment. We show that simulations results of the original and modified rules are exactly the same for various initial conditions. We obtain the analytical formula for exit probability using Kirkwood approximation and we show that it agrees perfectly with computer simulations in case of random initial conditions. Moreover, we compare our results with earlier analytical calculations obtained from renormalization group and from general sequential probabilistic frame introduced by Galam. Using computer simulations we investigate the time evolution of several correlation functions to show if Kirkwood approximation can be justified. Surprisingly, it occurs that Kirkwood approximation gives correct results even for these initial conditions for which it cannot be easily justified.

89.65.-s
05.40.-a
###### pacs:
02.50.-r

Social and economic systems Fluctuation phenomena, random processes, noise, and Brownian motion Probability theory, stochastic processes, and statistics

## 1 Introduction

The outflow dynamics was introduced to describe the opinion change in the society. The idea was based on the fundamental social phenomenon called ”social validation”. By now, the opinion dynamics was studied by many authors, starting perhaps from the works by Galam [1] and developed later in the Sznajd [2] and Majority rule [3] models. The common feature of these models is that the complexity of real-world opinions is reduced to the minimum set of two options, or .

However, in this paper we do not focus on social applications of the model (an interested reader may resort to reviews [4, 5, 6, 7, 8]). Here we deal with a more mathematical problem, namely finding the analytical formula for the probability of reaching consensus on opinion as a function of the initial fraction of opinion . This quantity is commonly called exit probability [9, 10]. In fact, we follow the method used in [9] for the Majority-rule model.

The one dimensional outflow dynamics is defined as follows: if pair of neighboring spins the the two neighbors of the pair followed its direction, i.e. and ; in case of different opinions at the central pair, the two neighboring states are unchanged. Until now several analytical approaches have been proposed. One of the analytical approaches used for the outflow dynamics was based on the mean field idea [11]. Within the mean field approach the mean relaxation time as a function of the initial fraction of opinion was computed, as well as distribution of relaxation times. The exit probability found in this approach is the trivial step function, at odds with the known simulation results for 1D dynamics.

Later, Galam in [12] presented a general sequential probabilistic frame (GSPF), which extended a series of earlier opinion dynamics models. Within his frame he was able to find analytic formulas for the probability to find at random an agent sharing opinion at time as a function of . Among several models, he considered the one dimensional rule, which we investigate in this paper, i.e.: if pair of neighboring spins then the two neighbors of the pair followed its direction; in case of different opinions at the central pair, the two neighboring states are unchanged. For such a rule, within his GSPF calculation Galam has found the following formula [12]:

 p(t+1) = p(t)4+72p(t)3[1−p(t)] (1) + 3p(t)2[1−p(t)]2+12p(t)[1−p(t)]3

Iterating above formula the exit probability can be found as a step function (see Fig. 1). It is worth to notice that step-like function describes exit probability in the case of two dimensional outflow dynamics [13], but not in one dimension [14]. Step-like function for exit probability has been found also in [15].

In the paper [15] real space renormalization approach has been proposed to calculate the probability of reaching consensus on opinion as a function of the initial fraction p of opinion . They have found in case of two sites convincing others the following analytical formulas:

• in the case of growing network (growing hierarchical or the Barabasi-Albert scale-free network)

 P+=3p2−2p3. (2)
• in the case of fixed network they have found as the step function observed also in computer simulations on the square lattice.

It is seen on Fig. 1 that RG results for growing networks agree much better with simulations that RG results for fixed network which are exactly the same as obtained using GSPF by Galam.

In this paper we present analytical results obtained using Kirkwood approximation [9] following the method used in for the Majority-rule model and we obtain perfect agreement with computer simulations. Moreover, we consider two types of non-random initial conditions and we show how analytical formulas for exit probabilities change for such cases.

## 2 Approximate solution in 1D

We consider linear chain with sites. Each site can be in two states . We use the following notation:
state of the system.
state of the spin at site if the system is in state .
state which differs from by flipping spin at site . Therefore .

We introduce here slight modifications with respect to original outflow rule: choose pair of neighbors and if they both are in the same state, then adjust one (instead of two) of its neighbors (chosen randomly on left or right with equal probability ) to the common state. Because this way at most one spin is flipped in one step while in original formulation two can be flipped simultaneously, the time must be rescaled by factor . We measure the time so that the speed of all processes remains constant when , so normally one update takes time . Here, instead, we consider also the factor , so single update takes time . Our modification eliminates some correlations due to simultaneous flip of spins at distance . However, if we look at later stages of the evolution , where typically the domains are larger than , simultaneous flips occurs very rarely. Therefore, we do not expect any substantial difference. Indeed, computer simulations confirm our expectations - only time has to be rescaled (see Fig. 2).

On the other hand, the modification simplifies the analytical treatment. Indeed, the update rule can be equivalently formulated as follows:

Choose randomly a spin and side ( for right, for left.) The updated state is if , otherwise .

Within such a formulation the probability that in one update the flip occurs:

 W(σ→σx) = 18N[σ(x+2)σ(x+1) (3) + σ(x−1)σ(x−2)− − σ(x)(σ(x+2)+σ(x+1)+σ(x−1)+ + σ(x−2))+2]

These flip probabilities are then inserted into master equation:

 P(σ;t+Δt)=∑σ′W(σ′→σ)P(σ′;t) (4)

Now, we make the limit which also implies the continuous time limit, as . We also note that most of the transition probabilities are zero, since only one spin flip is allowed in one step. Finally we end with

 ddtP(σ;t)=∑x[w(σx→σ)P(σx;t)−w(σ→σx)P(σ;t)] (5)

where the transition rates are trivially related to transition probabilities (3), . (The sum is now over infinite set of sites.) For completeness we repeat the formula for transition rates:

 w(σ→σx) = 14[σ(x+2)σ(x+1)+σ(x−1)σ(x−2) (6) − σ(x)(σ(x+2)+σ(x+1)+σ(x−1) + σ(x−2))+2].

It is hopeless to solve the master equation as it is. Instead, we write evolution equations for some correlation functions derived from it. We define:

 C0(t) = ⟨σ(y)⟩≡∑σσ(y)P(σ;t) C1(n;t) = ⟨σ(y)σ(y+n)⟩ C2(n,m;t) = ⟨σ(y−n)σ(y)σ(y+m)⟩ C3(n,m,l;t) = ⟨σ(y−n)σ(y)σ(y+m)σ(y+m+l)⟩ ⋮ (7)

Only two equations are relevant for us. The first is:

 ddtC0(t)=−C2(1,1;t)+C0(t) (8)

and the second:

 ddtC1(1;t)=−C3(1,1,1;t)−C1(1;t)+C1(3;t)+1 (9)

These two become closed set of equations, if we apply the approximations described in the next section. Before going to it, it is perhaps instructive to show the intermediate results which lead to equations (8), (9), and analogically to others, for more complicated correlation functions.

So, for example, for the lowest correlation function - the average of one spin - we have

 ddt⟨σ(y)⟩=−2⟨w(σ→σy)σ(y)⟩ (10)

and for the next one in the level of complexity

 ddt⟨σ(y)σ(y+1)⟩=−2⟨w(σ→σy)σ(y)σ(y+1)⟩ −2⟨w(σ→σy+1)σ(y)σ(y+1)⟩. (11)

The pattern is transparent. When computing the correlation function of spins at sites , , , …, on the RHS we have sum of terms, in which we average the product of spins at sites , , , …with transition rate (which is constructed from the spin configuration according to (6)) for flip at positions , , , …. As a formula, this sentence means

 ddt⟨∏iσ(xi)⟩=−2∑j⟨w(σ→σxj)∏iσ(xi)⟩. (12)

### 2.1 Kirkwood approximation

Now we discuss the approximations used for solving Eqs. (8) and (9).

The first one is the usual Kirkwood approximation, or decoupling, which is used in various contexts and accordingly it assumes different names. For example in the classical quantum many-body theory of electrons and phonons in solids, it is nothing else than the Hatree-Fock approximation (but contrary to this theory, which may be improved systematically using diagrammatic techniques, here the systematic expansions are not developed). We use the name Kirkwood approximation, following the work [9].

In our case, the Kirkwood approximation amounts to

 C3(1,1,1;t)≃(C1(1;t))2 (13)

in Eq. (9) and

 C2(1,1;t)≃C1(1;t)C0(t) (14)

in Eq. (8). While the latter assumption (14) enables us to relate the equation (8) directly to (9) and therefore to solve it as soon as we have the solution of (9), the approximation (13) does not yet make of (9) a closed equation. The point is that there is also the correlation at distance , the function . So, we make also an additional approximation, which is also made in [9]. We suppose that only weakly depends on distance , or else, that the decay of the correlations is relatively slow. If the spins are correlated to certain extent on distance (the neighbors) , they are correlated to essentially the same extent also on distance (next-next neighbors). This is also justified if the domains are large enough, i. e. at later stages of the evolution. So, we assume

 C1(3;t)≃C1(1;t). (15)

In the figure 3 we present a sample (not averaged) time evolution of several correlation functions. Indeed, our assumptions can be justified at later stages of the evolution, although the assumption (13) agrees perfectly with simulation results from very beginning. The second given by (14) agrees with simulations also quite well. Only the assumption (15) that the decay of the correlations is relatively slow is valid only at later stages of the evolution.

To sum it up, the approximations (13), (14), and (15) say that approximately

 C0(t) ≃ ψ(t) C1(n;t) ≃ ϕ(t) (16)

where and satisfy the equations (dot denotes the time-derivative

 ˙ψ = (1−ϕ)ψ ˙ϕ = 1−ϕ2. (17)

The solution is straightforward. We assume initial conditions and . First we solve the second equation from the set (17). This gives

 ϕ(t)=sinht+m1coshtcosht+m1sinht (18)

and inserting that into the first of the set (17) we have

 ψ(t)=2m01+m1+(1−m1)e−2t. (19)

The most important result is the asymptotics

 ψ(∞)=2m01+m1. (20)

How to interpret this finding? The average is the average magnetization. In other terms, it determines the probability that a randomly chosen spin will have state at time . This probability is . Therefore, is the initial magnetization. When we go to the limit , we know that ultimately the homogeneous state is reached. The asymptotic magnetization therefore says what is the probability that the final state will have all spins . It is . So, (20) means that

 C0(∞)≃2C0(0)1+C1(1;0). (21)

If the initial state is completely uncorrelated, i. e. we set the spins at random, with the only condition that average magnetization is , we have and

 C0(∞)≃2m01+m20. (22)

Finally, we express this result in terms of the probability to have a randomly chosen spin spin in state at the beginning and the probability that all spins are in state at the end. We have

 P+≃p22p2−2p+1. (23)

Computer simulations for random initial conditions, in which assumption can be done shows perfect agreement with analytical formula (23). In the next section we show how results will change in case of correlated initial conditions.

## 3 Correlated initial conditions

Here we consider two examples of correlated initial conditions with fraction of up-spins:

1. Ordered initial state that consists of two clusters: -length of up-spins and -length of down-spins, for example in case of :

 p=0.5 : ↑↑↑↑↑↓↓↓↓↓ p=0.4 : ↑↑↑↑↓↓↓↓↓↓ p=0.3 : ↑↑↑↓↓↓↓↓↓↓ … (24)
2. Correlated, completely homogeneous, initial state, i.e. for , for example in case of :

 p=0.5 : ↑↓↑↓↑↓↑↓ p=0.25 : ↓↓↓↑↓↓↓↑ (25) … (26)

In both cases it is easy to calculate exactly correlation function . In the first case of ordered initial conditions we obtain:

 C1(1;0)=1−1L≈1 (27)

Thus, from equation (21):

 C0(∞)≃2C0(0)1+C1(1;0)=2m01+1=m0→P+=p. (28)

Computer simulations shows that indeed for such a initial conditions (see Fig. 4).

As we see Kirkwood approximation surprisingly gives correct results also in this case. However, if we look at figure 5 we see that Kirkwood approximation given equations by (13) and (14) cannot be justified by computer simulations.

We have checked also the mean relaxation time in case of ordered initial conditions (Fig. 6). It occurs that analogously like for random initial conditions the mean relaxation time scales with the system size as (see Figs. 2 and 6). The same scaling has been found in the voter model [16, 17, 18]. However, contrary to the random initial conditions for which bell-shaped curve is observed, here the mean relaxation times is well described by simple parabola:

 ⟨τ⟩L2=12p(1−p). (29)

For the second correlated initial conditions, which are completely homogeneous we observed in computer simulations that exit probability is step like, i.e.

 P+=0 for p<0.5 P+=1 for p>0.5 antiferromagnetic state for p=0.5 (30)

In this case two-spins correlation function can be also calculated easily. For we obtain:

 C1(1;0)=p(1×(1p−2)+(−1)×2)=p(1p−4)=1−4p. (31)

Thus, from equation (21):

 C0(∞)≃2C0(0)1+C1(1;0)=4p−22−4p=−1→P+=0, (32)

which again agrees perfectly with computer simulations, although Kirkwood approximation cannot be easily justified.

Very interesting results is obtained for homogeneous initial condition if we measure the mean relaxation time (see Fig. 7). Computer simulation shows that for (and , respectively) the mean relaxation time does not depend on the system size and for depends linearly on system size, i.e. .

## 4 Summary

We introduced modified version of one-dimensional outflow dynamics in which we choose pair of neighbours and if they both are in the same state, then adjust one (in original version both) of its neighbours (chosen randomly on left or right with equal probability ) to the common state. We checked in computer simulations that accordingly to our expectations results in the case of modified rule are the same as in the case of original outflow dynamics, only the time must be rescaled by factor . Modified version simplified the analytical treatment and allowed to derive the master equation. Following the method proposed in [9] we wrote evolution equations for some correlation functions and used the Kirkwood approximation. This approach allowed us to derive the analytical formula for final magnetization (21). In fact, just before finishing this paper the same result was published by Lambiotte and Redner as a special case in the work [19] where a model interpolating the voter, Majority-rule (or Sznajd) and so-called vacillating voter dynamics was investigated, using also the Kirkwood approximation.

In the case of random initial conditions Kirkwood approximation can be justified looking at time evolution of simulated correlation functions. In this case our analytical results can be simplified to eq. (23) and agrees perfectly with simulations on contrary to earlier approaches [12, 15]. We have checked also how the Kirkwood approximation works in the case of two types of correlated initial conditions. Although in both cases the Kirkwood approximation cannot be easily justified, surprisingly we obtained perfect agreement with computer simulations.

###### Acknowledgements.
This work was supported by the MŠMT of the Czech Republic, grant no. 1P04OCP10.001, and by the Research Program CTS MSM 0021620845. Katarzyna Sznajd-Weron gratefully acknowledges the financial support in period 2007-2009 of the Polish Ministery of Science and Higher Education through the scientific grant no. N N202 0194 33

### References

1. S. Galam, J. Stat. Phys. 61, 943 (1990).
2. K. Sznajd-Weron and J. Sznajd, Int. J. Mod. Phys. C 11, 1157 (2000).
3. P. L. Krapivsky and S. Redner, Phys. Rev. Lett. 90, 238701 (2003).
4. D. Stauffer, Comput. Phys. Commun. 146, 93 (2002).
5. B. Schechter, New Scientist 175, 42 (2002).
6. S. Fortunato and D. Stauffer, in: Extreme Events in Nature and Society, edited by S. Albeverio, V. Jentsch and H. Kantz, (Springer, Berlin, 2005).
7. K. Sznajd-Weron, Acta Physica Polonica B 36, 2537 (2005).
8. C. Castellano, S. Fortunato and V. Loreto, arXiv:0710.3256v1.
9. M. Mobilia M. S. Redner, Phys. Rev. E 68, 046106 (2003).
10. R. Lambiotte S. Redner, J. Stat. Mech. L10001 (2007).
11. F. Slanina and H. Lavicka, Eur. Phys. J. B 35, 279 (2003).
12. S. Galam, Europhys. Lett., 70, 705 (2005).
13. D. Stauffer, A.O. Sousa, M. De Oliveira, Int. J. Mod. Phys. C 11 1239 (2000).
14. K. Sznajd-Weron, S. Krupa, Phys. Rev. E 74, 031109 (2006).
15. M.C. Gonzalez, A.O. Sousa and H.J. Herrmann, Eur. Phys. J. B 49, 253 (2006).
16. T. M. Liggett, Stochastic interacting systems: contact, voter, and exclusion processes, (Springer-Verlag, New York, 1999).
17. P. L. Krapivsky, Phys. Rev. A 45, 1067 (1992).
18. M. Mobilia, A. Petersen, S. Redner, J. Stat. Mech. P08029 (2007).
19. R. Lambiotte and S. Redner, arXiv:0712.0364v2 (2007).
Comments 0
You are adding the first comment!
How to quickly get a good reply:
• Give credit where it’s due by listing out the positive aspects of a paper before getting into which changes should be made.
• Be specific in your critique, and provide supporting evidence with appropriate references to substantiate general statements.
• Your comment should inspire ideas to flow and help the author improves the paper.

The better we are at sharing our knowledge with each other, the faster we move forward.
The feedback must be of minimum 40 characters and the title a minimum of 5 characters

Loading ...
157886

You are asking your first question!
How to quickly get a good answer:
• Keep your question short and to the point
• Check for grammar or spelling errors.
• Phrase it like a question
Test
Test description


text:
# Splitting the students by abilities

Disclaimer: This question will use as an example a computer-science university program, because it is much easier for me to describe and give some statistics, but it applies to math as well. The reason I posted it here is that talent (i.e. mathematical gift) plays a much greater role in thinking-heavy areas than in, for example, biology or history.

Context:

The university welcomes all kinds of students with varying degree of mathematical/programming ability. They are split into groups of 15 (approximately), however, to teach the beginners programming and to keep the experienced engaged, each such group might be "imperative" (beginners learn some standard programming language) or "functional" (those who could code before learn some functional language). There is a test of their programming skill and then students are assigned accordingly to the results (if student wishes and there are no obstacles, he may apply for a change; in the past there was no test and the students could pick the group type as they wished).

Summarizing: there are several "imperative" groups which contain mostly beginners and a few "functional" groups which include students that could code before. It is worth noting that the majority of the gifted students would usually participate in programming contests in high school, while the average and below-average students almost always can't code (even if they know the syntax, the test is too hard for them).

This works quite well: with such a split the beginners learn the basics, while students from "functional" groups are engaged because of the more advanced topics.

This works quite well, until the exams. The groups motivate/demotivate themselves internally and in result mediocre students from the "functional" groups have learned a way more than the good from the "imperative" groups. It wouldn't be a big problem, because the results between "functional" and "imperative" groups are incomparable - the tests are of incomparable difficulty, hence are graded separately.

However, as the schedules are inter-dependent, the groups formed there are kept also for other courses, i.e. these which didn't plan for a split at all. Again, groups motivate themselves internally (and also teachers are more engaged with brighter students), but this time all the students are graded according to the same key. The gap in performance is disastrous: the average score for the first group might be easily over $80\%$, while the average for the rest can be as low as $25\%$. Such results have impact on their learning, motivation and many other things, but most importantly, a big part that would attend the "imperative" would fail their exams and sometimes even drop out.

One could think that splitting the students by abilities is just a bad solution. On the other hand, their knowledge and experience varies so much that it would be impossible to keep all the parties interested. For example, this happens for electable courses, where the groups mix together, and pose a serious challenge for the teachers. It is so inconvenient that professors happen to make their optional classes intentionally very hard or very easy (the funny part is that it even feels natural, because those courses are in majority theoretical and practical respectively).

I'm sure that it's not a healthy state of affairs, but this is a hard problem and might lack a general solution. Also, there is the whole topic of sliding scale between teaching all something and teaching some everything, but that's out of scope of this question.

Question: Is there a way to avoid the negative effects of the split, in particular effects of good students from "imperative" groups averaging down and poor students from "functional" groups averaging up?

• What are the other courses that the students are grouped together in? Are they data structures courses? Discrete math? I think the answer varies based on the course. – adamblan Mar 15 '14 at 16:15
• @adamblan Generally it's discrete math and set theory. About a third or fourth part of the "functional" groups people pursue double degree, so the have analysis and linear algebra with math year (and so these groups are mixed). – dtldarek Mar 15 '14 at 16:24
• Awesome. Then, I'll take a shot at answering your question---I just tried to deal with this problem at CMU. I don't claim to have a full answer, but I can tell you what I tried and how well it worked out! – adamblan Mar 15 '14 at 16:26
• Done. It turned out a little more generic than I thought it would, but these are all things I've tried. I'd say group work was the most successful, and the extra credit was the most unpredictable. – adamblan Mar 15 '14 at 16:42

As per the comments above, I'm going to tackle this explicitly for discrete math and set theory being a shared course. What follows is some strategies I've tried and how well they worked (or didn't work!).

Group Work. Asking the students to do group work (either in class or on the homework), and assigning groups can really help this issue. Imagine that you ensure the groups are mixed between the less experienced and more experienced groups; so, you force the students to get to know others. A couple things happen when you do this. The first is that they realize even if they're different skill levels at programming, they share other interests, and you can often foster friendships between the groups which helps a lot. The second is that if you explicitly reward the experienced students who guide and help the unexperienced ones, and reward the unexperienced students who ask questions, you really do close the gap somewhat.

Varied Difficulty on the Homework. You can write homeworks where the students don't have to complete every question. Instead, they can complete several more rudimentary questions or one difficult one. This helps the weaker students get better at the basics, and it keeps the stronger ones from getting bored. If you were really brave, you could try doing something like this on the exams, but I'd suspect you'd end up with most students doing the easy questions to maximize their score.

Extra Credit. Extra credit is another way of keeping the interest of the stronger students without helping the weaker ones. I have often give difficult problems (with no credit whatsoever) and the interested students would come to me to talk about them. One way I implemented this that I think worked really well was that the "participation" part of your grade could be achieved by coming to office hours to talk about slightly more advanced topics. I found a mix of very weak and very strong students were all interested. Either way, you keep everyone's interest (and it gives you a chance to help the weaker students who normally wouldn't come to office hours!)

Language Agnostic Teaching. I'm not sure if you do any programming (or use any programming analogies) in your course, but I've found using a sort of pseudocode that is similar (but not identical!) to what the weaker students are learning to be very useful. They still need to integrate the concepts from the discrete math/set theory course(s), but it's at least somewhat familiar to them. I avoid explicitly using a language that one group knows, so that from their perspective, it looks like an even playing field.

Ultimately, if it's clear to the students that there's the "advanced" group and the "not-so-advanced" group, it makes it really difficult; so, I do my best to not call explicit attention to the discrepancy as much as humanly possible.

If you are not going to formally split the classes (with different exams, class names, etc.), I would advise just teaching to the basic level. [But I like Adam's idea to add ungraded extra hard problems for the students who just elect to do that for edification and enjoyment.] There is also nothing wrong with just letting the advanced kids know that this will be a bit easier for them, don't goof off and let down though as there is new content later, and maybe put some of the time they are saving from course X being easy into their other classes that need help more. If the students are really advanced advise them to take a final exam to validate the class and move on.


text:
# Detect madexcept inside an Delphi Application

can I detect wheather madexcept is used inside an delphi application by analyzing the exe file only ?

Is there a simple way by adding a few lines of code to my application and inform the final exe file user if madshi madexcept has been used or not

-
Are you compiling the executable? If so surely you know whether or not madExcept is in there. –  David Heffernan Jan 20 '13 at 15:05
@DavidHeffernan conceivable situation could be distribution of components which "need" to know ... –  bummi Jan 20 '13 at 15:54
the executable is at the customer, we compiled with madshi but madshi does not pop up at acess violation or frozen thread at customers PC's. Without exchanging executables once more we would like to confirm that our code is according to our specification including madshi debugg tools. –  Franz Jan 20 '13 at 16:27
If you have a repeatable build process you can regenerate the executable yourself and work with that. –  David Heffernan Jan 20 '13 at 16:47

If you use madexcept with a Delphi application, there should be a resource entry: MAD->EXCEPT in that executable.

To test an external application:

var
h: HMODULE;

if h <> 0 then
begin
if FindResource(h, 'EXCEPT', 'MAD') <> 0 then
FreeLibrary(h);
end;

To test inside your own application:

if FindResource(HInstance, 'EXCEPT', 'MAD') <> 0 then

Note that whis however will NOT tell you what options madexcept uses. for example there could be an exception filter set to filter access violation exceptions, or a setting that will NOT check frozen threads etc...

-
ResHacker or XNResourceEditor or dumpin are the tools here. Writing code isn't what's needed to solve this problem. –  David Heffernan Jan 20 '13 at 18:41
@DavidHeffernan, I thought the OP wanted this programmatically "Is there a simple way by adding a few lines of code to my application..." hens my answer. –  kobik Jan 20 '13 at 18:45
Yeah, the question doesn't say that, but it's in the comments. Sigh. –  David Heffernan Jan 20 '13 at 18:49
very helpful and fast answer from stackoverflow ..... Thanks a lot to you guys –  Franz Jan 20 '13 at 19:18
Given the accept, I guess I misunderstood the question. I thought Franz was after a one-off diagnostic. –  David Heffernan Jan 20 '13 at 19:24

You can do a plain text search for the text "madexcept". The easiest way to do that that I know of is with command line utilities. I would combine the strings and grep utilities like this:

C:\mydir>strings MyApp.exe | grep -i madexcept
.........

I personally use GnuWin32 as my source for these indispensable utilities.

If you are not a command line sort of a person, use Process Explorer. Run the executable and then run Process Explorer. Find the process and double click it. The brings up the Process Explorer properties dialog which contains a page named Strings. Select that page and click on the save button. Now you have a text file with all the strings in the executable in which you can search.

All this will tell you is that you compiled the madExcept code into your program. You won't know whether or not it is actually active.

-
{$IFDEF madExcept} .... {$ENDIF}


text:
# What is the longest column possible?

How long can a column be if it is loaded just by self-weight?     This is a rather different problem to those solved by the well-known Euler buckling formula and its variants.  The difference lies in the fact that under self-weight, loading is uniformly distributed along the length of the column, rather than being a point load on the column end, as the Euler formula assumes. This makes calculating the maximum length more complex.

## History

Greenhill solved the problem in 1881 in this paper, in which he obtained solutions by integrating the moment-curvature equation for columns of constant and varying cross-sections.  Timoshenko refered to Greenhill’s solutions in his classic Theory of Elastic Stability and also developed an energy-based approximate solution. More recently Wang discussed the problem in several papers, for example here.

The problem has always appeared to be a curiosity rather than having a practical use.  Greenhill suggested his solution could be used to determine the maximum possible height of trees but this ignores other factors like wind loading that will influence trees and is rather fanciful.  Risers in offshore engineering may have somewhat similar loading  but the link still seems tangential.

Are there any practical applications for this problem?  What are the effects of factors such as plasticity, eccentric loads and so on, matters that all affect the capacity of end-loaded columns substantially?  There is work to be done here, either by the intellectually curious or by someone who finds a practical application for the problem.

## Mathematical Summary

Greenhill’s starting point was, as for the Euler formula, the moment-curvature equation.

$\displaystyle M=EI\frac{d^2y}{dx^2}$

But, whereas for the Euler probem ${M}$ in the above equation is simply a force times a distance which leads to a linear differential equation with an analytical solution, with distrubted self-weight loading it is more complex.  Full details are in Greenhill’s paper but the key equations to compare are

$\displaystyle Py=EI\frac{d^2y}{dx^2}$

the normal Euler equation that leads to the well-known  solution $P_{cr}=\frac{\pi^2 EI}{L_{eff}^2}$, and

$\displaystyle wA\int^{x}_{0}(y'-y)dx=EI\frac{d^2y}{dx^2}$

the equation for a column under self-weight.  The LHS is considerably more complex than for the Euler case and leads to a differential equation requiring Bessel functions to obtain an approximate solution for maximum length of column under self-weight of

$\displaystyle L_{cr}=1.986\left(\frac{EI}{wA}\right)^{1/3}$

where $w$ is the density and $A$ the area of the column.


text:
Browse Questions

One mole of the complex compound $CO(NH_3)_5Cl_3$ gives 3 moles of ions on dissolution in water.On a mole of the same complex reacts with 2 moles of $AgNO_3$ solution to yield 2 moles of $AgCl(s)$.The structure of complex is

$\begin{array}{1 1}(a)\;[CO(NH_3)_3Cl_3].2NH_3\\(b)\;[CO(NH_3)_4Cl_2]Cl.NH_3\\(c)\;[CO(NH_3)_4Cl]Cl_2NH_3\\(d)\;[CO(NH_3)_5Cl]Cl_2\end{array}$

The complex structure is $[CO(NH_3)_3Cl_3].2NH_3$
Hence (a) is the correct answer.


text:
Note

Development of the AbsorptionSpectrum module has been moved to the Trident package. This version is deprecated and will be removed from yt in a future release. See https://github.com/trident-project/trident for further information.

# Creating Absorption Spectra¶

Absorption line spectra are spectra generated using bright background sources to illuminate tenuous foreground material and are primarily used in studies of the circumgalactic medium and intergalactic medium. These spectra can be created using the AbsorptionSpectrum and LightRay analysis modules.

The AbsorptionSpectrum class and its workhorse method make_spectrum() return two arrays, one with wavelengths, the other with the normalized flux values at each of the wavelength values. It can also output a text file listing all important lines.

For example, here is an absorption spectrum for the wavelength range from 900 to 1800 Angstroms made with a light ray extending from z = 0 to z = 0.4:

And a zoom-in on the 1425-1450 Angstrom window:

## Method for Creating Absorption Spectra¶

Once a LightRay has been created traversing a dataset using the light-ray-generator, a series of arrays store the various fields of the gas parcels (represented as cells) intersected along the ray. AbsorptionSpectrum steps through each element of the LightRay‘s arrays and calculates the column density for desired ion by multiplying its number density with the path length through the cell. Using these column densities along with temperatures to calculate thermal broadening, voigt profiles are deposited on to a featureless background spectrum. By default, the peculiar velocity of the gas is included as a doppler redshift in addition to any cosmological redshift of the data dump itself.

### Subgrid Deposition¶

For features not resolved (i.e. possessing narrower width than the spectral resolution), AbsorptionSpectrum performs subgrid deposition. The subgrid deposition algorithm creates a number of smaller virtual bins, by default the width of the virtual bins is 1/10th the width of the spectral feature. The Voigt profile is then deposited into these virtual bins where it is resolved, and then these virtual bins are numerically integrated back to the resolution of the original spectral bin size, yielding accurate equivalent widths values. AbsorptionSpectrum informs the user how many spectral features are deposited in this fashion.

## Tutorial on Creating an Absorption Spectrum¶

### Initializing AbsorptionSpectrum Class¶

To instantiate an AbsorptionSpectrum object, the arguments required are the minimum and maximum wavelengths (assumed to be in Angstroms), and the number of wavelength bins to span this range (including the endpoints)

from yt.analysis_modules.absorption_spectrum.api import AbsorptionSpectrum

sp = AbsorptionSpectrum(900.0, 1800.0, 10001)

### Adding Features to the Spectrum¶

Absorption lines and continuum features can then be added to the spectrum. To add a line, you must know some properties of the line: the rest wavelength, f-value, gamma value, and the atomic mass in amu of the atom. That line must be tied in some way to a field in the dataset you are loading, and this field must be added to the LightRay object when it is created. Below, we will add the H Lyman-alpha line, which is tied to the neutral hydrogen field (‘H_number_density’).

my_label = 'HI Lya'
field = 'H_number_density'
wavelength = 1215.6700 # Angstroms
f_value = 4.164E-01
gamma = 6.265e+08
mass = 1.00794

sp.add_line(my_label, field, wavelength, f_value, gamma, mass, label_threshold=1.e10)

In the above example, the field argument tells the spectrum generator which field from the ray data to use to calculate the column density. The label_threshold keyword tells the spectrum generator to add all lines above a column density of 10 10 cm -2 to the text line list output at the end. If None is provided, as is the default, no lines of this type will be added to the text list.

Continuum features with optical depths that follow a power law can also be added. Like adding lines, you must specify details like the wavelength and the field in the dataset and LightRay that is tied to this feature. The wavelength refers to the location at which the continuum begins to be applied to the dataset, and as it moves to lower wavelength values, the optical depth value decreases according to the defined power law. The normalization value is the column density of the linked field which results in an optical depth of 1 at the defined wavelength. Below, we add the hydrogen Lyman continuum.

my_label = 'HI Lya'
field = 'H_number_density'
wavelength = 912.323660 # Angstroms
normalization = 1.6e17
index = 3.0

sp.add_continuum(my_label, field, wavelength, normalization, index)

### Making the Spectrum¶

Once all the lines and continuua are added, it is time to make a spectrum out of some light ray data.

wavelength, flux = sp.make_spectrum('lightray.h5',
output_file='spectrum.fits',
line_list_file='lines.txt')

A spectrum will be made using the specified ray data and the wavelength and flux arrays will also be returned. If you set the optional use_peculiar_velocity keyword to False, the lines will not incorporate doppler redshifts to shift the deposition of the line features.

Three output file formats are supported for writing out the spectrum: fits, hdf5, and ascii. The file format used is based on the extension provided in the output_file keyword: .fits for a fits file, .h5 for an hdf5 file, and anything else for an ascii file.

Note

To write out a fits file, you must install the astropy python library in order to access the astropy.io.fits module. You can usually do this by simply running pip install astropy at the command line.

### Generating Spectra in Parallel¶

The AbsorptionSpectrum analysis module can be run in parallel simply by following the procedures laid out in Parallel Computation With yt for running yt scripts in parallel. Spectrum generation is parallelized using a multi-level strategy where each absorption line is deposited by a different processor. If the number of available processors is greater than the number of lines, then the deposition of individual lines will be divided over multiple processors.

# Fitting Absorption Spectra¶

This tool can be used to fit absorption spectra, particularly those generated using the (AbsorptionSpectrum) tool. For more details on its uses and implementation please see (Egan et al. (2013)). If you find this tool useful we encourage you to cite accordingly.

## Loading an Absorption Spectrum¶

To load an absorption spectrum created by (AbsorptionSpectrum), we specify the output file name. It is advisable to use either an .h5 or .fits file, rather than an ascii file to save the spectrum as rounding errors produced in saving to a ascii file will negatively impact fit quality.

f = h5py.File('spectrum.h5')
wavelength = f["wavelength"][:]
flux = f['flux'][:]
f.close()

## Specifying Species Properties¶

Before fitting a spectrum, you must specify the properties of all the species included when generating the spectrum.

The physical properties needed for each species are the rest wavelength, f-value, gamma value, and atomic mass. These will be the same values as used to generate the initial absorption spectrum. These values are given in list form as some species generate multiple lines (as in the OVI doublet). The number of lines is also specified on its own.

To fine tune the fitting procedure and give results in a minimal number of optimizing steps, we specify expected maximum and minimum values for the column density, doppler parameter, and redshift. These values can be well outside the range of expected values for a typical line and are mostly to prevent the algorithm from fitting to negative values or becoming numerically unstable.

Common initial guesses for doppler parameter and column density should also be given. These values will not affect the specific values generated by the fitting algorithm, provided they are in a reasonably appropriate range (ie: within the range given by the max and min values for the parameter).

For a spectrum containing both the H Lyman-alpha line and the OVI doublet, we set up a fit as shown below.

HI_parameters = {'name':'HI',
'f': [.4164],
'Gamma':[6.265E8],
'wavelength':[1215.67],
'numLines':1,
'maxN': 1E22, 'minN':1E11,
'maxb': 300, 'minb':1,
'maxz': 6, 'minz':0,
'init_b':30,
'init_N':1E14}

OVI_parameters = {'name':'OVI',
'f':[.1325,.06580],
'Gamma':[4.148E8,4.076E8],
'wavelength':[1031.9261,1037.6167],
'numLines':2,
'maxN':1E17,'minN':1E11,
'maxb':300, 'minb':1,
'maxz':6, 'minz':0,
'init_b':20,
'init_N':1E12}

speciesDicts = {'HI':HI_parameters,'OVI':OVI_parameters}

## Generating Fit of Spectrum¶

After loading a spectrum and specifying the properties of the species used to generate the spectrum, an appropriate fit can be generated.

orderFits = ['OVI','HI']

fitted_lines, fitted_flux = generate_total_fit(wavelength,
flux, orderFits, speciesDicts)

The orderFits variable is used to determine in what order the species should be fitted. This may affect the results of the resulting fit, as lines may be fit as an incorrect species. For best results, it is recommended to fit species the generate multiple lines first, as a fit will only be accepted if all of the lines are fit appropriately using a single set of parameters. At the moment no cross correlation between lines of different species is performed.

The parameters of the lines that are needed to fit the spectrum are contained in the fitted_lines variable. Each species given in orderFits will be a key in the fitted_lines dictionary. The entry for each species key will be another dictionary containing entries for ‘N’,’b’,’z’, and ‘group#’ which are the column density, doppler parameter, redshift, and associate line complex respectively. The i th line of a given species is then given by the parameters N[i], b[i], and z[i] and is part of the same complex (and was fitted at the same time) as all lines with the same group number as group#[i].

The fitted_flux is an ndarray of the same size as flux and wavelength that contains the cumulative absorption spectrum generated by the lines contained in fitted_lines.

## Saving a Spectrum Fit¶

Saving the results of a fitted spectrum for further analysis is accomplished automatically using the h5 file format. A group is made for each species that is fit, and each species group has a group for the corresponding N, b, z, and group# values.

## Procedure for Generating Fits¶

To generate a fit for a spectrum generate_total_fit() is called. This function controls the identification of line complexes, the fit of a series of absorption lines for each appropriate species, checks of those fits, and returns the results of the fits.

## Finding Line Complexes¶

Line complexes are found using the find_complexes() function. The process by which line complexes are found involves walking through the array of flux in order from minimum to maximum wavelength, and finding series of spatially contiguous cells whose flux is less than some limit. These regions are then checked in terms of an additional flux limit and size. The bounds of all the passing regions are then listed and returned. Those bounds that cover an exceptionally large region of wavelength space will be broken up if a suitable cut point is found. This method is only appropriate for noiseless spectra.

The optional parameter complexLim (default = 0.999), controls the limit that triggers the identification of a spatially contiguous region of flux that could be a line complex. This number should be very close to 1 but not exactly equal. It should also be at least an order of magnitude closer to 1 than the later discussed fitLim parameter, because a line complex where the flux of the trough is very close to the flux of the edge can be incredibly unstable when optimizing.

The fitLim parameter controls what is the maximum flux that the trough of the region can have and still be considered a line complex. This effectively controls the sensitivity to very low column absorbers. Default value is fitLim = 0.99. If a region is identified where the flux of the trough is greater than this value, the region is simply ignored.

The minLength parameter controls the minimum number of array elements that an identified region must have. This value must be greater than or equal to 3 as there are a minimum of 3 free parameters that must be fit. Default is minLength = 3.

The maxLength parameter controls the maximum number of array elements that an identified region can have before it is split into separate regions. Default is maxLength = 1000. This should be adjusted based on the resolution of the spectrum to remain appropriate. The value correspond to a wavelength of roughly 50 angstroms.

The splitLim parameter controls how exceptionally large regions are split. When such a region is identified by having more array elements than maxLength, the point of maximum flux (or minimum absorption) in the middle two quartiles is identified. If that point has a flux greater than or equal to splitLim, then two separate complexes are created: one from the lower wavelength edge to the minimum absorption point and the other from the minimum absorption point to the higher wavelength edge. The default value is splitLim =.99, but it should not drastically affect results, so long as the value is reasonably close to 1.

## Fitting a Line Complex¶

After a complex is identified, it is fitted by iteratively adding and optimizing a set of Voigt Profiles for a particular species until the region is considered successfully fit. The optimizing is accomplished using scipy’s least squares optimizer. This requires an initial estimate of the parameters to be fit (column density, b-value, redshift) for each line.

Each time a line is added, the guess of the parameters is based on the difference between the line complex and the fit so far. For the first line this just means the initial guess is based solely on the flux of the line complex. The column density is given by the initial column density given in the species parameters dictionary. If the line is saturated (some portion of the flux with a value less than .1) than the larger initial column density guess is chosen. If the flux is relatively high (all values >.9) than the smaller initial guess is given. These values are chosen to make optimization faster and more stable by being closer to the actual value, but the final results of fitting should not depend on them as they merely provide a starting point.

After the parameters for a line are optimized for the first time, the optimized parameters are then used for the initial guess on subsequent iterations with more lines.

The complex is considered successfully fit when the sum of the squares of the difference between the flux generated from the fit and the desired flux profile is less than errBound. errBound is related to the optional parameter to generate_total_fit(), maxAvgError by the number of array elements in the region such that errBound = number of elements * maxAvgError.

There are several other conditions under which the cycle of adding and optimizing lines will halt. If the error of the optimized fit from adding a line is an order of magnitude worse than the error of the fit without that line, then it is assumed that the fitting has become unstable and the latest line is removed. Lines are also prevented from being added if the total number of lines is greater than the number of elements in the flux array being fit divided by 3. This is because there must not be more free parameters in a fit than the number of points to constrain them.

## Checking Fit Results¶

After an acceptable fit for a region is determined, there are several steps the algorithm must go through to validate the fits.

First, the parameters must be in a reasonable range. This is a check to make sure that the optimization did not become unstable and generate a fit that diverges wildly outside the region where the fit was performed. This way, even if particular complex cannot be fit, the rest of the spectrum fitting still behaves as expected. The range of acceptability for each parameter is given in the species parameter dictionary. These are merely broad limits that will prevent numerical instability rather than physical limits.

In cases where a single species generates multiple lines (as in the OVI doublet), the fits are then checked for higher wavelength lines. Originally the fits are generated only considering the lowest wavelength fit to a region. This is because we perform the fitting of complexes in order from the lowest wavelength to the highest, so any contribution to a complex being fit must come from the lower wavelength as the higher wavelength contributions would already have been subtracted out after fitting the lower wavelength.

## Saturated Lyman Alpha Fitting Tools¶

In cases where a large or saturated line (there exists a point in the complex where the flux is less than .1) fails to be fit properly at first pass, a more robust set of fitting tools is used to try and remedy the situation. The basic approach is to simply try a much wider range of initial parameter guesses in order to find the true optimization minimum, rather than getting stuck in a local minimum. A set of hard coded initial parameter guesses for Lyman alpha lines is given by the function get_test_lines()`. Also included in these parameter guesses is an initial guess of a high column cool line overlapping a lower column warm line, indicative of a broad Lyman alpha (BLA) absorber.